summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2014-05-27 12:09:37 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-05-28 10:30:48 -0500
commit23874c1f61898f9cab7e23169ca36596b2e6c982 (patch)
tree62e09732f2b4e2f271fd1ac0e32f711231b7eae3
parent55e51c5a139b0403513976914e2719318cd3feb9 (diff)
fdo#67935 "print on group change" acted as "print in first group instance"
The "parent" group changed iff this is the first iteration of *this* group *or* *detail* *section*. The "parent" group's first iteration means that we are in the first value of the parent group (in other words, the *grand*-*parent* group changed). Change-Id: Ia4a798cb37db2f17e7deef1058b25795bfc02648 Reviewed-on: https://gerrit.libreoffice.org/9498 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormatValueUtility.java25
1 files changed, 7 insertions, 18 deletions
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormatValueUtility.java
index eca94e618037..b4c518060f17 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormatValueUtility.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/FormatValueUtility.java
@@ -44,6 +44,7 @@ import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil;
import org.jfree.report.flow.layoutprocessor.SectionLayoutController;
import org.jfree.report.structure.Element;
import org.jfree.report.structure.Group;
+import org.jfree.report.structure.DetailSection;
import org.pentaho.reporting.libraries.formula.lvalues.ContextLookup;
import org.pentaho.reporting.libraries.formula.lvalues.LValue;
@@ -257,14 +258,14 @@ public class FormatValueUtility
return true;
}
- public static boolean isGroupChanged(LayoutController ref)
+ private static boolean isGroupChanged(LayoutController ref)
{
// search the group.
- final SectionLayoutController slc = findGroup(ref);
+ final SectionLayoutController slc = findGroupOrDetail(ref);
if (slc == null)
{
- // Always print the content of the report header and footer and
- // the page header and footer.
+ // {Page, Report} × {Header, Footer} have no usable iteration count
+ // err on the side of showing them rather than not showing them
return true;
}
@@ -272,10 +273,9 @@ public class FormatValueUtility
return slc.getIterationCount() == 0;
}
- public static SectionLayoutController findGroup(LayoutController ref)
+ private static SectionLayoutController findGroupOrDetail(LayoutController ref)
{
LayoutController parent = ref.getParent();
- boolean skipNext = false;
while (parent != null)
{
if (!(parent instanceof SectionLayoutController))
@@ -286,19 +286,8 @@ public class FormatValueUtility
{
final SectionLayoutController slc = (SectionLayoutController) parent;
final Element element = slc.getElement();
- if (element instanceof OfficeGroupSection)
+ if (!(element instanceof Group || element instanceof DetailSection))
{
- // This is a header or footer. So we take the next group instead.
- skipNext = true;
- parent = parent.getParent();
- }
- else if (!(element instanceof Group))
- {
- parent = parent.getParent();
- }
- else if (skipNext)
- {
- skipNext = false;
parent = parent.getParent();
}
else