Legacy reports (not Sun/Oracle Report Builder ones) created by the
wizard in LibreOffice 3.5 or later fail to open (in LibreOffice 3.5
and later): show empty data.

To correct i#98163, LibO 3.5 leaves the Command hidden control value
empty, this is the signal that on opening, it should fetch the current
definition of the query (in QueryName hidden control); that change is
inherited from a OO.org 3.4 CWS...

The problem was within the prependSortCriteria() method call. It tries
to use (deeper withing subobjects) metadata about columns that gets
initialised only at ->execute time, and thus all this code raised an
exception (null pointer). So I moved it to after the execute(), but
then we have to ->execute again so that it gets taken into
account... Hmmm... There is probably a better solution, but this one
works for now.


Please apply to libreoffice-3-5 branch.

-- 
Lionel
>From 183ac99a1ceebd08f750963dce6170656a201626 Mon Sep 17 00:00:00 2001
From: Lionel Elie Mamane <lio...@mamane.lu>
Date: Tue, 5 Jun 2012 21:30:40 +0200
Subject: [PATCH] fdo#47473 try to set new order only after field columns are
 available

Change-Id: If8ba8f4e12aaebadec86a7f445a6d32bd363106d
---
 .../wizards/report/ReportTextImplementation.java   |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
index c45d282..94b4e40 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
@@ -279,7 +279,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
                         {
                             getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue(PropertyNames.COMMAND);
                             getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(getRecordParser().Command);
-                            getRecordParser().getSQLQueryComposer().prependSortingCriteria();
                             getRecordParser().Command = getRecordParser().getSQLQueryComposer().getQuery();
                         }
                         else
@@ -293,6 +292,12 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
                     if (bexecute)
                     {
                         bexecute = getRecordParser().getFields(sFieldNameList, true);
+                        if (bexecute && getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()))
+                        {
+                            getRecordParser().getSQLQueryComposer().prependSortingCriteria();
+                            getRecordParser().Command = getRecordParser().getSQLQueryComposer().getQuery();
+                            bexecute = getRecordParser().executeCommand(nCommandType);
+                        }
                     }
                     return bexecute;
                 }
-- 
1.7.9

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to