package net.sf.jasperreports.engine;

import java.awt.font.TextAttribute;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.util.JRFontUtil;

public interface JRStyledTextAttributeSelector {
  public static final JRStyledTextAttributeSelector ALL = new JRStyledTextAttributeSelector() {
      public Map getStyledTextAttributes(JRPrintText printText) {
        Map attributes = new HashMap();
        attributes.putAll(JRFontUtil.setAttributes(attributes, printText));
        attributes.put(TextAttribute.FOREGROUND, printText.getForecolor());
        if (printText.getMode() == 1)
          attributes.put(TextAttribute.BACKGROUND, printText.getBackcolor()); 
        return attributes;
      }
    };
  
  public static final JRStyledTextAttributeSelector NO_BACKCOLOR = new JRStyledTextAttributeSelector() {
      public Map getStyledTextAttributes(JRPrintText printText) {
        Map attributes = new HashMap();
        attributes.putAll(JRFontUtil.setAttributes(attributes, printText));
        attributes.put(TextAttribute.FOREGROUND, printText.getForecolor());
        return attributes;
      }
    };
  
  public static final JRStyledTextAttributeSelector NONE = new JRStyledTextAttributeSelector() {
      public Map getStyledTextAttributes(JRPrintText printText) {
        return null;
      }
    };
  
  Map getStyledTextAttributes(JRPrintText paramJRPrintText);
}
