Examples of OfficeStyle


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

        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

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

    predefStyles.getAutomaticStyles().addStyle(createVariablesStyle(false));
  }

  private OfficeStyle createVariablesStyle(final boolean keepWithNext)
  {
    final OfficeStyle variablesSectionStyle = new OfficeStyle();
    variablesSectionStyle.setStyleFamily("paragraph");
    if (keepWithNext)
    {
      variablesSectionStyle.setStyleName(TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT);
    }
    else
    {
      variablesSectionStyle.setStyleName(TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITHOUT_KEEPWNEXT);
    }

    final Section paragraphProps = new Section();
    paragraphProps.setNamespace(OfficeNamespaces.STYLE_NS);
    paragraphProps.setType("paragraph-properties");
    paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "background-color", "transparent");
    paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "text-align", "start");
    paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-with-next", "always");
    paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-together", "always");
    paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "vertical-align", "top");
    variablesSectionStyle.addNode(paragraphProps);

    final Section textProps = new Section();
    textProps.setNamespace(OfficeNamespaces.STYLE_NS);
    textProps.setType("text-properties");
    textProps.setAttribute(OfficeNamespaces.FO_NS, "font-variant", "normal");
    textProps.setAttribute(OfficeNamespaces.FO_NS, "text-transform", "none");
    textProps.setAttribute(OfficeNamespaces.FO_NS, "color", "#ffffff");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-outline", "false");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-blinking", "false");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-line-through-style", "none");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-line-through-mode", "continuous");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-position", "0% 100%");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "font-name", "Tahoma");
    textProps.setAttribute(OfficeNamespaces.FO_NS, "font-size", "1pt");
    textProps.setAttribute(OfficeNamespaces.FO_NS, "letter-spacing", "normal");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "letter-kerning", "false");
    textProps.setAttribute(OfficeNamespaces.FO_NS, "font-style", "normal");
    textProps.setAttribute(OfficeNamespaces.FO_NS, "text-shadow", "none");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-underline-style", "none");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-underline-mode", "continuous");
    textProps.setAttribute(OfficeNamespaces.FO_NS, "font-weight", "normal");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-rotation-angle", "0");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-emphasize", "none");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-combine", "none");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-combine-start-char", "");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-combine-end-char", "");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-blinking", "false");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-scale", "100%");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "font-relief", "none");
    textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-display", "none");
    variablesSectionStyle.addNode(textProps);
    return variablesSectionStyle;
  }
View Full Code Here

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

    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

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

      {
        cellEmpty = false;
        if (firstCellSeen == false && sectionKeepTogether)
        {
          final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS, "style-name");
          final OfficeStyle style = deriveStyle("paragraph", styleName);
          // Lets set the 'keep-together' flag..

          Element paragraphProps = style.getParagraphProperties();
          if (paragraphProps == null)
          {
            paragraphProps = new Section();
            paragraphProps.setNamespace(OfficeNamespaces.STYLE_NS);
            paragraphProps.setType("paragraph-properties");
            style.addNode(paragraphProps);
          }
          paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-together", "always");
          final int keepTogetherState = getCurrentContext().getKeepTogether();
          // We prevent pagebreaks within the two adjacent rows (this one and the next one) if
          // either a group-wide keep-together is defined or if we haven't reached the end of the
          // current section yet.
          if (keepTogetherState == PageContext.KEEP_TOGETHER_GROUP || expectedTableRowCount > 0)
          {
            paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-with-next", "always");
          }

          attrs.setAttribute(OfficeNamespaces.TEXT_NS, "style-name", style.getStyleName());
        }
      }
    }
    else
    {
      if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-cell", attrs))
      {
        cellEmpty = false;
        if (firstCellSeen == false && sectionKeepTogether)
        {
          final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, "style-name");
          final OfficeStyle style = deriveStyle("table-cell", styleName);
          // Lets set the 'keep-together' flag..

          Element paragraphProps = style.getParagraphProperties();
          if (paragraphProps == null)
          {
            paragraphProps = new Section();
            paragraphProps.setNamespace(OfficeNamespaces.STYLE_NS);
            paragraphProps.setType("paragraph-properties");
            style.addNode(paragraphProps);
          }
          paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-together", "always");
          final int keepTogetherState = getCurrentContext().getKeepTogether();
          // We prevent pagebreaks within the two adjacent rows (this one and the next one) if
          // either a group-wide keep-together is defined or if we haven't reached the end of the
          // current section yet.
          if (keepTogetherState == PageContext.KEEP_TOGETHER_GROUP || expectedTableRowCount > 0)
          {
            paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-with-next", "always");
          }

          attrs.setAttribute(OfficeNamespaces.TABLE_NS, "style-name", style.getStyleName());
        }
      }
    }

    // process the styles as usual
View Full Code Here

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

        // write a paragraph that uses the VARIABLES_HIDDEN_STYLE as
        // primary style. Derive that one and add the manual pagebreak.
        // The predefined style already has the 'keep-together' flags set.
//        Log.debug("Variables-Section with new Master-Page " + variables + " " + masterPageName);

        final OfficeStyle style = deriveStyle("paragraph", TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT);
        style.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName);
        if (breakDefinition.isResetPageNumber())
        {
          final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "paragraph-properties");
          paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1");
        }
        if (isColumnBreakPending())
        {
          final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "paragraph-properties");
          paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "break-before", "column");
          setColumnBreakPending(false);
        }
        xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", "style-name", style.getStyleName(), XmlWriterSupport.OPEN);
        xmlWriter.writeText(variables);
        xmlWriter.writeCloseTag();
        variables = null;
        masterPageName = null;
        breakDefinition = null;
      }
      else if (isColumnBreakPending())
      {
        setColumnBreakPending(false);

        final OfficeStyle style = deriveStyle("paragraph", TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT);
        final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "paragraph-properties");
        paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1");

        xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", "style-name", style.getStyleName(), XmlWriterSupport.OPEN);
        xmlWriter.writeText(variables);
        xmlWriter.writeCloseTag();
        variables = null;
      }
      else
      {
        // Write a paragraph without adding the pagebreak. We can reuse the global style, but we have to make
        // sure that the style is part of the current 'auto-style' collection.
//        Log.debug("Variables-Section " + variables);

        StyleUtilities.copyStyle("paragraph",
            TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(),
            getGlobalStylesCollection(), getPredefinedStylesCollection());
        xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", "style-name",
            TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.OPEN);
        xmlWriter.writeText(variables);
        xmlWriter.writeCloseTag();
        variables = null;
      }
    }

    final boolean keepWithNext = isKeepTableWithNext();
    final boolean localKeepTogether = "true".equals
        (attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "keep-together"));
    final boolean tableMergeActive = isTableMergeActive();
    if (tableMergeActive == false)
    {
      this.sectionKeepTogether = false;
    }
    else
    {
      this.sectionKeepTogether = localKeepTogether;
    }

    // Check, whether we have a reason to derive a style...
    if (masterPageName != null ||
        (tableMergeActive == false && (localKeepTogether || keepWithNext)) || isColumnBreakPending())
    {
      final String styleName = (String)
          attrs.getAttribute(OfficeNamespaces.TABLE_NS, "style-name");
      final OfficeStyle style = deriveStyle("table", styleName);

      if (masterPageName != null)
      {
//        Log.debug("Starting a new MasterPage: " + masterPageName);
        // Patch the current styles.
        // This usually only happens on Table-Styles or Paragraph-Styles
        style.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName);
        if (breakDefinition.isResetPageNumber())
        {
          final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "paragraph-properties");
          paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1");
        }
      }
      if (isColumnBreakPending())
      {
        final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "paragraph-properties");
        paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "break-before", "column");
        setColumnBreakPending(false);
      }

      // Inhibit breaks inside the table only if it has been defined and if we do not create one single
      // big detail section. In that case, this flag would be invalid and would cause layout-errors.
      if (tableMergeActive == false)
      {
        if (localKeepTogether)
        {
          final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "table-properties");
          tableProps.setAttribute(OfficeNamespaces.STYLE_NS, "may-break-between-rows", "false");
        }
      }
      else
      {
        if (detailBandProcessingState == DETAIL_SECTION_WAIT)
        {
          detailBandProcessingState = DETAIL_SECTION_FIRST_STARTED;
        }
        else if (detailBandProcessingState == DETAIL_SECTION_FIRST_PRINTED)
        {
          detailBandProcessingState = DETAIL_SECTION_OTHER_STARTED;
        }
      }
      if (keepWithNext)
      {
        final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "table-properties");
        tableProps.setAttribute(OfficeNamespaces.FO_NS, "keep-with-next", "always");
        // A keep-with-next does not work, if the may-break-betweek rows is not set to false ..
        tableProps.setAttribute(OfficeNamespaces.STYLE_NS, "may-break-between-rows", "false");
      }
      attrs.setAttribute(OfficeNamespaces.TABLE_NS, "style-name", style.getStyleName());
      // no need to copy the styles, this was done while deriving the
      // style ..
    }
    else
    {
View Full Code Here

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

            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");
View Full Code Here

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

    {
        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

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

    protected OfficeStyle deriveStyle(final String styleFamily, final String styleName)
            throws ReportProcessingException
    {
        // autogenerate a style. The style has already been added to the current
        // auto-collection.
        final OfficeStyle style = StyleUtilities.deriveStyle(styleFamily, styleName,
                getStylesCollection(), getGlobalStylesCollection(),
                getPredefinedStylesCollection(), getAutoStyleNameGenerator());
        return style;
    }
View Full Code Here

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

                    {
                        final double clipWidth = normalizedImageWidth.getValue() - imageAreaWidthVal.getValue();
                        final double clipHeight = normalizedImageHeight.getValue() - imageAreaHeightVal.getValue();
                        if (clipWidth > 0 && clipHeight > 0)
                        {
                            final OfficeStyle imageStyle = deriveStyle(OfficeToken.GRAPHIC, OfficeToken.GRAPHICS);
                            final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES);
                            final StringBuffer buffer = new StringBuffer();
                            buffer.append("rect(");
                            buffer.append(clipHeight / 2);
                            buffer.append(imageAreaHeightVal.getType().getType());
                            buffer.append(' ');
                            buffer.append(clipWidth / 2);
                            buffer.append(imageAreaWidthVal.getType().getType());
                            buffer.append(' ');
                            buffer.append(clipHeight / 2);
                            buffer.append(imageAreaHeightVal.getType().getType());
                            buffer.append(' ');
                            buffer.append(clipWidth / 2);
                            buffer.append(imageAreaWidthVal.getType().getType());
                            buffer.append(')');
                            graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString());

                            styleName = imageStyle.getStyleName();
                            getStylesCollection().getAutomaticStyles().addStyle(imageStyle);
                        }
                        else if (clipWidth > 0)
                        {
                            final OfficeStyle imageStyle = deriveStyle(OfficeToken.GRAPHIC, OfficeToken.GRAPHICS);
                            final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES);
                            final StringBuffer buffer = new StringBuffer();
                            buffer.append("rect(0cm ");
                            buffer.append(clipWidth / 2);
                            buffer.append(imageAreaWidthVal.getType().getType());
                            buffer.append(" 0cm ");
                            buffer.append(clipWidth / 2);
                            buffer.append(imageAreaWidthVal.getType().getType());
                            buffer.append(')');
                            graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString());

                            styleName = imageStyle.getStyleName();
                            getStylesCollection().getAutomaticStyles().addStyle(imageStyle);
                            imageAreaHeightVal = normalizedImageHeight;
                        }
                        else if (clipHeight > 0)
                        {
                            final OfficeStyle imageStyle = deriveStyle(OfficeToken.GRAPHIC, OfficeToken.GRAPHICS);
                            final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES);
                            final StringBuffer buffer = new StringBuffer();
                            buffer.append("rect(");
                            buffer.append(clipHeight / 2);
                            buffer.append(imageAreaHeightVal.getType().getType());
                            buffer.append(" 0cm ");
                            buffer.append(clipHeight / 2);
                            buffer.append(imageAreaHeightVal.getType().getType());
                            buffer.append(" 0cm)");
                            graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString());

                            styleName = imageStyle.getStyleName();
                            getStylesCollection().getAutomaticStyles().addStyle(imageStyle);
                            imageAreaWidthVal = normalizedImageWidth;
                        }
                        else
                        {
View Full Code Here

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

    }

    protected CSSNumericValue computeRowHeight(final String rowStyle)
    {
        final OfficeStylesCollection contentStyles = getContentStylesCollection();
        final OfficeStyle style = contentStyles.getStyle(OfficeToken.TABLE_ROW, rowStyle);
        if (style != null)
        {
            final Element element = style.getTableRowProperties();
            if (element != null)
            {
                final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "row-height");
                if (height != null)
                {
                    return parseLength(height);
                }
            }

            final String styleParent = style.getStyleParent();
            if (styleParent != null)
            {
                return computeRowHeight(styleParent);
            }
        }

        final OfficeStylesCollection globalStyles = getGlobalStylesCollection();
        final OfficeStyle globalStyle = globalStyles.getStyle(OfficeToken.TABLE_ROW, rowStyle);
        if (globalStyle != null)
        {
            final Element element = globalStyle.getTableRowProperties();
            if (element != null)
            {
                final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "row-height");
                if (height != null)
                {
                    return parseLength(height);
                }
            }
            final String styleParent = globalStyle.getStyleParent();
            if (styleParent != null)
            {
                return computeRowHeight(styleParent);
            }
        }

        final OfficeStylesCollection predefStyles = getPredefinedStylesCollection();
        final OfficeStyle predefStyle = predefStyles.getStyle(OfficeToken.TABLE_ROW, rowStyle);
        if (predefStyle != null)
        {
            final Element element = predefStyle.getTableRowProperties();
            if (element != null)
            {
                final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "row-height");
                if (height != null)
                {
                    return parseLength(height);
                }
            }
            final String styleParent = predefStyle.getStyleParent();
            if (styleParent != null)
            {
                return computeRowHeight(styleParent);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.