summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-12-12 17:18:33 +0200
committerNoel Grandin <noel@peralex.com>2012-12-21 09:12:09 +0200
commit6e5cb64670936ec86067c48b96e6b51715b6f18c (patch)
treeef7c622316248b87b8011c0867983c9a204ae956
parentec6843f51f38903b16750752e50dc0b05023edab (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
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.cxx19
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.hxx3
-rw-r--r--extensions/source/bibliography/framectr.cxx55
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx18
-rw-r--r--forms/source/runtime/formoperations.cxx46
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/sdb/FilterDialog.idl51
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx15
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx16
9 files changed, 128 insertions, 96 deletions
diff --git a/dbaccess/source/ui/uno/composerdialogs.cxx b/dbaccess/source/ui/uno/composerdialogs.cxx
index 5f65656baacf..d3bad7a193fe 100644
--- a/dbaccess/source/ui/uno/composerdialogs.cxx
+++ b/dbaccess/source/ui/uno/composerdialogs.cxx
@@ -149,6 +149,25 @@ namespace dbaui
return new DlgFilterCrit( _pParent, m_aContext.getUNOContext(), _rxConnection, m_xComposer, _rxColumns );
}
+ void RowsetFilterDialog::initialize( const Sequence< Any >& aArguments )
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+ {
+ if( aArguments.getLength() == 3 )
+ {
+ Reference<com::sun::star::sdb::XSingleSelectQueryComposer> xQueryComposer;
+ aArguments[0] >>= xQueryComposer;
+ Reference<com::sun::star::sdbc::XRowSet> xRowSet;
+ aArguments[1] >>= xRowSet;
+ Reference<com::sun::star::awt::XWindow> xParentWindow;
+ aArguments[2] >>= xParentWindow;
+ setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" ) ), makeAny( xQueryComposer ) );
+ setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowSet" ) ), makeAny( xRowSet ) );
+ setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ) ), makeAny( xParentWindow ) );
+ }
+ else
+ ComposerDialog::initialize(aArguments);
+ }
+
//---------------------------------------------------------------------
void RowsetFilterDialog::executedDialog( sal_Int16 _nExecutionResult )
{
diff --git a/dbaccess/source/ui/uno/composerdialogs.hxx b/dbaccess/source/ui/uno/composerdialogs.hxx
index b7e94cc71d4a..9a718c06991e 100644
--- a/dbaccess/source/ui/uno/composerdialogs.hxx
+++ b/dbaccess/source/ui/uno/composerdialogs.hxx
@@ -98,6 +98,9 @@ namespace dbaui
// OGenericUnoDialog overridables
virtual void executedDialog( sal_Int16 _nExecutionResult );
+ virtual void initialize( const ::com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments )
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+
};
//=====================================================================
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 ) );
diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx
index 6ba363ee5eb9..996368e70ae9 100644
--- a/forms/source/runtime/formoperations.cxx
+++ b/forms/source/runtime/formoperations.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/form/XConfirmDeleteListener.hpp>
#include <com/sun/star/sdb/RowChangeEvent.hpp>
#include <com/sun/star/sdb/RowChangeAction.hpp>
+#include <com/sun/star/sdb/FilterDialog.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/form/XReset.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
@@ -1606,33 +1607,36 @@ namespace frm
return;
try
{
- PropertyValue aFirst;
- aFirst.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" ) );
- aFirst.Value <<= m_xParser;
-
- PropertyValue aSecond;
- aSecond.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowSet" ) );
- aSecond.Value <<= m_xCursorProperties;
-
- Sequence<Any> aInit(2);
- aInit[0] <<= aFirst;
- aInit[1] <<= aSecond;
-
- ::rtl::OUString sDialogServiceName;
+ Reference< XExecutableDialog> xDialog;
if ( _bFilter )
- sDialogServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.FilterDialog" ) );
+ {
+ xDialog = com::sun::star::sdb::FilterDialog::createWithQuery(m_aContext.getUNOContext(), m_xParser, m_xCursor,
+ Reference<com::sun::star::awt::XWindow>());
+ }
else
- sDialogServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OrderDialog" ) );
+ {
+ PropertyValue aFirst;
+ aFirst.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" ) );
+ aFirst.Value <<= m_xParser;
- Reference< XExecutableDialog> xDialog;
- m_aContext.createComponentWithArguments( sDialogServiceName, aInit, xDialog );
+ PropertyValue aSecond;
+ aSecond.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowSet" ) );
+ aSecond.Value <<= m_xCursorProperties;
- if ( !xDialog.is() )
- {
- ShowServiceNotAvailableError( NULL, sDialogServiceName, sal_True );
- return;
+ Sequence<Any> aInit(2);
+ aInit[0] <<= aFirst;
+ aInit[1] <<= aSecond;
+
+ ::rtl::OUString sDialogServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OrderDialog" ) );
+ m_aContext.createComponentWithArguments( sDialogServiceName, aInit, xDialog );
+ if ( !xDialog.is() )
+ {
+ ShowServiceNotAvailableError( NULL, sDialogServiceName, sal_True );
+ return;
+ }
}
+
if ( RET_OK == xDialog->execute() )
{
WaitObject aWO( NULL );
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 7fe2cbba85b4..4ae182e80eb0 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -246,6 +246,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/sdb,\
DatabaseInteractionHandler \
ErrorMessageDialog \
InteractionHandler \
+ FilterDialog \
ReportDesign \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/sdb/application,\
diff --git a/offapi/com/sun/star/sdb/FilterDialog.idl b/offapi/com/sun/star/sdb/FilterDialog.idl
new file mode 100644
index 000000000000..a9c031ad6576
--- /dev/null
+++ b/offapi/com/sun/star/sdb/FilterDialog.idl
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __com_sun_star_sdb_FilterDialog_idl__
+#define __com_sun_star_sdb_FilterDialog_idl__
+
+#include <com/sun/star/awt/XWindow.idl>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.idl>
+#include <com/sun/star/sdbc/XRowSet.idl>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.idl>
+
+
+module com { module sun { module star { module sdb {
+
+/**
+ This interface could be incomplete since I derived it from its places of use.
+
+ @since LibreOffice 4.1
+*/
+service FilterDialog : com::sun::star::ui::dialogs::XExecutableDialog
+{
+ createDefault();
+
+ createWithQuery([in] com::sun::star::sdb::XSingleSelectQueryComposer QueryComposer,
+ [in] com::sun::star::sdbc::XRowSet RowSet,
+ [in] com::sun::star::awt::XWindow ParentWindow);
+};
+
+
+}; }; }; };
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index fa74b0922b0c..bd0bbca024e9 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -47,6 +47,7 @@
#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/FilterDialog.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/util/SearchOptions.hpp>
@@ -1594,22 +1595,12 @@ bool GeometryHandler::impl_dialogFilter_nothrow( ::rtl::OUString& _out_rSelected
return false;
// create the dialog
- uno::Reference< ui::dialogs::XExecutableDialog > xDialog(xFactory->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.FilterDialog")),m_xContext),uno::UNO_QUERY);
- if ( !xDialog.is() )
- {
- Window* pInspectorWindow = VCLUnoHelper::GetWindow( xInspectorWindow );
- ShowServiceNotAvailableError( pInspectorWindow, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.FilterDialog")), sal_True );
- return false;
- }
+ uno::Reference< ui::dialogs::XExecutableDialog > xDialog = sdb::FilterDialog::createWithQuery(m_xContext, xComposer, m_xRowSet, xInspectorWindow);
const String aGcc3WorkaroundTemporary( ModuleRes(RID_STR_FILTER));
const ::rtl::OUString sPropertyUIName( aGcc3WorkaroundTemporary );
// initialize the dialog
- uno::Reference< beans::XPropertySet > xDialogProps( xDialog, uno::UNO_QUERY_THROW );
- xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" ) ), uno::makeAny( xComposer ) );
- xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowSet" ) ), uno::makeAny( m_xRowSet ) );
- xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ) ), uno::makeAny( xInspectorWindow ) );
- xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), uno::makeAny( sPropertyUIName ) );
+ xDialog->setTitle( sPropertyUIName );
_rClearBeforeDialog.clear();
bSuccess = ( xDialog->execute() != 0 );
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 0617035de165..03f80d7c1295 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/XCompletedConnection.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/FilterDialog.hpp>
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
#include <com/sun/star/sdbc/XRowSet.hpp>
#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
@@ -290,8 +291,6 @@ IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl)
uno::Reference<XSingleSelectQueryComposer> xComposer(
xConnectFactory->createInstance(C2U("com.sun.star.sdb.SingleSelectQueryComposer")), UNO_QUERY_THROW);
- PropertyValue aSecond;
- aSecond.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowSet" ) );
uno::Reference<XRowSet> xRowSet(
xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY);
uno::Reference<XPropertySet> xRowProperties(xRowSet, UNO_QUERY);
@@ -302,24 +301,15 @@ IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl)
xRowProperties->setPropertyValue(C2U("CommandType"), makeAny(pUserData->nCommandType));
xRowProperties->setPropertyValue(C2U("ActiveConnection"), makeAny(pUserData->xConnection.getTyped()));
xRowSet->execute();
- aSecond.Value <<= xRowSet;
- PropertyValue aFirst;
- aFirst.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" ) );
::rtl::OUString sQuery;
xRowProperties->getPropertyValue(C2U("ActiveCommand"))>>= sQuery;
xComposer->setQuery(sQuery);
if(!pUserData->sFilter.isEmpty())
xComposer->setFilter(pUserData->sFilter);
- aFirst.Value <<= xComposer;
- uno::Sequence<Any> aInit(2);
- aInit[0] <<= aFirst;
- aInit[1] <<= aSecond;
-
- ::rtl::OUString sDialogServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.FilterDialog" ) );
- uno::Reference< XExecutableDialog> xDialog(
- xMgr->createInstanceWithArguments( sDialogServiceName, aInit ), UNO_QUERY);
+ uno::Reference< XExecutableDialog> xDialog = sdb::FilterDialog::createWithQuery( comphelper::getComponentContext(xMgr),
+ xComposer,xRowSet, uno::Reference<awt::XWindow>() );
if ( RET_OK == xDialog->execute() )
{