Examples of OfficeStyle


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.
//        LOGGER.debug("Variables-Section with new Master-Page " + variables + " " + masterPageName);

                final OfficeStyle style = deriveStyle(OfficeToken.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, OfficeToken.P, OfficeToken.STYLE_NAME, style.getStyleName(), XmlWriterSupport.OPEN);

                masterPageName = null;
            //breakDefinition = null;
            }
            else if (isColumnBreakPending())
            {
                setColumnBreakPending(false);

                final OfficeStyle style = deriveStyle(OfficeToken.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, OfficeToken.P, OfficeToken.STYLE_NAME, style.getStyleName(), XmlWriterSupport.OPEN);
            }
            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.
//        LOGGER.debug("Variables-Section " + variables);

                StyleUtilities.copyStyle(OfficeToken.PARAGRAPH,
                        TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(),
                        getGlobalStylesCollection(), getPredefinedStylesCollection());
                xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME,
                        TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.OPEN);
            }
            xmlWriter.writeText(variables);
            xmlWriter.writeCloseTag();
            variables = null;
        }

        final boolean keepWithNext = isKeepTableWithNext();
        final boolean localKeepTogether = OfficeToken.TRUE.equals(attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, KEEP_TOGETHER));
        final boolean tableMergeActive = isTableMergeActive();
        if (tableMergeActive)
        {
            this.sectionKeepTogether = localKeepTogether;
        }
        else
        {
            this.sectionKeepTogether = false;

        }

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

            if (masterPageName != null)
            {
//        LOGGER.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)
            {
                if (localKeepTogether)
                {
                    final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, TABLE_PROPERTIES);
                    tableProps.setAttribute(OfficeNamespaces.STYLE_NS, MAY_BREAK_BETWEEN_ROWS, OfficeToken.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)
            {
                boolean addKeepWithNext = true;
                if (currentRole == ROLE_GROUP_FOOTER)
                {
                    addKeepWithNext = isParentKeepTogether();
                }

                final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, TABLE_PROPERTIES);
                tableProps.setAttribute(OfficeNamespaces.STYLE_NS, MAY_BREAK_BETWEEN_ROWS, OfficeToken.FALSE);
                if (addKeepWithNext)
                {
                    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 ..
                }
            }
            attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName());
        // no need to copy the styles, this was done while deriving the
        // style ..
        }
        else
        {
            // Check, whether we may be able to skip the table.
            if (tableMergeActive)
            {
                if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED)
                {
                    // Skip the whole thing ..
                    return;
                }
                else if (detailBandProcessingState == DETAIL_SECTION_WAIT)
                {
                    if (keepWithNext)
                    {
                        final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);

                        final OfficeStyle style = deriveStyle(OfficeToken.TABLE, styleName);
                        final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, TABLE_PROPERTIES);
                        // 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, OfficeToken.FALSE);
                        final String hasGroupFooter = (String) attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "has-group-footer");
                        if (hasGroupFooter != null && hasGroupFooter.equals(OfficeToken.TRUE))
                        {
                            tableProps.setAttribute(OfficeNamespaces.FO_NS, KEEP_WITH_NEXT, ALWAYS);
                        }

                        attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName());
                    }
                    detailBandProcessingState = DETAIL_SECTION_FIRST_STARTED;
                }
                else if (detailBandProcessingState == DETAIL_SECTION_FIRST_PRINTED)
                {
View Full Code Here

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

        {
            // 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

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

            final Set 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

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

            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

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

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

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

            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

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

            return null;
        }
        final OfficeStyle[] styles = predefCollection.getAutomaticStyles().getAllStyles();
        for (int i = 0; i < styles.length; i++)
        {
            final OfficeStyle officeStyle = styles[i];
            if (officeStyle.getStyleFamily().equals(styleFamily))
            {
                final Element section = officeStyle.findFirstChild(OfficeNamespaces.STYLE_NS, sectionName);
                if (section != null)
                {
                    int j = 0;
                    for (; j < propertyNamespace.size(); j++)
                    {
View Full Code Here

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

        {
            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

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

    if (document == null)
    {
      return null;
    }

    final OfficeStyle style = document.getStylesCollection().getStyle("table-cell", cellStyleName);
    return (String) style.getAttribute(OfficeNamespaces.STYLE_NS, "data-style-name");
  }
View Full Code Here

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

      predefinedStylesCollection = reportDoc.getStylesCollection();

      final OfficeStyles commonStyles = predefinedStylesCollection.getCommonStyles();
      if (commonStyles.containsStyle("graphic", "Graphics") == false)
      {
        final OfficeStyle graphicsDefaultStyle = new OfficeStyle();
        graphicsDefaultStyle.setStyleFamily("graphic");
        graphicsDefaultStyle.setStyleName("Graphics");
        final Element graphicProperties = produceFirstChild(graphicsDefaultStyle, OfficeNamespaces.STYLE_NS, "graphic-properties");
        graphicProperties.setAttribute(OfficeNamespaces.TEXT_NS, "anchor-type", "paragraph");
        graphicProperties.setAttribute(OfficeNamespaces.SVG_NS, "x", "0cm");
        graphicProperties.setAttribute(OfficeNamespaces.SVG_NS, "y", "0cm");
        graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "wrap", "dynamic");
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.