Package com.sun.star.report.pentaho.model

Examples of com.sun.star.report.pentaho.model.OfficeStyle


  private final OfficeStyle officeStyle;
  private final List childs;

  public OfficeStyleReadHandler()
  {
    this.officeStyle = new OfficeStyle();
    this.childs = new ArrayList();
  }
View Full Code Here


    {
      // fine, there's already a copy of the stylesheet.
      return;
    }

    final OfficeStyle predefCommonStyle =
        predefCollection.getCommonStyles().getStyle(styleFamily, styleName);
    if (predefCommonStyle != null)
    {
      // so we have an style from the predefined collection.
      // copy it an add it to the current stylescollection
      final OfficeStyles commonStyles = commonCollection.getCommonStyles();

      copyStyleInternal(predefCommonStyle, commonStyles, stylesCollection,
          commonCollection, predefCollection, styleFamily, inheritanceTracker);
      return;
    }

    final OfficeStyle predefAutoStyle =
        predefCollection.getAutomaticStyles().getStyle(styleFamily, styleName);
    if (predefAutoStyle != null)
    {
      // so we have an style from the predefined collection.
      // copy it an add it to the current stylescollection
      final OfficeStyles autoStyles = stylesCollection.getAutomaticStyles();
      copyStyleInternal(predefAutoStyle, autoStyles, stylesCollection,
          commonCollection, predefCollection, styleFamily, inheritanceTracker);
      return;
    }

    // There is no automatic style either. Now this means that someone
    // messed up the fileformat. Lets create a new empty style for this.
    final OfficeStyle autostyle = new OfficeStyle();
    autostyle.setNamespace(OfficeNamespaces.STYLE_NS);
    autostyle.setType("style");
    autostyle.setStyleFamily(styleFamily);
    autostyle.setStyleName(styleName);

    final OfficeStyles autoStyles = stylesCollection.getAutomaticStyles();
    autoStyles.addStyle(autostyle);
  }
View Full Code Here

      final HashSet inheritanceTracker)
      throws ReportProcessingException
  {
    try
    {
      final OfficeStyle preStyle = (OfficeStyle) predefCommonStyle.clone();
      styles.addStyle(preStyle);
      performFontFaceProcessing(preStyle, stylesCollection, predefCollection);
      performDataStyleProcessing(preStyle, stylesCollection, predefCollection);

      // Lookup the parent style ..
      final String styleParent = preStyle.getStyleParent();
      final OfficeStyle inherited =
          stylesCollection.getStyle(styleFamily, styleParent);
      if (inherited != null)
      {
        // OK, recurse (and hope that we dont run into an infinite loop) ..
        copyStyle(styleFamily, styleParent, stylesCollection,
View Full Code Here

      throw new NullPointerException("StyleFamily must not be null");
    }
    if (styleName != null)
    {

      final OfficeStyle currentAuto =
          stylesCollection.getAutomaticStyles().getStyle(styleFamily,
              styleName);
      if (currentAuto != null)
      {
        // handle an automatic style ..
        final OfficeStyle derivedStyle =
            deriveAutomaticStyle(currentAuto, styleFamily, styleName,
                generator, commonCollection, predefCollection);
        stylesCollection.getAutomaticStyles().addStyle(derivedStyle);
        return derivedStyle;
      }

      final OfficeStyle currentCommon =
          stylesCollection.getCommonStyles().getStyle(styleFamily, styleName);
      if (currentCommon != null)
      {
        // handle an common style ..
        final OfficeStyle derivedStyle =
            deriveCommonStyle(currentCommon, styleFamily, styleName,
                generator, commonCollection, predefCollection);
        stylesCollection.getAutomaticStyles().addStyle(derivedStyle);
        return derivedStyle;
      }

//      final OfficeStyle commonAuto =
//          commonCollection.getAutomaticStyles().getStyle(styleFamily,
//              styleName);
//      if (commonAuto != null)
//      {
//        // handle an automatic style ..
//        final OfficeStyle derivedStyle =
//            deriveAutomaticStyle(commonAuto, styleFamily, styleName,
//                generator, commonCollection, predefCollection);
//        stylesCollection.getAutomaticStyles().addStyle(derivedStyle);
//        return derivedStyle;
//      }

      final OfficeStyle commonCommon =
          commonCollection.getCommonStyles().getStyle(styleFamily, styleName);
      if (commonCommon != null)
      {
        // handle an common style ..
        final OfficeStyle derivedStyle =
            deriveCommonStyle(commonCommon, styleFamily, styleName,
                generator, commonCollection, predefCollection);
        stylesCollection.getAutomaticStyles().addStyle(derivedStyle);
        return derivedStyle;
      }

      final OfficeStyle predefAuto =
          predefCollection.getAutomaticStyles().getStyle(styleFamily,
              styleName);
      if (predefAuto != null)
      {
        // handle an automatic style ..
        final OfficeStyle derivedStyle =
            deriveAutomaticStyle(predefAuto, styleFamily, styleName,
                generator, commonCollection, predefCollection);
        stylesCollection.getAutomaticStyles().addStyle(derivedStyle);
        return derivedStyle;
      }

      final OfficeStyle predefCommon =
          predefCollection.getCommonStyles().getStyle(styleFamily, styleName);
      if (predefCommon != null)
      {
        // handle an common style ..
        final OfficeStyle derivedStyle =
            deriveCommonStyle(predefCommon, styleFamily, styleName,
                generator, commonCollection, predefCollection);
        stylesCollection.getAutomaticStyles().addStyle(derivedStyle);
        return derivedStyle;
      }
    }

    // No such style. Create a new one ..
    final OfficeStyle autostyle = new OfficeStyle();
    autostyle.setNamespace(OfficeNamespaces.STYLE_NS);
    autostyle.setType("style");
    autostyle.setStyleFamily(styleFamily);
    if (styleName != null)
    {
      autostyle.setStyleName(styleName);
    }
    else
    {
      autostyle.setStyleName(generator.generateName("derived_anonymous"));
    }

    final OfficeStyles autoStyles = stylesCollection.getAutomaticStyles();
    autoStyles.addStyle(autostyle);
    return autostyle;
View Full Code Here

                                               final AttributeNameGenerator nameGenerator,
                                               final OfficeStylesCollection commonCollection,
                                               final OfficeStylesCollection predefCollection)
      throws ReportProcessingException
  {
    final OfficeStyle autostyle = new OfficeStyle();
    autostyle.setNamespace(OfficeNamespaces.STYLE_NS);
    autostyle.setType("style");
    autostyle.setStyleFamily(styleFamily);
    autostyle.setStyleName(nameGenerator.generateName("derived_" + styleName));
    autostyle.setStyleParent(styleName);

    // now copy the common style ..
    final OfficeStyles commonStyles = commonCollection.getCommonStyles();
    if (commonStyles.containsStyle(styleFamily, styleName) == false)
    {
View Full Code Here

                                                  final OfficeStylesCollection predefCollection)
      throws ReportProcessingException
  {
    try
    {
      final OfficeStyle autostyle = (OfficeStyle) commonStyle.clone();
      autostyle.setNamespace(OfficeNamespaces.STYLE_NS);
      autostyle.setType("style");
      autostyle.setStyleFamily(styleFamily);
      autostyle.setStyleName
          (nameGenerator.generateName("derived_auto_" + styleName));


      final String parent = autostyle.getStyleParent();
      if (parent != null)
      {
        copyStyle(styleFamily, parent, commonCollection, commonCollection,
            predefCollection);
      }
View Full Code Here

    {
      return null;
    }
    seenStyles.add(styleName);

    final OfficeStyle style = predefCollection.getStyle(styleFamily, styleName);
    if (style == null)
    {
      return null; // no such style
    }
    final Element section = style.findFirstChild(OfficeNamespaces.STYLE_NS, sectionName);
    if (section != null)
    {
      final Object attribute = section.getAttribute(propertyNamespace, propertyName);
      if (attribute != null)
      {
        return String.valueOf(attribute);
      }
    }
    final String parent = style.getStyleParent();
    if (parent == null)
    {
      return null;
    }
    return queryStyle(predefCollection, styleFamily, parent, sectionName, propertyNamespace, propertyName, seenStyles);
View Full Code Here

      columnCounter = 0;
      // Lets make sure the color of the table is ok ..
      if (tableBackgroundColor != null)
      {
        final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, "style-name");
        final OfficeStyle style = deriveStyle("table-row", styleName);
        Element tableRowProperties = style.getTableRowProperties();
        if (tableRowProperties == null)
        {
          tableRowProperties = new Section();
          tableRowProperties.setNamespace(OfficeNamespaces.STYLE_NS);
          tableRowProperties.setType("table-row-properties");
          tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, "background-color", tableBackgroundColor);
          style.addNode(tableRowProperties);
        }
        else
        {
          final Object oldValue = tableRowProperties.getAttribute(OfficeNamespaces.FO_NS, "background-color");
          if (oldValue == null || "transparent".equals(oldValue))
          {
            tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, "background-color", tableBackgroundColor);
          }
        }
        attrs.setAttribute(OfficeNamespaces.TABLE_NS, "style-name", style.getStyleName());
      }
    }
    else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-cell", attrs))
    {
      columnCounter++;
View Full Code Here

      {
        // This should not happen, but if it does, we will ignore that cell.
        return;
      }

      final OfficeStyle style = getPredefinedStylesCollection().getStyle("table-column", styleName);
      if (style == null)
      {
        // Now this is very bad. It means that there is no style defined with the given name.
        return;
      }

      final Element tableColumnProperties = style.getTableColumnProperties();
      String widthStr = (String) tableColumnProperties.getAttribute("column-width");
      widthStr = widthStr.substring(0, widthStr.indexOf(getUnitsOfMeasure(widthStr)));
      addColumnWidthToRowBoundaryMarker(Float.parseFloat(widthStr));
      ColumnBoundary currentRowBoundary = new ColumnBoundary(getCurrentRowBoundaryMarker());
      final List columnBoundaryList = getColumnBoundaryList();
View Full Code Here

        float columnWidth = cb.getBoundary();
        if (i > 1)
        {
          columnWidth -= cba[i - 1].getBoundary();
        }
        final OfficeStyle style = deriveStyle("table-column", ("co" + String.valueOf(i) + "_"));
        final Section tableColumnProperties = new Section();
        tableColumnProperties.setType("table-column-properties");
        tableColumnProperties.setNamespace(style.getNamespace());
        tableColumnProperties.setAttribute(style.getNamespace(), "column-width", String.valueOf(columnWidth)
            + getUnitsOfMeasure(null));
        style.addNode(tableColumnProperties);

        final AttributeList myAttrList = new AttributeList();
        myAttrList.setAttribute(OfficeNamespaces.TABLE_NS, "style-name", style.getStyleName());
        xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, "table-column", myAttrList, XmlWriterSupport.CLOSE);
      }
      xmlWriter.writeCloseTag();
    }
    catch (IOException e)
View Full Code Here

TOP

Related Classes of com.sun.star.report.pentaho.model.OfficeStyle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.