connectivity/source/drivers/postgresql/pq_databasemetadata.cxx | 1 extensions/source/propctrlr/formmetadata.cxx | 2 extensions/source/propctrlr/propcontroller.cxx | 6 extensions/source/propctrlr/propcontroller.hxx | 2 offapi/com/sun/star/report/XReportControlModel.idl | 2 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java | 144 +--------- reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java | 2 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java | 132 +++++++++ reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java | 4 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java | 4 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java | 2 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java | 40 ++ reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java | 10 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd | 2 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java | 2 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java | 4 reportdesign/source/core/inc/ReportControlModel.hxx | 2 reportdesign/source/filter/xml/xmlEnums.hxx | 4 reportdesign/source/filter/xml/xmlExport.cxx | 2 reportdesign/source/filter/xml/xmlReportElement.cxx | 8 reportdesign/source/filter/xml/xmlfilter.cxx | 2 reportdesign/source/ui/inc/metadata.hxx | 16 - reportdesign/source/ui/inspection/inspection.src | 2 xmloff/inc/xmloff/xmltoken.hxx | 2 xmloff/source/core/xmltoken.cxx | 2 25 files changed, 221 insertions(+), 178 deletions(-)
New commits: commit 7acc78705242464fa3fd5248cd8c73ff259ccc8b Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Tue Feb 19 12:27:51 2013 +0100 Tweak properties ordering That's so that heavily related ones stay together: PRINTREPEATEDVALUES PRINTWHENGROUPCHANGE Change-Id: I90513da4ae9ce0798dec91e5057b112735c1cdc2 diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx index 2757a27..a4812ea 100644 --- a/extensions/source/propctrlr/formmetadata.cxx +++ b/extensions/source/propctrlr/formmetadata.cxx @@ -129,9 +129,9 @@ namespace pcr DEF_INFO_3( READONLY, READONLY, READONLY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( PRINTABLE, PRINTABLE, PRINTABLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( STEP, STEP, STEP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( WHEEL_BEHAVIOR, WHEEL_BEHAVIOR, WHEEL_BEHAVIOR, FORM_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( TABSTOP, TABSTOP, TABSTOP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_2( TABINDEX, TABINDEX, TABINDEX, FORM_VISIBLE, DIALOG_VISIBLE ), - DEF_INFO_3( WHEEL_BEHAVIOR, WHEEL_BEHAVIOR, WHEEL_BEHAVIOR, FORM_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_2( BOUND_CELL, BOUND_CELL, BOUND_CELL, FORM_VISIBLE, DATA_PROPERTY ), DEF_INFO_3( CELL_EXCHANGE_TYPE,CELL_EXCHANGE_TYPE, CELL_EXCHANGE_TYPE,FORM_VISIBLE, DATA_PROPERTY, ENUM ), diff --git a/reportdesign/source/ui/inc/metadata.hxx b/reportdesign/source/ui/inc/metadata.hxx index 97ee6b2..06493f0 100644 --- a/reportdesign/source/ui/inc/metadata.hxx +++ b/reportdesign/source/ui/inc/metadata.hxx @@ -113,14 +113,14 @@ namespace rptui #define PROPERTY_ID_WIDTH 14 #define PROPERTY_ID_HEIGHT 15 #define PROPERTY_ID_FORMULA 16 - #define PROPERTY_ID_PRINTREPEATEDVALUES 17 - #define PROPERTY_ID_CONDITIONALPRINTEXPRESSION 18 - #define PROPERTY_ID_INITIALFORMULA 19 - #define PROPERTY_ID_STARTNEWCOLUMN 20 - #define PROPERTY_ID_TYPE 21 - #define PROPERTY_ID_DATAFIELD 22 - #define PROPERTY_ID_CHARFONTNAME 23 - #define PROPERTY_ID_PRINTWHENGROUPCHANGE 24 + #define PROPERTY_ID_CONDITIONALPRINTEXPRESSION 17 + #define PROPERTY_ID_PRINTREPEATEDVALUES 18 + #define PROPERTY_ID_PRINTWHENGROUPCHANGE 19 + #define PROPERTY_ID_INITIALFORMULA 20 + #define PROPERTY_ID_STARTNEWCOLUMN 21 + #define PROPERTY_ID_TYPE 22 + #define PROPERTY_ID_DATAFIELD 23 + #define PROPERTY_ID_CHARFONTNAME 24 #define PROPERTY_ID_DEEPTRAVERSING 25 #define PROPERTY_ID_PREEVALUATED 26 commit 55c53570e03f5afc43f7fda8975c712c1624a22f Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Tue Feb 19 12:27:37 2013 +0100 janitorial: typo in comment Change-Id: Ia3d8612e3774ee62b6d885cc9ab801361642c3a3 diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java index 1489098..5e8872d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -79,7 +79,7 @@ public class TableCellLayoutController extends SectionLayoutController FormatValueUtility.VALUE, "NaN"); } // #i114108#: except on form elements, the only value-type that can - // occur without an accomanying value attribute is "string" + // occur without an accompanying value attribute is "string" else if (!"string".equals(valueType)) { attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, commit 9f015df3558ddda6729fd0078cd3922feaa65aac Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Tue Feb 19 12:27:18 2013 +0100 add comment Change-Id: Id14dd289f8803378838725fbe08e327c9b1d233d diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java index 83c572a..7a7465f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java @@ -109,6 +109,18 @@ public abstract class AbstractReportElementLayoutController (AbstractReportElementLayoutController) clone(); alc.state = AbstractReportElementLayoutController.FINISHED; return alc; + // That's how this method is implemented in classes of pentaho itself; + // I'm not sure why we do something different, but I haven't been able + // to pinpoint a bug attributable to the above implementation. + // final LayoutController parent = getParent(); + // if (parent == null) + // { + // // skip to the next step .. + // throw new IllegalStateException("There is no parent to join with. " + + // "This should not happen in a sane environment!"); + // } + + // return parent.join(getFlowController()); } protected abstract LayoutController delegateContentGeneration(final ReportTarget target) commit ae1fbbfb690cb35eae7d56ae190d637d834697aa Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Tue Feb 19 12:26:29 2013 +0100 Tweak "PrintWhenGroupChange" property label. Change-Id: Iffd518a36f1418302955b0d85af8700cf8f9f75a diff --git a/reportdesign/source/ui/inspection/inspection.src b/reportdesign/source/ui/inspection/inspection.src index 9d4ca8d..dae3ae9 100644 --- a/reportdesign/source/ui/inspection/inspection.src +++ b/reportdesign/source/ui/inspection/inspection.src @@ -123,7 +123,7 @@ String RID_STR_CHARTTYPE }; String RID_STR_PRINTWHENGROUPCHANGE { - Text [ en-US ] = "Print When Group Change" ; + Text [ en-US ] = "Print repeated value on group change" ; }; String RID_STR_VISIBLE { commit 532421d208f21531d55554a356dd51105ba718bf Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Tue Feb 19 11:38:16 2013 +0100 fdo#52948 fix print-repeated-values=no with formatted values Factorise the "should this element be printed" decision into an utility function, which is used by 1) AbstractReportElementLayoutController (in charge of non-formatted values: string, image, OLE object, ...) which already obeyed PrintRepeatedValues. 2) TableCellLayoutController (in charge of formatted values: dates, numbers, ...) which blissfully ignored PrintRepeatedValues, but obeyed the display condition. Rename the inconsistently named PrintWhenGroupChange PrintWhenGroupChanges print-only-when-group-change print-when-group-change to PrintWhenGroupChange / print-when-group-change Change the meaning of "PrintWhenGroupChange" to "override PrintRepeatedValues in first occurrence in group". Since this feature never worked under the old semantics, no loss of feature. Since we change the XML attribute name, no ascending compatibility problem: it will be reset to its default value. Pursuant to the new meaning of PrintWhenGroupChange, change its default to *true*, which is the sane default. Change-Id: Idbe8e90565a354f70db222d047b3d51eeddbbb9f diff --git a/offapi/com/sun/star/report/XReportControlModel.idl b/offapi/com/sun/star/report/XReportControlModel.idl index ece9a78..45e76c0 100644 --- a/offapi/com/sun/star/report/XReportControlModel.idl +++ b/offapi/com/sun/star/report/XReportControlModel.idl @@ -66,7 +66,7 @@ interface XReportControlModel }; /** Specifies that the element gets printed when the group changes. - The default value is <FALSE/>. + The default value is <TRUE/>. */ [attribute,bound] boolean PrintWhenGroupChange { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java index dfa7f16..83c572a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java @@ -78,106 +78,19 @@ public abstract class AbstractReportElementLayoutController throw new IllegalStateException(); } - boolean isPrintableContent = true; - final ReportElement text = (ReportElement) getNode(); - // Tests we have to perform: - // 1. Print when group changes. We can know whether a group changed by - // looking at the newly introduced iteration counter. - // - // Whether we use the next one or the one after that depends on whether - // this element is a child of a group-header or group-footer. - - // 2. Print repeated values. This never applies to static text or static - // elements. - if ((text.isPrintWhenGroupChanges() && !isGroupChanged()) || (!text.isPrintRepeatedValues() && !isValueChanged())) - { - // if this is set to true, then we print the element only if this is the - // first occurrence in this group. - // or - // If this is set to true, we evaluate the formula of the element and - // try to derive whether there was a change. - isPrintableContent = false; - } - - // 3. Evaluate the Display Condition - final Expression dc = text.getDisplayCondition(); - if (dc != null) - { - final Object o = LayoutControllerUtil.evaluateExpression(getFlowController(), text, dc); - if (Boolean.FALSE.equals(o)) - { -// LOGGER.debug ("DISPLAY Condition forbids printing"); - isPrintableContent = false; - } - } - - if (!isPrintableContent) - { - // There is no printable content at all. Set the state to FINISHED - return join(getFlowController()); - } - else + if (FormatValueUtility.shouldPrint(this, (ReportElement)getNode())) { // delegate to the handler .. return delegateContentGeneration(target); } - - } - - protected abstract boolean isValueChanged(); - - protected boolean isGroupChanged() - { - // search the group. - final SectionLayoutController slc = findGroup(); - if (slc == null) + else { - // Always print the content of the report header and footer and - // the page header and footer. - return true; + // There is no printable content at all. Set the state to FINISHED + return join(getFlowController()); } - - // we are in the first iteration, so yes, the group has changed recently. - return slc.getIterationCount() == 0; } - private SectionLayoutController findGroup() - { - LayoutController parent = getParent(); - boolean skipNext = false; - while (parent != null) - { - if (!(parent instanceof SectionLayoutController)) - { - parent = parent.getParent(); - } - else - { - final SectionLayoutController slc = (SectionLayoutController) parent; - final Element element = slc.getElement(); - if (element instanceof OfficeGroupSection) - { - // 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 - { - return (SectionLayoutController) parent; - } - } - } - return null; - } + public abstract boolean isValueChanged(); /** * Joins with a delegated process flow. This is generally called from a child @@ -213,41 +126,6 @@ public abstract class AbstractReportElementLayoutController return state != AbstractReportElementLayoutController.FINISHED; } - protected boolean isReferenceChanged(final LValue lValue) - { - if (lValue instanceof ContextLookup) - { - final ContextLookup rval = (ContextLookup) lValue; - final String s = rval.getName(); - final DataRow view = getFlowController().getMasterRow().getGlobalView(); - try - { - final DataFlags flags = view.getFlags(s); - if (flags != null && flags.isChanged()) - { -// LOGGER.debug ("Reference " + s + " is changed"); - return true; - } -// LOGGER.debug ("Reference " + s + " is unchanged"); - } - catch (DataSourceException e) - { - // ignore .. assume that the reference has not changed. - } - } - final LValue[] childValues = lValue.getChildValues(); - for (int i = 0; i < childValues.length; i++) - { - final LValue value = childValues[i]; - if (isReferenceChanged(value)) - { - return true; - } - } -// LOGGER.debug ("Unchanged."); - return false; - } - public int getState() { return state; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java index 0707016..2dd554e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java @@ -49,7 +49,7 @@ public class FixedTextLayoutController { } - protected boolean isValueChanged() + public boolean isValueChanged() { final FlowController controller = getFlowController(); final GlobalMasterRow masterRow = controller.getMasterRow(); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java index ddb3b04..99ff3e5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -21,6 +21,8 @@ package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormattedTextElement; +import com.sun.star.report.pentaho.model.OfficeGroupSection; +import com.sun.star.report.pentaho.model.ReportElement; import java.math.BigDecimal; import java.sql.Time; @@ -31,12 +33,20 @@ import java.util.Date; import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataFlags; +import org.jfree.report.DataRow; import org.jfree.report.DataSourceException; import org.jfree.report.data.DefaultDataFlags; +import org.jfree.report.expressions.Expression; import org.jfree.report.expressions.FormulaExpression; import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.layoutprocessor.LayoutController; 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.pentaho.reporting.libraries.formula.lvalues.ContextLookup; +import org.pentaho.reporting.libraries.formula.lvalues.LValue; import org.pentaho.reporting.libraries.formula.util.HSSFDateUtil; /** @@ -228,4 +238,126 @@ public class FormatValueUtility return new DefaultDataFlags(null, result, true); } } + + public static boolean shouldPrint(final LayoutController ref, final ReportElement text) + throws DataSourceException + { + final boolean isValueChanged; + if (ref instanceof AbstractReportElementLayoutController) + isValueChanged=((AbstractReportElementLayoutController)ref).isValueChanged(); + else if (ref instanceof TableCellLayoutController) + isValueChanged=((TableCellLayoutController)ref).isValueChanged(); + else + throw new AssertionError("com.sun.star.report.pentaho.layoutprocessor.FormatValueUtility.shouldPrint expects an implementor of isValueChanged as first argument"); + + // Tests we have to perform: + // 1. If repeated values are supposed to be printed, then print. + // (this is always the case for static text and static elements) + // 2. If value changed, then print. + // 3. If (printing should be forced on group change AND group changed), then print + if ( !( isValueChanged + || text.isPrintRepeatedValues() + || ( text.isPrintWhenGroupChange() && isGroupChanged(ref) ))) + { + return false; + } + + final Expression dc = text.getDisplayCondition(); + if (dc != null) + { + final Object o = LayoutControllerUtil.evaluateExpression(ref.getFlowController(), text, dc); + if (Boolean.FALSE.equals(o)) + { + return false; + } + } + + return true; + } + + public static boolean isGroupChanged(LayoutController ref) + { + // search the group. + final SectionLayoutController slc = findGroup(ref); + if (slc == null) + { + // Always print the content of the report header and footer and + // the page header and footer. + return true; + } + + // we are in the first iteration, so yes, the group has changed recently. + return slc.getIterationCount() == 0; + } + + public static SectionLayoutController findGroup(LayoutController ref) + { + LayoutController parent = ref.getParent(); + boolean skipNext = false; + while (parent != null) + { + if (!(parent instanceof SectionLayoutController)) + { + parent = parent.getParent(); + } + else + { + final SectionLayoutController slc = (SectionLayoutController) parent; + final Element element = slc.getElement(); + if (element instanceof OfficeGroupSection) + { + // 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 + { + return (SectionLayoutController) parent; + } + } + } + return null; + } + + public static boolean isReferenceChanged(LayoutController ref, final LValue lValue) + { + if (lValue instanceof ContextLookup) + { + final ContextLookup rval = (ContextLookup) lValue; + final String s = rval.getName(); + final DataRow view = ref.getFlowController().getMasterRow().getGlobalView(); + try + { + final DataFlags flags = view.getFlags(s); + if (flags != null && flags.isChanged()) + { + return true; + } + } + catch (DataSourceException e) + { + // ignore .. assume that the reference has not changed. + } + } + final LValue[] childValues = lValue.getChildValues(); + for (int i = 0; i < childValues.length; i++) + { + final LValue value = childValues[i]; + if (isReferenceChanged(ref, value)) + { + return true; + } + } + return false; + } + } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java index db8c1ff..ea3d22b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java @@ -78,7 +78,7 @@ public class FormattedTextLayoutController return null; } - protected boolean isValueChanged() + public boolean isValueChanged() { try { @@ -86,7 +86,7 @@ public class FormattedTextLayoutController final FormulaExpression formulaExpression = element.getValueExpression(); final Formula formula = formulaExpression.getCompiledFormula(); final LValue lValue = formula.getRootReference(); - return isReferenceChanged(lValue); + return FormatValueUtility.isReferenceChanged(this, lValue); } catch (final ParseException e) { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java index e164bb3..a32073e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java @@ -230,7 +230,7 @@ public class ImageElementLayoutController return null; } - protected boolean isValueChanged() + public boolean isValueChanged() { final ImageElement imageElement = (ImageElement) getNode(); final FormulaExpression formulaExpression = imageElement.getFormula(); @@ -246,7 +246,7 @@ public class ImageElementLayoutController { final Formula formula = formulaExpression.getCompiledFormula(); final LValue lValue = formula.getRootReference(); - return isReferenceChanged(lValue); + return FormatValueUtility.isReferenceChanged(this, lValue); } catch (ParseException e) { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java index a762ee1..4dbac0f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java @@ -44,7 +44,7 @@ public class ObjectOleLayoutController extends AbstractReportElementLayoutContro { } - protected boolean isValueChanged() + public boolean isValueChanged() { final ObjectOleElement element = (ObjectOleElement) getNode(); final List masterfields = element.getMasterfields(); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java index bb1af2f..1489098 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -27,6 +27,7 @@ import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataFlags; import org.jfree.report.DataSourceException; import org.jfree.report.expressions.Expression; +import org.jfree.report.expressions.FormulaExpression; import org.jfree.report.flow.FlowController; import org.jfree.report.flow.ReportTarget; import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; @@ -34,6 +35,9 @@ import org.jfree.report.flow.layoutprocessor.SectionLayoutController; import org.jfree.report.structure.Element; import org.jfree.report.structure.Node; import org.jfree.report.structure.Section; +import org.pentaho.reporting.libraries.formula.Formula; +import org.pentaho.reporting.libraries.formula.lvalues.LValue; +import org.pentaho.reporting.libraries.formula.parser.ParseException; import org.pentaho.reporting.libraries.base.util.ObjectUtilities; @@ -99,18 +103,36 @@ public class TableCellLayoutController extends SectionLayoutController { return null; } - final Expression dc = element.getDisplayCondition(); - if (dc != null) + if (!FormatValueUtility.shouldPrint(this, element)) { - final Object o = LayoutControllerUtil.evaluateExpression(getFlowController(), element, dc); - if (Boolean.FALSE.equals(o)) + attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, + FormatValueUtility.VALUE_TYPE, "string"); + return null; + } + return FormatValueUtility.computeDataFlag(element, getFlowController()); + } + + public boolean isValueChanged() + { + try + { + final Section cell = (Section) getElement(); + final FormattedTextElement element = findFormattedTextElement(cell); + if (element == null) + return false; + else { - attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, - FormatValueUtility.VALUE_TYPE, "string"); - return null; + final FormulaExpression formulaExpression = element.getValueExpression(); + final Formula formula = formulaExpression.getCompiledFormula(); + final LValue lValue = formula.getRootReference(); + return FormatValueUtility.isReferenceChanged(this, lValue); } } - return FormatValueUtility.computeDataFlag(element, getFlowController()); + catch (final ParseException e) + { + //LOGGER.debug("Parse Exception", e); + return false; + } } private FormattedTextElement findFormattedTextElement(final Section section) diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java index 74e4822..37e11ff 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java @@ -49,15 +49,15 @@ public abstract class ReportElement extends Element * @return true, if the element should only be printed in the first row of the * current group, false otherwise. */ - public boolean isPrintWhenGroupChanges() + public boolean isPrintWhenGroupChange() { - return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-changes")); + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-change")); } - public void setPrintWhenGroupChanges(final boolean printWhenGroupChanges) + public void setPrintWhenGroupChange(final boolean printWhenGroupChange) { - setAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-changes", - String.valueOf(printWhenGroupChanges)); + setAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-change", + String.valueOf(printWhenGroupChange)); } /** diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd index 0acba65..4c296ac 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd @@ -330,7 +330,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="rpt-report-element-attlist"> - <xs:attribute name="print-when-group-change" default="false" form="qualified"> + <xs:attribute name="print-when-group-change" default="true" form="qualified"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java index 94b8f21..0ed48ca 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java @@ -64,7 +64,7 @@ public class FormattedTextReadHandler extends ElementReadHandler // * Print-Repeated-Values // * Print-In-First-New-Section - // * Print-When-Group-Changes + // * Print-When-Group-Change // * Print-When-Section-Overflows // That property cannot be evaluated yet, as this would require us to diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java index 7d0e735..d7adf86 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java @@ -60,8 +60,8 @@ public class ReportElementReadHandler extends ElementReadHandler throws SAXException { super.startParsing(attrs); - final String printWhenGroupChanges = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "print-when-group-changes"); - element.setPrintWhenGroupChanges(OfficeToken.TRUE.equals(printWhenGroupChanges)); + final String printWhenGroupChange = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "print-when-group-change"); + element.setPrintWhenGroupChange(OfficeToken.TRUE.equals(printWhenGroupChange)); final String printRepeatingValues = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "print-repeated-values"); element.setPrintRepeatedValues(printRepeatingValues == null || OfficeToken.TRUE.equals(printRepeatingValues)); } diff --git a/reportdesign/source/core/inc/ReportControlModel.hxx b/reportdesign/source/core/inc/ReportControlModel.hxx index c327cfc..43a8f73 100644 --- a/reportdesign/source/core/inc/ReportControlModel.hxx +++ b/reportdesign/source/core/inc/ReportControlModel.hxx @@ -100,7 +100,7 @@ namespace reportdesign ,aComponent(_xContext) ,m_pOwner(_pOwner) ,m_rMutex(_rMutex) - ,bPrintWhenGroupChange(sal_False) + ,bPrintWhenGroupChange(sal_True) {} // XContainer diff --git a/reportdesign/source/filter/xml/xmlEnums.hxx b/reportdesign/source/filter/xml/xmlEnums.hxx index 120c153..53df992 100644 --- a/reportdesign/source/filter/xml/xmlEnums.hxx +++ b/reportdesign/source/filter/xml/xmlEnums.hxx @@ -116,9 +116,9 @@ namespace rptxml }; enum XMLReportElement { - XML_TOK_PRINT_ONLY_WHEN_GROUP_CHANGE + XML_TOK_PRINT_WHEN_GROUP_CHANGE ,XML_TOK_REP_CONDITIONAL_PRINT_EXPRESSION - ,XML_TOK_PRINT_REPEATED_VALUES + ,XML_TOK_PRINT_REPEATED_VALUES ,XML_TOK_COMPONENT ,XML_TOK_FORMATCONDITION }; diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index f637902..df6a24e 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -472,7 +472,7 @@ void ORptExport::exportReportElement(const Reference<XReportControlModel>& _xRep { OSL_ENSURE(_xReportElement.is(),"_xReportElement is NULL -> GPF"); if ( _xReportElement->getPrintWhenGroupChange() ) - AddAttribute(XML_NAMESPACE_REPORT, XML_PRINT_ONLY_WHEN_GROUP_CHANGE, XML_TRUE ); + AddAttribute(XML_NAMESPACE_REPORT, XML_PRINT_WHEN_GROUP_CHANGE, XML_TRUE ); if ( !_xReportElement->getPrintRepeatedValues() ) AddAttribute(XML_NAMESPACE_REPORT, XML_PRINT_REPEATED_VALUES,XML_FALSE); diff --git a/reportdesign/source/filter/xml/xmlReportElement.cxx b/reportdesign/source/filter/xml/xmlReportElement.cxx index c857e8a..2c4d6c8 100644 --- a/reportdesign/source/filter/xml/xmlReportElement.cxx +++ b/reportdesign/source/filter/xml/xmlReportElement.cxx @@ -55,18 +55,18 @@ OXMLReportElement::OXMLReportElement( ORptFilter& rImport, { for(sal_Int16 i = 0; i < nLength; ++i) { - ::rtl::OUString sLocalName; + ::rtl::OUString sLocalName; const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i ); const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName ); const rtl::OUString sValue = _xAttrList->getValueByIndex( i ); switch( rTokenMap.Get( nPrefix, sLocalName ) ) { - case XML_TOK_PRINT_ONLY_WHEN_GROUP_CHANGE: + case XML_TOK_PRINT_WHEN_GROUP_CHANGE: m_xComponent->setPrintWhenGroupChange(s_sTRUE == sValue); break; - case XML_TOK_PRINT_REPEATED_VALUES: - m_xComponent->setPrintRepeatedValues(sValue == s_sTRUE ? sal_True : sal_False); + case XML_TOK_PRINT_REPEATED_VALUES: + m_xComponent->setPrintRepeatedValues(sValue == s_sTRUE); break; default: break; diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index 2854a66..a3d0cc7 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -820,7 +820,7 @@ const SvXMLTokenMap& ORptFilter::GetReportElementElemTokenMap() const static SvXMLTokenMapEntry aElemTokenMap[]= { { XML_NAMESPACE_REPORT, XML_PRINT_REPEATED_VALUES ,XML_TOK_PRINT_REPEATED_VALUES }, - { XML_NAMESPACE_REPORT, XML_PRINT_ONLY_WHEN_GROUP_CHANGE,XML_TOK_PRINT_ONLY_WHEN_GROUP_CHANGE }, + { XML_NAMESPACE_REPORT, XML_PRINT_WHEN_GROUP_CHANGE ,XML_TOK_PRINT_WHEN_GROUP_CHANGE }, { XML_NAMESPACE_REPORT, XML_CONDITIONAL_PRINT_EXPRESSION,XML_TOK_REP_CONDITIONAL_PRINT_EXPRESSION }, { XML_NAMESPACE_REPORT, XML_REPORT_COMPONENT ,XML_TOK_COMPONENT }, { XML_NAMESPACE_REPORT, XML_FORMAT_CONDITION ,XML_TOK_FORMATCONDITION }, diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index 13b59fe..e7e886e 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -2959,7 +2959,7 @@ namespace xmloff { namespace token { XML_GROUP_ON, XML_FORCE_NEW_PAGE, XML_GROUP_INTERVAL, - XML_PRINT_ONLY_WHEN_GROUP_CHANGE, + XML_PRINT_WHEN_GROUP_CHANGE, XML_REPORT_ELEMENT, XML_LIST_SOURCE, XML_LIST_SOURCE_TYPE, diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 0318052..afd52ba 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -2955,7 +2955,7 @@ namespace xmloff { namespace token { TOKEN( "group-on", XML_GROUP_ON), TOKEN( "force-new-page", XML_FORCE_NEW_PAGE), TOKEN( "group-interval", XML_GROUP_INTERVAL), - TOKEN( "print-only-when-group-change", XML_PRINT_ONLY_WHEN_GROUP_CHANGE), + TOKEN( "print-when-group-change", XML_PRINT_WHEN_GROUP_CHANGE), TOKEN( "report-element", XML_REPORT_ELEMENT), TOKEN( "list-source", XML_LIST_SOURCE), TOKEN( "list-source-type", XML_LIST_SOURCE_TYPE), commit 818b84eb1573b55961cba56baca857806c0e8c8b Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Fri Feb 15 10:07:30 2013 +0100 property browser: respect property ordering Consider the following situation: Property Name Property Order Index ------------- -------------------- propA4 4 propB5 5 propB4 4 And the loop goes over these properties in this order. propB4 should be before propB5, but with the old code, propB4 would be pushed after propB5: it asks for position 4, but as positions 4 and 5 are already occupied, it gets pushed to position 6. Remaining difficulty: properties from different property index ordering series will be interleaved. This should be solved at object model level; ideally property order index should be unique, at least within an object. Change-Id: Ie235a4b22155df97df139f1dc354247845626620 diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index cf69ca6..6bb6024 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -1098,9 +1098,7 @@ namespace pcr sal_Int32 nRelativePropertyOrder = sourceProps - aProperties.begin(); if ( m_xModel.is() ) nRelativePropertyOrder = m_xModel->getPropertyOrderIndex( sourceProps->Name ); - while ( m_aProperties.find( nRelativePropertyOrder ) != m_aProperties.end() ) - ++nRelativePropertyOrder; - m_aProperties[ nRelativePropertyOrder ] = *sourceProps; + m_aProperties.insert(OrderedPropertyMap::value_type(nRelativePropertyOrder, *sourceProps)); } // be notified when one of our inspectees dies diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx index db77bb0..8540709 100644 --- a/extensions/source/propctrlr/propcontroller.hxx +++ b/extensions/source/propctrlr/propcontroller.hxx @@ -101,7 +101,7 @@ namespace pcr ,public IPropertyExistenceCheck { private: - typedef ::std::map< sal_Int32, ::com::sun::star::beans::Property > OrderedPropertyMap; + typedef ::std::multimap< sal_Int32, ::com::sun::star::beans::Property > OrderedPropertyMap; typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > InterfaceArray; commit 1b2debf80af5807421a0e9dd3def02fd0213aec9 Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Fri Feb 15 10:00:29 2013 +0100 janitorial: indentation Change-Id: Id21de98433f52c8659a3432c1c47354e18166f06 diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 73dbf49..cf69ca6 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -1254,7 +1254,7 @@ namespace pcr // this category does not yet exist. This is allowed, as an inspector model might be lazy, and not provide // any category information of its own. In this case, we have a fallback ... m_aPageIds[ aDescriptor.Category ] = - getPropertyBox().AppendPage( aDescriptor.Category, rtl::OString() ); + getPropertyBox().AppendPage( aDescriptor.Category, rtl::OString() ); nTargetPageId = impl_getPageIdForCategory_nothrow( aDescriptor.Category ); } commit 9953c1b5a6977f62b10e1c85a7069fd1dc2d9ec6 Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Mon Feb 4 06:00:51 2013 +0100 pure comment: write down interesting idea gleaned at FOSDEM Change-Id: I96685f405989fdd3b090b6a482edf8ad65bfd4e9 diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx index 34d64a1..1569c0c 100644 --- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx @@ -334,6 +334,7 @@ OUString DatabaseMetaData::getSQLKeywords( ) throw (SQLException, RuntimeExcept // In Java 2 v1.4 and as per LibreOffice SDK doc, this is all keywords that are not SQL92 // I understand this to mean "reserved keywords" only. // See http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html + // LEM TODO: consider using pg_get_keywords(), filter on catcode return OUString( "ANALYSE," "ANALYZE," _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits