diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-12 17:18:33 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-21 09:12:09 +0200 |
commit | 6e5cb64670936ec86067c48b96e6b51715b6f18c (patch) | |
tree | ef7c622316248b87b8011c0867983c9a204ae956 /extensions | |
parent | ec6843f51f38903b16750752e50dc0b05023edab (diff) |
fdo#46808, Adapt sdb::FilterDialog UNO service to new style
The service already existed, it just did not have an IDL file.
Change-Id: I2267bec182ad1cc8f6a37939861a7368a17fcef2
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/bibliography/framectr.cxx | 55 | ||||
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 18 |
2 files changed, 23 insertions, 50 deletions
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index eb0998e581fc..61601bbb5c2b 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/sdbcx/Privilege.hpp> #include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#include <com/sun/star/sdb/FilterDialog.hpp> #include <com/sun/star/sdb/RowChangeAction.hpp> #include <com/sun/star/frame/CommandGroup.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> @@ -486,54 +487,18 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen { try { - uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); - - // build the arguments for the filter dialog to be created - Sequence< Any > aDialogCreationArgs( 3 ); - Any* pDialogCreationArgs = aDialogCreationArgs.getArray(); - // the query composer - *pDialogCreationArgs++ <<= beans::PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" )), - -1, - makeAny( pDatMan->getParser() ), - beans::PropertyState_DIRECT_VALUE - ); - - // the rowset - *pDialogCreationArgs++ <<= beans::PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowSet" )), - -1, - makeAny( pDatMan->getForm() ), - beans::PropertyState_DIRECT_VALUE - ); - // the parent window for the dialog - *pDialogCreationArgs++ <<= beans::PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )), - -1, - makeAny( xWindow ), - beans::PropertyState_DIRECT_VALUE - ); + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); // create the dialog object - const ::rtl::OUString sDialogServiceName(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.FilterDialog" )); - uno::Reference< uno::XInterface > xDialog = xORB->createInstanceWithArguments( - sDialogServiceName, - aDialogCreationArgs - ); - if ( !xDialog.is() ) + uno::Reference< ui::dialogs::XExecutableDialog > xDialog = sdb::FilterDialog::createWithQuery(xContext, pDatMan->getParser(), + Reference<sdbc::XRowSet>(pDatMan->getForm(), uno::UNO_QUERY_THROW), xWindow); + // execute it + if ( xDialog->execute( ) ) { - ShowServiceNotAvailableError( VCLUnoHelper::GetWindow( xWindow ), sDialogServiceName, sal_True ); - } - else - { - // execute it - uno::Reference< ui::dialogs::XExecutableDialog > xExec( xDialog, UNO_QUERY ); - DBG_ASSERT( xExec.is(), "BibFrameController_Impl::dispatch: missing an interface on the dialog!" ); - if ( xExec.is() ) - if ( xExec->execute( ) ) - { - // the dialog has been executed successfully, and the filter on the query composer - // has been changed - ::rtl::OUString sNewFilter = pDatMan->getParser()->getFilter(); - pDatMan->setFilter( sNewFilter ); - } + // the dialog has been executed successfully, and the filter on the query composer + // has been changed + ::rtl::OUString sNewFilter = pDatMan->getParser()->getFilter(); + pDatMan->setFilter( sNewFilter ); } } catch( const uno::Exception& ) diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index badf4077248b..2a26b9e249d5 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/form/XForm.hpp> #include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/sdb/FilterDialog.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> @@ -2635,16 +2636,23 @@ namespace pcr ::rtl::OUString sPropertyUIName( m_pInfoService->getPropertyTranslation( _bFilter ? PROPERTY_ID_FILTER : PROPERTY_ID_SORT ) ); - const sal_Char* pAsciiServiceName = _bFilter ? "com.sun.star.sdb.FilterDialog" : "com.sun.star.sdb.OrderDialog"; - // create the dialog Reference< XExecutableDialog > xDialog; - if ( !m_aContext.createComponent( pAsciiServiceName, xDialog ) ) + if ( _bFilter) { - ShowServiceNotAvailableError( impl_getDefaultDialogParent_nothrow(), ::rtl::OUString::createFromAscii( pAsciiServiceName ), sal_True ); - return false; + xDialog.set( sdb::FilterDialog::createDefault(m_aContext.getUNOContext()) ); + } + else + { + const sal_Char* pAsciiServiceName = "com.sun.star.sdb.OrderDialog"; + if ( !m_aContext.createComponent( pAsciiServiceName, xDialog ) ) + { + ShowServiceNotAvailableError( impl_getDefaultDialogParent_nothrow(), ::rtl::OUString::createFromAscii( pAsciiServiceName ), sal_True ); + return false; + } } + // initialize the dialog Reference< XPropertySet > xDialogProps( xDialog, UNO_QUERY_THROW ); xDialogProps->setPropertyValue( ::rtl::OUString( "QueryComposer" ), makeAny( xComposer ) ); |