Tag: cws_src680_asyncdialogs2 User: pb Date: 2007-07-11 12:18:04+0000 Modified: dba/dbaccess/source/ui/app/AppController.cxx
Log: RESYNC: (1.41-1.42); FILE MERGED 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.37.34.5&r2=1.37.34.6 Delta lines: +77 -9 -------------------- --- AppController.cxx 2007-06-26 06:27:52+0000 1.37.34.5 +++ AppController.cxx 2007-07-11 12:18:01+0000 1.37.34.6 @@ -64,6 +64,9 @@ #ifndef _COM_SUN_STAR_SDB_XBOOKMARKSSUPPLIER_HPP_ #include <com/sun/star/sdb/XBookmarksSupplier.hpp> #endif +#ifndef _COM_SUN_STAR_CONTAINER_XCONTENTENUMERATIONACCESS_HPP_ +#include <com/sun/star/container/XContentEnumerationAccess.hpp> +#endif #ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_ #include <com/sun/star/sdbcx/XAppend.hpp> #endif @@ -82,7 +85,9 @@ #ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ #include <com/sun/star/sdb/CommandType.hpp> #endif +#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_ #include <com/sun/star/sdb/SQLContext.hpp> +#endif #ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_ #include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp> #endif @@ -252,6 +257,8 @@ #include <algorithm> #include <functional> +#include "ExtensionNotPresent.hxx" + #define APP_SIZE_WIDTH 350 #define APP_SIZE_HEIGHT 250 @@ -663,6 +670,21 @@ case ID_DOCUMENT_CREATE_REPWIZ: aReturn.bEnabled = !isDataSourceReadOnly() && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SWRITER); break; + case SID_APP_NEW_REPORT: + aReturn.bEnabled = !isDataSourceReadOnly() + && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SWRITER); + if ( aReturn.bEnabled ) + { + 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_VIEW_TABLES: aReturn.bEnabled = sal_True; aReturn.bChecked = getContainer()->getElementType() == E_TABLE; @@ -1102,6 +1124,7 @@ case SID_FORM_CREATE_REPWIZ_PRE_SEL: case ID_DOCUMENT_CREATE_REPWIZ: case SID_APP_NEW_FORM: + case SID_APP_NEW_REPORT: case ID_NEW_QUERY_SQL: case ID_NEW_QUERY_DESIGN: case ID_NEW_TABLE_DESIGN: @@ -1122,6 +1145,8 @@ case ID_DOCUMENT_CREATE_REPWIZ: case SID_REPORT_CREATE_REPWIZ_PRE_SEL: bAutoPilot = sal_True; + // run through + case SID_APP_NEW_REPORT: eType = E_REPORT; break; case ID_APP_NEW_QUERY_AUTO_PILOT: @@ -1347,6 +1372,7 @@ SID_FORM_CREATE_REPWIZ_PRE_SEL, CommandGroup::APPLICATION ); + implDescribeSupportedFeature( ".uno:DBNewReport", SID_APP_NEW_REPORT, CommandGroup::INSERT ); implDescribeSupportedFeature( ".uno:DBNewReportAutoPilot", ID_DOCUMENT_CREATE_REPWIZ, CommandGroup::INSERT ); implDescribeSupportedFeature( ".uno:DBNewReportAutoPilotWithPreSelection", @@ -1680,15 +1706,45 @@ } switch ( _eType ) { - case E_REPORT: // TODO: seperate handling of forms and reports + case E_REPORT: + { + Reference< XContentEnumerationAccess > xEnumAccess(m_xServiceFactory, UNO_QUERY); + static ::rtl::OUString s_sReportDesign(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.pentaho.SOReportJobFactory")); + Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(s_sReportDesign); + if ( !xEnumDrivers.is() || !xEnumDrivers->hasMoreElements() ) + { + OExtensionNotPresentDialog aDlg(getView(), getORB()); + aDlg.Execute(); + // // is there no report designer available? + // static const ::rtl::OUString sStatus = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")); + // String sMsg = String( ModuleRes( RID_STR_ERROR_NO_REPORT_INSTALLED ) ); + // // sMsg.SearchAndReplace('#',e.Message); + // SQLExceptionInfo aInfo; + // + // SQLException aSQLException; + // aSQLException.Message = sMsg; + // // aSQLException.Context = e.Context; + // aInfo = SQLExceptionInfo(aSQLException); + // + // showError(aInfo); + + break; + } + }// run through case E_FORM: { ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType); Reference< XComponent > xDefinition; xRet.set(aHelper->open(_sName, xDefinition,_eOpenMode),UNO_QUERY); + if (_eOpenMode == OLinkedDocumentsAccess::OPEN_DESIGN || + _eType == E_FORM ) + { + // // LLA: close only if in EDIT mode addDocumentListener(xRet,xDefinition); } + } break; + case E_QUERY: case E_TABLE: { @@ -1704,7 +1760,7 @@ { pDesigner.reset( new TableDesigner( getORB(), this, m_xCurrentFrame ) ); } - else + else if ( _eType == E_QUERY ) { sal_Bool bQuerySQLMode = ( ( _nInstigatorCommand == SID_DB_APP_EDIT_SQL_VIEW ) @@ -1712,6 +1768,10 @@ ); pDesigner.reset( new QueryDesigner( getORB(), this, m_xCurrentFrame, sal_False, bQuerySQLMode ) ); } + else if ( _eType == E_REPORT ) + { + pDesigner.reset(new OReportDesigner(getORB(),this, m_xCurrentFrame )); + } aDataSource <<= m_xDataSource; } else @@ -1809,10 +1869,6 @@ switch ( _eType ) { - case E_REPORT: - OSL_ENSURE( sal_False, "OApplicationController::newElement: can't create a blank report!" ); - break; - case E_FORM: { ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType); @@ -1821,8 +1877,17 @@ 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); + addDocumentListener(xComponent,xDefinition); + } + break; case E_QUERY: case E_TABLE: + { ::std::auto_ptr< DatabaseObjectView > pDesigner; SharedConnection xConnection( ensureConnection() ); @@ -1832,10 +1897,13 @@ { pDesigner.reset( new TableDesigner( getORB(), this, m_xCurrentFrame ) ); } - else + else if ( _eType == E_QUERY ) { pDesigner.reset( new QueryDesigner( getORB(), this, m_xCurrentFrame, sal_False, _bSQLView ) ); } + else + pDesigner.reset(new OReportDesigner(getORB(),this, m_xCurrentFrame )); + Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); Reference< XComponent > xComponent( pDesigner->createNew( xDataSource ), UNO_QUERY ); addDocumentListener(xComponent,NULL); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
