protected void processAttributes(List<Property> properties, Element element) {
   CTShd shd = null;
   Shading shading = null;
   int bgColor = 0xffffff; // the background color of the page is assumed as white
   int fgColor = 0; // the default color of the font is assumed as black
   int pctPattern = -1;
   for (int i = 0; i < properties.size(); i++) {
     if (properties.get(i) instanceof Shading) {
       shd = (CTShd) properties.get(i).getObject();
       fgColor = extractColor(shd.getColor(), 0);
       if ((shd.getVal() != null)
           && ("clear".equals(shd.getVal().value()))
           && ("auto".equals(shd.getFill()))) {
         // This is a reset to the background color of the page,
         // it is treated as an special case, as the background color
         // isn't inherited
         bgColor = 0xffffff;
         pctPattern = -2;
       } else {
         pctPattern = (shd.getVal() != null ? extractPattern(shd.getVal().value()) : -1);
         bgColor = extractColor(shd.getFill(), bgColor);
       }
     }
   }
   if (pctPattern == -1) {
     applyAttributes(properties, element);
   } else {
     properties.add(createShading(fgColor, bgColor, pctPattern));
     applyAttributes(properties, element);
     properties.remove(properties.size() - 1);
   }
 }
Exemple #2
0
  @Override
  public void setXslFO(Element foElement) {

    CTShd shd = ((CTShd) this.getObject());

    // TODO
    // STShd styleVal = shd.getVal();

    if (shd.getColor() != null && !shd.getColor().equals("auto")) {
      log.warn("TODO support w:shd/@w:color=" + shd.getColor());
    }

    // We just support fill color right now
    if (shd.getFill() != null && !shd.getFill().equals("auto")) {
      foElement.setAttribute(FO_NAME, "#" + shd.getFill());
    }
  }
Exemple #3
0
  @Override
  public String getCssProperty() {

    CTShd shd = ((CTShd) this.getObject());

    // TODO
    // STShd styleVal = shd.getVal();

    if (shd.getColor() != null && !shd.getColor().equals("auto")) {
      log.warn("TODO support w:shd/@w:color=" + shd.getColor());
    }

    // We just support fill color right now
    if (shd.getFill() != null && !shd.getFill().equals("auto")) {
      return composeCss(CSS_NAME, "#" + shd.getFill());
    } else {
      return CSS_NULL;
    }
  }