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

kz.greetgo.msoffice.xlsx.gen.Styles Maven / Gradle / Ivy

There is a newer version: 0.5.9
Show newest version
package kz.greetgo.msoffice.xlsx.gen;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

class Styles {
  private final List fills = new ArrayList();

  int fillIndex(Fill fill) {
    if (fill == null) fill = new PatternFill(PatternFillType.none);
    int index = 0;
    for (Fill f : fills) {
      if (f.equals(fill)) return index;
      index++;
    }
    fills.add(fill.copy());
    return index;
  }

  private final List bordersList = new ArrayList();

  int bordersIndex(Borders borders) {
    if (borders == null) borders = new Borders();
    int index = 0;
    for (Borders b : bordersList) {
      if (b.equals(borders)) return index;
      index++;
    }
    bordersList.add(new Borders(borders));
    return index;
  }

  private final List fonts = new ArrayList();

  int fontIndex(Font font) {
    if (font == null) font = new Font();
    int index = 0;
    for (Font f : fonts) {
      if (f.equals(font)) return index;
      index++;
    }
    fonts.add(new Font(font));
    return index;
  }

  private final List