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

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


        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


    }


    try
    {
      final OfficeStyles automaticStyles = predefCollection.getAutomaticStyles();
      final DataStyle autoDataStyle = automaticStyles.getDataStyle(styleName);
      if (autoDataStyle != null)
      {
        final DataStyle derivedStyle = (DataStyle) autoDataStyle.clone();
        Node[] nodes = autoDataStyle.getNodeArray();
        for (int i = 0; i < nodes.length; i++) {
            Node node = nodes[i];
            if (node instanceof DataStyle) {
                DataStyle element = (DataStyle) node;
                final Object apply = element.getAttribute(OfficeNamespaces.STYLE_NS, "apply-style-name");
                if (apply != null) {
                    final String applyStyleName = String.valueOf(apply);
                    if (!stylesCollection.getAutomaticStyles().containsDataStyle(applyStyleName)) {
                        final DataStyle autoApplyDataStyle = automaticStyles.getDataStyle(applyStyleName);
                        if (autoApplyDataStyle != null) {
                            stylesCollection.getAutomaticStyles().addDataStyle((DataStyle) autoApplyDataStyle.clone());
                        }
                    }
                    break;
                }
            }
        }
        stylesCollection.getAutomaticStyles().addDataStyle(derivedStyle);
        return;
      }
      final OfficeStyles commonStyles = predefCollection.getCommonStyles();
      final DataStyle commonDataStyle = commonStyles.getDataStyle(styleName);
      if (commonDataStyle != null)
      {
        final DataStyle derivedStyle = (DataStyle) commonDataStyle.clone();
        stylesCollection.getCommonStyles().addDataStyle(derivedStyle);
        return;
View Full Code Here

    else
    {
      autostyle.setStyleName(generator.generateName("derived_anonymous"));
    }

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

    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)
    {
      copyStyleInternal(commonStyle, commonStyles,
          commonCollection, commonCollection, predefCollection,
          styleFamily, new HashSet());
    }
View Full Code Here

  }

  private String generateInitialTableStyle () throws ReportProcessingException
  {
    final OfficeStylesCollection predefStyles = getPredefinedStylesCollection();
    final OfficeStyles commonStyles = predefStyles.getAutomaticStyles();
    if (commonStyles.containsStyle("table", "Initial_Table") == false)
    {
      final String masterPageName = createMasterPage();

      final OfficeStyle tableStyle = new OfficeStyle();
      tableStyle.setStyleFamily("table");
      tableStyle.setStyleName("Initial_Table");
      tableStyle.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName);
      final Element tableProperties = produceFirstChild(tableStyle, OfficeNamespaces.STYLE_NS, "table-properties");
      tableProperties.setAttribute(OfficeNamespaces.FO_NS, "background-color", "transparent");
      commonStyles.addStyle(tableStyle);
    }
    return "Initial_Table";
  }
View Full Code Here

    return finishBuffering();
  }

  private String generateSectionStyle(final int columnCount)
  {
    final OfficeStyles automaticStyles = getStylesCollection().getAutomaticStyles();
    final String styleName = getAutoStyleNameGenerator().generateName("auto_section_style");

    final Section sectionProperties = new Section();
    sectionProperties.setNamespace(OfficeNamespaces.STYLE_NS);
    sectionProperties.setType("section-properties");
    sectionProperties.setAttribute(OfficeNamespaces.FO_NS, "background-color", "transparent");
    sectionProperties.setAttribute(OfficeNamespaces.TEXT_NS, "dont-balance-text-columns", "false");
    sectionProperties.setAttribute(OfficeNamespaces.STYLE_NS, "editable", "false");

    if (columnCount > 1)
    {
      final Section columns = new Section();
      columns.setNamespace(OfficeNamespaces.STYLE_NS);
      columns.setType("columns");
      columns.setAttribute(OfficeNamespaces.FO_NS, "column-count", String.valueOf(columnCount));
      columns.setAttribute(OfficeNamespaces.STYLE_NS, "column-gap", "0cm");
      sectionProperties.addNode(columns);

//    final Section columnSep = new Section();
//    columnSep.setNamespace(OfficeNamespaces.STYLE_NS);
//    columnSep.setType("column-sep");
//    columnSep.setAttribute(OfficeNamespaces.STYLE_NS, "width", "0.035cm");
//    columnSep.setAttribute(OfficeNamespaces.STYLE_NS, "color", "#000000");
//    columnSep.setAttribute(OfficeNamespaces.STYLE_NS, "height", "100%");
//    columns.addNode(columnSep);

      for (int i = 0; i < columnCount; i++)
      {
        final Section column = new Section();
        column.setNamespace(OfficeNamespaces.STYLE_NS);
        column.setType("column");
        column.setAttribute(OfficeNamespaces.STYLE_NS, "rel-width", "1*");
        column.setAttribute(OfficeNamespaces.FO_NS, "start-indent", "0cm");
        column.setAttribute(OfficeNamespaces.FO_NS, "end-indent", "0cm");
        columns.addNode(column);
      }
    }

    final OfficeStyle style = new OfficeStyle();
    style.setNamespace(OfficeNamespaces.STYLE_NS);
    style.setType("style");
    style.setAttribute(OfficeNamespaces.STYLE_NS, "name", styleName);
    style.setAttribute(OfficeNamespaces.STYLE_NS, "family", "section");
    style.addNode(sectionProperties);

    automaticStyles.addStyle(style);
    return styleName;
  }
View Full Code Here

            frameNameGenerator.reset();

            final OfficeDocument reportDoc = (OfficeDocument) report;
            predefinedStylesCollection = reportDoc.getStylesCollection();

            final OfficeStyles commonStyles = predefinedStylesCollection.getCommonStyles();
            if (!commonStyles.containsStyle(OfficeToken.GRAPHIC, OfficeToken.GRAPHICS))
            {
                final OfficeStyle graphicsDefaultStyle = new OfficeStyle();
                graphicsDefaultStyle.setStyleFamily(OfficeToken.GRAPHIC);
                graphicsDefaultStyle.setStyleName(OfficeToken.GRAPHICS);
                final Element graphicProperties = produceFirstChild(graphicsDefaultStyle, OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES);
                graphicProperties.setAttribute(OfficeNamespaces.TEXT_NS, "anchor-type", OfficeToken.PARAGRAPH);
                graphicProperties.setAttribute(OfficeNamespaces.SVG_NS, "x", ZERO_CM);
                graphicProperties.setAttribute(OfficeNamespaces.SVG_NS, "y", ZERO_CM);
                graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "wrap", "dynamic");
                graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "number-wrapped-paragraphs", "no-limit");
                graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "wrap-contour", OfficeToken.FALSE);
                graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, VERTICAL_POS, "from-top"); // changed for chart

                graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "vertical-rel", OfficeToken.PARAGRAPH);
                graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, HORIZONTAL_POS, "from-left"); // changed for chart

                graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "horizontal-rel", OfficeToken.PARAGRAPH);
                commonStyles.addStyle(graphicsDefaultStyle);
            }

            // Make sure that later generated styles do not overwrite existing styles.
            fillStyleNameGenerator(predefinedStylesCollection);
View Full Code Here

        return autoStyleNameGenerator;
    }

    private void fillStyleNameGenerator(final OfficeStylesCollection stylesCollection)
    {
        final OfficeStyles commonStyles = stylesCollection.getCommonStyles();
        final OfficeStyle[] allCommonStyles = commonStyles.getAllStyles();
        for (int i = 0; i < allCommonStyles.length; i++)
        {
            final OfficeStyle style = allCommonStyles[i];
            autoStyleNameGenerator.generateName(style.getStyleName());
        }

        final OfficeStyles autoStyles = stylesCollection.getAutomaticStyles();
        final OfficeStyle[] allAutoStyles = autoStyles.getAllStyles();
        for (int i = 0; i < allAutoStyles.length; i++)
        {
            final OfficeStyle style = allAutoStyles[i];
            autoStyleNameGenerator.generateName(style.getStyleName());
        }
View Full Code Here

    }

    private String generateInitialTableStyle() throws ReportProcessingException
    {
        final OfficeStylesCollection predefStyles = getPredefinedStylesCollection();
        final OfficeStyles commonStyles = predefStyles.getAutomaticStyles();
        if (!commonStyles.containsStyle(OfficeToken.TABLE, "Initial_Table"))
        {
            final String masterPageName = createMasterPage();

            final OfficeStyle tableStyle = new OfficeStyle();
            tableStyle.setStyleFamily(OfficeToken.TABLE);
            tableStyle.setStyleName("Initial_Table");
            tableStyle.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName);
            final Element tableProperties = produceFirstChild(tableStyle, OfficeNamespaces.STYLE_NS, "table-properties");
            tableProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, "transparent");
            commonStyles.addStyle(tableStyle);
        }
        return "Initial_Table";
    }
View Full Code Here

        (OfficeNamespaces.OFFICE_NS, "styles", XmlWriterSupport.OPEN);

    for (int sci = 0; sci < osc.length; sci++)
    {
      final OfficeStylesCollection collection = osc[sci];
      final OfficeStyles officeStyles = collection.getCommonStyles();
      writeStyles(officeStyles);
    }

    xmlWriter.writeCloseTag();
  }
View Full Code Here

TOP

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

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.