Tag: cws_src680_rptchart01 User: oj Date: 2008-02-20 11:19:40+0000 Modified: dba/reportdesign/source/ui/inc/propbrw.hxx dba/reportdesign/source/ui/report/ReportController.cxx dba/reportdesign/source/ui/report/propbrw.cxx dba/reportdesign/source/ui/report/report.src
Log: #i85225# execute report is now always enabled, but with error message File Changes: Directory: /dba/reportdesign/source/ui/inc/ =========================================== File [changed]: propbrw.hxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/inc/propbrw.hxx?r1=1.4&r2=1.4.16.1 Delta lines: +4 -4 ------------------- --- propbrw.hxx 2008-01-29 13:49:29+0000 1.4 +++ propbrw.hxx 2008-02-20 11:19:37+0000 1.4.16.1 @@ -6,9 +6,9 @@ * * $RCSfile: propbrw.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.4.16.1 $ * - * last change: $Author: rt $ $Date: 2008/01/29 13:49:29 $ + * last change: $Author: oj $ $Date: 2008/02/20 11:19:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -139,7 +139,7 @@ void Update( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xReportComponent); inline OSectionView* GetCurView() const { return m_pView; } ::rtl::OUString getCurrentPage() const; - inline void setCurrentPage(const ::rtl::OUString& _sLastActivePage) { m_sLastActivePage = _sLastActivePage; } + void setCurrentPage(const ::rtl::OUString& _sLastActivePage); ::Size getMinimumSize() const; private: Directory: /dba/reportdesign/source/ui/report/ ============================================== File [changed]: ReportController.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/report/ReportController.cxx?r1=1.6.16.5&r2=1.6.16.6 Delta lines: +84 -59 --------------------- --- ReportController.cxx 2008-02-20 07:37:25+0000 1.6.16.5 +++ ReportController.cxx 2008-02-20 11:19:37+0000 1.6.16.6 @@ -4,9 +4,9 @@ * * $RCSfile: ReportController.cxx,v $ * - * $Revision: 1.6.16.5 $ + * $Revision: 1.6.16.6 $ * - * last change: $Author: oj $ $Date: 2008/02/20 07:37:25 $ + * last change: $Author: oj $ $Date: 2008/02/20 11:19:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -612,18 +612,7 @@ aReturn.bEnabled = sal_True; break; case SID_EXECUTE_REPORT: - aReturn.bEnabled = isConnected() && isEditable() && m_xReportDefinition.is() - && m_xReportDefinition->getCommand().getLength(); - if ( aReturn.bEnabled ) - { - aReturn.bEnabled = sal_False; - const sal_uInt16 nCount = m_aReportModel->GetPageCount(); - for (sal_uInt16 i = 0; i < nCount && !aReturn.bEnabled ; ++i) - { - const SdrPage* pPage = m_aReportModel->GetPage(i); - aReturn.bEnabled = pPage->GetObjCount() != 0; - } - } + aReturn.bEnabled = isConnected() && m_xReportDefinition.is(); break; case SID_DELETE: aReturn.bEnabled = isEditable() && m_pMyOwnView->HasSelection() && !m_pMyOwnView->isHandleEvent(_nId); @@ -2928,10 +2917,47 @@ // ----------------------------------------------------------------------------- uno::Reference<frame::XModel> OReportController::executeReport() { + OSL_ENSURE(m_xReportDefinition.is(),"Where is my report?"); + uno::Reference<frame::XModel> xModel; if ( m_xReportDefinition.is() ) { + sal_uInt16 nErrorId = RID_ERR_NO_COMMAND; + bool bEnabled = m_xReportDefinition->getCommand().getLength() != 0; + if ( bEnabled ) + { + bEnabled = false; + const sal_uInt16 nCount = m_aReportModel->GetPageCount(); + sal_uInt16 i = 0; + for (; i < nCount && !bEnabled ; ++i) + { + const SdrPage* pPage = m_aReportModel->GetPage(i); + bEnabled = pPage->GetObjCount() != 0; + } + if ( !bEnabled ) + nErrorId = RID_ERR_NO_OBJECTS; + } + dbtools::SQLExceptionInfo aInfo; + if ( !bEnabled ) + { + sdb::SQLContext aFirstMessage; + String sInfo = String( ModuleRes( nErrorId ) ); + aFirstMessage.Message = sInfo; + aInfo = aFirstMessage; + if ( isEditable() && nErrorId == RID_ERR_NO_COMMAND ) + { + if ( !m_bShowProperties ) + executeUnChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue>()); + + m_sLastActivePage = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Data")); + m_pMyOwnView->setCurrentPage(m_sLastActivePage); + uno::Sequence< beans::PropertyValue> aArgs; + executeUnChecked(SID_SELECT_REPORT,aArgs); + } + } + else + { try { WaitObject aWait(getView()); // cursor @@ -2939,11 +2965,6 @@ m_xReportEngine.set(getORB()->createInstance(SERVICE_REPORTENGINE),uno::UNO_QUERY_THROW); m_xReportEngine->setReportDefinition(m_xReportDefinition); m_xReportEngine->setActiveConnection(getConnection()); - // if ( !m_xFrameLoader.is() ) - // m_xFrameLoader.set(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))),uno::UNO_QUERY_THROW); - // const sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; - // const ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); - // Reference<XFrame> xFrame = Reference<XFrame>(m_xFrameLoader,uno::UNO_QUERY_THROW)->findFrame(sTarget,nFrameSearchFlag); Reference<XFrame> xFrame = getXFrame(); xModel = m_xReportEngine->createDocumentAlive(xFrame); } @@ -2981,11 +3002,15 @@ aInfo = aFirstMessage; } - if (aInfo.isValid()) { const String suSQLContext = String( ModuleRes( RID_STR_COULD_NOT_CREATE_REPORT ) ); aInfo.prepend(suSQLContext); + } + } + + if (aInfo.isValid()) + { showError(aInfo); } } File [changed]: propbrw.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/report/propbrw.cxx?r1=1.4&r2=1.4.16.1 Delta lines: +20 -27 --------------------- --- propbrw.cxx 2008-01-29 13:52:46+0000 1.4 +++ propbrw.cxx 2008-02-20 11:19:37+0000 1.4.16.1 @@ -4,9 +4,9 @@ * * $RCSfile: propbrw.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.4.16.1 $ * - * last change: $Author: rt $ $Date: 2008/01/29 13:52:46 $ + * last change: $Author: oj $ $Date: 2008/02/20 11:19:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -317,7 +317,11 @@ DBG_DTOR( rpt_PropBrw,NULL); } - +// ----------------------------------------------------------------------------- +void PropBrw::setCurrentPage(const ::rtl::OUString& _sLastActivePage) +{ + m_sLastActivePage = _sLastActivePage; +} //---------------------------------------------------------------------------- void PropBrw::implDetachController() @@ -424,6 +428,18 @@ m_xBrowserController->inspect(uno::Sequence< Reference<uno::XInterface> >()); m_xBrowserController->inspect(_aObjects); + if ( m_sLastActivePage.getLength() ) + { + try + { + m_xBrowserController->restoreViewData( makeAny( m_sLastActivePage ) ); + } + catch( const Exception& ) + { + OSL_ENSURE( sal_False, "FmPropBrw::StateChanged: caught an exception while setting the initial page!" ); + } + } + //Resize(); } SetText( GetHeadlineName(_aObjects) ); @@ -618,29 +634,6 @@ } } - // if ( nMarkCount == 1 ) - // { - // m_xLastSection.clear(); - // SdrObject* pDlgEdObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - // OObjectBase* pObj = dynamic_cast<OObjectBase*>(pDlgEdObj); - // if ( pObj ) - // { - // if ( pDlgEdObj && pDlgEdObj->IsGroupObject() ) - // { - // implSetNewObject( CreateCompPropSet( rMarkList ) ); - // } - // else // single selection - // { - // uno::Reference< uno::XInterface > xTemp = CreateComponentPair(pObj); - // implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) ); - // } - // } - // else - // { - // implSetNewObject( ); - // } - //} - // else if ( aMarkedObjects.getLength() ) // multiple selection { m_xLastSection.clear(); File [changed]: report.src Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/report/report.src?r1=1.3&r2=1.3.36.1 Delta lines: +11 -3 -------------------- --- report.src 2007-08-30 12:14:03+0000 1.3 +++ report.src 2008-02-20 11:19:37+0000 1.3.36.1 @@ -4,9 +4,9 @@ * * $RCSfile: report.src,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.36.1 $ * - * last change: $Author: vg $ $Date: 2007/08/30 12:14:03 $ + * last change: $Author: oj $ $Date: 2008/02/20 11:19:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -626,3 +626,11 @@ { Text [ en-US ] = "Delete Report Header/Footer"; }; +String RID_ERR_NO_COMMAND +{ + Text [ en-US ] = "The report can not be executed whilst it is not bound to a table or a query or a command."; +}; +String RID_ERR_NO_OBJECTS +{ + Text [ en-US ] = "The report can not be executed whilst at least one object will be inserted."; +}; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
