2015-06-01 09:35:51 +00:00
|
|
|
package com.bytezone.diskbrowser.appleworks;
|
|
|
|
|
2020-02-08 07:50:03 +00:00
|
|
|
// -----------------------------------------------------------------------------------//
|
|
|
|
class CellFormat
|
|
|
|
// -----------------------------------------------------------------------------------//
|
2015-06-01 09:35:51 +00:00
|
|
|
{
|
|
|
|
boolean labelAllowed;
|
|
|
|
boolean valueAllowed;
|
|
|
|
boolean display;
|
|
|
|
boolean standard;
|
|
|
|
boolean fixed;
|
|
|
|
boolean dollars;
|
|
|
|
boolean commas;
|
|
|
|
boolean percent;
|
|
|
|
boolean appropriate;
|
|
|
|
int decimals;
|
|
|
|
|
2020-02-08 07:50:03 +00:00
|
|
|
// ---------------------------------------------------------------------------------//
|
|
|
|
CellFormat (byte format)
|
|
|
|
// ---------------------------------------------------------------------------------//
|
2015-06-01 09:35:51 +00:00
|
|
|
{
|
|
|
|
display = (format & 0x40) == 0;
|
|
|
|
labelAllowed = (format & 0x10) == 0;
|
|
|
|
valueAllowed = (format & 0x08) == 0;
|
|
|
|
|
|
|
|
int formatting = format & 0x07;
|
|
|
|
|
|
|
|
standard = formatting == 1;
|
|
|
|
fixed = formatting == 2;
|
|
|
|
dollars = formatting == 3;
|
|
|
|
commas = formatting == 4;
|
|
|
|
percent = formatting == 5;
|
|
|
|
appropriate = formatting == 6;
|
|
|
|
}
|
|
|
|
|
2020-02-08 07:50:03 +00:00
|
|
|
// ---------------------------------------------------------------------------------//
|
|
|
|
CellFormat (byte format, byte decimals)
|
|
|
|
// ---------------------------------------------------------------------------------//
|
2015-06-01 09:35:51 +00:00
|
|
|
{
|
|
|
|
this (format);
|
|
|
|
this.decimals = decimals & 0x07;
|
|
|
|
}
|
|
|
|
|
2020-02-08 07:50:03 +00:00
|
|
|
// ---------------------------------------------------------------------------------//
|
|
|
|
String mask ()
|
|
|
|
// ---------------------------------------------------------------------------------//
|
2015-06-01 09:35:51 +00:00
|
|
|
{
|
|
|
|
String fmt = dollars ? "$%" : "%";
|
|
|
|
if (commas)
|
|
|
|
fmt += ",";
|
|
|
|
fmt += "12." + decimals;
|
|
|
|
fmt += "f";
|
|
|
|
if (percent)
|
|
|
|
fmt += "%%";
|
|
|
|
|
|
|
|
return fmt;
|
|
|
|
}
|
|
|
|
}
|