summaryrefslogtreecommitdiffstats
path: root/dbaccess/source/ui/uno
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/uno')
-rw-r--r--dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx142
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.cxx137
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.hxx56
-rw-r--r--dbaccess/source/ui/uno/ColumnModel.cxx149
-rw-r--r--dbaccess/source/ui/uno/ColumnModel.hxx103
-rw-r--r--dbaccess/source/ui/uno/ColumnPeer.cxx147
-rw-r--r--dbaccess/source/ui/uno/ColumnPeer.hxx49
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlg.cxx101
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlg.hxx67
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx122
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx70
-rw-r--r--dbaccess/source/ui/uno/TableFilterDlg.cxx101
-rw-r--r--dbaccess/source/ui/uno/TableFilterDlg.hxx68
-rw-r--r--dbaccess/source/ui/uno/UserSettingsDlg.cxx101
-rw-r--r--dbaccess/source/ui/uno/UserSettingsDlg.hxx68
-rw-r--r--dbaccess/source/ui/uno/admindlg.cxx107
-rw-r--r--dbaccess/source/ui/uno/admindlg.hxx67
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.cxx235
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.hxx137
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx1553
-rw-r--r--dbaccess/source/ui/uno/dbinteraction.cxx367
-rw-r--r--dbaccess/source/ui/uno/dbinteraction.hxx184
-rw-r--r--dbaccess/source/ui/uno/textconnectionsettings_uno.cxx271
-rw-r--r--dbaccess/source/ui/uno/unoDirectSql.cxx126
-rw-r--r--dbaccess/source/ui/uno/unoDirectSql.hxx70
-rw-r--r--dbaccess/source/ui/uno/unoadmin.cxx77
-rw-r--r--dbaccess/source/ui/uno/unosqlmessage.cxx160
27 files changed, 4835 insertions, 0 deletions
diff --git a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
new file mode 100644
index 000000000..3debcbe3b
--- /dev/null
+++ b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
@@ -0,0 +1,142 @@
+/* -*- 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 .
+ */
+
+#include <sal/config.h>
+
+#include <uiservices.hxx>
+#include <unoadmin.hxx>
+#include <dbu_reghelper.hxx>
+#include <advancedsettingsdlg.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <vcl/svapp.hxx>
+
+namespace dbaui
+{
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+ namespace {
+
+ // OAdvancedSettingsDialog
+ class OAdvancedSettingsDialog
+ :public ODatabaseAdministrationDialog
+ ,public ::comphelper::OPropertyArrayUsageHelper< OAdvancedSettingsDialog >
+ {
+
+ protected:
+ explicit OAdvancedSettingsDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+
+ public:
+ // XTypeProvider
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XServiceInfo - static methods
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static();
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+ protected:
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+ };
+
+ }
+
+ OAdvancedSettingsDialog::OAdvancedSettingsDialog(const Reference< XComponentContext >& _rxORB)
+ :ODatabaseAdministrationDialog(_rxORB)
+ {
+ }
+ Sequence<sal_Int8> SAL_CALL OAdvancedSettingsDialog::getImplementationId( )
+ {
+ return css::uno::Sequence<sal_Int8>();
+ }
+
+ Reference< XInterface > OAdvancedSettingsDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
+ {
+ return *(new OAdvancedSettingsDialog( comphelper::getComponentContext(_rxFactory) ));
+ }
+
+ OUString SAL_CALL OAdvancedSettingsDialog::getImplementationName()
+ {
+ return getImplementationName_Static();
+ }
+
+ OUString OAdvancedSettingsDialog::getImplementationName_Static()
+ {
+ return "org.openoffice.comp.dbu.OAdvancedSettingsDialog";
+ }
+
+ css::uno::Sequence<OUString> SAL_CALL OAdvancedSettingsDialog::getSupportedServiceNames()
+ {
+ return getSupportedServiceNames_Static();
+ }
+
+ css::uno::Sequence<OUString> OAdvancedSettingsDialog::getSupportedServiceNames_Static()
+ {
+ return { "com.sun.star.sdb.AdvancedDatabaseSettingsDialog" };
+ }
+
+ Reference<XPropertySetInfo> SAL_CALL OAdvancedSettingsDialog::getPropertySetInfo()
+ {
+ Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ ::cppu::IPropertyArrayHelper& OAdvancedSettingsDialog::getInfoHelper()
+ {
+ return *getArrayHelper();
+ }
+
+ ::cppu::IPropertyArrayHelper* OAdvancedSettingsDialog::createArrayHelper( ) const
+ {
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+ }
+
+ std::unique_ptr<weld::DialogController> OAdvancedSettingsDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+ {
+ return std::make_unique<AdvancedSettingsDialog>(Application::GetFrameWeld(rParent), m_pDatasourceItems.get(),
+ m_aContext, m_aInitialSelection);
+ }
+
+} // namespace dbaui
+
+extern "C" void createRegistryInfo_OAdvancedSettingsDialog()
+{
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OAdvancedSettingsDialog > aAutoRegistration;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx b/dbaccess/source/ui/uno/ColumnControl.cxx
new file mode 100644
index 000000000..03c2c80bf
--- /dev/null
+++ b/dbaccess/source/ui/uno/ColumnControl.cxx
@@ -0,0 +1,137 @@
+/* -*- 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 .
+ */
+
+#include "ColumnControl.hxx"
+#include "ColumnPeer.hxx"
+#include <uiservices.hxx>
+#include <apitools.hxx>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <dbu_reghelper.hxx>
+#include <comphelper/processfactory.hxx>
+
+extern "C" void createRegistryInfo_OColumnControl()
+{
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OColumnControl> aAutoRegistration;
+}
+
+namespace dbaui
+{
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdbc;
+
+OColumnControl::OColumnControl(const Reference<XComponentContext>& rxContext)
+ :UnoControl(), m_xContext(rxContext)
+{
+}
+
+IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(OColumnControl, SERVICE_CONTROLDEFAULT)
+IMPLEMENT_SERVICE_INFO_SUPPORTS(OColumnControl)
+IMPLEMENT_SERVICE_INFO_GETSUPPORTED2_STATIC(OColumnControl, "com.sun.star.awt.UnoControl","com.sun.star.sdb.ColumnDescriptorControl")
+
+Reference< XInterface > OColumnControl::Create(const Reference< XMultiServiceFactory >& _rxORB)
+{
+ return static_cast< XServiceInfo* >(new OColumnControl(comphelper::getComponentContext(_rxORB)));
+}
+
+OUString OColumnControl::GetComponentServiceName()
+{
+ return "com.sun.star.sdb.ColumnDescriptorControl";
+}
+
+void SAL_CALL OColumnControl::createPeer(const Reference< XToolkit >& /*rToolkit*/, const Reference< XWindowPeer >& rParentPeer)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ if ( getPeer().is() )
+ return;
+
+ mbCreatingPeer = true;
+
+ vcl::Window* pParentWin = nullptr;
+ if (rParentPeer.is())
+ {
+ VCLXWindow* pParent = comphelper::getUnoTunnelImplementation<VCLXWindow>(rParentPeer);
+ if (pParent)
+ pParentWin = pParent->GetWindow().get();
+ }
+
+ OColumnPeer* pPeer = new OColumnPeer( pParentWin, m_xContext );
+ OSL_ENSURE(pPeer != nullptr, "FmXGridControl::createPeer : imp_CreatePeer didn't return a peer !");
+ setPeer( pPeer );
+
+ UnoControlComponentInfos aComponentInfos(maComponentInfos);
+ Reference< XGraphics > xGraphics( mxGraphics );
+ Reference< XView > xV(getPeer(), UNO_QUERY);
+ Reference< XWindow > xW(getPeer(), UNO_QUERY);
+
+ aGuard.clear();
+
+ updateFromModel();
+
+ xV->setZoom( aComponentInfos.nZoomX, aComponentInfos.nZoomY );
+ setPosSize( aComponentInfos.nX, aComponentInfos.nY, aComponentInfos.nWidth, aComponentInfos.nHeight, css::awt::PosSize::POSSIZE );
+
+ Reference<XPropertySet> xProp(getModel(), UNO_QUERY);
+ if ( xProp.is() )
+ {
+ Reference<XConnection> xCon(xProp->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY);
+ pPeer->setConnection(xCon);
+ Reference<XPropertySet> xColumn(xProp->getPropertyValue(PROPERTY_COLUMN),UNO_QUERY);
+ pPeer->setColumn(xColumn);
+ sal_Int32 nWidth = 50;
+ xProp->getPropertyValue(PROPERTY_EDIT_WIDTH) >>= nWidth;
+ pPeer->setEditWidth(nWidth);
+ }
+
+ if (aComponentInfos.bVisible)
+ xW->setVisible(true);
+
+ if (!aComponentInfos.bEnable)
+ xW->setEnable(false);
+
+ if (maWindowListeners.getLength())
+ xW->addWindowListener( &maWindowListeners );
+
+ if (maFocusListeners.getLength())
+ xW->addFocusListener( &maFocusListeners );
+
+ if (maKeyListeners.getLength())
+ xW->addKeyListener( &maKeyListeners );
+
+ if (maMouseListeners.getLength())
+ xW->addMouseListener( &maMouseListeners );
+
+ if (maMouseMotionListeners.getLength())
+ xW->addMouseMotionListener( &maMouseMotionListeners );
+
+ if (maPaintListeners.getLength())
+ xW->addPaintListener( &maPaintListeners );
+
+ Reference< css::awt::XView > xPeerView(getPeer(), UNO_QUERY);
+ xPeerView->setZoom( maComponentInfos.nZoomX, maComponentInfos.nZoomY );
+ xPeerView->setGraphics( xGraphics );
+
+ mbCreatingPeer = false;
+}
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/ColumnControl.hxx b/dbaccess/source/ui/uno/ColumnControl.hxx
new file mode 100644
index 000000000..1d69e1ea2
--- /dev/null
+++ b/dbaccess/source/ui/uno/ColumnControl.hxx
@@ -0,0 +1,56 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNCONTROL_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNCONTROL_HXX
+
+#include <connectivity/CommonTools.hxx>
+#include <toolkit/controls/unocontrol.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace dbaui
+{
+ class OColumnControl : public UnoControl
+ {
+ private:
+ css::uno::Reference< css::uno::XComponentContext> m_xContext;
+ public:
+ explicit OColumnControl(const css::uno::Reference< css::uno::XComponentContext>& rxContext);
+
+ // UnoControl
+ virtual OUString GetComponentServiceName() override;
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static( );
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ // css::awt::XControl
+ virtual void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit >& _rToolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent) override;
+ };
+} // namespace dbaui
+
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNCONTROL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/ColumnModel.cxx b/dbaccess/source/ui/uno/ColumnModel.cxx
new file mode 100644
index 000000000..b56fdcfbb
--- /dev/null
+++ b/dbaccess/source/ui/uno/ColumnModel.cxx
@@ -0,0 +1,149 @@
+/* -*- 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 .
+ */
+
+#include "ColumnModel.hxx"
+#include <uiservices.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <stringconstants.hxx>
+#include <dbu_reghelper.hxx>
+
+extern "C" void createRegistryInfo_OColumnControlModel()
+{
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OColumnControlModel> aAutoRegistration;
+}
+
+namespace dbaui
+{
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+
+OColumnControlModel::OColumnControlModel()
+ :OPropertyContainer(m_aBHelper)
+ ,OColumnControlModel_BASE(m_aMutex)
+ ,m_sDefaultControl(SERVICE_CONTROLDEFAULT)
+ ,m_bEnable(true)
+ ,m_nBorder(0)
+ ,m_nWidth(50)
+{
+ registerProperties();
+}
+
+OColumnControlModel::OColumnControlModel(const OColumnControlModel* _pSource)
+ :OPropertyContainer(m_aBHelper)
+ ,OColumnControlModel_BASE(m_aMutex)
+ ,m_sDefaultControl(_pSource->m_sDefaultControl)
+ ,m_aTabStop(_pSource->m_aTabStop)
+ ,m_bEnable(_pSource->m_bEnable)
+ ,m_nBorder(_pSource->m_nBorder)
+ ,m_nWidth(50)
+{
+ registerProperties();
+}
+
+OColumnControlModel::~OColumnControlModel()
+{
+ if ( !OColumnControlModel_BASE::rBHelper.bDisposed && !OColumnControlModel_BASE::rBHelper.bInDispose )
+ {
+ acquire();
+ dispose();
+ }
+}
+
+void OColumnControlModel::registerProperties()
+{
+ registerProperty( PROPERTY_ACTIVE_CONNECTION, PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
+ &m_xConnection, cppu::UnoType<decltype(m_xConnection)>::get() );
+ Any a;
+ a <<= m_xColumn;
+ registerProperty( PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::TRANSIENT | PropertyAttribute::BOUND,
+ &m_xColumn, cppu::UnoType<decltype(m_xColumn)>::get() );
+
+ registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
+ &m_aTabStop, ::cppu::UnoType<sal_Int16>::get() );
+ registerProperty( PROPERTY_DEFAULTCONTROL, PROPERTY_ID_DEFAULTCONTROL, PropertyAttribute::BOUND,
+ &m_sDefaultControl, cppu::UnoType<decltype(m_sDefaultControl)>::get() );
+ registerProperty( PROPERTY_ENABLED, PROPERTY_ID_ENABLED, PropertyAttribute::BOUND,
+ &m_bEnable, cppu::UnoType<decltype(m_bEnable)>::get() );
+ registerProperty( PROPERTY_BORDER, PROPERTY_ID_BORDER, PropertyAttribute::BOUND,
+ &m_nBorder, cppu::UnoType<decltype(m_nBorder)>::get() );
+ registerProperty( PROPERTY_EDIT_WIDTH, PROPERTY_ID_EDIT_WIDTH, PropertyAttribute::BOUND,
+ &m_nWidth, cppu::UnoType<decltype(m_nWidth)>::get() );
+}
+
+// XCloneable
+Reference< XCloneable > SAL_CALL OColumnControlModel::createClone( )
+{
+ return new OColumnControlModel( this );
+}
+
+css::uno::Sequence<sal_Int8> OColumnControlModel::getImplementationId()
+{
+ return css::uno::Sequence<sal_Int8>();
+}
+
+IMPLEMENT_GETTYPES2(OColumnControlModel,OColumnControlModel_BASE,comphelper::OPropertyContainer)
+IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OColumnControlModel)
+IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(OColumnControlModel, "com.sun.star.comp.dbu.OColumnControlModel")
+IMPLEMENT_SERVICE_INFO_SUPPORTS(OColumnControlModel)
+IMPLEMENT_SERVICE_INFO_GETSUPPORTED2_STATIC(OColumnControlModel, "com.sun.star.awt.UnoControlModel","com.sun.star.sdb.ColumnDescriptorControlModel")
+css::uno::Reference< css::uno::XInterface >
+ OColumnControlModel::Create(const css::uno::Reference< css::lang::XMultiServiceFactory >& )
+{
+ return static_cast< XServiceInfo* >(new OColumnControlModel());
+}
+IMPLEMENT_FORWARD_REFCOUNT( OColumnControlModel, OColumnControlModel_BASE )
+Any SAL_CALL OColumnControlModel::queryInterface( const Type& _rType )
+{
+ return OColumnControlModel_BASE::queryInterface( _rType );
+}
+
+// css::XAggregation
+Any SAL_CALL OColumnControlModel::queryAggregation( const Type& rType )
+{
+ Any aRet(OColumnControlModel_BASE::queryAggregation(rType));
+ if (!aRet.hasValue())
+ aRet = comphelper::OPropertyContainer::queryInterface(rType);
+ return aRet;
+}
+
+OUString SAL_CALL OColumnControlModel::getServiceName()
+{
+ return OUString();
+}
+
+void OColumnControlModel::write(const Reference<XObjectOutputStream>& /*_rxOutStream*/)
+{
+ // TODO
+}
+
+void OColumnControlModel::read(const Reference<XObjectInputStream>& /*_rxInStream*/)
+{
+ // TODO
+}
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/ColumnModel.hxx b/dbaccess/source/ui/uno/ColumnModel.hxx
new file mode 100644
index 000000000..f89b26e91
--- /dev/null
+++ b/dbaccess/source/ui/uno/ColumnModel.hxx
@@ -0,0 +1,103 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNMODEL_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNMODEL_HXX
+
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <apitools.hxx>
+
+namespace dbaui
+{
+
+// OColumnControlModel
+typedef ::cppu::WeakAggComponentImplHelper4 < css::awt::XControlModel
+ , css::lang::XServiceInfo
+ , css::util::XCloneable
+ , css::io::XPersistObject
+ > OColumnControlModel_BASE;
+
+class OColumnControlModel;
+
+class OColumnControlModel : public ::comphelper::OMutexAndBroadcastHelper
+ ,public ::comphelper::OPropertyContainer
+ ,public ::comphelper::OPropertyArrayUsageHelper< OColumnControlModel >
+ ,public OColumnControlModel_BASE
+{
+
+// [properties]
+ css::uno::Reference< css::sdbc::XConnection> m_xConnection;
+ css::uno::Reference< css::beans::XPropertySet > m_xColumn;
+ OUString m_sDefaultControl;
+ css::uno::Any m_aTabStop;
+ bool m_bEnable;
+ sal_Int16 m_nBorder;
+ sal_Int32 m_nWidth;
+// [properties]
+
+ void registerProperties();
+protected:
+
+ virtual ~OColumnControlModel() override;
+ OColumnControlModel(const OColumnControlModel* _pSource);
+public:
+ explicit OColumnControlModel();
+
+// UNO binding
+ DECLARE_XINTERFACE( )
+
+// css::lang::XServiceInfo
+ DECLARE_SERVICE_INFO();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static( );
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
+
+// css::uno::XAggregation
+ virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
+
+// css::io::XPersistObject
+ virtual OUString SAL_CALL getServiceName() override;
+ virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream>& _rxOutStream) override;
+ virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream>& _rxInStream) override;
+
+// OPropertyArrayUsageHelper
+ DECLARE_PROPERTYCONTAINER_DEFAULTS( );
+
+ virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
+};
+
+} // namespace dbaui
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNMODEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/ColumnPeer.cxx b/dbaccess/source/ui/uno/ColumnPeer.cxx
new file mode 100644
index 000000000..36bad3a10
--- /dev/null
+++ b/dbaccess/source/ui/uno/ColumnPeer.cxx
@@ -0,0 +1,147 @@
+/* -*- 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 .
+ */
+
+#include "ColumnPeer.hxx"
+#include <ColumnControlWindow.hxx>
+#include <vcl/svapp.hxx>
+#include <strings.hxx>
+#include <FieldDescriptions.hxx>
+
+namespace dbaui
+{
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdbc;
+
+OColumnPeer::OColumnPeer(vcl::Window* _pParent,const Reference<XComponentContext>& _rxContext)
+ :m_pActFieldDescr(nullptr)
+{
+ osl_atomic_increment( &m_refCount );
+ {
+ VclPtrInstance<OColumnControlWindow> pFieldControl(_pParent, _rxContext);
+ pFieldControl->SetComponentInterface(this);
+ pFieldControl->Show();
+ }
+ osl_atomic_decrement( &m_refCount );
+}
+
+void OColumnPeer::setEditWidth(sal_Int32 _nWidth)
+{
+ SolarMutexGuard aGuard;
+ VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>();
+ if ( pFieldControl )
+ pFieldControl->setEditWidth(_nWidth);
+}
+
+void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn)
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>();
+ if ( !pFieldControl )
+ return;
+
+ if ( m_pActFieldDescr )
+ {
+ delete m_pActFieldDescr;
+ m_pActFieldDescr = nullptr;
+ }
+ if ( _xColumn.is() )
+ {
+ sal_Int32 nType = 0;
+ sal_Int32 nScale = 0;
+ sal_Int32 nPrecision = 0;
+ bool bAutoIncrement = false;
+ OUString sTypeName;
+
+ try
+ {
+ // get the properties from the column
+ _xColumn->getPropertyValue(PROPERTY_TYPENAME) >>= sTypeName;
+ _xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
+ _xColumn->getPropertyValue(PROPERTY_SCALE) >>= nScale;
+ _xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision;
+ _xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT) >>= bAutoIncrement;
+ }
+ catch(const Exception&)
+ {
+ }
+
+ m_pActFieldDescr = new OFieldDescription(_xColumn,true);
+ // search for type
+ OUString const sCreateParam("x");
+ bool bForce;
+ TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(*pFieldControl->getTypeInfo(),nType,sTypeName,sCreateParam,nPrecision,nScale,bAutoIncrement,bForce);
+ if ( !pTypeInfo )
+ pTypeInfo = pFieldControl->getDefaultTyp();
+
+ m_pActFieldDescr->FillFromTypeInfo(pTypeInfo,true,false);
+ m_xColumn = _xColumn;
+ }
+ pFieldControl->DisplayData(m_pActFieldDescr);
+}
+
+void OColumnPeer::setConnection(const Reference< XConnection>& _xCon)
+{
+ SolarMutexGuard aGuard;
+ VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>();
+ if ( pFieldControl )
+ pFieldControl->setConnection(_xCon);
+}
+
+void OColumnPeer::setProperty( const OUString& _rPropertyName, const Any& Value)
+{
+ SolarMutexGuard aGuard;
+
+ if (_rPropertyName == PROPERTY_COLUMN)
+ {
+ Reference<XPropertySet> xProp(Value,UNO_QUERY);
+ setColumn(xProp);
+ }
+ else if (_rPropertyName == PROPERTY_ACTIVE_CONNECTION)
+ {
+ Reference<XConnection> xCon(Value,UNO_QUERY);
+ setConnection(xCon);
+ }
+ else
+ VCLXWindow::setProperty(_rPropertyName,Value);
+}
+
+Any OColumnPeer::getProperty( const OUString& _rPropertyName )
+{
+ Any aProp;
+ VclPtr< OFieldDescControl > pFieldControl = GetAs< OFieldDescControl >();
+ if (pFieldControl && _rPropertyName == PROPERTY_COLUMN)
+ {
+ aProp <<= m_xColumn;
+ }
+ else if (pFieldControl && _rPropertyName == PROPERTY_ACTIVE_CONNECTION)
+ {
+ aProp <<= pFieldControl->getConnection();
+ }
+ else
+ aProp = VCLXWindow::getProperty(_rPropertyName);
+ return aProp;
+}
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/ColumnPeer.hxx b/dbaccess/source/ui/uno/ColumnPeer.hxx
new file mode 100644
index 000000000..91ebbdc7f
--- /dev/null
+++ b/dbaccess/source/ui/uno/ColumnPeer.hxx
@@ -0,0 +1,49 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNPEER_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNPEER_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace dbaui
+{
+ class OFieldDescription;
+ class OColumnPeer : public VCLXWindow
+ {
+ OFieldDescription* m_pActFieldDescr;
+ css::uno::Reference< css::beans::XPropertySet> m_xColumn;
+ public:
+
+ OColumnPeer(vcl::Window* _pParent
+ ,const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
+
+ void setColumn(const css::uno::Reference< css::beans::XPropertySet>& _xColumn);
+ void setConnection(const css::uno::Reference< css::sdbc::XConnection>& _xCon);
+ void setEditWidth(sal_Int32 _nWidth);
+ // VCLXWindow
+ virtual void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ virtual css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+ };
+} // namespace dbaui
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_COLUMNPEER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
new file mode 100644
index 000000000..4906d080b
--- /dev/null
+++ b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
@@ -0,0 +1,101 @@
+/* -*- 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 .
+ */
+
+#include <dbu_reghelper.hxx>
+#include <uiservices.hxx>
+#include "DBTypeWizDlg.hxx"
+#include <dbwiz.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace dbaui;
+
+extern "C" void createRegistryInfo_ODBTypeWizDialog()
+{
+ static OMultiInstanceAutoRegistration< ODBTypeWizDialog > aAutoRegistration;
+}
+
+namespace dbaui
+{
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+ODBTypeWizDialog::ODBTypeWizDialog(const Reference< XComponentContext >& _rxORB)
+ :ODatabaseAdministrationDialog(_rxORB)
+{
+}
+
+Sequence<sal_Int8> SAL_CALL ODBTypeWizDialog::getImplementationId( )
+{
+ return css::uno::Sequence<sal_Int8>();
+}
+
+Reference< XInterface > ODBTypeWizDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
+{
+ return *(new ODBTypeWizDialog( comphelper::getComponentContext(_rxFactory) ));
+}
+
+OUString SAL_CALL ODBTypeWizDialog::getImplementationName()
+{
+ return getImplementationName_Static();
+}
+
+OUString ODBTypeWizDialog::getImplementationName_Static()
+{
+ return "org.openoffice.comp.dbu.ODBTypeWizDialog";
+}
+
+css::uno::Sequence<OUString> SAL_CALL ODBTypeWizDialog::getSupportedServiceNames()
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence<OUString> ODBTypeWizDialog::getSupportedServiceNames_Static()
+{
+ return { "com.sun.star.sdb.DataSourceTypeChangeDialog" };
+}
+
+Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialog::getPropertySetInfo()
+{
+ Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+::cppu::IPropertyArrayHelper& ODBTypeWizDialog::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+::cppu::IPropertyArrayHelper* ODBTypeWizDialog::createArrayHelper( ) const
+{
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+std::unique_ptr<weld::DialogController> ODBTypeWizDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+{
+ return std::make_unique<ODbTypeWizDialog>(Application::GetFrameWeld(rParent), m_pDatasourceItems.get(), m_aContext, m_aInitialSelection);
+}
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.hxx b/dbaccess/source/ui/uno/DBTypeWizDlg.hxx
new file mode 100644
index 000000000..1d134421f
--- /dev/null
+++ b/dbaccess/source/ui/uno/DBTypeWizDlg.hxx
@@ -0,0 +1,67 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLG_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLG_HXX
+
+#include <unoadmin.hxx>
+
+#include <comphelper/proparrhlp.hxx>
+
+namespace dbaui
+{
+class ODBTypeWizDialog final
+ :public ODatabaseAdministrationDialog
+ ,public ::comphelper::OPropertyArrayUsageHelper< ODBTypeWizDialog >
+{
+
+ explicit ODBTypeWizDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+
+public:
+ // XTypeProvider
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XServiceInfo - static methods
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static();
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+private:
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+};
+
+} // namespace dbaui
+
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
new file mode 100644
index 000000000..ebf4f0964
--- /dev/null
+++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
@@ -0,0 +1,122 @@
+/* -*- 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 .
+ */
+
+#include <dbu_reghelper.hxx>
+#include <uiservices.hxx>
+#include "DBTypeWizDlgSetup.hxx"
+#include <dbwizsetup.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace dbaui;
+
+extern "C" void createRegistryInfo_ODBTypeWizDialogSetup()
+{
+ static OMultiInstanceAutoRegistration< ODBTypeWizDialogSetup > aAutoRegistration;
+}
+
+namespace dbaui
+{
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::sdbc;
+
+ODBTypeWizDialogSetup::ODBTypeWizDialogSetup(const Reference< XComponentContext >& _rxORB)
+ :ODatabaseAdministrationDialog(_rxORB)
+ ,m_bOpenDatabase(true)
+ ,m_bStartTableWizard(false)
+{
+ registerProperty("OpenDatabase", 3, PropertyAttribute::TRANSIENT,
+ &m_bOpenDatabase, cppu::UnoType<bool>::get());
+
+ registerProperty("StartTableWizard", 4, PropertyAttribute::TRANSIENT,
+ &m_bStartTableWizard, cppu::UnoType<bool>::get());
+}
+
+Sequence<sal_Int8> SAL_CALL ODBTypeWizDialogSetup::getImplementationId( )
+{
+ return css::uno::Sequence<sal_Int8>();
+}
+
+Reference< XInterface > ODBTypeWizDialogSetup::Create(const Reference< XMultiServiceFactory >& _rxFactory)
+{
+ Reference < XInterface > xDBWizard = *(new ODBTypeWizDialogSetup( comphelper::getComponentContext(_rxFactory) ));
+ return xDBWizard;
+}
+
+OUString SAL_CALL ODBTypeWizDialogSetup::getImplementationName()
+{
+ return getImplementationName_Static();
+}
+
+OUString ODBTypeWizDialogSetup::getImplementationName_Static()
+{
+ return "org.openoffice.comp.dbu.ODBTypeWizDialogSetup";
+}
+
+css::uno::Sequence<OUString> SAL_CALL ODBTypeWizDialogSetup::getSupportedServiceNames()
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence<OUString> ODBTypeWizDialogSetup::getSupportedServiceNames_Static()
+{
+ css::uno::Sequence<OUString> aSupported { "com.sun.star.sdb.DatabaseWizardDialog" };
+ return aSupported;
+}
+
+Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo()
+{
+ return createPropertySetInfo( getInfoHelper() );
+}
+
+::cppu::IPropertyArrayHelper& ODBTypeWizDialogSetup::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+::cppu::IPropertyArrayHelper* ODBTypeWizDialogSetup::createArrayHelper( ) const
+{
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+std::unique_ptr<weld::DialogController> ODBTypeWizDialogSetup::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+{
+ return std::make_unique<ODbTypeWizDialogSetup>(Application::GetFrameWeld(rParent), m_pDatasourceItems.get(), m_aContext, m_aInitialSelection);
+}
+
+void ODBTypeWizDialogSetup::executedDialog(sal_Int16 nExecutionResult)
+{
+ if (nExecutionResult == css::ui::dialogs::ExecutableDialogResults::OK)
+ {
+ const ODbTypeWizDialogSetup* pDialog = static_cast<ODbTypeWizDialogSetup*>(m_xDialog.get());
+ m_bOpenDatabase = pDialog->IsDatabaseDocumentToBeOpened();
+ m_bStartTableWizard = pDialog->IsTableWizardToBeStarted();
+ }
+}
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx
new file mode 100644
index 000000000..65a25b5f0
--- /dev/null
+++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx
@@ -0,0 +1,70 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLGSETUP_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLGSETUP_HXX
+
+#include <unoadmin.hxx>
+
+#include <comphelper/proparrhlp.hxx>
+
+namespace dbaui
+{
+class ODBTypeWizDialogSetup final
+ :public ODatabaseAdministrationDialog
+ ,public ::comphelper::OPropertyArrayUsageHelper< ODBTypeWizDialogSetup >
+{
+ bool m_bOpenDatabase;
+ bool m_bStartTableWizard;
+
+ explicit ODBTypeWizDialogSetup(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+
+public:
+ // XTypeProvider
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XServiceInfo - static methods
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static();
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+private:
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+ virtual void executedDialog(sal_Int16 _nExecutionResult) override;
+};
+
+} // namespace dbaui
+
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_DBTYPEWIZDLGSETUP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/TableFilterDlg.cxx b/dbaccess/source/ui/uno/TableFilterDlg.cxx
new file mode 100644
index 000000000..17fb72660
--- /dev/null
+++ b/dbaccess/source/ui/uno/TableFilterDlg.cxx
@@ -0,0 +1,101 @@
+/* -*- 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 .
+ */
+
+#include <dbu_reghelper.hxx>
+#include <uiservices.hxx>
+#include "TableFilterDlg.hxx"
+#include <TablesSingleDlg.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace dbaui;
+
+extern "C" void createRegistryInfo_OTableFilterDialog()
+{
+ static OMultiInstanceAutoRegistration< OTableFilterDialog > aAutoRegistration;
+}
+
+namespace dbaui
+{
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+OTableFilterDialog::OTableFilterDialog(const Reference< XComponentContext >& _rxORB)
+ :ODatabaseAdministrationDialog(_rxORB)
+{
+}
+
+Sequence<sal_Int8> SAL_CALL OTableFilterDialog::getImplementationId( )
+{
+ return css::uno::Sequence<sal_Int8>();
+}
+
+Reference< XInterface > OTableFilterDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
+{
+ return *(new OTableFilterDialog( comphelper::getComponentContext(_rxFactory) ));
+}
+
+OUString SAL_CALL OTableFilterDialog::getImplementationName()
+{
+ return getImplementationName_Static();
+}
+
+OUString OTableFilterDialog::getImplementationName_Static()
+{
+ return "org.openoffice.comp.dbu.OTableFilterDialog";
+}
+
+css::uno::Sequence<OUString> SAL_CALL OTableFilterDialog::getSupportedServiceNames()
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence<OUString> OTableFilterDialog::getSupportedServiceNames_Static()
+{
+ return { "com.sun.star.sdb.TableFilterDialog" };
+}
+
+Reference<XPropertySetInfo> SAL_CALL OTableFilterDialog::getPropertySetInfo()
+{
+ Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+::cppu::IPropertyArrayHelper& OTableFilterDialog::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+::cppu::IPropertyArrayHelper* OTableFilterDialog::createArrayHelper( ) const
+{
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+std::unique_ptr<weld::DialogController> OTableFilterDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+{
+ return std::make_unique<OTableSubscriptionDialog>(Application::GetFrameWeld(rParent), m_pDatasourceItems.get(), m_aContext, m_aInitialSelection);
+}
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/TableFilterDlg.hxx b/dbaccess/source/ui/uno/TableFilterDlg.hxx
new file mode 100644
index 000000000..6e80a1d5c
--- /dev/null
+++ b/dbaccess/source/ui/uno/TableFilterDlg.hxx
@@ -0,0 +1,68 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_TABLEFILTERDLG_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_TABLEFILTERDLG_HXX
+
+#include <unoadmin.hxx>
+
+#include <comphelper/proparrhlp.hxx>
+
+namespace dbaui
+{
+
+class OTableFilterDialog final
+ :public ODatabaseAdministrationDialog
+ ,public ::comphelper::OPropertyArrayUsageHelper< OTableFilterDialog >
+{
+
+ explicit OTableFilterDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+
+public:
+ // XTypeProvider
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XServiceInfo - static methods
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static();
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+private:
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+};
+
+} // namespace dbaui
+
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_TABLEFILTERDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.cxx b/dbaccess/source/ui/uno/UserSettingsDlg.cxx
new file mode 100644
index 000000000..88ab03961
--- /dev/null
+++ b/dbaccess/source/ui/uno/UserSettingsDlg.cxx
@@ -0,0 +1,101 @@
+/* -*- 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 .
+ */
+
+#include <dbu_reghelper.hxx>
+#include <uiservices.hxx>
+#include "UserSettingsDlg.hxx"
+#include <UserAdminDlg.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace dbaui;
+
+extern "C" void createRegistryInfo_OUserSettingsDialog()
+{
+ static OMultiInstanceAutoRegistration< OUserSettingsDialog > aAutoRegistration;
+}
+
+namespace dbaui
+{
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+OUserSettingsDialog::OUserSettingsDialog(const Reference< XComponentContext >& _rxORB)
+ :ODatabaseAdministrationDialog(_rxORB)
+{
+}
+
+Sequence<sal_Int8> SAL_CALL OUserSettingsDialog::getImplementationId( )
+{
+ return css::uno::Sequence<sal_Int8>();
+}
+
+Reference< XInterface > OUserSettingsDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
+{
+ return *(new OUserSettingsDialog( comphelper::getComponentContext(_rxFactory) ));
+}
+
+OUString SAL_CALL OUserSettingsDialog::getImplementationName()
+{
+ return getImplementationName_Static();
+}
+
+OUString OUserSettingsDialog::getImplementationName_Static()
+{
+ return "org.openoffice.comp.dbu.OUserSettingsDialog";
+}
+
+css::uno::Sequence<OUString> SAL_CALL OUserSettingsDialog::getSupportedServiceNames()
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence<OUString> OUserSettingsDialog::getSupportedServiceNames_Static()
+{
+ return { "com.sun.star.sdb.UserAdministrationDialog" };
+}
+
+Reference<XPropertySetInfo> SAL_CALL OUserSettingsDialog::getPropertySetInfo()
+{
+ Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+::cppu::IPropertyArrayHelper& OUserSettingsDialog::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+::cppu::IPropertyArrayHelper* OUserSettingsDialog::createArrayHelper( ) const
+{
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+std::unique_ptr<weld::DialogController> OUserSettingsDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+{
+ return std::make_unique<OUserAdminDlg>(Application::GetFrameWeld(rParent), m_pDatasourceItems.get(), m_aContext, m_aInitialSelection, m_xActiveConnection);
+}
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.hxx b/dbaccess/source/ui/uno/UserSettingsDlg.hxx
new file mode 100644
index 000000000..e70a57f60
--- /dev/null
+++ b/dbaccess/source/ui/uno/UserSettingsDlg.hxx
@@ -0,0 +1,68 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_USERSETTINGSDLG_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_USERSETTINGSDLG_HXX
+
+#include <unoadmin.hxx>
+
+#include <comphelper/proparrhlp.hxx>
+
+namespace dbaui
+{
+// OUserSettingsDialog
+class OUserSettingsDialog final
+ :public ODatabaseAdministrationDialog
+ ,public ::comphelper::OPropertyArrayUsageHelper< OUserSettingsDialog >
+{
+
+ explicit OUserSettingsDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+
+public:
+ // XTypeProvider
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XServiceInfo - static methods
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static();
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+private:
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+};
+
+} // namespace dbaui
+
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_USERSETTINGSDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/admindlg.cxx b/dbaccess/source/ui/uno/admindlg.cxx
new file mode 100644
index 000000000..b9ebc6f2e
--- /dev/null
+++ b/dbaccess/source/ui/uno/admindlg.cxx
@@ -0,0 +1,107 @@
+/* -*- 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 .
+ */
+
+#include <dbu_reghelper.hxx>
+#include <uiservices.hxx>
+#include "admindlg.hxx"
+#include <dbadmin.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace dbaui;
+
+extern "C" void createRegistryInfo_ODataSourcePropertyDialog()
+{
+ static OMultiInstanceAutoRegistration< ODataSourcePropertyDialog > aAutoRegistration;
+}
+
+namespace dbaui
+{
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+ODataSourcePropertyDialog::ODataSourcePropertyDialog(const Reference< XComponentContext >& _rxORB)
+ :ODatabaseAdministrationDialog(_rxORB)
+{
+}
+
+Sequence<sal_Int8> SAL_CALL ODataSourcePropertyDialog::getImplementationId( )
+{
+ return css::uno::Sequence<sal_Int8>();
+}
+
+Reference< XInterface > ODataSourcePropertyDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
+{
+ return *(new ODataSourcePropertyDialog( comphelper::getComponentContext(_rxFactory) ));
+}
+
+OUString SAL_CALL ODataSourcePropertyDialog::getImplementationName()
+{
+ return getImplementationName_Static();
+}
+
+OUString ODataSourcePropertyDialog::getImplementationName_Static()
+{
+ return "org.openoffice.comp.dbu.ODatasourceAdministrationDialog";
+}
+
+css::uno::Sequence<OUString> SAL_CALL ODataSourcePropertyDialog::getSupportedServiceNames()
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence<OUString> ODataSourcePropertyDialog::getSupportedServiceNames_Static()
+{
+ return { "com.sun.star.sdb.DatasourceAdministrationDialog" };
+}
+
+Reference<XPropertySetInfo> SAL_CALL ODataSourcePropertyDialog::getPropertySetInfo()
+{
+ Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+::cppu::IPropertyArrayHelper& ODataSourcePropertyDialog::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+::cppu::IPropertyArrayHelper* ODataSourcePropertyDialog::createArrayHelper( ) const
+{
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+std::unique_ptr<weld::DialogController> ODataSourcePropertyDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+{
+ std::unique_ptr<ODbAdminDialog> xDialog(new ODbAdminDialog(Application::GetFrameWeld(rParent), m_pDatasourceItems.get(), m_aContext));
+
+ // the initial selection
+ if ( m_aInitialSelection.hasValue() )
+ xDialog->selectDataSource(m_aInitialSelection);
+
+ return xDialog;
+}
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/admindlg.hxx b/dbaccess/source/ui/uno/admindlg.hxx
new file mode 100644
index 000000000..e4c817c3c
--- /dev/null
+++ b/dbaccess/source/ui/uno/admindlg.hxx
@@ -0,0 +1,67 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_ADMINDLG_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_ADMINDLG_HXX
+
+#include <unoadmin.hxx>
+
+#include <comphelper/proparrhlp.hxx>
+
+namespace dbaui
+{
+class ODataSourcePropertyDialog final
+ :public ODatabaseAdministrationDialog
+ ,public ::comphelper::OPropertyArrayUsageHelper< ODataSourcePropertyDialog >
+{
+
+ explicit ODataSourcePropertyDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+
+public:
+ // XTypeProvider
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XServiceInfo - static methods
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static();
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+private:
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+};
+
+} // namespace dbaui
+
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_ADMINDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/composerdialogs.cxx b/dbaccess/source/ui/uno/composerdialogs.cxx
new file mode 100644
index 000000000..15dea317d
--- /dev/null
+++ b/dbaccess/source/ui/uno/composerdialogs.cxx
@@ -0,0 +1,235 @@
+/* -*- 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 .
+ */
+
+#include "composerdialogs.hxx"
+#include <uiservices.hxx>
+
+#include <dbu_reghelper.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <queryfilter.hxx>
+#include <queryorder.hxx>
+#include <comphelper/processfactory.hxx>
+#include <connectivity/dbtools.hxx>
+#include <tools/diagnose_ex.h>
+#include <osl/diagnose.h>
+#include <vcl/svapp.hxx>
+
+extern "C" void createRegistryInfo_ComposerDialogs()
+{
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::RowsetOrderDialog > aOrderDialogRegistration;
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::RowsetFilterDialog > aFilterDialogRegistration;
+}
+
+namespace dbaui
+{
+
+#define PROPERTY_ID_QUERYCOMPOSER 100
+#define PROPERTY_ID_ROWSET 101
+
+#define PROPERTY_QUERYCOMPOSER "QueryComposer"
+#define PROPERTY_ROWSET "RowSet"
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::sdbcx;
+ using namespace ::com::sun::star::sdbc;
+ using namespace ::com::sun::star::sdb;
+
+ // ComposerDialog
+ ComposerDialog::ComposerDialog(const Reference< XComponentContext >& _rxORB)
+ :OGenericUnoDialog( _rxORB )
+ {
+
+ registerProperty( PROPERTY_QUERYCOMPOSER, PROPERTY_ID_QUERYCOMPOSER, PropertyAttribute::TRANSIENT,
+ &m_xComposer, cppu::UnoType<decltype(m_xComposer)>::get() );
+ registerProperty( PROPERTY_ROWSET, PROPERTY_ID_ROWSET, PropertyAttribute::TRANSIENT,
+ &m_xRowSet, cppu::UnoType<decltype(m_xRowSet)>::get() );
+ }
+
+ ComposerDialog::~ComposerDialog()
+ {
+
+ }
+
+ css::uno::Sequence<sal_Int8> ComposerDialog::getImplementationId()
+ {
+ return css::uno::Sequence<sal_Int8>();
+ }
+
+ IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ComposerDialog )
+
+ std::unique_ptr<weld::DialogController> ComposerDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+ {
+ // obtain all the objects needed for the dialog
+ Reference< XConnection > xConnection;
+ Reference< XNameAccess > xColumns;
+ try
+ {
+ // the connection the row set is working with
+ if ( !::dbtools::isEmbeddedInDatabase( m_xRowSet, xConnection ) )
+ {
+ Reference< XPropertySet > xRowsetProps( m_xRowSet, UNO_QUERY );
+ if ( xRowsetProps.is() )
+ xRowsetProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xConnection;
+ }
+
+ // fallback: if there is a connection and thus a row set, but no composer, create one
+ if ( xConnection.is() && !m_xComposer.is() )
+ m_xComposer = ::dbtools::getCurrentSettingsComposer( Reference< XPropertySet >( m_xRowSet, UNO_QUERY ), m_aContext, rParent );
+
+ // the columns of the row set
+ Reference< XColumnsSupplier > xSuppColumns( m_xRowSet, UNO_QUERY );
+ if ( xSuppColumns.is() )
+ xColumns = xSuppColumns->getColumns();
+
+ if ( !xColumns.is() || !xColumns->hasElements() )
+ { // perhaps the composer can supply us with columns? This is necessary for cases
+ // where the dialog is invoked for a rowset which is not yet loaded
+ // #i22878#
+ xSuppColumns.set(m_xComposer, css::uno::UNO_QUERY);
+ if ( xSuppColumns.is() )
+ xColumns = xSuppColumns->getColumns();
+ }
+
+ OSL_ENSURE( xColumns.is() && xColumns->hasElements(), "ComposerDialog::createDialog: not much fun without any columns!" );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+
+ if ( !xConnection.is() || !xColumns.is() || !m_xComposer.is() )
+ {
+ // can't create the dialog if I have improper settings
+ return nullptr;
+ }
+
+ return createComposerDialog(Application::GetFrameWeld(rParent), xConnection, xColumns);
+ }
+
+ // RowsetFilterDialog
+ RowsetFilterDialog::RowsetFilterDialog( const Reference< XComponentContext >& _rxORB )
+ :ComposerDialog( _rxORB )
+ {
+ }
+
+ IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(RowsetFilterDialog, "com.sun.star.uno.comp.sdb.RowsetFilterDialog")
+ IMPLEMENT_SERVICE_INFO_SUPPORTS(RowsetFilterDialog)
+ IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(RowsetFilterDialog, "com.sun.star.sdb.FilterDialog")
+
+ css::uno::Reference< css::uno::XInterface >
+ RowsetFilterDialog::Create(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxORB)
+ {
+ return static_cast< XServiceInfo* >(new RowsetFilterDialog( comphelper::getComponentContext(_rxORB)));
+ }
+
+ std::unique_ptr<weld::GenericDialogController> RowsetFilterDialog::createComposerDialog(weld::Window* _pParent, const Reference< XConnection >& _rxConnection, const Reference< XNameAccess >& _rxColumns )
+ {
+ return std::make_unique<DlgFilterCrit>(_pParent, m_aContext, _rxConnection, m_xComposer, _rxColumns);
+ }
+
+ void SAL_CALL RowsetFilterDialog::initialize( const Sequence< Any >& aArguments )
+ {
+ if( aArguments.getLength() == 3 )
+ {
+ // this is the FilterDialog::createWithQuery method
+ Reference<css::sdb::XSingleSelectQueryComposer> xQueryComposer;
+ aArguments[0] >>= xQueryComposer;
+ Reference<css::sdbc::XRowSet> xRowSet;
+ aArguments[1] >>= xRowSet;
+ Reference<css::awt::XWindow> xParentWindow;
+ aArguments[2] >>= xParentWindow;
+ setPropertyValue( "QueryComposer", makeAny( xQueryComposer ) );
+ setPropertyValue( "RowSet", makeAny( xRowSet ) );
+ setPropertyValue( "ParentWindow", makeAny( xParentWindow ) );
+ }
+ else
+ ComposerDialog::initialize(aArguments);
+ }
+
+ void RowsetFilterDialog::executedDialog( sal_Int16 _nExecutionResult )
+ {
+ ComposerDialog::executedDialog( _nExecutionResult );
+
+ if ( _nExecutionResult && m_xDialog )
+ static_cast<DlgFilterCrit*>(m_xDialog.get())->BuildWherePart();
+ }
+
+ // RowsetOrderDialog
+ RowsetOrderDialog::RowsetOrderDialog( const Reference< XComponentContext >& _rxORB )
+ :ComposerDialog( _rxORB )
+ {
+ }
+
+ IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(RowsetOrderDialog, "com.sun.star.uno.comp.sdb.RowsetOrderDialog")
+ IMPLEMENT_SERVICE_INFO_SUPPORTS(RowsetOrderDialog)
+ IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(RowsetOrderDialog, "com.sun.star.sdb.OrderDialog")
+
+ css::uno::Reference< css::uno::XInterface >
+ RowsetOrderDialog::Create(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxORB)
+ {
+ return static_cast< XServiceInfo* >(new RowsetOrderDialog( comphelper::getComponentContext(_rxORB)));
+ }
+
+ std::unique_ptr<weld::GenericDialogController> RowsetOrderDialog::createComposerDialog(weld::Window* pParent, const Reference< XConnection >& rxConnection, const Reference< XNameAccess >& rxColumns)
+ {
+ return std::make_unique<DlgOrderCrit>(pParent, rxConnection, m_xComposer, rxColumns);
+ }
+
+ void SAL_CALL RowsetOrderDialog::initialize( const Sequence< Any >& aArguments )
+ {
+ if (aArguments.getLength() == 2 || aArguments.getLength() == 3)
+ {
+ Reference<css::sdb::XSingleSelectQueryComposer> xQueryComposer;
+ aArguments[0] >>= xQueryComposer;
+ Reference<css::beans::XPropertySet> xRowSet;
+ aArguments[1] >>= xRowSet;
+ setPropertyValue( "QueryComposer", makeAny( xQueryComposer ) );
+ setPropertyValue( "RowSet", makeAny( xRowSet ) );
+ if (aArguments.getLength() == 3)
+ {
+ Reference<css::awt::XWindow> xParentWindow;
+ aArguments[2] >>= xParentWindow;
+ setPropertyValue("ParentWindow", makeAny(xParentWindow));
+ }
+ }
+ else
+ ComposerDialog::initialize(aArguments);
+ }
+
+ void RowsetOrderDialog::executedDialog( sal_Int16 _nExecutionResult )
+ {
+ ComposerDialog::executedDialog( _nExecutionResult );
+
+ if ( !m_xDialog )
+ return;
+
+ if ( _nExecutionResult )
+ static_cast<DlgOrderCrit*>(m_xDialog.get())->BuildOrderPart();
+ else if ( m_xComposer.is() )
+ m_xComposer->setOrder(static_cast<DlgOrderCrit*>(m_xDialog.get())->GetOriginalOrder());
+ }
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/composerdialogs.hxx b/dbaccess/source/ui/uno/composerdialogs.hxx
new file mode 100644
index 000000000..f50ce5d79
--- /dev/null
+++ b/dbaccess/source/ui/uno/composerdialogs.hxx
@@ -0,0 +1,137 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_COMPOSERDIALOGS_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_COMPOSERDIALOGS_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+
+#include <comphelper/proparrhlp.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <svtools/genericunodialog.hxx>
+#include <apitools.hxx>
+
+namespace dbaui
+{
+
+ // ComposerDialog
+ class ComposerDialog;
+ typedef ::comphelper::OPropertyArrayUsageHelper< ComposerDialog > ComposerDialog_PBASE;
+
+ class ComposerDialog
+ :public svt::OGenericUnoDialog
+ ,public ComposerDialog_PBASE
+ {
+ protected:
+ // <properties>
+ css::uno::Reference< css::sdb::XSingleSelectQueryComposer >
+ m_xComposer;
+ css::uno::Reference< css::sdbc::XRowSet >
+ m_xRowSet;
+ // </properties>
+
+ protected:
+ explicit ComposerDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+ virtual ~ComposerDialog() override;
+
+ public:
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
+
+ DECLARE_PROPERTYCONTAINER_DEFAULTS( );
+
+ protected:
+ // own overridables
+ virtual std::unique_ptr<weld::GenericDialogController> createComposerDialog(
+ weld::Window* _pParent,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::container::XNameAccess >& _rxColumns
+ ) = 0;
+
+ private:
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+ };
+
+ // RowsetFilterDialog
+ class RowsetFilterDialog : public ComposerDialog
+ {
+ public:
+ explicit RowsetFilterDialog(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB
+ );
+
+ DECLARE_SERVICE_INFO();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static( );
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ protected:
+ // own overridables
+ virtual std::unique_ptr<weld::GenericDialogController> createComposerDialog(
+ weld::Window* _pParent,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::container::XNameAccess >& _rxColumns
+ ) override;
+
+ // OGenericUnoDialog overridables
+ virtual void executedDialog( sal_Int16 _nExecutionResult ) override;
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+
+ };
+
+ // RowsetOrderDialog
+ class RowsetOrderDialog : public ComposerDialog
+ {
+ public:
+ explicit RowsetOrderDialog(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB
+ );
+
+ DECLARE_SERVICE_INFO();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static( );
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ protected:
+ // own overridables
+ virtual std::unique_ptr<weld::GenericDialogController> createComposerDialog(
+ weld::Window* _pParent,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::container::XNameAccess >& _rxColumns
+ ) override;
+
+ // OGenericUnoDialog overridables
+ virtual void executedDialog( sal_Int16 _nExecutionResult ) override;
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+ };
+
+} // namespace dbaui
+
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_COMPOSERDIALOGS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
new file mode 100644
index 000000000..aed45a484
--- /dev/null
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -0,0 +1,1553 @@
+/* -*- 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 .
+ */
+
+#include <memory>
+#include <dbu_reghelper.hxx>
+#include <strings.hrc>
+#include <strings.hxx>
+#include <core_resource.hxx>
+#include <uiservices.hxx>
+#include <WCopyTable.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sdb/application/XCopyTableWizard.hpp>
+#include <com/sun/star/sdb/application/CopyTableContinuation.hpp>
+#include <com/sun/star/sdb/application/CopyTableOperation.hpp>
+#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
+#include <com/sun/star/lang/NotInitializedException.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/task/InteractionHandler.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
+#include <com/sun/star/sdb/XDocumentDataSource.hpp>
+#include <com/sun/star/sdb/XCompletedConnection.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#include <com/sun/star/sdbc/XParameters.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdbc/DriverManager.hpp>
+#include <com/sun/star/sdbc/ConnectionPool.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/interaction.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/interfacecontainer2.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <sal/log.hxx>
+#include <svtools/genericunodialog.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/diagnose_ex.h>
+#include <unotools/sharedunocomponent.hxx>
+#include <vcl/svapp.hxx>
+
+namespace dbaui
+{
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::XComponentContext;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::beans::Property;
+ using ::com::sun::star::sdb::application::XCopyTableWizard;
+ using ::com::sun::star::sdb::application::XCopyTableListener;
+ using ::com::sun::star::sdb::application::CopyTableRowEvent;
+ using ::com::sun::star::beans::Optional;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::ucb::AlreadyInitializedException;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::lang::NotInitializedException;
+ using ::com::sun::star::lang::XServiceInfo;
+ using ::com::sun::star::sdbc::XConnection;
+ using ::com::sun::star::sdbc::XDataSource;
+ using ::com::sun::star::container::XNameAccess;
+ using ::com::sun::star::container::XChild;
+ using ::com::sun::star::task::InteractionHandler;
+ using ::com::sun::star::task::XInteractionHandler;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::sdb::DatabaseContext;
+ using ::com::sun::star::sdb::XDatabaseContext;
+ using ::com::sun::star::sdb::XDocumentDataSource;
+ using ::com::sun::star::sdb::XCompletedConnection;
+ using ::com::sun::star::lang::WrappedTargetException;
+ using ::com::sun::star::sdbcx::XTablesSupplier;
+ using ::com::sun::star::sdb::XQueriesSupplier;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::sdbc::XPreparedStatement;
+ using ::com::sun::star::sdb::XSingleSelectQueryComposer;
+ using ::com::sun::star::sdbc::XDatabaseMetaData;
+ using ::com::sun::star::sdbcx::XColumnsSupplier;
+ using ::com::sun::star::sdbc::XParameters;
+ using ::com::sun::star::sdbc::XResultSet;
+ using ::com::sun::star::sdbc::XRow;
+ using ::com::sun::star::sdbcx::XRowLocate;
+ using ::com::sun::star::sdbc::XResultSetMetaDataSupplier;
+ using ::com::sun::star::sdbc::XResultSetMetaData;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::sdb::SQLContext;
+ using ::com::sun::star::sdbc::ConnectionPool;
+ using ::com::sun::star::sdbc::XDriverManager;
+ using ::com::sun::star::sdbc::DriverManager;
+ using ::com::sun::star::beans::PropertyValue;
+
+ namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOperation;
+ namespace CopyTableContinuation = ::com::sun::star::sdb::application::CopyTableContinuation;
+ namespace CommandType = ::com::sun::star::sdb::CommandType;
+ namespace DataType = ::com::sun::star::sdbc::DataType;
+
+ typedef ::utl::SharedUNOComponent< XConnection > SharedConnection;
+
+ // CopyTableWizard
+ typedef ::svt::OGenericUnoDialog CopyTableWizard_DialogBase;
+ typedef ::cppu::ImplInheritanceHelper< CopyTableWizard_DialogBase
+ , XCopyTableWizard
+ > CopyTableWizard_Base;
+
+ namespace {
+
+ class CopyTableWizard
+ :public CopyTableWizard_Base
+ ,public ::comphelper::OPropertyArrayUsageHelper< CopyTableWizard >
+ {
+ public:
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XServiceInfo - static methods
+ /// @throws RuntimeException
+ static Sequence< OUString > getSupportedServiceNames_Static();
+ /// @throws RuntimeException
+ static OUString getImplementationName_Static();
+ static Reference< XInterface > Create( const Reference< XMultiServiceFactory >& );
+
+ // XCopyTableWizard
+ virtual ::sal_Int16 SAL_CALL getOperation() override;
+ virtual void SAL_CALL setOperation( ::sal_Int16 _operation ) override;
+ virtual OUString SAL_CALL getDestinationTableName() override;
+ virtual void SAL_CALL setDestinationTableName( const OUString& _destinationTableName ) override;
+ virtual Optional< OUString > SAL_CALL getCreatePrimaryKey() override;
+ virtual void SAL_CALL setCreatePrimaryKey( const Optional< OUString >& _newPrimaryKey ) override;
+ virtual sal_Bool SAL_CALL getUseHeaderLineAsColumnNames() override;
+ virtual void SAL_CALL setUseHeaderLineAsColumnNames( sal_Bool _bUseHeaderLineAsColumnNames ) override;
+ virtual void SAL_CALL addCopyTableListener( const Reference< XCopyTableListener >& Listener ) override;
+ virtual void SAL_CALL removeCopyTableListener( const Reference< XCopyTableListener >& Listener ) override;
+
+ // XCopyTableWizard::XExecutableDialog
+ virtual void SAL_CALL setTitle( const OUString& aTitle ) override;
+ virtual ::sal_Int16 SAL_CALL execute( ) override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override;
+
+ // XPropertySet
+ virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+
+ public:
+ ::osl::Mutex& getMutex() { return m_aMutex; }
+ bool isInitialized() const { return m_xSourceConnection.is() && m_pSourceObject && m_xDestConnection.is(); }
+
+ protected:
+ explicit CopyTableWizard( const Reference< XComponentContext >& _rxORB );
+ virtual ~CopyTableWizard() override;
+
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+ virtual void executedDialog( sal_Int16 _nExecutionResult ) override;
+
+ private:
+ /// ensures our current attribute values are reflected in the dialog
+ void impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialog ) const;
+
+ /// ensures the current dialog settings are reflected in our attributes
+ void impl_dialogToAttributes_nothrow( const OCopyTableWizard& _rDialog );
+
+ /** returns our typed dialog
+
+ @throws css::uno::RuntimeException
+ if we don't have a dialog at the moment the method is called
+ */
+ OCopyTableWizard&
+ impl_getDialog_throw();
+
+ /** ensures the given argument sequence contains a valid data access descriptor at the given position
+ @param _rAllArgs
+ the arguments as passed to ->initialize
+ @param _nArgPos
+ the position within ->_rAllArgs which contains the data access descriptor
+ @param _out_rxConnection
+ will, upon successful return, contain the connection for the data source
+ @param _out_rxDocInteractionHandler
+ will, upon successful return, contain the interaction handler which could
+ be deduced from database document described by the descriptor, if any.
+ (It is possible that the descriptor does not allow to deduce a database document,
+ in which case <code>_out_rxDocInteractionHandler</code> will be <NULL/>.)
+ @return the data access descriptor
+ */
+ Reference< XPropertySet >
+ impl_ensureDataAccessDescriptor_throw(
+ const Sequence< Any >& _rAllArgs,
+ const sal_Int16 _nArgPos,
+ SharedConnection& _out_rxConnection,
+ Reference< XInteractionHandler >& _out_rxDocInteractionHandler
+ ) const;
+
+ /** extracts the source object (table or query) described by the given descriptor,
+ relative to m_xSourceConnection
+ */
+ std::unique_ptr< ICopyTableSourceObject >
+ impl_extractSourceObject_throw(
+ const Reference< XPropertySet >& _rxDescriptor,
+ sal_Int32& _out_rCommandType
+ ) const;
+
+ /** extracts the result set to copy records from, and the selection-related aspects, if any.
+
+ Effectively, this method extracts m_xSourceResultSet, m_aSourceSelection, and m_bSourceSelectionBookmarks.
+
+ If an inconsistent/insufficient sub set of those properties is present in the descriptor, and exception
+ is thrown.
+ */
+ void impl_extractSourceResultSet_throw(
+ const Reference< XPropertySet >& i_rDescriptor
+ );
+
+ /** checks whether the given copy source descriptor contains settings which are not
+ supported (yet)
+
+ Throws an IllegalArgumentException if the descriptor contains a valid setting, which is
+ not yet supported.
+ */
+ void impl_checkForUnsupportedSettings_throw(
+ const Reference< XPropertySet >& _rxSourceDescriptor ) const;
+
+ /** obtains the connection described by the given data access descriptor
+
+ If needed and possible, the method will ask the user, using the interaction
+ handler associated with the database described by the descriptor.
+
+ All errors are handled with the InteractionHandler associated with the data source,
+ if there is one. Else, they will be silenced (but asserted in non-product builds).
+
+ @param _rxDataSourceDescriptor
+ the data access descriptor describing the data source whose connection
+ should be obtained. Must not be <NULL/>.
+ @param _out_rxDocInteractionHandler
+ the interaction handler which could be deduced from the descriptor
+
+ @throws RuntimeException
+ if anything goes seriously wrong.
+ */
+ SharedConnection
+ impl_extractConnection_throw(
+ const Reference< XPropertySet >& _rxDataSourceDescriptor,
+ Reference< XInteractionHandler >& _out_rxDocInteractionHandler
+ ) const;
+
+ /** actually copies the table
+
+ This method is called after the dialog has been successfully executed.
+ */
+ void impl_doCopy_nothrow();
+
+ /** creates the INSERT INTO statement
+ @param _xTable The destination table.
+ */
+ OUString impl_getServerSideCopyStatement_throw( const Reference< XPropertySet >& _xTable );
+
+ /** creates the statement which, when executed, will produce the source data to copy
+
+ If the source object refers to a query which contains parameters, those parameters
+ are filled in, using an interaction handler.
+ */
+ ::utl::SharedUNOComponent< XPreparedStatement >
+ impl_createSourceStatement_throw() const;
+
+ /** copies the data rows from the given source result set to the given destination table
+ */
+ void impl_copyRows_throw(
+ const Reference< XResultSet >& _rxSourceResultSet,
+ const Reference< XPropertySet >& _rxDestTable
+ );
+
+ /** processes an error which occurred during copying
+
+ First, all listeners are ask. If a listener tells to cancel or continue copying, this is reported to the
+ method's caller. If a listener tells to ask the user, this is done, and the user's decision is
+ reported to the method's caller.
+
+ @return
+ <TRUE/> if and only if copying should be continued.
+ */
+ bool impl_processCopyError_nothrow(
+ const CopyTableRowEvent& _rEvent );
+
+private:
+ Reference<XComponentContext> m_xContext;
+
+ // attributes
+ sal_Int16 m_nOperation;
+ OUString m_sDestinationTable;
+ Optional< OUString > m_aPrimaryKeyName;
+ bool m_bUseHeaderLineAsColumnNames;
+
+ // source
+ SharedConnection m_xSourceConnection;
+ sal_Int32 m_nCommandType;
+ std::unique_ptr< ICopyTableSourceObject >
+ m_pSourceObject;
+ Reference< XResultSet > m_xSourceResultSet;
+ Sequence< Any > m_aSourceSelection;
+ bool m_bSourceSelectionBookmarks;
+
+ // destination
+ SharedConnection m_xDestConnection;
+
+ // other
+ Reference< XInteractionHandler > m_xInteractionHandler;
+ ::comphelper::OInterfaceContainerHelper2
+ m_aCopyTableListeners;
+ sal_Int16 m_nOverrideExecutionResult;
+ };
+
+// MethodGuard
+class CopyTableAccessGuard
+{
+public:
+ explicit CopyTableAccessGuard( CopyTableWizard& _rWizard )
+ :m_rWizard( _rWizard )
+ {
+ m_rWizard.getMutex().acquire();
+ if ( !m_rWizard.isInitialized() )
+ throw NotInitializedException();
+ }
+
+ ~CopyTableAccessGuard()
+ {
+ m_rWizard.getMutex().release();
+ }
+
+private:
+ CopyTableWizard& m_rWizard;
+};
+
+}
+
+CopyTableWizard::CopyTableWizard( const Reference< XComponentContext >& _rxORB )
+ :CopyTableWizard_Base( _rxORB )
+ ,m_xContext( _rxORB )
+ ,m_nOperation( CopyTableOperation::CopyDefinitionAndData )
+ ,m_sDestinationTable()
+ ,m_aPrimaryKeyName( false, "ID" )
+ ,m_bUseHeaderLineAsColumnNames( true )
+ ,m_xSourceConnection()
+ ,m_nCommandType( CommandType::COMMAND )
+ ,m_pSourceObject()
+ ,m_xSourceResultSet()
+ ,m_aSourceSelection()
+ ,m_bSourceSelectionBookmarks( true )
+ ,m_xDestConnection()
+ ,m_aCopyTableListeners( m_aMutex )
+ ,m_nOverrideExecutionResult( -1 )
+{
+}
+
+CopyTableWizard::~CopyTableWizard()
+{
+ acquire();
+
+ // protect some members whose dtor might potentially throw
+ try { m_xSourceConnection.clear(); }
+ catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION("dbaccess"); }
+ try { m_xDestConnection.clear(); }
+ catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION("dbaccess"); }
+
+ // TODO: shouldn't we have explicit disposal support? If a listener is registered
+ // at our instance, and perhaps holds this our instance by a hard ref, then we'll never
+ // be destroyed.
+ // However, adding XComponent support to the GenericUNODialog probably requires
+ // some thinking - would it break existing clients which do not call a dispose, then?
+}
+
+Reference< XInterface > CopyTableWizard::Create( const Reference< XMultiServiceFactory >& _rxFactory )
+{
+ return *( new CopyTableWizard( comphelper::getComponentContext(_rxFactory) ) );
+}
+
+OUString SAL_CALL CopyTableWizard::getImplementationName()
+{
+ return getImplementationName_Static();
+}
+
+OUString CopyTableWizard::getImplementationName_Static()
+{
+ return "org.openoffice.comp.dbu.CopyTableWizard";
+}
+
+css::uno::Sequence<OUString> SAL_CALL CopyTableWizard::getSupportedServiceNames()
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence<OUString> CopyTableWizard::getSupportedServiceNames_Static()
+{
+ return { "com.sun.star.sdb.application.CopyTableWizard" };
+}
+
+Reference< XPropertySetInfo > SAL_CALL CopyTableWizard::getPropertySetInfo()
+{
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+::sal_Int16 SAL_CALL CopyTableWizard::getOperation()
+{
+ CopyTableAccessGuard aGuard( *this );
+ return m_nOperation;
+}
+
+void SAL_CALL CopyTableWizard::setOperation( ::sal_Int16 _operation )
+{
+ CopyTableAccessGuard aGuard( *this );
+
+ if ( ( _operation != CopyTableOperation::CopyDefinitionAndData )
+ && ( _operation != CopyTableOperation::CopyDefinitionOnly )
+ && ( _operation != CopyTableOperation::CreateAsView )
+ && ( _operation != CopyTableOperation::AppendData )
+ )
+ throw IllegalArgumentException( OUString(), *this, 1 );
+
+ if ( ( _operation == CopyTableOperation::CreateAsView )
+ && !OCopyTableWizard::supportsViews( m_xDestConnection )
+ )
+ throw IllegalArgumentException(
+ DBA_RES( STR_CTW_NO_VIEWS_SUPPORT ),
+ *this,
+ 1
+ );
+
+ m_nOperation = _operation;
+}
+
+OUString SAL_CALL CopyTableWizard::getDestinationTableName()
+{
+ CopyTableAccessGuard aGuard( *this );
+ return m_sDestinationTable;
+}
+
+void SAL_CALL CopyTableWizard::setDestinationTableName( const OUString& _destinationTableName )
+{
+ CopyTableAccessGuard aGuard( *this );
+ m_sDestinationTable = _destinationTableName;
+}
+
+Optional< OUString > SAL_CALL CopyTableWizard::getCreatePrimaryKey()
+{
+ CopyTableAccessGuard aGuard( *this );
+ return m_aPrimaryKeyName;
+}
+
+void SAL_CALL CopyTableWizard::setCreatePrimaryKey( const Optional< OUString >& _newPrimaryKey )
+{
+ CopyTableAccessGuard aGuard( *this );
+
+ if ( _newPrimaryKey.IsPresent && !OCopyTableWizard::supportsPrimaryKey( m_xDestConnection ) )
+ throw IllegalArgumentException(
+ DBA_RES( STR_CTW_NO_PRIMARY_KEY_SUPPORT ),
+ *this,
+ 1
+ );
+
+ m_aPrimaryKeyName = _newPrimaryKey;
+}
+
+sal_Bool SAL_CALL CopyTableWizard::getUseHeaderLineAsColumnNames()
+{
+ CopyTableAccessGuard aGuard( *this );
+ return m_bUseHeaderLineAsColumnNames;
+}
+
+void SAL_CALL CopyTableWizard::setUseHeaderLineAsColumnNames( sal_Bool _bUseHeaderLineAsColumnNames )
+{
+ CopyTableAccessGuard aGuard( *this );
+ m_bUseHeaderLineAsColumnNames = _bUseHeaderLineAsColumnNames;
+}
+
+void SAL_CALL CopyTableWizard::addCopyTableListener( const Reference< XCopyTableListener >& _rxListener )
+{
+ CopyTableAccessGuard aGuard( *this );
+ if ( _rxListener.is() )
+ m_aCopyTableListeners.addInterface( _rxListener );
+}
+
+void SAL_CALL CopyTableWizard::removeCopyTableListener( const Reference< XCopyTableListener >& _rxListener )
+{
+ CopyTableAccessGuard aGuard( *this );
+ if ( _rxListener.is() )
+ m_aCopyTableListeners.removeInterface( _rxListener );
+}
+
+void SAL_CALL CopyTableWizard::setTitle( const OUString& _rTitle )
+{
+ CopyTableAccessGuard aGuard( *this );
+ CopyTableWizard_DialogBase::setTitle( _rTitle );
+}
+
+::sal_Int16 SAL_CALL CopyTableWizard::execute( )
+{
+ CopyTableAccessGuard aGuard( *this );
+
+ m_nOverrideExecutionResult = -1;
+ sal_Int16 nExecutionResult = CopyTableWizard_DialogBase::execute();
+ if ( m_nOverrideExecutionResult )
+ nExecutionResult = m_nOverrideExecutionResult;
+
+ return nExecutionResult;
+}
+
+OCopyTableWizard& CopyTableWizard::impl_getDialog_throw()
+{
+ OCopyTableWizard* pWizard = dynamic_cast<OCopyTableWizard*>(m_xDialog.get());
+ if ( !pWizard )
+ throw DisposedException( OUString(), *this );
+ return *pWizard;
+}
+
+void CopyTableWizard::impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialog ) const
+{
+ // primary key column
+ _rDialog.setCreatePrimaryKey( m_aPrimaryKeyName.IsPresent, m_aPrimaryKeyName.Value );
+ _rDialog.setUseHeaderLine(m_bUseHeaderLineAsColumnNames);
+
+ // everything else was passed at construction time already
+}
+
+void CopyTableWizard::impl_dialogToAttributes_nothrow( const OCopyTableWizard& _rDialog )
+{
+ m_aPrimaryKeyName.IsPresent = _rDialog.shouldCreatePrimaryKey();
+ if ( m_aPrimaryKeyName.IsPresent )
+ m_aPrimaryKeyName.Value = _rDialog.getPrimaryKeyName();
+ else
+ m_aPrimaryKeyName.Value.clear();
+
+ m_sDestinationTable = _rDialog.getName();
+
+ m_nOperation = _rDialog.getOperation();
+ m_bUseHeaderLineAsColumnNames = _rDialog.UseHeaderLine();
+}
+
+namespace
+{
+ /** tries to obtain the InteractionHandler associated with a given data source
+
+ If the data source is a sdb-level data source, it will have a DatabaseDocument associated
+ with it. This document may have an InteractionHandler used while loading it.
+
+ @throws RuntimeException
+ if it occurs during invoking any of the data source's methods, or if any of the involved
+ components violates its contract by not providing the required interfaces
+ */
+ Reference< XInteractionHandler > lcl_getInteractionHandler_throw( const Reference< XDataSource >& _rxDataSource, const Reference< XInteractionHandler >& _rFallback )
+ {
+ Reference< XInteractionHandler > xHandler( _rFallback );
+
+ // try to obtain the document model
+ Reference< XModel > xDocumentModel;
+ Reference< XDocumentDataSource > xDocDataSource( _rxDataSource, UNO_QUERY );
+ if ( xDocDataSource.is() )
+ xDocumentModel.set( xDocDataSource->getDatabaseDocument(), UNO_QUERY_THROW );
+
+ // see whether the document model can provide a handler
+ if ( xDocumentModel.is() )
+ {
+ ::comphelper::NamedValueCollection aModelArgs( xDocumentModel->getArgs() );
+ xHandler = aModelArgs.getOrDefault( "InteractionHandler", xHandler );
+ }
+
+ return xHandler;
+ }
+ /** tries to obtain the InteractionHandler associated with a given connection
+
+ If the connection belongs to a sdb-level data source, then this data source
+ is examined for an interaction handler. Else, <NULL/> is returned.
+
+ @throws RuntimeException
+ if it occurs during invoking any of the data source's methods, or if any of the involved
+ components violates its contract by not providing the required interfaces
+ */
+ Reference< XInteractionHandler > lcl_getInteractionHandler_throw( const Reference< XConnection >& _rxConnection, const Reference< XInteractionHandler >& _rFallback )
+ {
+ // try whether there is a data source which the connection belongs to
+ Reference< XDataSource > xDataSource;
+ Reference< XChild > xAsChild( _rxConnection, UNO_QUERY );
+ if ( xAsChild.is() )
+ xDataSource.set(xAsChild->getParent(), css::uno::UNO_QUERY);
+
+ if ( xDataSource.is() )
+ return lcl_getInteractionHandler_throw( xDataSource, _rFallback );
+
+ return _rFallback;
+ }
+}
+
+Reference< XPropertySet > CopyTableWizard::impl_ensureDataAccessDescriptor_throw(
+ const Sequence< Any >& _rAllArgs, const sal_Int16 _nArgPos, SharedConnection& _out_rxConnection,
+ Reference< XInteractionHandler >& _out_rxDocInteractionHandler ) const
+{
+ Reference< XPropertySet > xDescriptor;
+ _rAllArgs[ _nArgPos ] >>= xDescriptor;
+
+ // the descriptor must be non-NULL, of course
+ bool bIsValid = xDescriptor.is();
+
+ // it must support the proper service
+ if ( bIsValid )
+ {
+ Reference< XServiceInfo > xSI( xDescriptor, UNO_QUERY );
+ bIsValid = ( xSI.is()
+ && xSI->supportsService( "com.sun.star.sdb.DataAccessDescriptor" ) );
+ }
+
+ // it must be able to provide a connection
+ if ( bIsValid )
+ {
+ _out_rxConnection = impl_extractConnection_throw( xDescriptor, _out_rxDocInteractionHandler );
+ bIsValid = _out_rxConnection.is();
+ }
+
+ if ( !bIsValid )
+ {
+ throw IllegalArgumentException(
+ DBA_RES( STR_CTW_INVALID_DATA_ACCESS_DESCRIPTOR ),
+ *const_cast< CopyTableWizard* >( this ),
+ _nArgPos + 1
+ );
+ }
+
+ return xDescriptor;
+}
+
+namespace
+{
+ bool lcl_hasNonEmptyStringValue_throw( const Reference< XPropertySet >& _rxDescriptor,
+ const Reference< XPropertySetInfo >& rxPSI, const OUString& _rPropertyName )
+ {
+ OUString sValue;
+ if ( rxPSI->hasPropertyByName( _rPropertyName ) )
+ {
+ OSL_VERIFY( _rxDescriptor->getPropertyValue( _rPropertyName ) >>= sValue );
+ }
+ return !sValue.isEmpty();
+ }
+}
+
+void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< XPropertySet >& _rxSourceDescriptor ) const
+{
+ OSL_PRECOND( _rxSourceDescriptor.is(), "CopyTableWizard::impl_checkForUnsupportedSettings_throw: illegal argument!" );
+ Reference< XPropertySetInfo > xPSI( _rxSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW );
+ OUString sUnsupportedSetting;
+
+ const OUString aSettings[] = {
+ OUString(PROPERTY_FILTER), OUString(PROPERTY_ORDER), OUString(PROPERTY_HAVING_CLAUSE), OUString(PROPERTY_GROUP_BY)
+ };
+ for (const auto & aSetting : aSettings)
+ {
+ if ( lcl_hasNonEmptyStringValue_throw( _rxSourceDescriptor, xPSI, aSetting ) )
+ {
+ sUnsupportedSetting = aSetting;
+ break;
+ }
+ }
+
+ if ( !sUnsupportedSetting.isEmpty() )
+ {
+ OUString sMessage(
+ DBA_RES(STR_CTW_ERROR_UNSUPPORTED_SETTING).
+ replaceFirst("$name$", sUnsupportedSetting));
+ throw IllegalArgumentException(
+ sMessage,
+ *const_cast< CopyTableWizard* >( this ),
+ 1
+ );
+ }
+
+}
+
+std::unique_ptr< ICopyTableSourceObject > CopyTableWizard::impl_extractSourceObject_throw( const Reference< XPropertySet >& _rxDescriptor, sal_Int32& _out_rCommandType ) const
+{
+ OSL_PRECOND( _rxDescriptor.is() && m_xSourceConnection.is(), "CopyTableWizard::impl_extractSourceObject_throw: illegal arguments!" );
+
+ Reference< XPropertySetInfo > xPSI( _rxDescriptor->getPropertySetInfo(), UNO_SET_THROW );
+ if ( !xPSI->hasPropertyByName( PROPERTY_COMMAND )
+ || !xPSI->hasPropertyByName( PROPERTY_COMMAND_TYPE )
+ )
+ throw IllegalArgumentException("Expecting a table or query specification.",
+ // TODO: resource
+ *const_cast< CopyTableWizard* >( this ), 1);
+
+ OUString sCommand;
+ _out_rCommandType = CommandType::COMMAND;
+ OSL_VERIFY( _rxDescriptor->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand );
+ OSL_VERIFY( _rxDescriptor->getPropertyValue( PROPERTY_COMMAND_TYPE ) >>= _out_rCommandType );
+
+ std::unique_ptr< ICopyTableSourceObject > pSourceObject;
+ Reference< XNameAccess > xContainer;
+ switch ( _out_rCommandType )
+ {
+ case CommandType::TABLE:
+ {
+ Reference< XTablesSupplier > xSuppTables( m_xSourceConnection.getTyped(), UNO_QUERY );
+ if ( xSuppTables.is() )
+ xContainer.set( xSuppTables->getTables(), UNO_SET_THROW );
+ }
+ break;
+ case CommandType::QUERY:
+ {
+ Reference< XQueriesSupplier > xSuppQueries( m_xSourceConnection.getTyped(), UNO_QUERY );
+ if ( xSuppQueries.is() )
+ xContainer.set( xSuppQueries->getQueries(), UNO_SET_THROW );
+ }
+ break;
+ default:
+ throw IllegalArgumentException(
+ DBA_RES( STR_CTW_ONLY_TABLES_AND_QUERIES_SUPPORT ),
+ *const_cast< CopyTableWizard* >( this ),
+ 1
+ );
+ }
+
+ if ( xContainer.is() )
+ {
+ pSourceObject.reset( new ObjectCopySource( m_xSourceConnection,
+ Reference< XPropertySet >( xContainer->getByName( sCommand ), UNO_QUERY_THROW ) ) );
+ }
+ else
+ {
+ // our source connection is an SDBC level connection only, not a SDBCX level one
+ // Which means it cannot provide the to-be-copied object as component.
+
+ if ( _out_rCommandType == CommandType::QUERY )
+ // we cannot copy a query if the connection cannot provide it ...
+ throw IllegalArgumentException(
+ DBA_RES( STR_CTW_ERROR_NO_QUERY ),
+ *const_cast< CopyTableWizard* >( this ),
+ 1
+ );
+ pSourceObject.reset( new NamedTableCopySource( m_xSourceConnection, sCommand ) );
+ }
+
+ return pSourceObject;
+}
+
+void CopyTableWizard::impl_extractSourceResultSet_throw( const Reference< XPropertySet >& i_rDescriptor )
+{
+ Reference< XPropertySetInfo > xPSI( i_rDescriptor->getPropertySetInfo(), UNO_SET_THROW );
+
+ // extract relevant settings
+ if ( xPSI->hasPropertyByName( PROPERTY_RESULT_SET ) )
+ m_xSourceResultSet.set( i_rDescriptor->getPropertyValue( PROPERTY_RESULT_SET ), UNO_QUERY );
+
+ if ( xPSI->hasPropertyByName( PROPERTY_SELECTION ) )
+ OSL_VERIFY( i_rDescriptor->getPropertyValue( PROPERTY_SELECTION ) >>= m_aSourceSelection );
+
+ if ( xPSI->hasPropertyByName( PROPERTY_BOOKMARK_SELECTION ) )
+ OSL_VERIFY( i_rDescriptor->getPropertyValue( PROPERTY_BOOKMARK_SELECTION ) >>= m_bSourceSelectionBookmarks );
+
+ // sanity checks
+ const bool bHasResultSet = m_xSourceResultSet.is();
+ const bool bHasSelection = m_aSourceSelection.hasElements();
+ if ( bHasSelection && !bHasResultSet )
+ throw IllegalArgumentException("A result set is needed when specifying a selection to copy.",
+ // TODO: resource
+ *this, 1);
+
+ if ( bHasSelection && m_bSourceSelectionBookmarks )
+ {
+ Reference< XRowLocate > xRowLocate( m_xSourceResultSet, UNO_QUERY );
+ if ( !xRowLocate.is() )
+ {
+ ::dbtools::throwGenericSQLException(
+ DBA_RES(STR_CTW_COPY_SOURCE_NEEDS_BOOKMARKS),
+ *this
+ );
+ }
+ }
+}
+
+SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< XPropertySet >& _rxDataSourceDescriptor,
+ Reference< XInteractionHandler >& _out_rxDocInteractionHandler ) const
+{
+ SharedConnection xConnection;
+
+ OSL_PRECOND( _rxDataSourceDescriptor.is(), "CopyTableWizard::impl_extractConnection_throw: no descriptor!" );
+ if ( !_rxDataSourceDescriptor.is() )
+ return xConnection;
+
+ Reference< XInteractionHandler > xInteractionHandler;
+
+ do
+ {
+ Reference< XPropertySetInfo > xPSI( _rxDataSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW );
+
+ // if there's an ActiveConnection, use it
+ if ( xPSI->hasPropertyByName( PROPERTY_ACTIVE_CONNECTION ) )
+ {
+ Reference< XConnection > xPure;
+ OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xPure );
+ xConnection.reset( xPure, SharedConnection::NoTakeOwnership );
+ }
+ if ( xConnection.is() )
+ {
+ xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler );
+ SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" );
+ break;
+ }
+
+ // there could be a DataSourceName or a DatabaseLocation, describing the css.sdb.DataSource
+ OUString sDataSource, sDatabaseLocation;
+ if ( xPSI->hasPropertyByName( PROPERTY_DATASOURCENAME ) )
+ OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sDataSource );
+ if ( xPSI->hasPropertyByName( PROPERTY_DATABASE_LOCATION ) )
+ OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation );
+
+ // need a DatabaseContext for loading the data source
+ Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create( m_xContext );
+ Reference< XDataSource > xDataSource;
+ if ( !sDataSource.isEmpty() )
+ xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW );
+ if ( !xDataSource.is() && !sDatabaseLocation.isEmpty() )
+ xDataSource.set( xDatabaseContext->getByName( sDatabaseLocation ), UNO_QUERY_THROW );
+
+ if ( xDataSource.is() )
+ {
+ // first, try connecting with completion
+ xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler );
+ SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" );
+ if ( xInteractionHandler.is() )
+ {
+ Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY );
+ if ( xInteractiveConnection.is() )
+ xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership );
+ }
+
+ // interactively connecting was not successful or possible -> connect without interaction
+ if ( !xConnection.is() )
+ {
+ xConnection.reset( xDataSource->getConnection( OUString(), OUString() ), SharedConnection::TakeOwnership );
+ }
+ }
+
+ if ( xConnection.is() )
+ break;
+
+ // finally, there could be a ConnectionResource/ConnectionInfo
+ OUString sConnectionResource;
+ Sequence< PropertyValue > aConnectionInfo;
+ if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_RESOURCE ) )
+ OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_RESOURCE ) >>= sConnectionResource );
+ if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) )
+ OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo );
+
+ Reference< XDriverManager > xDriverManager;
+ try {
+ xDriverManager.set( ConnectionPool::create( m_xContext ), UNO_QUERY_THROW );
+ } catch( const Exception& ) { }
+ if ( !xDriverManager.is() )
+ // no connection pool installed
+ xDriverManager.set( DriverManager::create( m_xContext ), UNO_QUERY_THROW );
+
+ if ( aConnectionInfo.hasElements() )
+ xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW );
+ else
+ xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW );
+ }
+ while ( false );
+
+ if ( xInteractionHandler != m_xInteractionHandler )
+ _out_rxDocInteractionHandler = xInteractionHandler;
+
+ return xConnection;
+}
+
+::utl::SharedUNOComponent< XPreparedStatement > CopyTableWizard::impl_createSourceStatement_throw() const
+{
+ OSL_PRECOND( m_xSourceConnection.is(), "CopyTableWizard::impl_createSourceStatement_throw: illegal call!" );
+ if ( !m_xSourceConnection.is() )
+ throw RuntimeException( "CopyTableWizard::impl_createSourceStatement_throw: illegal call!", *const_cast< CopyTableWizard* >( this ));
+
+ ::utl::SharedUNOComponent< XPreparedStatement > xStatement;
+ switch ( m_nCommandType )
+ {
+ case CommandType::TABLE:
+ xStatement.set( m_pSourceObject->getPreparedSelectStatement(), UNO_SET_THROW );
+ break;
+
+ case CommandType::QUERY:
+ {
+ OUString sQueryCommand( m_pSourceObject->getSelectStatement() );
+ xStatement.set( m_pSourceObject->getPreparedSelectStatement(), UNO_SET_THROW );
+
+ // check whether we have to fill in parameter values
+ // create and fill a composer
+
+ Reference< XMultiServiceFactory > xFactory( m_xSourceConnection, UNO_QUERY );
+ ::utl::SharedUNOComponent< XSingleSelectQueryComposer > xComposer;
+ if ( xFactory.is() )
+ // note: connections below the sdb-level are allowed to not support the XMultiServiceFactory interface
+ xComposer.set( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY );
+
+ if ( xComposer.is() )
+ {
+ xComposer->setQuery( sQueryCommand );
+
+ Reference< XParameters > xStatementParams( xStatement, UNO_QUERY );
+ OSL_ENSURE( xStatementParams.is(), "CopyTableWizard::impl_createSourceStatement_throw: no access to the statement's parameters!" );
+ // the statement should be a css.sdbc.PreparedStatement (this is what
+ // we created), and a prepared statement is required to support XParameters
+ if ( xStatementParams.is() )
+ {
+ OSL_ENSURE( m_xInteractionHandler.is(),
+ "CopyTableWizard::impl_createSourceStatement_throw: no interaction handler for the parameters request!" );
+ // we should always have an interaction handler - as last fallback, we create an own one in ::initialize
+
+ if ( m_xInteractionHandler.is() )
+ ::dbtools::askForParameters( xComposer, xStatementParams, m_xSourceConnection, m_xInteractionHandler );
+ }
+ }
+ }
+ break;
+
+ default:
+ // this should not have survived initialization phase
+ throw RuntimeException("No case matched, this should not have survived the initialization phase", *const_cast< CopyTableWizard* >( this ));
+ }
+
+ return xStatement;
+}
+
+namespace
+{
+ class ValueTransfer
+ {
+ public:
+ ValueTransfer( const sal_Int32& _rSourcePos, const sal_Int32& _rDestPos, const std::vector< sal_Int32 >& _rColTypes,
+ const Reference< XRow >& _rxSource, const Reference< XParameters >& _rxDest )
+ :m_rSourcePos( _rSourcePos )
+ ,m_rDestPos( _rDestPos )
+ ,m_rColTypes( _rColTypes )
+ ,m_xSource( _rxSource )
+ ,m_xDest( _rxDest )
+ {
+ }
+
+ template< typename VALUE_TYPE >
+ void transferValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ),
+ void (SAL_CALL XParameters::*_pSetter)( sal_Int32, VALUE_TYPE ) )
+ {
+ VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) );
+ if ( m_xSource->wasNull() )
+ m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] );
+ else
+ (m_xDest.get()->*_pSetter)( m_rDestPos, value );
+ }
+ template< typename VALUE_TYPE >
+ void transferComplexValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ),
+ void (SAL_CALL XParameters::*_pSetter)( sal_Int32, const VALUE_TYPE& ) )
+ {
+ const VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) );
+ if ( m_xSource->wasNull() )
+ m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] );
+ else
+ (m_xDest.get()->*_pSetter)( m_rDestPos, value );
+ }
+ private:
+ const sal_Int32& m_rSourcePos;
+ const sal_Int32& m_rDestPos;
+ const std::vector< sal_Int32 > m_rColTypes;
+ const Reference< XRow > m_xSource;
+ const Reference< XParameters > m_xDest;
+ };
+}
+
+bool CopyTableWizard::impl_processCopyError_nothrow( const CopyTableRowEvent& _rEvent )
+{
+ Reference< XCopyTableListener > xListener;
+ try
+ {
+ ::comphelper::OInterfaceIteratorHelper2 aIter( m_aCopyTableListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ xListener.set( aIter.next(), UNO_QUERY_THROW );
+ sal_Int16 nListenerChoice = xListener->copyRowError( _rEvent );
+ switch ( nListenerChoice )
+ {
+ case CopyTableContinuation::Proceed: return true; // continue copying
+ case CopyTableContinuation::CallNextHandler: continue; // continue the loop, ask next listener
+ case CopyTableContinuation::Cancel: return false; // cancel copying
+ case CopyTableContinuation::AskUser: break; // stop asking the listeners, ask the user
+
+ default:
+ SAL_WARN("dbaccess.ui", "CopyTableWizard::impl_processCopyError_nothrow: invalid listener response!" );
+ // ask next listener
+ continue;
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+
+ // no listener felt responsible for the error, or a listener told to ask the user
+
+ try
+ {
+ SQLContext aError;
+ aError.Context = *this;
+ aError.Message = DBA_RES(STR_ERROR_OCCURRED_WHILE_COPYING);
+
+ ::dbtools::SQLExceptionInfo aInfo( _rEvent.Error );
+ if ( aInfo.isValid() )
+ aError.NextException = _rEvent.Error;
+ else
+ {
+ // a non-SQL exception happened
+ Exception aException;
+ OSL_VERIFY( _rEvent.Error >>= aException );
+ SQLContext aContext;
+ aContext.Context = aException.Context;
+ aContext.Message = aException.Message;
+ aContext.Details = _rEvent.Error.getValueTypeName();
+ aError.NextException <<= aContext;
+ }
+
+ ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) );
+
+ ::rtl::Reference< ::comphelper::OInteractionApprove > xYes = new ::comphelper::OInteractionApprove;
+ xRequest->addContinuation( xYes.get() );
+ xRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
+
+ OSL_ENSURE( m_xInteractionHandler.is(),
+ "CopyTableWizard::impl_processCopyError_nothrow: we always should have an interaction handler!" );
+ if ( m_xInteractionHandler.is() )
+ m_xInteractionHandler->handle( xRequest.get() );
+
+ if ( xYes->wasSelected() )
+ // continue copying
+ return true;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+
+ // cancel copying
+ return false;
+}
+
+void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSourceResultSet,
+ const Reference< XPropertySet >& _rxDestTable )
+{
+ OSL_PRECOND( m_xDestConnection.is(), "CopyTableWizard::impl_copyRows_throw: illegal call!" );
+ if ( !m_xDestConnection.is() )
+ throw RuntimeException( "m_xDestConnection is set to null, CopyTableWizard::impl_copyRows_throw: illegal call!", *this );
+
+ Reference< XDatabaseMetaData > xDestMetaData( m_xDestConnection->getMetaData(), UNO_SET_THROW );
+
+ const OCopyTableWizard& rWizard = impl_getDialog_throw();
+ ODatabaseExport::TPositions aColumnPositions = rWizard.GetColumnPositions();
+
+ Reference< XRow > xRow ( _rxSourceResultSet, UNO_QUERY_THROW );
+ Reference< XRowLocate > xRowLocate ( _rxSourceResultSet, UNO_QUERY_THROW );
+
+ Reference< XResultSetMetaDataSupplier > xSuppResMeta( _rxSourceResultSet, UNO_QUERY_THROW );
+ Reference< XResultSetMetaData> xMeta( xSuppResMeta->getMetaData() );
+
+ // we need a vector which all types
+ sal_Int32 nCount = xMeta->getColumnCount();
+ std::vector< sal_Int32 > aSourceColTypes;
+ aSourceColTypes.reserve( nCount + 1 );
+ aSourceColTypes.push_back( -1 ); // just to avoid an every time i-1 call
+
+ std::vector< sal_Int32 > aSourcePrec;
+ aSourcePrec.reserve( nCount + 1 );
+ aSourcePrec.push_back( -1 ); // just to avoid an every time i-1 call
+
+ for ( sal_Int32 k=1; k <= nCount; ++k )
+ {
+ aSourceColTypes.push_back( xMeta->getColumnType( k ) );
+ aSourcePrec.push_back( xMeta->getPrecision( k ) );
+ }
+
+ // now create, fill and execute the prepared statement
+ Reference< XPreparedStatement > xStatement( ODatabaseExport::createPreparedStatment( xDestMetaData, _rxDestTable, aColumnPositions ), UNO_SET_THROW );
+ Reference< XParameters > xStatementParams( xStatement, UNO_QUERY_THROW );
+
+ const bool bSelectedRecordsOnly = m_aSourceSelection.hasElements();
+ const Any* pSelectedRow = m_aSourceSelection.getConstArray();
+ const Any* pSelEnd = pSelectedRow + m_aSourceSelection.getLength();
+
+ sal_Int32 nRowCount = 0;
+ bool bContinue = false;
+
+ CopyTableRowEvent aCopyEvent;
+ aCopyEvent.Source = *this;
+ aCopyEvent.SourceData = _rxSourceResultSet;
+
+ do // loop as long as there are more rows or the selection ends
+ {
+ bContinue = false;
+ if ( bSelectedRecordsOnly )
+ {
+ if ( pSelectedRow != pSelEnd )
+ {
+ if ( m_bSourceSelectionBookmarks )
+ {
+ bContinue = xRowLocate->moveToBookmark( *pSelectedRow );
+ }
+ else
+ {
+ sal_Int32 nPos = 0;
+ OSL_VERIFY( *pSelectedRow >>= nPos );
+ bContinue = _rxSourceResultSet->absolute( nPos );
+ }
+ ++pSelectedRow;
+ }
+ }
+ else
+ bContinue = _rxSourceResultSet->next();
+
+ if ( !bContinue )
+ {
+ break;
+ }
+
+ ++nRowCount;
+
+ aCopyEvent.Error.clear();
+ try
+ {
+ // notify listeners
+ m_aCopyTableListeners.notifyEach( &XCopyTableListener::copyingRow, aCopyEvent );
+
+ sal_Int32 nDestColumn( 0 );
+ sal_Int32 nSourceColumn( 1 );
+ ValueTransfer aTransfer( nSourceColumn, nDestColumn, aSourceColTypes, xRow, xStatementParams );
+
+ for ( auto const& rColumnPos : aColumnPositions )
+ {
+ nDestColumn = rColumnPos.first;
+ if ( nDestColumn == COLUMN_POSITION_NOT_FOUND )
+ {
+ ++nSourceColumn;
+ // otherwise we don't get the correct value when only the 2nd source column was selected
+ continue;
+ }
+
+ if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= static_cast<sal_Int32>(aSourceColTypes.size()) ) )
+ { // ( we have to check here against 1 because the parameters are 1 based)
+ ::dbtools::throwSQLException("Internal error: invalid column type index.",
+ ::dbtools::StandardSQLState::INVALID_DESCRIPTOR_INDEX, *this);
+ }
+
+ switch ( aSourceColTypes[ nSourceColumn ] )
+ {
+ case DataType::DOUBLE:
+ case DataType::REAL:
+ aTransfer.transferValue( &XRow::getDouble, &XParameters::setDouble );
+ break;
+
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ aTransfer.transferComplexValue( &XRow::getString, &XParameters::setString );
+ break;
+
+ case DataType::BIGINT:
+ aTransfer.transferValue( &XRow::getLong, &XParameters::setLong );
+ break;
+
+ case DataType::FLOAT:
+ aTransfer.transferValue( &XRow::getFloat, &XParameters::setFloat );
+ break;
+
+ case DataType::LONGVARBINARY:
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes );
+ break;
+
+ case DataType::DATE:
+ aTransfer.transferComplexValue( &XRow::getDate, &XParameters::setDate );
+ break;
+
+ case DataType::TIME:
+ aTransfer.transferComplexValue( &XRow::getTime, &XParameters::setTime );
+ break;
+
+ case DataType::TIMESTAMP:
+ aTransfer.transferComplexValue( &XRow::getTimestamp, &XParameters::setTimestamp );
+ break;
+
+ case DataType::BIT:
+ if ( aSourcePrec[nSourceColumn] > 1 )
+ {
+ aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes );
+ break;
+ }
+ [[fallthrough]];
+ case DataType::BOOLEAN:
+ aTransfer.transferValue( &XRow::getBoolean, &XParameters::setBoolean );
+ break;
+
+ case DataType::TINYINT:
+ aTransfer.transferValue( &XRow::getByte, &XParameters::setByte );
+ break;
+
+ case DataType::SMALLINT:
+ aTransfer.transferValue( &XRow::getShort, &XParameters::setShort );
+ break;
+
+ case DataType::INTEGER:
+ aTransfer.transferValue( &XRow::getInt, &XParameters::setInt );
+ break;
+
+ case DataType::BLOB:
+ aTransfer.transferComplexValue( &XRow::getBlob, &XParameters::setBlob );
+ break;
+
+ case DataType::CLOB:
+ aTransfer.transferComplexValue( &XRow::getClob, &XParameters::setClob );
+ break;
+
+ default:
+ {
+ OUString aMessage( DBA_RES( STR_CTW_UNSUPPORTED_COLUMN_TYPE ) );
+
+ aMessage = aMessage.replaceFirst( "$type$", OUString::number( aSourceColTypes[ nSourceColumn ] ) );
+ aMessage = aMessage.replaceFirst( "$pos$", OUString::number( nSourceColumn ) );
+
+ ::dbtools::throwSQLException(
+ aMessage,
+ ::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE,
+ *this
+ );
+ }
+ }
+ ++nSourceColumn;
+ }
+ xStatement->executeUpdate();
+
+ // notify listeners
+ m_aCopyTableListeners.notifyEach( &XCopyTableListener::copiedRow, aCopyEvent );
+ }
+ catch( const Exception& )
+ {
+ aCopyEvent.Error = ::cppu::getCaughtException();
+ }
+
+ if ( aCopyEvent.Error.hasValue() )
+ bContinue = impl_processCopyError_nothrow( aCopyEvent );
+ }
+ while( bContinue );
+}
+
+void CopyTableWizard::impl_doCopy_nothrow()
+{
+ Any aError;
+
+ try
+ {
+ OCopyTableWizard& rWizard( impl_getDialog_throw() );
+
+ weld::WaitObject aWO(rWizard.getDialog());
+ Reference< XPropertySet > xTable;
+
+ switch ( rWizard.getOperation() )
+ {
+ case CopyTableOperation::CopyDefinitionOnly:
+ case CopyTableOperation::CopyDefinitionAndData:
+ {
+ xTable = rWizard.createTable();
+
+ if( !xTable.is() )
+ {
+ SAL_WARN("dbaccess.ui", "CopyTableWizard::impl_doCopy_nothrow: createTable should throw here, shouldn't it?" );
+ break;
+ }
+
+ if( CopyTableOperation::CopyDefinitionOnly == rWizard.getOperation() )
+ break;
+
+ [[fallthrough]];
+ }
+
+ case CopyTableOperation::AppendData:
+ {
+ // note that the CopyDefinitionAndData case falls through to here.
+ assert((rWizard.getOperation() == CopyTableOperation::CopyDefinitionAndData) ||
+ (rWizard.getOperation() == CopyTableOperation::AppendData));
+ assert((rWizard.getOperation() == CopyTableOperation::CopyDefinitionAndData) == xTable.is());
+ if ( !xTable.is() )
+ {
+ assert(rWizard.getOperation() == CopyTableOperation::AppendData);
+ xTable = rWizard.getTable();
+ if ( !xTable.is() )
+ {
+ SAL_WARN("dbaccess.ui", "CopyTableWizard::impl_doCopy_nothrow: getTable should throw here, shouldn't it?" );
+ break;
+ }
+ }
+
+ ::utl::SharedUNOComponent< XPreparedStatement > xSourceStatement;
+ ::utl::SharedUNOComponent< XResultSet > xSourceResultSet;
+
+ if ( m_xSourceResultSet.is() )
+ {
+ xSourceResultSet.reset( m_xSourceResultSet, ::utl::SharedUNOComponent< XResultSet >::NoTakeOwnership );
+ }
+ else
+ {
+ const bool bIsSameConnection = ( m_xSourceConnection.getTyped() == m_xDestConnection.getTyped() );
+ const bool bIsTable = ( CommandType::TABLE == m_nCommandType );
+ bool bDone = false;
+ if ( bIsSameConnection && bIsTable )
+ {
+ // try whether the server supports copying via SQL
+ try
+ {
+ m_xDestConnection->createStatement()->executeUpdate( impl_getServerSideCopyStatement_throw(xTable) );
+ bDone = true;
+ }
+ catch( const Exception& )
+ {
+ // this is allowed.
+ }
+ }
+
+ if ( !bDone )
+ {
+ xSourceStatement.set( impl_createSourceStatement_throw(), UNO_SET_THROW );
+ xSourceResultSet.set( xSourceStatement->executeQuery(), UNO_SET_THROW );
+ }
+ }
+
+ if ( xSourceResultSet.is() )
+ impl_copyRows_throw( xSourceResultSet, xTable );
+ }
+ break;
+
+ case CopyTableOperation::CreateAsView:
+ rWizard.createView();
+ break;
+
+ default:
+ SAL_WARN("dbaccess.ui", "CopyTableWizard::impl_doCopy_nothrow: What operation, please?" );
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ aError = ::cppu::getCaughtException();
+
+ // silence the error of the user cancelling the parameter's dialog
+ SQLException aSQLError;
+ if ( ( aError >>= aSQLError ) && ( aSQLError.ErrorCode == ::dbtools::ParameterInteractionCancelled ) )
+ {
+ aError.clear();
+ m_nOverrideExecutionResult = RET_CANCEL;
+ }
+ }
+
+ if ( aError.hasValue() && m_xInteractionHandler.is() )
+ {
+ try
+ {
+ ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( aError ) );
+ m_xInteractionHandler->handle( xRequest.get() );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ }
+}
+
+OUString CopyTableWizard::impl_getServerSideCopyStatement_throw(const Reference< XPropertySet >& _xTable)
+{
+ const Reference<XColumnsSupplier> xDestColsSup(_xTable,UNO_QUERY_THROW);
+ const Sequence< OUString> aDestColumnNames = xDestColsSup->getColumns()->getElementNames();
+ const Reference< XDatabaseMetaData > xDestMetaData( m_xDestConnection->getMetaData(), UNO_SET_THROW );
+ const OUString sQuote = xDestMetaData->getIdentifierQuoteString();
+ OUStringBuffer sColumns;
+ // 1st check if the columns matching
+ for ( auto const & rColumnPositionPair : impl_getDialog_throw().GetColumnPositions() )
+ {
+ if ( COLUMN_POSITION_NOT_FOUND != rColumnPositionPair.second )
+ {
+ if ( !sColumns.isEmpty() )
+ sColumns.append(",");
+ sColumns.append(sQuote).append(aDestColumnNames[rColumnPositionPair.second - 1]).append(sQuote);
+ }
+ }
+ const OUString sComposedTableName = ::dbtools::composeTableName( xDestMetaData, _xTable, ::dbtools::EComposeRule::InDataManipulation, true );
+ OUString sSql("INSERT INTO " + sComposedTableName + " ( " + sColumns.makeStringAndClear() + " ) " + m_pSourceObject->getSelectStatement());
+
+ return sSql;
+}
+
+void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( isInitialized() )
+ throw AlreadyInitializedException( OUString(), *this );
+
+ sal_Int32 nArgCount( _rArguments.getLength() );
+ if ( ( nArgCount != 2 ) && ( nArgCount != 3 ) )
+ throw IllegalArgumentException(
+ DBA_RES( STR_CTW_ILLEGAL_PARAMETER_COUNT ),
+ *this,
+ 1
+ );
+
+ try
+ {
+ if ( nArgCount == 3 )
+ { // ->createWithInteractionHandler
+ if ( !( _rArguments[2] >>= m_xInteractionHandler ) )
+ throw IllegalArgumentException(
+ DBA_RES( STR_CTW_ERROR_INVALID_INTERACTIONHANDLER ),
+ *this,
+ 3
+ );
+ }
+ if ( !m_xInteractionHandler.is() )
+ m_xInteractionHandler = InteractionHandler::createWithParent(m_xContext, nullptr);
+
+ Reference< XInteractionHandler > xSourceDocHandler;
+ Reference< XPropertySet > xSourceDescriptor( impl_ensureDataAccessDescriptor_throw( _rArguments, 0, m_xSourceConnection, xSourceDocHandler ) );
+ impl_checkForUnsupportedSettings_throw( xSourceDescriptor );
+ m_pSourceObject = impl_extractSourceObject_throw( xSourceDescriptor, m_nCommandType );
+ impl_extractSourceResultSet_throw( xSourceDescriptor );
+
+ Reference< XInteractionHandler > xDestDocHandler;
+ impl_ensureDataAccessDescriptor_throw( _rArguments, 1, m_xDestConnection, xDestDocHandler );
+
+ if ( xDestDocHandler.is() && !m_xInteractionHandler.is() )
+ m_xInteractionHandler = xDestDocHandler;
+
+ Reference< XPropertySet > xInteractionHandler(m_xInteractionHandler, UNO_QUERY);
+ if (xInteractionHandler.is())
+ {
+ Any aParentWindow(xInteractionHandler->getPropertyValue("ParentWindow"));
+ aParentWindow >>= m_xParent;
+ }
+ }
+ catch( const RuntimeException& ) { throw; }
+ catch( const SQLException& ) { throw; }
+ catch( const Exception& )
+ {
+ throw WrappedTargetException(
+ DBA_RES( STR_CTW_ERROR_DURING_INITIALIZATION ),
+ *this,
+ ::cppu::getCaughtException()
+ );
+ }
+}
+
+::cppu::IPropertyArrayHelper& CopyTableWizard::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+::cppu::IPropertyArrayHelper* CopyTableWizard::createArrayHelper( ) const
+{
+ Sequence< Property > aProps;
+ describeProperties( aProps );
+ return new ::cppu::OPropertyArrayHelper( aProps );
+}
+
+std::unique_ptr<weld::DialogController> CopyTableWizard::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+{
+ OSL_PRECOND( isInitialized(), "CopyTableWizard::createDialog: not initialized!" );
+ // this should have been prevented in ::execute already
+
+ auto xWizard = std::make_unique<OCopyTableWizard>(
+ Application::GetFrameWeld(rParent),
+ m_sDestinationTable,
+ m_nOperation,
+ *m_pSourceObject,
+ m_xSourceConnection.getTyped(),
+ m_xDestConnection.getTyped(),
+ m_xContext,
+ m_xInteractionHandler);
+
+ impl_attributesToDialog_nothrow(*xWizard);
+
+ return xWizard;
+}
+
+void CopyTableWizard::executedDialog( sal_Int16 _nExecutionResult )
+{
+ CopyTableWizard_DialogBase::executedDialog( _nExecutionResult );
+
+ if ( _nExecutionResult == RET_OK )
+ impl_doCopy_nothrow();
+
+ // do this after impl_doCopy_nothrow: The attributes may change during copying, for instance
+ // if the user entered an unqualified table name
+ impl_dialogToAttributes_nothrow( impl_getDialog_throw() );
+}
+
+} // namespace dbaui
+
+extern "C" void createRegistryInfo_CopyTableWizard()
+{
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::CopyTableWizard > aAutoRegistration;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/dbinteraction.cxx b/dbaccess/source/ui/uno/dbinteraction.cxx
new file mode 100644
index 000000000..c3ba87ab0
--- /dev/null
+++ b/dbaccess/source/ui/uno/dbinteraction.cxx
@@ -0,0 +1,367 @@
+/* -*- 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 .
+ */
+
+#include "dbinteraction.hxx"
+#include <apitools.hxx>
+#include <dbu_reghelper.hxx>
+#include <uiservices.hxx>
+#include <tools/diagnose_ex.h>
+#include <osl/diagnose.h>
+#include <connectivity/dbexception.hxx>
+#include <sqlmessage.hxx>
+#include <com/sun/star/task/InteractionHandler.hpp>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#include <com/sun/star/sdb/XInteractionSupplyParameters.hpp>
+#include <com/sun/star/sdb/XInteractionDocumentSave.hpp>
+#include <sfx2/QuerySaveDocument.hxx>
+#include <paramdialog.hxx>
+#include <vcl/svapp.hxx>
+#include <CollectionView.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+
+extern "C" void createRegistryInfo_OInteractionHandler()
+{
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::SQLExceptionInteractionHandler > aSQLExceptionInteractionHandler_AutoRegistration;
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::LegacyInteractionHandler > aLegacyInteractionHandler_AutoRegistration;
+}
+
+namespace dbaui
+{
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::ucb;
+ using namespace ::com::sun::star::sdb;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::task;
+ using namespace ::com::sun::star::beans;
+ using namespace ::dbtools;
+
+ // BasicInteractionHandler
+ BasicInteractionHandler::BasicInteractionHandler( const Reference< XComponentContext >& rxContext, const bool i_bFallbackToGeneric )
+ :m_xContext( rxContext )
+ ,m_bFallbackToGeneric( i_bFallbackToGeneric )
+ {
+ OSL_ENSURE( !m_bFallbackToGeneric,
+ "BasicInteractionHandler::BasicInteractionHandler: enabling legacy behavior, there should be no clients of this anymore!" );
+ }
+
+ void SAL_CALL BasicInteractionHandler::initialize(const Sequence<Any>& rArgs)
+ {
+ comphelper::SequenceAsHashMap aMap(rArgs);
+ m_xParentWindow.set(aMap.getValue("Parent"), UNO_QUERY);
+ }
+
+ sal_Bool SAL_CALL BasicInteractionHandler::handleInteractionRequest( const Reference< XInteractionRequest >& i_rRequest )
+ {
+ return impl_handle_throw( i_rRequest );
+ }
+
+ void SAL_CALL BasicInteractionHandler::handle( const Reference< XInteractionRequest >& i_rRequest )
+ {
+ impl_handle_throw( i_rRequest );
+ }
+
+ bool BasicInteractionHandler::impl_handle_throw( const Reference< XInteractionRequest >& i_Request )
+ {
+ Any aRequest( i_Request->getRequest() );
+ OSL_ENSURE(aRequest.hasValue(), "BasicInteractionHandler::handle: invalid request!");
+ if ( !aRequest.hasValue() )
+ // no request -> no handling
+ return false;
+
+ Sequence< Reference< XInteractionContinuation > > aContinuations( i_Request->getContinuations() );
+
+ // try to extract an SQLException (or one of its derived members
+ SQLExceptionInfo aInfo( aRequest );
+ if ( aInfo.isValid() )
+ {
+ implHandle( aInfo, aContinuations );
+ return true;
+ }
+
+ ParametersRequest aParamRequest;
+ if ( aRequest >>= aParamRequest )
+ {
+ implHandle( aParamRequest, aContinuations );
+ return true;
+ }
+
+ DocumentSaveRequest aDocuRequest;
+ if ( aRequest >>= aDocuRequest )
+ {
+ implHandle( aDocuRequest, aContinuations );
+ return true;
+ }
+
+ if ( m_bFallbackToGeneric )
+ return implHandleUnknown( i_Request );
+
+ return false;
+ }
+
+ void BasicInteractionHandler::implHandle(const ParametersRequest& _rParamRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations)
+ {
+ SolarMutexGuard aGuard;
+ // want to open a dialog...
+
+ sal_Int32 nAbortPos = getContinuation(ABORT, _rContinuations);
+ sal_Int32 nParamPos = getContinuation(SUPPLY_PARAMETERS, _rContinuations);
+
+ Reference< XInteractionSupplyParameters > xParamCallback;
+ if (-1 != nParamPos)
+ xParamCallback.set(_rContinuations[nParamPos], UNO_QUERY);
+ OSL_ENSURE(xParamCallback.is(), "BasicInteractionHandler::implHandle(ParametersRequest): can't set the parameters without an appropriate interaction handler!s");
+
+ OParameterDialog aDlg(Application::GetFrameWeld(m_xParentWindow), _rParamRequest.Parameters, _rParamRequest.Connection, m_xContext);
+ sal_Int16 nResult = aDlg.run();
+ try
+ {
+ switch (nResult)
+ {
+ case RET_OK:
+ if (xParamCallback.is())
+ {
+ xParamCallback->setParameters(aDlg.getValues());
+ xParamCallback->select();
+ }
+ break;
+ default:
+ if (-1 != nAbortPos)
+ _rContinuations[nAbortPos]->select();
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ }
+
+ void BasicInteractionHandler::implHandle(const SQLExceptionInfo& _rSqlInfo, const Sequence< Reference< XInteractionContinuation > >& _rContinuations)
+ {
+ SolarMutexGuard aGuard;
+ // want to open a dialog...
+
+ sal_Int32 nApprovePos = getContinuation(APPROVE, _rContinuations);
+ sal_Int32 nDisapprovePos = getContinuation(DISAPPROVE, _rContinuations);
+ sal_Int32 nAbortPos = getContinuation(ABORT, _rContinuations);
+ sal_Int32 nRetryPos = getContinuation(RETRY, _rContinuations);
+
+ // determine the style of the dialog, dependent on the present continuation types
+ MessBoxStyle nDialogStyle = MessBoxStyle::NONE;
+ bool bHaveCancel = nAbortPos != -1;
+ // "approve" means "Yes", "disapprove" means "No"
+ // VCL only supports having both (which makes sense ...)
+ if ( ( nApprovePos != -1 ) || ( nDisapprovePos != -1 ) )
+ nDialogStyle = ( bHaveCancel ? MessBoxStyle::YesNoCancel : MessBoxStyle::YesNo ) | MessBoxStyle::DefaultYes;
+ else
+ {
+ // if there's no yes/no, then use a default OK button
+ nDialogStyle = ( bHaveCancel ? MessBoxStyle::OkCancel : MessBoxStyle::Ok ) | MessBoxStyle::DefaultOk;
+ }
+
+ // If there's a "Retry" continuation, have a "Retry" button
+ if ( nRetryPos != -1 )
+ {
+ nDialogStyle = MessBoxStyle::RetryCancel | MessBoxStyle::DefaultRetry;
+ }
+
+ // execute the dialog
+ OSQLMessageBox aDialog(nullptr, _rSqlInfo, nDialogStyle);
+ // TODO: need a way to specify the parent window
+ sal_Int16 nResult = aDialog.run();
+ try
+ {
+ switch (nResult)
+ {
+ case RET_YES:
+ case RET_OK:
+ if ( nApprovePos != -1 )
+ _rContinuations[ nApprovePos ]->select();
+ else
+ OSL_ENSURE( nResult != RET_YES, "BasicInteractionHandler::implHandle: no handler for YES!" );
+ break;
+
+ case RET_NO:
+ if ( nDisapprovePos != -1 )
+ _rContinuations[ nDisapprovePos ]->select();
+ else
+ OSL_FAIL( "BasicInteractionHandler::implHandle: no handler for NO!" );
+ break;
+
+ case RET_CANCEL:
+ if ( nAbortPos != -1 )
+ _rContinuations[ nAbortPos ]->select();
+ else if ( nDisapprovePos != -1 )
+ _rContinuations[ nDisapprovePos ]->select();
+ else
+ OSL_FAIL( "BasicInteractionHandler::implHandle: no handler for CANCEL!" );
+ break;
+ case RET_RETRY:
+ if ( nRetryPos != -1 )
+ _rContinuations[ nRetryPos ]->select();
+ else
+ OSL_FAIL( "BasicInteractionHandler::implHandle: where does the RETRY come from?" );
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ }
+ void BasicInteractionHandler::implHandle(const DocumentSaveRequest& _rDocuRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations)
+ {
+ SolarMutexGuard aGuard;
+ // want to open a dialog...
+
+ sal_Int32 nApprovePos = getContinuation(APPROVE, _rContinuations);
+ sal_Int32 nDisApprovePos = getContinuation(DISAPPROVE, _rContinuations);
+ sal_Int32 nAbortPos = getContinuation(ABORT, _rContinuations);
+
+ short nRet = RET_YES;
+ if ( -1 != nApprovePos )
+ {
+ // ask whether it should be saved
+ nRet = ExecuteQuerySaveDocument(Application::GetFrameWeld(m_xParentWindow), _rDocuRequest.Name);
+ }
+
+ if ( RET_CANCEL == nRet )
+ {
+ if (-1 != nAbortPos)
+ _rContinuations[nAbortPos]->select();
+ return;
+ }
+ else if ( RET_YES == nRet )
+ {
+ sal_Int32 nDocuPos = getContinuation(SUPPLY_DOCUMENTSAVE, _rContinuations);
+
+ if (-1 != nDocuPos)
+ {
+ Reference< XInteractionDocumentSave > xCallback(_rContinuations[nDocuPos], UNO_QUERY);
+ OSL_ENSURE(xCallback.is(), "BasicInteractionHandler::implHandle(DocumentSaveRequest): can't save document without an appropriate interaction handler!s");
+
+ OCollectionView aDlg(Application::GetFrameWeld(m_xParentWindow), _rDocuRequest.Content, _rDocuRequest.Name, m_xContext);
+ sal_Int16 nResult = aDlg.run();
+ try
+ {
+ switch (nResult)
+ {
+ case RET_OK:
+ if (xCallback.is())
+ {
+ xCallback->setName(aDlg.getName(), aDlg.getSelectedFolder());
+ xCallback->select();
+ }
+ break;
+ default:
+ if (-1 != nAbortPos)
+ _rContinuations[nAbortPos]->select();
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ }
+ else if ( -1 != nApprovePos )
+ _rContinuations[nApprovePos]->select();
+ }
+ else if ( -1 != nDisApprovePos )
+ _rContinuations[nDisApprovePos]->select();
+ }
+
+ bool BasicInteractionHandler::implHandleUnknown( const Reference< XInteractionRequest >& _rxRequest )
+ {
+ if ( m_xContext.is() )
+ {
+ Reference< XInteractionHandler2 > xFallbackHandler(
+ InteractionHandler::createWithParent(m_xContext, nullptr) );
+ xFallbackHandler->handle( _rxRequest );
+ return true;
+ }
+ return false;
+ }
+
+ sal_Int32 BasicInteractionHandler::getContinuation(Continuation _eCont, const Sequence< Reference< XInteractionContinuation > >& _rContinuations)
+ {
+ const Reference< XInteractionContinuation >* pContinuations = _rContinuations.getConstArray();
+ for (sal_Int32 i=0; i<_rContinuations.getLength(); ++i, ++pContinuations)
+ {
+ switch (_eCont)
+ {
+ case APPROVE:
+ if (Reference< XInteractionApprove >(*pContinuations, UNO_QUERY).is())
+ return i;
+ break;
+ case DISAPPROVE:
+ if (Reference< XInteractionDisapprove >(*pContinuations, UNO_QUERY).is())
+ return i;
+ break;
+ case RETRY:
+ if (Reference< XInteractionRetry >(*pContinuations, UNO_QUERY).is())
+ return i;
+ break;
+ case ABORT:
+ if (Reference< XInteractionAbort >(*pContinuations, UNO_QUERY).is())
+ return i;
+ break;
+ case SUPPLY_PARAMETERS:
+ if (Reference< XInteractionSupplyParameters >(*pContinuations, UNO_QUERY).is())
+ return i;
+ break;
+ case SUPPLY_DOCUMENTSAVE:
+ if (Reference< XInteractionDocumentSave >(*pContinuations, UNO_QUERY).is())
+ return i;
+ break;
+ }
+ }
+
+ return -1;
+ }
+
+ // SQLExceptionInteractionHandler
+ IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(SQLExceptionInteractionHandler, "com.sun.star.comp.dbaccess.DatabaseInteractionHandler")
+ IMPLEMENT_SERVICE_INFO_SUPPORTS(SQLExceptionInteractionHandler)
+ IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(SQLExceptionInteractionHandler, "com.sun.star.sdb.DatabaseInteractionHandler")
+
+ Reference< XInterface >
+ SQLExceptionInteractionHandler::Create(const Reference< XMultiServiceFactory >& _rxORB)
+ {
+ return static_cast< XServiceInfo* >(new SQLExceptionInteractionHandler(comphelper::getComponentContext(_rxORB)));
+ }
+
+ // LegacyInteractionHandler
+ IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(LegacyInteractionHandler, "com.sun.star.comp.dbaccess.LegacyInteractionHandler")
+ IMPLEMENT_SERVICE_INFO_SUPPORTS(LegacyInteractionHandler)
+ IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(LegacyInteractionHandler, "com.sun.star.sdb.InteractionHandler")
+
+ Reference< XInterface >
+ LegacyInteractionHandler::Create(const Reference< XMultiServiceFactory >& _rxORB)
+ {
+ return static_cast< XServiceInfo* >(new LegacyInteractionHandler(comphelper::getComponentContext(_rxORB)));
+ }
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/dbinteraction.hxx b/dbaccess/source/ui/uno/dbinteraction.hxx
new file mode 100644
index 000000000..66e0bfb16
--- /dev/null
+++ b/dbaccess/source/ui/uno/dbinteraction.hxx
@@ -0,0 +1,184 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_DBINTERACTION_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_DBINTERACTION_HXX
+
+#include <cppuhelper/implbase.hxx>
+#include <connectivity/CommonTools.hxx>
+
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/task/XInteractionHandler2.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sdb/ParametersRequest.hpp>
+#include <com/sun/star/sdb/DocumentSaveRequest.hpp>
+
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace dbtools
+{
+ class SQLExceptionInfo;
+}
+
+namespace dbaui
+{
+
+ // BasicInteractionHandler
+ typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo
+ , css::lang::XInitialization
+ , css::task::XInteractionHandler2
+ > BasicInteractionHandler_Base;
+ /** implements an <type scope="com.sun.star.task">XInteractionHandler</type> for
+ database related interaction requests.
+ <p/>
+ Supported interaction requests by now (specified by an exception: The appropriate exception
+ has to be returned by the getRequest method of the object implementing the
+ <type scope="com.sun.star.task">XInteractionRequest</type> interface.
+ <ul>
+ <li><b><type scope="com.sun.star.sdbc">SQLException</type></b>: requests to display a
+ standard error dialog for the (maybe chained) exception given</li>
+ </ul>
+ */
+ class BasicInteractionHandler
+ :public BasicInteractionHandler_Base
+ {
+ css::uno::Reference< css::awt::XWindow > m_xParentWindow;
+ const css::uno::Reference< css::uno::XComponentContext >
+ m_xContext;
+ const bool m_bFallbackToGeneric;
+
+ public:
+ BasicInteractionHandler(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const bool i_bFallbackToGeneric
+ );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArgs ) override;
+
+ // XInteractionHandler2
+ virtual sal_Bool SAL_CALL handleInteractionRequest( const css::uno::Reference< css::task::XInteractionRequest >& Request ) override;
+
+ // XInteractionHandler
+ virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& Request ) override;
+
+ protected:
+ bool
+ impl_handle_throw( const css::uno::Reference< css::task::XInteractionRequest >& i_Request );
+
+ /// handle SQLExceptions (and derived classes)
+ static void implHandle(
+ const ::dbtools::SQLExceptionInfo& _rSqlInfo,
+ const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >& _rContinuations);
+
+ /// handle parameter requests
+ void implHandle(
+ const css::sdb::ParametersRequest& _rParamRequest,
+ const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >& _rContinuations);
+
+ /// handle document save requests
+ void implHandle(
+ const css::sdb::DocumentSaveRequest& _rParamRequest,
+ const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >& _rContinuations);
+
+ /// handles requests which are not SDB-specific
+ bool implHandleUnknown(
+ const css::uno::Reference< css::task::XInteractionRequest >& _rxRequest );
+
+ /// known continuation types
+ enum Continuation
+ {
+ APPROVE,
+ DISAPPROVE,
+ RETRY,
+ ABORT,
+ SUPPLY_PARAMETERS,
+ SUPPLY_DOCUMENTSAVE
+ };
+ /** check if a given continuation sequence contains a given continuation type<p/>
+ @return the index within <arg>_rContinuations</arg> of the first occurrence of a continuation
+ of the requested type, -1 of no such continuation exists
+ */
+ static sal_Int32 getContinuation(
+ Continuation _eCont,
+ const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >& _rContinuations);
+ };
+
+ // SQLExceptionInteractionHandler
+ class SQLExceptionInteractionHandler : public BasicInteractionHandler
+ {
+ public:
+ explicit SQLExceptionInteractionHandler(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ )
+ :BasicInteractionHandler( rxContext, false )
+ {
+ }
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static( );
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+ };
+
+ // SQLExceptionInteractionHandler
+ /** an implementation for the legacy css.sdb.InteractionHandler
+
+ css.sdb.InteractionHandler is deprecated, as it does not only handle database related interactions,
+ but also delegates all kind of unknown requests to a css.task.InteractionHandler.
+
+ In today's architecture, there's only one central css.task.InteractionHandler, which is to be used
+ for all requests. Depending on configuration information, it decides which handler implementation
+ to delegate a request to.
+
+ SQLExceptionInteractionHandler is the delegatee which handles only database related interactions.
+ LegacyInteractionHandler is the version which first checks for a database related interaction, and
+ forwards everything else to the css.task.InteractionHandler.
+ */
+ class LegacyInteractionHandler : public BasicInteractionHandler
+ {
+ public:
+ explicit LegacyInteractionHandler(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext
+ )
+ :BasicInteractionHandler( rxContext, true )
+ {
+ }
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static( );
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+ };
+
+} // namespace dbaui
+
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_DBINTERACTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
new file mode 100644
index 000000000..a6f826127
--- /dev/null
+++ b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
@@ -0,0 +1,271 @@
+/* -*- 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 .
+ */
+
+#include <textconnectionsettings.hxx>
+#include <uiservices.hxx>
+#include <dbu_reghelper.hxx>
+#include <apitools.hxx>
+#include <unoadmin.hxx>
+#include <stringconstants.hxx>
+#include <propertystorage.hxx>
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/sdb/XTextConnectionSettings.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
+#include <cppuhelper/implbase.hxx>
+
+namespace dbaui
+{
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::XComponentContext;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::beans::Property;
+
+ namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
+
+ // OTextConnectionSettingsDialog
+
+ namespace {
+
+ class OTextConnectionSettingsDialog;
+
+ }
+
+ typedef ::cppu::ImplInheritanceHelper< ODatabaseAdministrationDialog
+ , css::sdb::XTextConnectionSettings
+ > OTextConnectionSettingsDialog_BASE;
+ typedef ::comphelper::OPropertyArrayUsageHelper< OTextConnectionSettingsDialog > OTextConnectionSettingsDialog_PBASE;
+
+ namespace {
+
+ class OTextConnectionSettingsDialog
+ :public OTextConnectionSettingsDialog_BASE
+ ,public OTextConnectionSettingsDialog_PBASE
+ ,public ::cppu::WeakImplHelper< css::sdb::XTextConnectionSettings >
+ {
+ PropertyValues m_aPropertyValues;
+
+ protected:
+ explicit OTextConnectionSettingsDialog( const Reference<XComponentContext>& _rContext );
+ virtual ~OTextConnectionSettingsDialog() override;
+
+ public:
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
+
+ DECLARE_SERVICE_INFO();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static( );
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+ DECLARE_PROPERTYCONTAINER_DEFAULTS( );
+
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) override;
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) override;
+ virtual void SAL_CALL getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const override;
+
+ // Overrides to resolve inheritance ambiguity
+ virtual void SAL_CALL setPropertyValue(const OUString& p1, const css::uno::Any& p2) override
+ { ODatabaseAdministrationDialog::setPropertyValue(p1, p2); }
+ virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& p1) override
+ { return ODatabaseAdministrationDialog::getPropertyValue(p1); }
+ virtual void SAL_CALL addPropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) override
+ { ODatabaseAdministrationDialog::addPropertyChangeListener(p1, p2); }
+ virtual void SAL_CALL removePropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) override
+ { ODatabaseAdministrationDialog::removePropertyChangeListener(p1, p2); }
+ virtual void SAL_CALL addVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) override
+ { ODatabaseAdministrationDialog::addVetoableChangeListener(p1, p2); }
+ virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) override
+ { ODatabaseAdministrationDialog::removeVetoableChangeListener(p1, p2); }
+ virtual void SAL_CALL setTitle(const OUString& p1) override
+ { ODatabaseAdministrationDialog::setTitle(p1); }
+ virtual sal_Int16 SAL_CALL execute() override
+ { return ODatabaseAdministrationDialog::execute(); }
+
+ protected:
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+ using OTextConnectionSettingsDialog_BASE::getFastPropertyValue;
+ };
+
+ }
+
+ // OTextConnectionSettingsDialog
+ OTextConnectionSettingsDialog::OTextConnectionSettingsDialog( const Reference<XComponentContext>& _rContext )
+ :OTextConnectionSettingsDialog_BASE( _rContext )
+ {
+ TextConnectionSettingsDialog::bindItemStorages( *m_pDatasourceItems, m_aPropertyValues );
+ }
+
+ OTextConnectionSettingsDialog::~OTextConnectionSettingsDialog()
+ {
+ }
+
+ css::uno::Sequence<sal_Int8>
+ OTextConnectionSettingsDialog::getImplementationId()
+ {
+ return css::uno::Sequence<sal_Int8>();
+ }
+
+ IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(OTextConnectionSettingsDialog, "com.sun.star.comp.dbaccess.OTextConnectionSettingsDialog")
+ IMPLEMENT_SERVICE_INFO_SUPPORTS(OTextConnectionSettingsDialog)
+ IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(OTextConnectionSettingsDialog, "com.sun.star.sdb.TextConnectionSettings")
+
+ css::uno::Reference< css::uno::XInterface >
+ OTextConnectionSettingsDialog::Create(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxORB)
+ {
+ return static_cast< XServiceInfo* >(new OTextConnectionSettingsDialog( comphelper::getComponentContext(_rxORB)));
+ }
+
+ Reference< XPropertySetInfo > SAL_CALL OTextConnectionSettingsDialog::getPropertySetInfo()
+ {
+ return createPropertySetInfo( getInfoHelper() );
+ }
+
+ ::cppu::IPropertyArrayHelper& OTextConnectionSettingsDialog::getInfoHelper()
+ {
+ return *getArrayHelper();
+ }
+
+ ::cppu::IPropertyArrayHelper* OTextConnectionSettingsDialog::createArrayHelper( ) const
+ {
+ Sequence< Property > aProps;
+ describeProperties( aProps );
+
+ // in addition to the properties registered by the base class, we have
+ // more properties which are not even handled by the PropertyContainer implementation,
+ // but whose values are stored in our item set
+ sal_Int32 nProp = aProps.getLength();
+ aProps.realloc( nProp + 6 );
+
+ aProps[ nProp++ ] = Property(
+ "HeaderLine",
+ PROPERTY_ID_HEADER_LINE,
+ ::cppu::UnoType< sal_Bool >::get(),
+ PropertyAttribute::TRANSIENT
+ );
+
+ aProps[ nProp++ ] = Property(
+ "FieldDelimiter",
+ PROPERTY_ID_FIELD_DELIMITER,
+ ::cppu::UnoType< OUString >::get(),
+ PropertyAttribute::TRANSIENT
+ );
+
+ aProps[ nProp++ ] = Property(
+ "StringDelimiter",
+ PROPERTY_ID_STRING_DELIMITER,
+ ::cppu::UnoType< OUString >::get(),
+ PropertyAttribute::TRANSIENT
+ );
+
+ aProps[ nProp++ ] = Property(
+ "DecimalDelimiter",
+ PROPERTY_ID_DECIMAL_DELIMITER,
+ ::cppu::UnoType< OUString >::get(),
+ PropertyAttribute::TRANSIENT
+ );
+
+ aProps[ nProp++ ] = Property(
+ "ThousandDelimiter",
+ PROPERTY_ID_THOUSAND_DELIMITER,
+ ::cppu::UnoType< OUString >::get(),
+ PropertyAttribute::TRANSIENT
+ );
+
+ aProps[ nProp++ ] = Property(
+ "CharSet",
+ PROPERTY_ID_ENCODING,
+ ::cppu::UnoType< OUString >::get(),
+ PropertyAttribute::TRANSIENT
+ );
+
+ return new ::cppu::OPropertyArrayHelper( aProps );
+ }
+
+ std::unique_ptr<weld::DialogController> OTextConnectionSettingsDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+ {
+ return std::make_unique<TextConnectionSettingsDialog>(Application::GetFrameWeld(rParent), *m_pDatasourceItems);
+ }
+
+ void SAL_CALL OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue )
+ {
+ PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
+ if ( pos != m_aPropertyValues.end() )
+ {
+ pos->second->setPropertyValue( _rValue );
+ }
+ else
+ {
+ OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
+ }
+ }
+
+ sal_Bool SAL_CALL OTextConnectionSettingsDialog::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue)
+ {
+ bool bModified = false;
+
+ PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
+ if ( pos != m_aPropertyValues.end() )
+ {
+ // we're lazy here ...
+ _rConvertedValue = _rValue;
+ pos->second->getPropertyValue( _rOldValue );
+ bModified = true;
+ }
+ else
+ {
+ bModified = OTextConnectionSettingsDialog::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
+ }
+
+ return bModified;
+ }
+
+ void SAL_CALL OTextConnectionSettingsDialog::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
+ {
+ PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
+ if ( pos != m_aPropertyValues.end() )
+ {
+ pos->second->getPropertyValue( _rValue );
+ }
+ else
+ {
+ OTextConnectionSettingsDialog::getFastPropertyValue( _rValue, _nHandle );
+ }
+ }
+
+} // namespace dbaui
+
+extern "C" void createRegistryInfo_OTextConnectionSettingsDialog()
+{
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OTextConnectionSettingsDialog > aAutoRegistration;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/unoDirectSql.cxx b/dbaccess/source/ui/uno/unoDirectSql.cxx
new file mode 100644
index 000000000..7abfbdfef
--- /dev/null
+++ b/dbaccess/source/ui/uno/unoDirectSql.cxx
@@ -0,0 +1,126 @@
+/* -*- 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 .
+ */
+
+#include <sal/config.h>
+
+#include <uiservices.hxx>
+#include "unoDirectSql.hxx"
+#include <dbu_reghelper.hxx>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/connection/XConnection.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <directsql.hxx>
+#include <datasourceconnector.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+
+extern "C" void createRegistryInfo_ODirectSQLDialog()
+{
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::ODirectSQLDialog > aAutoRegistration;
+}
+
+namespace dbaui
+{
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::sdbcx;
+ using namespace ::com::sun::star::sdbc;
+
+ // ODirectSQLDialog
+ ODirectSQLDialog::ODirectSQLDialog(const Reference< XComponentContext >& _rxORB)
+ :ODirectSQLDialog_BASE( _rxORB )
+ {
+
+ }
+
+ ODirectSQLDialog::~ODirectSQLDialog()
+ {
+
+ }
+
+ css::uno::Sequence<sal_Int8> ODirectSQLDialog::getImplementationId()
+ {
+ return css::uno::Sequence<sal_Int8>();
+ }
+
+ IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(ODirectSQLDialog, "com.sun.star.comp.sdb.DirectSQLDialog")
+ IMPLEMENT_SERVICE_INFO_SUPPORTS(ODirectSQLDialog)
+ IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(ODirectSQLDialog, SERVICE_SDB_DIRECTSQLDIALOG)
+
+ css::uno::Reference< css::uno::XInterface >
+ ODirectSQLDialog::Create(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxORB)
+ {
+ return static_cast< XServiceInfo* >(new ODirectSQLDialog( comphelper::getComponentContext(_rxORB)));
+ }
+
+ IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ODirectSQLDialog )
+
+ std::unique_ptr<weld::DialogController> ODirectSQLDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+ {
+ // obtain all the objects needed for the dialog
+ Reference< XConnection > xConnection = m_xActiveConnection;
+ weld::Window* pParent = Application::GetFrameWeld(rParent);
+ if ( !xConnection.is() )
+ {
+ try
+ {
+ // the connection the row set is working with
+ ODatasourceConnector aDSConnector(m_aContext, pParent);
+ xConnection = aDSConnector.connect( m_sInitialSelection, nullptr );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ }
+ if (!xConnection.is())
+ {
+ // can't create the dialog if I have improper settings
+ return nullptr;
+ }
+
+ return std::make_unique<DirectSQLDialog>(pParent, xConnection);
+ }
+
+ void ODirectSQLDialog::implInitialize(const Any& _rValue)
+ {
+ PropertyValue aProperty;
+ if (_rValue >>= aProperty)
+ {
+ if (aProperty.Name == "InitialSelection")
+ {
+ OSL_VERIFY( aProperty.Value >>= m_sInitialSelection );
+ return;
+ }
+ else if (aProperty.Name == "ActiveConnection")
+ {
+ m_xActiveConnection.set( aProperty.Value, UNO_QUERY );
+ OSL_ENSURE( m_xActiveConnection.is(), "ODirectSQLDialog::implInitialize: invalid connection!" );
+ return;
+ }
+ }
+ ODirectSQLDialog_BASE::implInitialize(_rValue);
+ }
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/unoDirectSql.hxx b/dbaccess/source/ui/uno/unoDirectSql.hxx
new file mode 100644
index 000000000..afad0d820
--- /dev/null
+++ b/dbaccess/source/ui/uno/unoDirectSql.hxx
@@ -0,0 +1,70 @@
+/* -*- 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 INCLUDED_DBACCESS_SOURCE_UI_UNO_UNODIRECTSQL_HXX
+#define INCLUDED_DBACCESS_SOURCE_UI_UNO_UNODIRECTSQL_HXX
+
+#include <svtools/genericunodialog.hxx>
+#include <apitools.hxx>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <connectivity/CommonTools.hxx>
+
+namespace dbaui
+{
+
+ // ODirectSQLDialog
+ class ODirectSQLDialog;
+ typedef ::svt::OGenericUnoDialog ODirectSQLDialog_BASE;
+ typedef ::comphelper::OPropertyArrayUsageHelper< ODirectSQLDialog > ODirectSQLDialog_PBASE;
+
+ class ODirectSQLDialog
+ :public ODirectSQLDialog_BASE
+ ,public ODirectSQLDialog_PBASE
+ {
+ OUString m_sInitialSelection;
+ css::uno::Reference< css::sdbc::XConnection > m_xActiveConnection;
+ protected:
+ explicit ODirectSQLDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+ virtual ~ODirectSQLDialog() override;
+
+ public:
+ virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
+
+ DECLARE_SERVICE_INFO();
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static( );
+ /// @throws css::uno::RuntimeException
+ static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
+ static css::uno::Reference< css::uno::XInterface >
+ Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
+
+ DECLARE_PROPERTYCONTAINER_DEFAULTS( );
+
+ protected:
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+ virtual void implInitialize(const css::uno::Any& _rValue) override;
+ };
+
+} // namespace dbaui
+
+#endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_UNODIRECTSQL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/unoadmin.cxx b/dbaccess/source/ui/uno/unoadmin.cxx
new file mode 100644
index 000000000..f53df65a9
--- /dev/null
+++ b/dbaccess/source/ui/uno/unoadmin.cxx
@@ -0,0 +1,77 @@
+/* -*- 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 .
+ */
+
+#include <unoadmin.hxx>
+#include <dbadmin.hxx>
+
+#include <osl/mutex.hxx>
+
+
+namespace dbaui
+{
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XComponentContext >& _rxORB)
+ :ODatabaseAdministrationDialogBase(_rxORB)
+ ,m_pItemPool(nullptr)
+ ,m_pItemPoolDefaults(nullptr)
+{
+ m_pCollection.reset( new ::dbaccess::ODsnTypeCollection(_rxORB) );
+ ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection.get());
+}
+
+ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog()
+{
+ if (m_xDialog)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if (m_xDialog)
+ {
+ destroyDialog();
+ ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults);
+ }
+ }
+}
+
+void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue)
+{
+ PropertyValue aProperty;
+ if (_rValue >>= aProperty)
+ {
+ if (aProperty.Name == "InitialSelection")
+ {
+ m_aInitialSelection = aProperty.Value;
+ }
+ else if (aProperty.Name == "ActiveConnection")
+ {
+ m_xActiveConnection.set(aProperty.Value,UNO_QUERY);
+ }
+ else
+ ODatabaseAdministrationDialogBase::implInitialize(_rValue);
+ }
+ else
+ ODatabaseAdministrationDialogBase::implInitialize(_rValue);
+}
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/unosqlmessage.cxx b/dbaccess/source/ui/uno/unosqlmessage.cxx
new file mode 100644
index 000000000..4881a1744
--- /dev/null
+++ b/dbaccess/source/ui/uno/unosqlmessage.cxx
@@ -0,0 +1,160 @@
+/* -*- 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 .
+ */
+
+#include <sqlmessage.hxx>
+#include <uiservices.hxx>
+#include <unosqlmessage.hxx>
+#include <dbu_reghelper.hxx>
+#include <stringconstants.hxx>
+#include <strings.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
+#include <connectivity/dbexception.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/sdbc/SQLException.hpp>
+
+using namespace dbaui;
+using namespace dbtools;
+
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdb;
+
+extern "C" void createRegistryInfo_OSQLMessageDialog()
+{
+ static OMultiInstanceAutoRegistration< OSQLMessageDialog > aAutoRegistration;
+}
+
+namespace dbaui
+{
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+OSQLMessageDialog::OSQLMessageDialog(const Reference< XComponentContext >& _rxORB)
+ :OSQLMessageDialogBase(_rxORB)
+{
+ registerMayBeVoidProperty(PROPERTY_SQLEXCEPTION, PROPERTY_ID_SQLEXCEPTION, PropertyAttribute::TRANSIENT | PropertyAttribute::MAYBEVOID,
+ &m_aException, ::cppu::UnoType<SQLException>::get());
+ registerProperty( PROPERTY_HELP_URL, PROPERTY_ID_HELP_URL, PropertyAttribute::TRANSIENT,
+ &m_sHelpURL, cppu::UnoType<decltype(m_sHelpURL)>::get() );
+}
+
+Sequence<sal_Int8> SAL_CALL OSQLMessageDialog::getImplementationId( )
+{
+ return css::uno::Sequence<sal_Int8>();
+}
+
+Reference< XInterface > OSQLMessageDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
+{
+ return *(new OSQLMessageDialog( comphelper::getComponentContext(_rxFactory) ));
+}
+
+OUString SAL_CALL OSQLMessageDialog::getImplementationName()
+{
+ return getImplementationName_Static();
+}
+
+OUString OSQLMessageDialog::getImplementationName_Static()
+{
+ return "org.openoffice.comp.dbu.OSQLMessageDialog";
+}
+
+css::uno::Sequence<OUString> SAL_CALL OSQLMessageDialog::getSupportedServiceNames()
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence<OUString> OSQLMessageDialog::getSupportedServiceNames_Static()
+{
+ return { "com.sun.star.sdb.ErrorMessageDialog" };
+}
+
+void OSQLMessageDialog::initialize(Sequence<Any> const & args)
+{
+ OUString title;
+ Reference< css::awt::XWindow > parentWindow;
+
+ if ((args.getLength() == 3) && (args[0] >>= title) && (args[1] >>= parentWindow)) {
+ Sequence<Any> s(comphelper::InitAnyPropertySequence(
+ {
+ {"Title", Any(title)},
+ {"ParentWindow", Any(parentWindow)},
+ {"SQLException", args[2]}
+ }));
+ OGenericUnoDialog::initialize(s);
+ } else {
+ OGenericUnoDialog::initialize(args);
+ }
+}
+
+sal_Bool SAL_CALL OSQLMessageDialog::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue)
+{
+ switch (_nHandle)
+ {
+ case PROPERTY_ID_SQLEXCEPTION:
+ {
+ SQLExceptionInfo aInfo(_rValue);
+ if (!aInfo.isValid())
+ throw IllegalArgumentException();
+
+ _rOldValue = m_aException;
+ _rConvertedValue = aInfo.get();
+
+ return true;
+ // always assume "modified", don't bother with comparing the two values
+ }
+ default:
+ return OSQLMessageDialogBase::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue);
+ }
+}
+
+Reference<XPropertySetInfo> SAL_CALL OSQLMessageDialog::getPropertySetInfo()
+{
+ Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+::cppu::IPropertyArrayHelper& OSQLMessageDialog::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+::cppu::IPropertyArrayHelper* OSQLMessageDialog::createArrayHelper( ) const
+{
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+std::unique_ptr<weld::DialogController> OSQLMessageDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+{
+ weld::Window* pParent = Application::GetFrameWeld(rParent);
+ if ( m_aException.hasValue() )
+ return std::make_unique<OSQLMessageBox>(pParent, SQLExceptionInfo(m_aException), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, m_sHelpURL);
+
+ OSL_FAIL("OSQLMessageDialog::createDialog : You should use the SQLException property to specify the error to display!");
+ return std::make_unique<OSQLMessageBox>(pParent, SQLException());
+}
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */