User: ihi Date: 2007-11-20 19:22:53+0000 Modified: dba/dbaccess/source/ui/app/AppController.cxx
Log: INTEGRATION: CWS reportdesign01 (1.44.30); FILE MERGED 2007/10/15 08:45:12 oj 1.44.30.2: RESYNC: (1.44-1.47); FILE MERGED 2007/09/21 10:51:38 oj 1.44.30.1: #i77690# add new context menu entry to create a report with prefilled table or query File Changes: Directory: /dba/dbaccess/source/ui/app/ ======================================= File [changed]: AppController.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppController.cxx?r1=1.48&r2=1.49 Delta lines: +43 -26 --------------------- --- AppController.cxx 2007-11-01 15:03:13+0000 1.48 +++ AppController.cxx 2007-11-20 19:22:51+0000 1.49 @@ -731,6 +731,7 @@ break; case SID_FORM_CREATE_REPWIZ_PRE_SEL: case SID_REPORT_CREATE_REPWIZ_PRE_SEL: + case SID_APP_NEW_REPORT_PRE_SEL: aReturn.bEnabled = !isDataSourceReadOnly() && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SWRITER) && getContainer()->isALeafSelected(); @@ -738,6 +739,17 @@ { ElementType eType = getContainer()->getElementType(); aReturn.bEnabled = eType == E_QUERY || eType == E_TABLE; + if ( aReturn.bEnabled && SID_APP_NEW_REPORT_PRE_SEL == _nId ) + { + Reference< XContentEnumerationAccess > xEnumAccess(m_xServiceFactory, UNO_QUERY); + aReturn.bEnabled = xEnumAccess.is(); + if ( aReturn.bEnabled ) + { + static ::rtl::OUString s_sReportDesign(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.pentaho.SOReportJobFactory")); + Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(s_sReportDesign); + aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements(); + } + } } break; case SID_DB_APP_DELETE: @@ -1144,6 +1156,7 @@ case ID_APP_NEW_QUERY_AUTO_PILOT: case SID_DB_FORM_NEW_PILOT: case SID_REPORT_CREATE_REPWIZ_PRE_SEL: + case SID_APP_NEW_REPORT_PRE_SEL: case SID_FORM_CREATE_REPWIZ_PRE_SEL: case ID_DOCUMENT_CREATE_REPWIZ: case SID_APP_NEW_FORM: @@ -1170,6 +1183,7 @@ bAutoPilot = sal_True; // run through case SID_APP_NEW_REPORT: + case SID_APP_NEW_REPORT_PRE_SEL: eType = E_REPORT; break; case ID_APP_NEW_QUERY_AUTO_PILOT: @@ -1360,6 +1374,8 @@ CommandGroup::APPLICATION ); implDescribeSupportedFeature( ".uno:DBNewReport", SID_APP_NEW_REPORT, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:DBNewReportWithPreSelection", + SID_APP_NEW_REPORT_PRE_SEL,CommandGroup::APPLICATION ); implDescribeSupportedFeature( ".uno:DBNewReportAutoPilot", ID_DOCUMENT_CREATE_REPWIZ, CommandGroup::INSERT ); implDescribeSupportedFeature( ".uno:DBNewReportAutoPilotWithPreSelection", @@ -1779,24 +1795,8 @@ ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType); if ( aHelper->isConnected() ) { - sal_Int32 nCommandType = ( (getContainer()->getElementType() == E_QUERY) - ? CommandType::QUERY : ( (getContainer()->getElementType() == E_TABLE) ? CommandType::TABLE : -1 )); - Reference<XConnection> xConnection; - - ::rtl::OUString sName; - if ( nCommandType != -1 ) - { - try - { - sName = getContainer()->getQualifiedName( NULL ); - OSL_ENSURE( sName.getLength(), "OApplicationController::newElementWithPilot: no name given!" ); - } - catch(Exception) - { - OSL_ENSURE( 0, "OApplicationController::newElementWithPilot: Exception catched!" ); - } - } - + sal_Int32 nCommandType = -1; + const ::rtl::OUString sName(getCurrentlySelectedName(nCommandType)); Reference< XComponent > xComponent,xDefinition; if ( E_REPORT == _eType ) xComponent = aHelper->newReportWithPilot(xDefinition,nCommandType,sName); @@ -1833,18 +1833,13 @@ switch ( _eType ) { case E_FORM: - { - ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType); - Reference< XComponent > xComponent,xDefinition; - xComponent = aHelper->newForm(ID_FORM_NEW_TEXT,xDefinition); - addDocumentListener(xComponent,xDefinition); - } - break; case E_REPORT: { ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType); Reference< XComponent > xComponent,xDefinition; - xComponent = aHelper->newForm(ID_REPORT_NEW_TEXT,xDefinition); + sal_Int32 nCommandType = -1; + const ::rtl::OUString sName(getCurrentlySelectedName(nCommandType)); + xComponent = aHelper->newDocument(_eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT,xDefinition,nCommandType,sName); addDocumentListener(xComponent,xDefinition); } break; @@ -2477,6 +2472,28 @@ } } // ----------------------------------------------------------------------------- +::rtl::OUString OApplicationController::getCurrentlySelectedName(sal_Int32& _rnCommandType) const +{ + _rnCommandType = ( (getContainer()->getElementType() == E_QUERY) + ? CommandType::QUERY : ( (getContainer()->getElementType() == E_TABLE) ? CommandType::TABLE : -1 )); + + + ::rtl::OUString sName; + if ( _rnCommandType != -1 ) + { + try + { + sName = getContainer()->getQualifiedName( NULL ); + OSL_ENSURE( sName.getLength(), "OApplicationController::newElementWithPilot: no name given!" ); + } + catch(Exception) + { + OSL_ENSURE( 0, "OApplicationController::newElementWithPilot: Exception catched!" ); + } + } + return sName; +} +// ----------------------------------------------------------------------------- ::sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection ) throw (IllegalArgumentException, RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
