[Libreoffice-commits] core.git: 2 commits - reportbuilder/java
Lionel Elie Mamane
lionel at mamane.lu
Wed Dec 17 02:02:31 PST 2014
reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormattedTextLayoutController.java | 138 ++--------
reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/VariablesCollection.java | 7
2 files changed, 34 insertions(+), 111 deletions(-)
New commits:
commit 9c346fbcf291685f576c28395b870db32232eab2
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Wed Dec 17 10:59:54 2014 +0100
Revert "reportbuilder: re-add numerous bits of dead code needed by bug fix"
This reverts commit 458f22c338f39ad777ad3f34b45a81b4eb8dfe8e.
Since we reverted d6ce95ae2288859fe74d601f1bdaf616ab1ee7f0, this code
is again unused.
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormattedTextLayoutController.java b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormattedTextLayoutController.java
index 8c1f619..7f1470e 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormattedTextLayoutController.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormattedTextLayoutController.java
@@ -18,18 +18,13 @@
package org.libreoffice.report.pentaho.layoutprocessor;
-import org.libreoffice.report.OfficeToken;
import org.libreoffice.report.pentaho.OfficeNamespaces;
import org.libreoffice.report.pentaho.model.FormattedTextElement;
-import org.libreoffice.report.pentaho.model.OfficeDocument;
-import org.libreoffice.report.pentaho.model.OfficeStyle;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jfree.layouting.util.AttributeMap;
import org.jfree.report.DataFlags;
import org.jfree.report.DataSourceException;
-import org.jfree.report.JFreeReportInfo;
import org.jfree.report.ReportDataFactoryException;
import org.jfree.report.ReportProcessingException;
import org.jfree.report.expressions.FormulaExpression;
@@ -52,27 +47,6 @@ public class FormattedTextLayoutController
private static final Log LOGGER = LogFactory.getLog(FormattedTextLayoutController.class);
- private VariablesCollection getVariablesCollection()
- {
- LayoutController parent = getParent();
- while (parent != null)
- {
- if (parent instanceof OfficeRepeatingStructureLayoutController)
- {
- final OfficeRepeatingStructureLayoutController orslc =
- (OfficeRepeatingStructureLayoutController) parent;
- if (orslc.isNormalFlowProcessing())
- {
- return null;
- }
-
- return orslc.getVariablesCollection();
- }
- parent = parent.getParent();
- }
- return null;
- }
-
@Override
public boolean isValueChanged()
{
@@ -154,21 +128,6 @@ public class FormattedTextLayoutController
return join(getFlowController());
}
- private OfficeDocument getDocument()
- {
- LayoutController parent = getParent();
- while (parent != null)
- {
- final Object node = parent.getNode();
- if (node instanceof OfficeDocument)
- {
- return (OfficeDocument) node;
- }
- parent = parent.getParent();
- }
- return null;
- }
-
private Element getParentTableCell()
{
LayoutController parent = getParent();
@@ -184,44 +143,4 @@ public class FormattedTextLayoutController
return null;
}
- private String computeValueStyle()
- {
- final Element tce = getParentTableCell();
- if (tce == null)
- {
- return null;
- }
-
- final String cellStyleName = (String) tce.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
- if (cellStyleName == null)
- {
- return null;
- }
- final OfficeDocument document = getDocument();
- if (document == null)
- {
- return null;
- }
-
- final OfficeStyle style = document.getStylesCollection().getStyle("table-cell", cellStyleName);
- return (String) style.getAttribute(OfficeNamespaces.STYLE_NS, "data-style-name");
- }
-
- private String computeValueType()
- {
- final Element tce = getParentTableCell();
- if (tce == null)
- {
- // NO particular format means: Fallback to string and hope and pray ..
- throw new IllegalStateException("A formatted text element must be a child of a Table-Cell.");
- }
-
- final String type = (String) tce.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE);
- if (type == null)
- {
- LOGGER.error("The Table-Cell does not have a office:value attribute defined. Your content will be messed up.");
- return "string";
- }
- return type;
- }
}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/VariablesCollection.java b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/VariablesCollection.java
index 4bb380e..961206a 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/VariablesCollection.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/VariablesCollection.java
@@ -68,12 +68,7 @@ public class VariablesCollection
return namePrefix;
}
- public String addVariable(final FormattedTextElement element)
- {
- variables.add(element);
- final int size = variables.size();
- return namePrefix + size;
- }
+
public FormattedTextElement[] getVariables()
{
commit 08715e24c13d21767544725292d8dbf1c2381479
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Wed Dec 17 10:58:19 2014 +0100
Revert "fdo#87044: reportbuilder: Revert "fdo#67930 don't use variables ..."
This reverts commit d6ce95ae2288859fe74d601f1bdaf616ab1ee7f0.
Not necessary to fix fdo#87044, commit
1e10f6d229587ffc2a955c225b489645f8016e23 is sufficient. Since the code
that is reintroduced leads to an overly complex and fragile document
structure, I'd rather not have it.
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormattedTextLayoutController.java b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormattedTextLayoutController.java
index afd8a59..8c1f619 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormattedTextLayoutController.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormattedTextLayoutController.java
@@ -99,30 +99,39 @@ public class FormattedTextLayoutController
DataSourceException
{
final FormattedTextElement element = (FormattedTextElement) getNode();
- final VariablesCollection vc = getVariablesCollection();
- if (vc != null)
- {
- final String name = vc.addVariable(element);
- final AttributeMap variablesGet = new AttributeMap();
- variablesGet.setAttribute(JFreeReportInfo.REPORT_NAMESPACE,
- Element.TYPE_ATTRIBUTE, "variable-get");
- variablesGet.setAttribute(JFreeReportInfo.REPORT_NAMESPACE,
- Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TEXT_NS);
- variablesGet.setAttribute(OfficeNamespaces.TEXT_NS, "name", name);
-
- final String dataStyleName = computeValueStyle();
- if (dataStyleName != null)
- {
- variablesGet.setAttribute(OfficeNamespaces.STYLE_NS, "data-style-name", dataStyleName);
- }
-
- final String valueType = computeValueType();
- variablesGet.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, valueType);
- target.startElement(variablesGet);
-
- target.endElement(variablesGet);
- }
- else
+ // LEM 20130812 I have absolutely no clue why it wants to go via
+ // a variable like that. It complicates things, is fragile
+ // (because the variable-set is done in *every* detail section
+ // again and again. This in itself is not that bad, but when
+ // the detail section is of height zero, the "set" is never done...
+ // and this whole schema fails). For now, keep the code in case
+ // something break. If we survive the 4.2 cycle (in its entirety)
+ // without regression traced to this, then remove it (for 4.4 or
+ // something like that).
+ // final VariablesCollection vc = getVariablesCollection();
+ // if (vc != null)
+ // {
+ // final String name = vc.addVariable(element);
+ // final AttributeMap variablesGet = new AttributeMap();
+ // variablesGet.setAttribute(JFreeReportInfo.REPORT_NAMESPACE,
+ // Element.TYPE_ATTRIBUTE, "variable-get");
+ // variablesGet.setAttribute(JFreeReportInfo.REPORT_NAMESPACE,
+ // Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TEXT_NS);
+ // variablesGet.setAttribute(OfficeNamespaces.TEXT_NS, "name", name);
+
+ // final String dataStyleName = computeValueStyle();
+ // if (dataStyleName != null)
+ // {
+ // variablesGet.setAttribute(OfficeNamespaces.STYLE_NS, "data-style-name", dataStyleName);
+ // }
+
+ // final String valueType = computeValueType();
+ // variablesGet.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, valueType);
+ // target.startElement(variablesGet);
+
+ // target.endElement(variablesGet);
+ // }
+ // else
{
final DataFlags df = FormatValueUtility.computeDataFlag(element, getFlowController());
if (df != null)
More information about the Libreoffice-commits
mailing list