Tag: cws_src680_reportdesign01 User: oj Date: 2007-09-21 10:51:42+0000 Modified: dba/dbaccess/inc/dbaccess_slotid.hrc dba/dbaccess/source/ui/app/AppController.cxx dba/dbaccess/source/ui/app/AppController.hxx dba/dbaccess/source/ui/app/app.src dba/dbaccess/source/ui/inc/linkeddocuments.hxx dba/dbaccess/source/ui/misc/linkeddocuments.cxx dba/dbaccess/util/hidother.src
Log: #i77690# add new context menu entry to create a report with prefilled table or query File Changes: Directory: /dba/dbaccess/inc/ ============================= File [changed]: dbaccess_slotid.hrc Url: http://dba.openoffice.org/source/browse/dba/dbaccess/inc/dbaccess_slotid.hrc?r1=1.9&r2=1.9.50.1 Delta lines: +4 -4 ------------------- --- dbaccess_slotid.hrc 2007-07-06 07:49:37+0000 1.9 +++ dbaccess_slotid.hrc 2007-09-21 10:51:38+0000 1.9.50.1 @@ -4,9 +4,9 @@ * * $RCSfile: dbaccess_slotid.hrc,v $ * - * $Revision: 1.9 $ + * $Revision: 1.9.50.1 $ * - * last change: $Author: rt $ $Date: 2007/07/06 07:49:37 $ + * last change: $Author: oj $ $Date: 2007/09/21 10:51:38 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -59,7 +59,7 @@ #define SID_DB_APP_CLOSECONNECTION ( SID_DBACCESS_START + 16 ) #define SID_DB_APP_DSPROPS ( SID_DBACCESS_START + 17 ) #define SID_DB_APP_DBADMIN ( SID_DBACCESS_START + 18 ) -// free +#define SID_APP_NEW_REPORT_PRE_SEL ( SID_DBACCESS_START + 19 ) #define SID_DB_APP_CONVERTTOVIEW ( SID_DBACCESS_START + 20 ) #define SID_DB_APP_REFRESH_TABLES ( SID_DBACCESS_START + 21 ) #define SID_DB_APP_VIEW_REPORTS ( SID_DBACCESS_START + 22 ) 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.44&r2=1.44.30.1 Delta lines: +46 -29 --------------------- --- AppController.cxx 2007-08-03 12:47:47+0000 1.44 +++ AppController.cxx 2007-09-21 10:51:38+0000 1.44.30.1 @@ -4,9 +4,9 @@ * * $RCSfile: AppController.cxx,v $ * - * $Revision: 1.44 $ + * $Revision: 1.44.30.1 $ * - * last change: $Author: hr $ $Date: 2007/08/03 12:47:47 $ + * last change: $Author: oj $ $Date: 2007/09/21 10:51:38 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -729,6 +729,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(); @@ -736,6 +737,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: @@ -1132,6 +1144,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: @@ -1158,6 +1171,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: @@ -1348,6 +1362,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", @@ -1767,24 +1783,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); @@ -1821,18 +1821,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; @@ -2456,6 +2451,28 @@ OSL_ENSURE(0,"Could not listener on the container!"); } } +// ----------------------------------------------------------------------------- +::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; +} //........................................................................ } // namespace dbaui //........................................................................ File [changed]: AppController.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppController.hxx?r1=1.19&r2=1.19.48.1 Delta lines: +10 -4 -------------------- --- AppController.hxx 2007-07-06 07:58:06+0000 1.19 +++ AppController.hxx 2007-09-21 10:51:39+0000 1.19.48.1 @@ -4,9 +4,9 @@ * * $RCSfile: AppController.hxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.19.48.1 $ * - * last change: $Author: rt $ $Date: 2007/07/06 07:58:06 $ + * last change: $Author: oj $ $Date: 2007/09/21 10:51:39 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -443,7 +443,13 @@ Defines the mode of opening. @see OLinkedDocumentsAccess::EOpenMode */ void doAction(sal_uInt16 _nId ,OLinkedDocumentsAccess::EOpenMode _eOpenMode); - protected: + + /** returns the currently selected table or query name. + * + * \return the name of the currently table or query. If the tables or query container is selected otherwise an empty string will be returned. + */ + ::rtl::OUString getCurrentlySelectedName(sal_Int32& _rnCommandType) const; + // ---------------------------------------------------------------- // initalizing members /** forces usage of a connection which we do not own File [changed]: app.src Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/app.src?r1=1.14&r2=1.14.50.1 Delta lines: +10 -5 -------------------- --- app.src 2007-07-06 08:01:34+0000 1.14 +++ app.src 2007-09-21 10:51:39+0000 1.14.50.1 @@ -4,9 +4,9 @@ * * $RCSfile: app.src,v $ * - * $Revision: 1.14 $ + * $Revision: 1.14.50.1 $ * - * last change: $Author: rt $ $Date: 2007/07/06 08:01:34 $ + * last change: $Author: oj $ $Date: 2007/09/21 10:51:39 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -71,7 +71,6 @@ String RID_STR_NEW_REPORT { - Text [ de ] ="Bericht in Entwurfsansicht erstellen..." ; Text [ en-US ] = "Create Report in Design View..." ; }; @@ -129,7 +128,6 @@ Identifier = SID_APP_NEW_REPORT; HelpId = SID_APP_NEW_REPORT; Command = ".uno:DBNewReport"; - Text [ de ] ="Bericht..." ; Text [ en-US ] = "Report..." ; }; MenuItem @@ -245,6 +243,13 @@ }; MenuItem { + Identifier = SID_APP_NEW_REPORT_PRE_SEL; + HelpId = SID_APP_NEW_REPORT_PRE_SEL; + Command = ".uno:DBNewReportWithPreSelection"; + Text [ en-US ] = "Report..." ; + }; + MenuItem + { Identifier = SID_REPORT_CREATE_REPWIZ_PRE_SEL ; HelpID = HID_DOCUMENT_CREATE_REPWIZ ; Text[ en-US ] = "Report Wizard..."; Directory: /dba/dbaccess/source/ui/inc/ ======================================= File [changed]: linkeddocuments.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/inc/linkeddocuments.hxx?r1=1.14&r2=1.14.68.1 Delta lines: +8 -6 ------------------- --- linkeddocuments.hxx 2007-05-10 10:33:02+0000 1.14 +++ linkeddocuments.hxx 2007-09-21 10:51:39+0000 1.14.68.1 @@ -4,9 +4,9 @@ * * $RCSfile: linkeddocuments.hxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.14.68.1 $ * - * last change: $Author: kz $ $Date: 2007/05/10 10:33:02 $ + * last change: $Author: oj $ $Date: 2007/09/21 10:51:39 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -104,14 +104,16 @@ OPEN_FORMAIL }; - sal_Bool isConnected() const { return m_xConnection.is(); } + inline sal_Bool isConnected() const { return m_xConnection.is(); } ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> open(const ::rtl::OUString& _rLinkName ,::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition , EOpenMode _eOpenMode = OPEN_NORMAL); - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> newForm(sal_Int32 _nNewFormId - ,::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> newDocument(sal_Int32 _nNewFormId + ,::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition + ,const sal_Int32 _nCommandType + ,const ::rtl::OUString& _sObjectName); ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> newWithPilot( const char* _pWizardService Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: linkeddocuments.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/linkeddocuments.cxx?r1=1.23&r2=1.23.10.1 Delta lines: +10 -4 -------------------- --- linkeddocuments.cxx 2007-08-03 10:23:25+0000 1.23 +++ linkeddocuments.cxx 2007-09-21 10:51:39+0000 1.23.10.1 @@ -4,9 +4,9 @@ * * $RCSfile: linkeddocuments.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.23.10.1 $ * - * last change: $Author: hr $ $Date: 2007/08/03 10:23:25 $ + * last change: $Author: oj $ $Date: 2007/09/21 10:51:39 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -339,7 +339,7 @@ newWithPilot("com.sun.star.wizards.query.CallQueryWizard",xDefinition,_nCommandType,_rObjectName); } //------------------------------------------------------------------ - Reference< XComponent > OLinkedDocumentsAccess::newForm(sal_Int32 _nNewFormId,Reference< XComponent >& _xDefinition) + Reference< XComponent > OLinkedDocumentsAccess::newDocument(sal_Int32 _nNewFormId,Reference< XComponent >& _xDefinition,const sal_Int32 _nCommandType,const ::rtl::OUString& _sObjectName) { OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid document container!"); // determine the URL to use for the new document @@ -399,6 +399,12 @@ aCommand.Argument <<= aOpenCommand; WaitObject aWaitCursor( m_pDialogParent ); xNewDocument.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()),UNO_QUERY); + Reference<XPropertySet> xProp(xNewDocument,UNO_QUERY); + if ( xProp.is() && _sObjectName.getLength() ) + { + xProp->setPropertyValue(PROPERTY_COMMANDTYPE,makeAny(_nCommandType)); + xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(_sObjectName)); + } } } } Directory: /dba/dbaccess/util/ ============================== File [changed]: hidother.src Url: http://dba.openoffice.org/source/browse/dba/dbaccess/util/hidother.src?r1=1.64&r2=1.64.82.1 Delta lines: +5 -3 ------------------- --- hidother.src 2007-02-07 12:08:50+0000 1.64 +++ hidother.src 2007-09-21 10:51:39+0000 1.64.82.1 @@ -4,9 +4,9 @@ * * $RCSfile: hidother.src,v $ * - * $Revision: 1.64 $ + * $Revision: 1.64.82.1 $ * - * last change: $Author: vg $ $Date: 2007/02/07 12:08:50 $ + * last change: $Author: oj $ $Date: 2007/09/21 10:51:39 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -414,6 +414,8 @@ hidspecial SID_QUERY_DISTINCT_VALUES { HelpId = SID_QUERY_DISTINCT_VALUES; }; hidspecial SID_FORM_CREATE_REPWIZ_PRE_SEL { HelpId = SID_FORM_CREATE_REPWIZ_PRE_SEL; }; hidspecial SID_REPORT_CREATE_REPWIZ_PRE_SEL { HelpId = SID_REPORT_CREATE_REPWIZ_PRE_SEL; }; +hidspecial SID_APP_NEW_REPORT_PRE_SEL { HelpId = SID_APP_NEW_REPORT_PRE_SEL; }; + hidspecial SID_APP_NEW_FOLDER { HelpId = SID_APP_NEW_FOLDER; }; hidspecial SID_APP_NEW_FORM { HelpId = SID_APP_NEW_FORM; }; hidspecial SID_DB_APP_PASTE_SPECIAL { HelpId = SID_DB_APP_PASTE_SPECIAL; }; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
