Tag: cws_src680_reportdesign01
User: lla     
Date: 2007-10-09 09:26:49+0000
Modified:
   dba/reportdesign/source/core/api/ReportEngineJFree.cxx

Log:
 #i79214# changes in sorting/grouping

File Changes:

Directory: /dba/reportdesign/source/core/api/
=============================================

File [changed]: ReportEngineJFree.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/api/ReportEngineJFree.cxx?r1=1.4&r2=1.4.20.1
Delta lines:  +36 -5
--------------------
--- ReportEngineJFree.cxx       2007-08-03 12:42:59+0000        1.4
+++ ReportEngineJFree.cxx       2007-10-09 09:26:47+0000        1.4.20.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: ReportEngineJFree.cxx,v $
  *
- *  $Revision: 1.4 $
+ *  $Revision: 1.4.20.1 $
  *
- *  last change: $Author: hr $ $Date: 2007/08/03 12:42:59 $
+ *  last change: $Author: lla $ $Date: 2007/10/09 09:26:47 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -68,6 +68,11 @@
 #ifndef _COM_SUN_STAR_SDB_XCOMPLETEDEXECUTION_HPP_
 #include <com/sun/star/sdb/XCompletedExecution.hpp>
 #endif
+#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <connectivity/statementcomposer.hxx>
+
 #include <com/sun/star/task/XInteractionHandler.hpp>
 #ifndef _COM_SUN_STAR_TASK_XJOB_HPP_
 #include <com/sun/star/task/XJob.hpp>
@@ -290,10 +295,36 @@
                     ::rtl::OUString sOrder = getOrderStatement();
                                        if (sOrder.getLength() > 0)
                                        {
-                                               
xRowSetProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Order")),uno::makeAny(sOrder));
+                                               sal_Int32 nCommandType = 0;
+                                               
xRowSetProp->getPropertyValue(PROPERTY_COMMANDTYPE) >>= nCommandType;
+                                               if (nCommandType != 
sdb::CommandType::TABLE)
+                                               {       
+                                                       rtl::OUString 
sOldCommand;
+                                                       
xRowSetProp->getPropertyValue(PROPERTY_COMMAND) >>= sOldCommand;
+                                                       
dbtools::StatementComposer aComposer(m_xActiveConnection, sOldCommand, 
nCommandType, sal_True );
+
+                                                       uno::Reference< 
sdb::XSingleSelectQueryComposer > xComposer( aComposer.getComposer() );
+                                                       if ( xComposer.is() )
+                                                       {
+                                                               rtl::OUString 
sCurrentSQL = xComposer->getQuery();
+                                                               // Magic here, 
read the nice documentation out of the IDL.
+                                                               
xComposer->setQuery(sCurrentSQL);
+                                                               rtl::OUString 
sOldOrder = xComposer->getOrder();
+                                                               if 
(sOldOrder.getLength() > 0)
+                                                               {
+                                                                       sOrder 
+= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
+                                                                       sOrder 
+= sOldOrder;
+                                                                       
xComposer->setOrder(rtl::OUString());
+                                                                       
rtl::OUString sQuery = xComposer->getQuery();
+                                                                       
xRowSetProp->setPropertyValue(PROPERTY_COMMAND, uno::makeAny(sQuery));
+                                                                       
xRowSetProp->setPropertyValue(PROPERTY_COMMANDTYPE, 
uno::makeAny(sdb::CommandType::COMMAND));
+                                                               }
+                                                       }
+                                               }
+                                               
xRowSetProp->setPropertyValue(PROPERTY_ORDER,uno::makeAny(sOrder));
                                        }
                     if ( m_xReport->getFilter().getLength() )
-                        
xRowSetProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ApplyFilter")),uno::makeAny(sal_True));
+                        
xRowSetProp->setPropertyValue(PROPERTY_APPLYFILTER,uno::makeAny(sal_True));
 
                     uno::Reference<sdb::XCompletedExecution> xExecute( 
m_xRowSet, uno::UNO_QUERY );
                     if ( xExecute.is() )




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to