summaryrefslogtreecommitdiffstats
path: root/dbaccess/source/ui/inc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /dbaccess/source/ui/inc
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dbaccess/source/ui/inc')
-rw-r--r--dbaccess/source/ui/inc/AppElementType.hxx53
-rw-r--r--dbaccess/source/ui/inc/ChildWindow.hxx38
-rw-r--r--dbaccess/source/ui/inc/CollectionView.hxx65
-rw-r--r--dbaccess/source/ui/inc/ColumnControlWindow.hxx82
-rw-r--r--dbaccess/source/ui/inc/ConnectionLine.hxx71
-rw-r--r--dbaccess/source/ui/inc/ConnectionLineAccess.hxx76
-rw-r--r--dbaccess/source/ui/inc/ConnectionLineData.hxx80
-rw-r--r--dbaccess/source/ui/inc/DExport.hxx162
-rw-r--r--dbaccess/source/ui/inc/FieldControls.hxx120
-rw-r--r--dbaccess/source/ui/inc/FieldDescControl.hxx201
-rw-r--r--dbaccess/source/ui/inc/FieldDescriptions.hxx111
-rw-r--r--dbaccess/source/ui/inc/GeneralUndo.hxx40
-rw-r--r--dbaccess/source/ui/inc/HtmlReader.hxx68
-rw-r--r--dbaccess/source/ui/inc/IClipBoardTest.hxx40
-rw-r--r--dbaccess/source/ui/inc/IItemSetHelper.hxx72
-rw-r--r--dbaccess/source/ui/inc/IUpdateHelper.hxx44
-rw-r--r--dbaccess/source/ui/inc/JAccess.hxx64
-rw-r--r--dbaccess/source/ui/inc/JoinController.hxx154
-rw-r--r--dbaccess/source/ui/inc/JoinDesignView.hxx68
-rw-r--r--dbaccess/source/ui/inc/JoinExchange.hxx62
-rw-r--r--dbaccess/source/ui/inc/JoinTableView.hxx325
-rw-r--r--dbaccess/source/ui/inc/QEnumTypes.hxx79
-rw-r--r--dbaccess/source/ui/inc/QueryDesignView.hxx154
-rw-r--r--dbaccess/source/ui/inc/QueryPropertiesDialog.hxx45
-rw-r--r--dbaccess/source/ui/inc/QueryTableView.hxx116
-rw-r--r--dbaccess/source/ui/inc/QueryTextView.hxx69
-rw-r--r--dbaccess/source/ui/inc/QueryViewSwitch.hxx94
-rw-r--r--dbaccess/source/ui/inc/RTableConnectionData.hxx79
-rw-r--r--dbaccess/source/ui/inc/RelControliFace.hxx40
-rw-r--r--dbaccess/source/ui/inc/RelationControl.hxx91
-rw-r--r--dbaccess/source/ui/inc/RelationController.hxx79
-rw-r--r--dbaccess/source/ui/inc/RelationDesignView.hxx45
-rw-r--r--dbaccess/source/ui/inc/RelationDlg.hxx74
-rw-r--r--dbaccess/source/ui/inc/RelationTableView.hxx74
-rw-r--r--dbaccess/source/ui/inc/RtfReader.hxx59
-rw-r--r--dbaccess/source/ui/inc/SqlNameEdit.hxx122
-rw-r--r--dbaccess/source/ui/inc/TableConnection.hxx98
-rw-r--r--dbaccess/source/ui/inc/TableConnectionData.hxx101
-rw-r--r--dbaccess/source/ui/inc/TableController.hxx129
-rw-r--r--dbaccess/source/ui/inc/TableCopyHelper.hxx188
-rw-r--r--dbaccess/source/ui/inc/TableDesignControl.hxx78
-rw-r--r--dbaccess/source/ui/inc/TableDesignHelpBar.hxx59
-rw-r--r--dbaccess/source/ui/inc/TableDesignView.hxx112
-rw-r--r--dbaccess/source/ui/inc/TableFieldDescription.hxx150
-rw-r--r--dbaccess/source/ui/inc/TableGrantCtrl.hxx104
-rw-r--r--dbaccess/source/ui/inc/TableRow.hxx76
-rw-r--r--dbaccess/source/ui/inc/TableRowExchange.hxx40
-rw-r--r--dbaccess/source/ui/inc/TableWindow.hxx183
-rw-r--r--dbaccess/source/ui/inc/TableWindowAccess.hxx79
-rw-r--r--dbaccess/source/ui/inc/TableWindowData.hxx95
-rw-r--r--dbaccess/source/ui/inc/TableWindowListBox.hxx121
-rw-r--r--dbaccess/source/ui/inc/TableWindowTitle.hxx44
-rw-r--r--dbaccess/source/ui/inc/TablesSingleDlg.hxx71
-rw-r--r--dbaccess/source/ui/inc/TokenWriter.hxx206
-rw-r--r--dbaccess/source/ui/inc/TypeInfo.hxx121
-rw-r--r--dbaccess/source/ui/inc/UITools.hxx396
-rw-r--r--dbaccess/source/ui/inc/UserAdminDlg.hxx76
-rw-r--r--dbaccess/source/ui/inc/WCPage.hxx78
-rw-r--r--dbaccess/source/ui/inc/WColumnSelect.hxx82
-rw-r--r--dbaccess/source/ui/inc/WCopyTable.hxx413
-rw-r--r--dbaccess/source/ui/inc/WExtendPages.hxx69
-rw-r--r--dbaccess/source/ui/inc/WNameMatch.hxx63
-rw-r--r--dbaccess/source/ui/inc/WTabPage.hxx46
-rw-r--r--dbaccess/source/ui/inc/WTypeSelect.hxx138
-rw-r--r--dbaccess/source/ui/inc/adtabdlg.hxx98
-rw-r--r--dbaccess/source/ui/inc/advancedsettingsdlg.hxx70
-rw-r--r--dbaccess/source/ui/inc/asyncmodaldialog.hxx47
-rw-r--r--dbaccess/source/ui/inc/browserids.hxx98
-rw-r--r--dbaccess/source/ui/inc/brwctrlr.hxx332
-rw-r--r--dbaccess/source/ui/inc/brwview.hxx96
-rw-r--r--dbaccess/source/ui/inc/callbacks.hxx123
-rw-r--r--dbaccess/source/ui/inc/charsetlistbox.hxx50
-rw-r--r--dbaccess/source/ui/inc/charsets.hxx105
-rw-r--r--dbaccess/source/ui/inc/commontypes.hxx39
-rw-r--r--dbaccess/source/ui/inc/curledit.hxx102
-rw-r--r--dbaccess/source/ui/inc/databaseobjectview.hxx230
-rw-r--r--dbaccess/source/ui/inc/datasourceconnector.hxx76
-rw-r--r--dbaccess/source/ui/inc/dbadmin.hxx114
-rw-r--r--dbaccess/source/ui/inc/dbexchange.hxx83
-rw-r--r--dbaccess/source/ui/inc/dbtreelistbox.hxx164
-rw-r--r--dbaccess/source/ui/inc/dbu_dlg.hxx24
-rw-r--r--dbaccess/source/ui/inc/dbwiz.hxx100
-rw-r--r--dbaccess/source/ui/inc/dbwizsetup.hxx170
-rw-r--r--dbaccess/source/ui/inc/defaultobjectnamecheck.hxx121
-rw-r--r--dbaccess/source/ui/inc/directsql.hxx113
-rw-r--r--dbaccess/source/ui/inc/dlgattr.hxx41
-rw-r--r--dbaccess/source/ui/inc/dlgsave.hxx100
-rw-r--r--dbaccess/source/ui/inc/dlgsize.hxx44
-rw-r--r--dbaccess/source/ui/inc/dsitems.hxx102
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx124
-rw-r--r--dbaccess/source/ui/inc/exsrcbrw.hxx96
-rw-r--r--dbaccess/source/ui/inc/formadapter.hxx436
-rw-r--r--dbaccess/source/ui/inc/imageprovider.hxx107
-rw-r--r--dbaccess/source/ui/inc/indexcollection.hxx93
-rw-r--r--dbaccess/source/ui/inc/indexdialog.hxx103
-rw-r--r--dbaccess/source/ui/inc/indexes.hxx81
-rw-r--r--dbaccess/source/ui/inc/indexfieldscontrol.hxx91
-rw-r--r--dbaccess/source/ui/inc/linkeddocuments.hxx108
-rw-r--r--dbaccess/source/ui/inc/objectnamecheck.hxx57
-rw-r--r--dbaccess/source/ui/inc/opendoccontrols.hxx78
-rw-r--r--dbaccess/source/ui/inc/paramdialog.hxx103
-rw-r--r--dbaccess/source/ui/inc/propertystorage.hxx54
-rw-r--r--dbaccess/source/ui/inc/querycontainerwindow.hxx104
-rw-r--r--dbaccess/source/ui/inc/querycontroller.hxx217
-rw-r--r--dbaccess/source/ui/inc/queryfilter.hxx109
-rw-r--r--dbaccess/source/ui/inc/queryorder.hxx81
-rw-r--r--dbaccess/source/ui/inc/sbagrid.hrc37
-rw-r--r--dbaccess/source/ui/inc/sbagrid.hxx291
-rw-r--r--dbaccess/source/ui/inc/sbamultiplex.hxx305
-rw-r--r--dbaccess/source/ui/inc/singledoccontroller.hxx78
-rw-r--r--dbaccess/source/ui/inc/sqledit.hxx100
-rw-r--r--dbaccess/source/ui/inc/sqlmessage.hxx145
-rw-r--r--dbaccess/source/ui/inc/stringlistitem.hxx48
-rw-r--r--dbaccess/source/ui/inc/tabletree.hxx155
-rw-r--r--dbaccess/source/ui/inc/textconnectionsettings.hxx59
-rw-r--r--dbaccess/source/ui/inc/undosqledit.hxx45
-rw-r--r--dbaccess/source/ui/inc/unoadmin.hxx59
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx448
-rw-r--r--dbaccess/source/ui/inc/unosqlmessage.hxx68
119 files changed, 13154 insertions, 0 deletions
diff --git a/dbaccess/source/ui/inc/AppElementType.hxx b/dbaccess/source/ui/inc/AppElementType.hxx
new file mode 100644
index 0000000000..b7265e5af6
--- /dev/null
+++ b/dbaccess/source/ui/inc/AppElementType.hxx
@@ -0,0 +1,53 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <com/sun/star/sdb/application/DatabaseObject.hpp>
+
+namespace dbaui
+{
+
+ enum ElementType
+ {
+ E_TABLE = css::sdb::application::DatabaseObject::TABLE,
+ E_QUERY = css::sdb::application::DatabaseObject::QUERY,
+ E_FORM = css::sdb::application::DatabaseObject::FORM,
+ E_REPORT = css::sdb::application::DatabaseObject::REPORT,
+
+ E_NONE = 4,
+ E_ELEMENT_TYPE_COUNT = E_NONE
+ };
+
+ enum class PreviewMode
+ {
+ NONE = 0,
+ Document = 1,
+ DocumentInfo = 2
+ };
+
+ enum class ElementOpenMode
+ {
+ Normal,
+ Design,
+ Mail
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ChildWindow.hxx b/dbaccess/source/ui/inc/ChildWindow.hxx
new file mode 100644
index 0000000000..c2f68ac46f
--- /dev/null
+++ b/dbaccess/source/ui/inc/ChildWindow.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+
+namespace dbaui
+{
+class OChildWindow
+{
+protected:
+ OChildWindow(weld::Container* pParent, const OUString& rUIXMLDescription, const OUString& rID);
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+
+public:
+ virtual ~OChildWindow();
+
+ virtual void GrabFocus() = 0;
+
+ virtual bool HasChildPathFocus() const = 0;
+
+ void Enable(bool bEnable) { m_xContainer->set_sensitive(bEnable); }
+
+ void SetHelpId(const OUString& rHelpId) { m_xContainer->set_help_id(rHelpId); }
+
+ void Show() { m_xContainer->show(); }
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/dbaccess/source/ui/inc/CollectionView.hxx b/dbaccess/source/ui/inc/CollectionView.hxx
new file mode 100644
index 0000000000..c49a5fd4fc
--- /dev/null
+++ b/dbaccess/source/ui/inc/CollectionView.hxx
@@ -0,0 +1,65 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace dbaui
+{
+ /* this class allows to browse through the collection of forms and reports
+ */
+ class OCollectionView : public weld::GenericDialogController
+ {
+ css::uno::Reference< css::ucb::XContent> m_xContent;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::ucb::XCommandEnvironment > m_xCmdEnv;
+ bool m_bCreateForm;
+
+ std::unique_ptr<weld::Label> m_xFTCurrentPath;
+ std::unique_ptr<weld::Button> m_xNewFolder;
+ std::unique_ptr<weld::Button> m_xUp;
+ std::unique_ptr<weld::TreeView> m_xView;
+ std::unique_ptr<weld::Entry> m_xName;
+ std::unique_ptr<weld::Button> m_xPB_OK;
+
+ DECL_LINK(Up_Click, weld::Button&, void);
+ DECL_LINK(NewFolder_Click, weld::Button&, void);
+ DECL_LINK(Save_Click, weld::Button&, void);
+ DECL_LINK(Dbl_Click_FileView, weld::TreeView&, bool);
+
+ /// sets the fixedtext to the right content
+ void initCurrentPath();
+
+ void Initialize();
+ public:
+ OCollectionView(weld::Window * pParent,
+ const css::uno::Reference< css::ucb::XContent>& _xContent,
+ const OUString& _sDefaultName,
+ css::uno::Reference< css::uno::XComponentContext > _xContext);
+ virtual ~OCollectionView() override;
+ const css::uno::Reference< css::ucb::XContent>& getSelectedFolder() const { return m_xContent;}
+ OUString getName() const;
+ };
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ColumnControlWindow.hxx b/dbaccess/source/ui/inc/ColumnControlWindow.hxx
new file mode 100644
index 0000000000..e68b99067e
--- /dev/null
+++ b/dbaccess/source/ui/inc/ColumnControlWindow.hxx
@@ -0,0 +1,82 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "FieldDescControl.hxx"
+#include "TypeInfo.hxx"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <vcl/InterimItemWindow.hxx>
+
+namespace dbaui
+{
+ // OColumnControlWindow
+ class OColumnControlWindow : public OFieldDescControl
+ {
+ css::lang::Locale m_aLocale;
+ css::uno::Reference< css::uno::XComponentContext> m_xContext;
+ css::uno::Reference< css::sdbc::XConnection> m_xConnection;
+ mutable css::uno::Reference< css::util::XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier
+
+ OTypeInfoMap m_aDestTypeInfo;
+ std::vector<OTypeInfoMap::iterator> m_aDestTypeInfoIndex;
+
+ mutable TOTypeInfoSP m_pTypeInfo; // default type
+ OUString m_sTypeNames; // these type names are the ones out of the resource file
+ OUString m_sAutoIncrementValue;
+ bool m_bAutoIncrementEnabled;
+ protected:
+ virtual void ActivateAggregate( EControlType eType ) override;
+ virtual void DeactivateAggregate( EControlType eType ) override;
+
+ virtual css::lang::Locale GetLocale() const override;
+ virtual css::uno::Reference< css::util::XNumberFormatter > GetFormatter() const override;
+ virtual TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) override;
+ virtual bool isAutoIncrementValueEnabled() const override;
+ virtual OUString getAutoIncrementValue() const override;
+ virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId ) override;
+
+ public:
+ OColumnControlWindow(weld::Container* pParent,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
+
+ void setConnection(const css::uno::Reference< css::sdbc::XConnection>& _xCon);
+
+ virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() override;
+ virtual css::uno::Reference< css::sdbc::XConnection> getConnection() override;
+ virtual const OTypeInfoMap* getTypeInfo() const override;
+ TOTypeInfoSP const & getDefaultTyp() const;
+ };
+
+ class OColumnControlTopLevel final : public InterimItemWindow
+ {
+ std::unique_ptr<OColumnControlWindow> m_xControl;
+ public:
+ OColumnControlTopLevel(vcl::Window* pParent,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
+ virtual void dispose() override;
+
+ OColumnControlWindow& GetControl() { return *m_xControl; }
+
+ virtual void GetFocus() override;
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ConnectionLine.hxx b/dbaccess/source/ui/inc/ConnectionLine.hxx
new file mode 100644
index 0000000000..360395f94b
--- /dev/null
+++ b/dbaccess/source/ui/inc/ConnectionLine.hxx
@@ -0,0 +1,71 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <tools/gen.hxx>
+#include "ConnectionLineData.hxx"
+#include <vcl/vclptr.hxx>
+
+class OutputDevice;
+namespace dbaui
+{
+
+ // ConnData ---------->* ConnLineData
+ // ^1 ^1
+ // | |
+ // Conn ---------->* ConnLine
+
+ /*
+ the class OConnectionLine represents the graphical line between the to two windows
+ **/
+ class OTableConnection;
+ class OConnectionLine final
+ {
+ VclPtr<OTableConnection> m_pTabConn;
+ OConnectionLineDataRef m_pData;
+
+ Point m_aSourceConnPos,
+ m_aDestConnPos;
+ Point m_aSourceDescrLinePos,
+ m_aDestDescrLinePos;
+ public:
+ OConnectionLine( OTableConnection* pConn, OConnectionLineDataRef pLineData );
+ OConnectionLine( const OConnectionLine& rLine );
+ ~OConnectionLine();
+
+ OConnectionLine& operator=( const OConnectionLine& rLine );
+
+ tools::Rectangle GetBoundingRect() const;
+ bool RecalcLine();
+ void Draw( OutputDevice* pOutDev );
+ bool CheckHit( const Point& rMousePos ) const;
+
+ bool IsValid() const;
+
+ tools::Rectangle GetSourceTextPos() const;
+ tools::Rectangle GetDestTextPos() const;
+
+ const OConnectionLineDataRef& GetData() const { return m_pData; }
+
+ Point getMidPoint() const;
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ConnectionLineAccess.hxx b/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
new file mode 100644
index 0000000000..5e14186b07
--- /dev/null
+++ b/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
@@ -0,0 +1,76 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "TableConnection.hxx"
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <vcl/vclptr.hxx>
+
+namespace dbaui
+{
+ class OTableConnection;
+ /** the class OConnectionLineAccess represents the accessible object for the connection between two table windows
+ like they are used in the QueryDesign and the RelationDesign
+ */
+ class OConnectionLineAccess : public cppu::ImplInheritanceHelper<
+ VCLXAccessibleComponent,
+ css::accessibility::XAccessibleRelationSet,
+ css::accessibility::XAccessible>
+ {
+ VclPtr<const OTableConnection> m_pLine; // the window which I should give accessibility to
+ protected:
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing() override;
+
+ public:
+ OConnectionLineAccess(OTableConnection* _pLine);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+
+ // XAccessible
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
+
+ // XAccessibleContext
+ virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
+ virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override;
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
+ virtual OUString SAL_CALL getAccessibleDescription( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
+
+ // XAccessibleComponent
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
+ virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
+ virtual css::awt::Point SAL_CALL getLocation( ) override;
+ virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
+ virtual css::awt::Size SAL_CALL getSize( ) override;
+
+ // XAccessibleRelationSet
+ virtual sal_Int32 SAL_CALL getRelationCount( ) override;
+ virtual css::accessibility::AccessibleRelation SAL_CALL getRelation( sal_Int32 nIndex ) override;
+ virtual sal_Bool SAL_CALL containsRelation( sal_Int16 aRelationType ) override;
+ virtual css::accessibility::AccessibleRelation SAL_CALL getRelationByType( sal_Int16 aRelationType ) override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/ConnectionLineData.hxx b/dbaccess/source/ui/inc/ConnectionLineData.hxx
new file mode 100644
index 0000000000..2a41c93d9a
--- /dev/null
+++ b/dbaccess/source/ui/inc/ConnectionLineData.hxx
@@ -0,0 +1,80 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "QEnumTypes.hxx"
+#include <vector>
+
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <rtl/ustring.hxx>
+
+namespace dbaui
+{
+
+ // ConnData ---------->* ConnLineData
+ // ^1 ^1
+ // | |
+ // Conn ---------->* ConnLine
+
+ /**
+ the class OConnectionLineData contains the data of a connection
+ e.g. the source and the destination field
+ **/
+ class OConnectionLineData : public ::salhelper::SimpleReferenceObject
+ {
+ OUString m_aSourceFieldName;
+ OUString m_aDestFieldName;
+
+ friend bool operator==(const OConnectionLineData& lhs, const OConnectionLineData& rhs);
+ friend bool operator!=(const OConnectionLineData& lhs, const OConnectionLineData& rhs) { return !(lhs == rhs); }
+ protected:
+ virtual ~OConnectionLineData() override;
+ public:
+ OConnectionLineData();
+ OConnectionLineData( OUString sSourceFieldName, OUString sDestFieldName );
+ OConnectionLineData( const OConnectionLineData& rConnLineData );
+ // provide a copy of own instance (this is somehow more acceptable for me compared to a virtual assignment operator
+ void CopyFrom(const OConnectionLineData& rSource);
+
+ // member access (write)
+ void SetFieldName(EConnectionSide nWhich, const OUString& strFieldName)
+ {
+ if (nWhich==JTCS_FROM)
+ m_aSourceFieldName = strFieldName;
+ else
+ m_aDestFieldName = strFieldName;
+ }
+ void SetSourceFieldName( const OUString& rSourceFieldName){ SetFieldName(JTCS_FROM, rSourceFieldName); }
+ void SetDestFieldName( const OUString& rDestFieldName ){ SetFieldName(JTCS_TO, rDestFieldName); }
+
+ // member access (read)
+ const OUString& GetFieldName(EConnectionSide nWhich) const { return (nWhich == JTCS_FROM) ? m_aSourceFieldName : m_aDestFieldName; }
+ OUString const & GetSourceFieldName() const { return GetFieldName(JTCS_FROM); }
+ OUString const & GetDestFieldName() const { return GetFieldName(JTCS_TO); }
+
+ void Reset();
+ OConnectionLineData& operator=( const OConnectionLineData& rConnLineData );
+ };
+
+ typedef ::rtl::Reference< OConnectionLineData > OConnectionLineDataRef;
+ typedef std::vector< OConnectionLineDataRef > OConnectionLineDataVec;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/DExport.hxx b/dbaccess/source/ui/inc/DExport.hxx
new file mode 100644
index 0000000000..a799996470
--- /dev/null
+++ b/dbaccess/source/ui/inc/DExport.hxx
@@ -0,0 +1,162 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <map>
+#include <vector>
+#include <comphelper/stl_types.hxx>
+#include "TypeInfo.hxx"
+#include "WTypeSelect.hxx"
+#include "commontypes.hxx"
+#include "IUpdateHelper.hxx"
+
+namespace com::sun::star {
+ namespace awt{
+ struct FontDescriptor;
+ }
+ namespace sdbc{
+ class XPreparedStatement;
+ class XDatabaseMetaData;
+ }
+}
+
+#define COLUMN_POSITION_NOT_FOUND (sal_Int32(-1))
+
+class SvNumberFormatter;
+namespace dbaui
+{
+ class OFieldDescription;
+ class ODatabaseExport
+ {
+ public:
+ typedef std::map<OUString, OFieldDescription*, ::comphelper::UStringMixLess> TColumns;
+ typedef std::vector<TColumns::const_iterator> TColumnVector;
+ typedef std::vector< std::pair<sal_Int32,sal_Int32> > TPositions;
+
+ protected:
+ TPositions m_vColumnPositions; ///< columns to be used
+ std::vector<sal_Int32> m_vColumnTypes; ///< ColumnTypes for faster access
+ std::vector<sal_Int32> m_vColumnSize;
+ std::vector<sal_Int16> m_vNumberFormat;
+ css::lang::Locale m_aLocale;
+
+ TColumns m_aDestColumns; ///< container for new created columns
+ TColumnVector m_vDestVector;
+
+ css::uno::Reference< css::beans::XPropertySet > m_xTable; ///< dest table
+ css::uno::Reference< css::container::XNameAccess> m_xTables; ///< container
+ SharedConnection m_xConnection; ///< dest conn
+
+ std::shared_ptr<IUpdateHelper> m_pUpdateHelper;
+ css::uno::Reference< css::util::XNumberFormatter > m_xFormatter; ///< a number formatter working with the connection's NumberFormatsSupplier
+ css::uno::Reference< css::uno::XComponentContext> m_xContext;
+ css::util::Date m_aNullDate;
+
+ SvNumberFormatter* m_pFormatter;
+ SvStream& m_rInputStream;
+ /// for saving the selected tablename
+ OUString m_sDefaultTableName;
+
+ OUString m_sTextToken; ///< cell content
+ OUString m_sNumToken; ///< SDNUM value
+ TOTypeInfoSP m_pTypeInfo; ///< contains the default type
+ const TColumnVector* m_pColumnList;
+ const OTypeInfoMap* m_pInfoMap;
+ sal_Int32 m_nColumnPos; ///< current column position
+ sal_Int32 m_nRows; ///< number of rows to be searched
+ sal_Int32 m_nRowCount; ///< current count of rows
+ bool m_bError; ///< error and termination code
+ bool m_bInTbl; ///< true, if parser is in RTF table
+ bool m_bHead; ///< true, if the header hasn't been read yet
+ bool m_bDontAskAgain;///< if there is an error when pasting, don't show it again
+ bool m_bIsAutoIncrement; ///< if PKey is set by user
+ bool m_bFoundTable; ///< set to true when a table was found
+ bool m_bCheckOnly;
+ bool m_bAppendFirstLine;
+
+
+ virtual TypeSelectionPageFactory
+ getTypeSelectionPageFactory() = 0;
+
+ void CreateDefaultColumn(const OUString& _rColumnName);
+ sal_Int16 CheckString(const OUString& aToken, sal_Int16 _nOldNumberFormat);
+ void adjustFormat();
+ void eraseTokens();
+ void insertValueIntoColumn();
+ void createRowSet();
+ void showErrorDialog(const css::sdbc::SQLException& e);
+ void ensureFormatter();
+
+ /** executeWizard calls a wizard to create/append data
+
+ @param _sTableName the tablename
+ @param _aTextColor the text color of the new created table
+ @param _rFont the font of the new table
+
+ @return true when an error occurs
+ */
+ bool executeWizard( const OUString& _sTableName,
+ const css::uno::Any& _aTextColor,
+ const css::awt::FontDescriptor& _rFont);
+
+ virtual ~ODatabaseExport();
+
+ public:
+ ODatabaseExport(
+ const SharedConnection& _rxConnection,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ SvStream& _rInputStream
+ );
+
+ // required for automatic type recognition
+ ODatabaseExport(
+ sal_Int32 nRows,
+ TPositions&& _rColumnPositions,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const TColumnVector* rList,
+ const OTypeInfoMap* _pInfoMap,
+ bool _bAutoIncrementEnabled,
+ SvStream& _rInputStream
+ );
+
+ void SetColumnTypes(const TColumnVector* rList,const OTypeInfoMap* _pInfoMap);
+
+ void SetTableName(const OUString &_sTableName){ m_sDefaultTableName = _sTableName ; }
+
+ void enableCheckOnly() { m_bCheckOnly = true; }
+ bool isCheckEnabled() const { return m_bCheckOnly; }
+
+ static css::uno::Reference< css::sdbc::XPreparedStatement > createPreparedStatement( const css::uno::Reference< css::sdbc::XDatabaseMetaData>& _xMetaData
+ ,const css::uno::Reference< css::beans::XPropertySet>& _xDestTable
+ ,const TPositions& _rvColumnPositions);
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/FieldControls.hxx b/dbaccess/source/ui/inc/FieldControls.hxx
new file mode 100644
index 0000000000..7eb88ec4e0
--- /dev/null
+++ b/dbaccess/source/ui/inc/FieldControls.hxx
@@ -0,0 +1,120 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "SqlNameEdit.hxx"
+#include <unotools/resmgr.hxx>
+
+namespace dbaui
+{
+
+ class OPropColumnEditCtrl : public OSQLNameEntry
+ {
+ short m_nPos;
+ OUString m_strHelpText;
+ public:
+ OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry, OUString const & _rAllowedChars, TranslateId pHelpId, short nPosition);
+
+ short GetPos() const { return m_nPos; }
+ const OUString& GetHelp() const { return m_strHelpText; }
+ };
+
+ class OPropEditCtrl : public OWidgetBase
+ {
+ std::unique_ptr<weld::Entry> m_xEntry;
+ short m_nPos;
+ OUString m_strHelpText;
+
+ public:
+ OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, TranslateId pHelpId, short nPosition);
+
+ void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
+ OUString get_text() const { return m_xEntry->get_text(); }
+ void set_editable(bool bEditable) { m_xEntry->set_editable(bEditable); }
+
+ virtual void save_value() override { m_xEntry->save_value(); }
+ virtual bool get_value_changed_from_saved() const override { return m_xEntry->get_value_changed_from_saved(); }
+
+ short GetPos() const { return m_nPos; }
+ const OUString& GetHelp() const { return m_strHelpText; }
+ };
+
+ class OPropNumericEditCtrl : public OWidgetBase
+ {
+ std::unique_ptr<weld::SpinButton> m_xSpinButton;
+ short m_nPos;
+ OUString m_strHelpText;
+
+ public:
+ OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, TranslateId pHelpId, short nPosition);
+
+ void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
+ OUString get_text() const { return m_xSpinButton->get_text(); }
+
+ virtual void save_value() override { m_xSpinButton->save_value(); }
+ virtual bool get_value_changed_from_saved() const override { return m_xSpinButton->get_value_changed_from_saved(); }
+ void set_digits(int nLen) { m_xSpinButton->set_digits(nLen); }
+ void set_min(int nMin) { m_xSpinButton->set_min(nMin); }
+ void set_max(int nMax) { m_xSpinButton->set_max(nMax); }
+ void set_range(int nMin, int nMax) { m_xSpinButton->set_range(nMin, nMax); }
+ int get_value() const { return m_xSpinButton->get_value(); }
+
+ short GetPos() const { return m_nPos; }
+ const OUString& GetHelp() const { return m_strHelpText; }
+
+ void set_editable(bool bEditable) { m_xSpinButton->set_editable(bEditable); }
+ };
+
+ class OPropListBoxCtrl : public OWidgetBase
+ {
+ std::unique_ptr<weld::ComboBox> m_xComboBox;
+ short m_nPos;
+ OUString m_strHelpText;
+
+ public:
+ OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, TranslateId pHelpId, short nPosition);
+ virtual ~OPropListBoxCtrl() override
+ {
+ m_xComboBox->clear();
+ }
+
+ virtual void save_value() override { m_xComboBox->save_value(); }
+ virtual bool get_value_changed_from_saved() const override { return m_xComboBox->get_value_changed_from_saved(); }
+
+ weld::ComboBox& GetComboBox() { return *m_xComboBox; }
+
+ OUString get_active_text() const { return m_xComboBox->get_active_text(); }
+ void set_active_text(const OUString &rText) { m_xComboBox->set_active_text(rText); }
+
+ int get_active() const { return m_xComboBox->get_active(); }
+ void set_active(int nPos) { m_xComboBox->set_active(nPos); }
+
+ int get_count() const { return m_xComboBox->get_count(); }
+
+ void append_text(const OUString &rText) { m_xComboBox->append_text(rText); }
+ void remove_text(const OUString &rText) { m_xComboBox->remove_text(rText); }
+ int find_text(const OUString &rText) const { return m_xComboBox->find_text(rText); }
+
+ short GetPos() const { return m_nPos; }
+ const OUString& GetHelp() const { return m_strHelpText; }
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
new file mode 100644
index 0000000000..410e086116
--- /dev/null
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -0,0 +1,201 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/weld.hxx>
+#include "IClipBoardTest.hxx"
+#include "QEnumTypes.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include "TypeInfo.hxx"
+#include <unotools/resmgr.hxx>
+
+// field description columns of a table
+#define FIELD_NAME 1
+#define FIELD_TYPE 2
+#define HELP_TEXT 3
+#define COLUMN_DESCRIPTION 4
+
+#define FIELD_FIRST_VIRTUAL_COLUMN 5
+
+#define FIELD_PROPERTY_REQUIRED 5
+#define FIELD_PROPERTY_NUMTYPE 6
+#define FIELD_PROPERTY_AUTOINC 7
+#define FIELD_PROPERTY_DEFAULT 8
+#define FIELD_PROPERTY_TEXTLEN 9
+#define FIELD_PROPERTY_LENGTH 10
+#define FIELD_PROPERTY_SCALE 11
+#define FIELD_PROPERTY_BOOL_DEFAULT 12
+#define FIELD_PROPERTY_FORMAT 13
+#define FIELD_PROPERTY_COLUMNNAME 14
+#define FIELD_PROPERTY_TYPE 15
+#define FIELD_PROPERTY_AUTOINCREMENT 16
+
+namespace dbaui
+{
+ class OTableDesignHelpBar;
+ class OPropListBoxCtrl;
+ class OPropEditCtrl;
+ class OPropNumericEditCtrl;
+ class OFieldDescription;
+ class OPropColumnEditCtrl;
+
+ class OFieldDescControl : public IClipboardTest
+ {
+ private:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+
+ OTableDesignHelpBar* m_pHelp;
+ weld::Widget* m_pLastFocusWindow;
+ weld::Widget* m_pActFocusWindow;
+
+ std::unique_ptr<weld::Label> m_xDefaultText;
+ std::unique_ptr<weld::Label> m_xRequiredText;
+ std::unique_ptr<weld::Label> m_xAutoIncrementText;
+ std::unique_ptr<weld::Label> m_xTextLenText;
+ std::unique_ptr<weld::Label> m_xNumTypeText;
+ std::unique_ptr<weld::Label> m_xLengthText;
+ std::unique_ptr<weld::Label> m_xScaleText;
+ std::unique_ptr<weld::Label> m_xFormatText;
+ std::unique_ptr<weld::Label> m_xBoolDefaultText;
+ std::unique_ptr<weld::Label> m_xColumnNameText;
+ std::unique_ptr<weld::Label> m_xTypeText;
+ std::unique_ptr<weld::Label> m_xAutoIncrementValueText;
+
+ std::unique_ptr<OPropListBoxCtrl> m_xRequired;
+ std::unique_ptr<OPropListBoxCtrl> m_xNumType;
+ std::unique_ptr<OPropListBoxCtrl> m_xAutoIncrement;
+ std::unique_ptr<OPropEditCtrl> m_xDefault;
+ std::unique_ptr<OPropNumericEditCtrl> m_xTextLen;
+ std::unique_ptr<OPropNumericEditCtrl> m_xLength;
+ std::unique_ptr<OPropNumericEditCtrl> m_xScale;
+ std::unique_ptr<OPropEditCtrl> m_xFormatSample;
+ std::unique_ptr<OPropListBoxCtrl> m_xBoolDefault;
+ std::unique_ptr<OPropColumnEditCtrl> m_xColumnName;
+ std::unique_ptr<OPropListBoxCtrl> m_xType;
+ std::unique_ptr<OPropEditCtrl> m_xAutoIncrementValue;
+
+ std::unique_ptr<weld::Button> m_xFormat;
+
+ Link<weld::Widget&, void> m_aControlFocusIn;
+
+ TOTypeInfoSP m_pPreviousType;
+ short m_nPos;
+ OUString aYes;
+ OUString aNo;
+
+ sal_Int32 m_nEditWidth;
+
+ OFieldDescription* pActFieldDescr;
+
+ DECL_LINK(FormatClickHdl, weld::Button&, void);
+ DECL_LINK(ChangeHdl, weld::ComboBox&, void);
+
+ // used by ActivatePropertyField
+ DECL_LINK( OnControlFocusLost, weld::Widget&, void );
+ DECL_LINK( OnControlFocusGot, weld::Widget&, void );
+
+ DECL_LINK( HelpFocusOut, weld::Widget&, void );
+
+ void UpdateFormatSample(OFieldDescription const * pFieldDescr);
+
+ bool isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const;
+ std::unique_ptr<OPropNumericEditCtrl> CreateNumericControl(const OUString& rId, TranslateId pHelpId, short _nProperty, const OUString& _sHelpId);
+ void InitializeControl(weld::Widget* _pControl,const OUString& _sHelpId);
+ void InitializeControl(OPropListBoxCtrl* _pControl,const OUString& _sHelpId,bool _bAddChangeHandler);
+
+ bool IsFocusInEditableWidget() const;
+
+ void dispose();
+ protected:
+ void saveCurrentFieldDescData() { SaveData( pActFieldDescr ); }
+ OFieldDescription* getCurrentFieldDescData() { return pActFieldDescr; }
+ void setCurrentFieldDescData( OFieldDescription* _pDesc ) { pActFieldDescr = _pDesc; }
+
+ virtual void ActivateAggregate( EControlType eType );
+ virtual void DeactivateAggregate( EControlType eType );
+ virtual bool IsReadOnly() { return false; };
+
+ virtual css::uno::Reference< css::util::XNumberFormatter > GetFormatter() const = 0;
+
+ virtual css::lang::Locale GetLocale() const = 0;
+
+ virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId ) = 0;
+ virtual void SetModified(bool bModified); // base implementation is empty
+
+ virtual TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) = 0;
+ virtual const OTypeInfoMap* getTypeInfo() const = 0;
+
+ virtual bool isAutoIncrementValueEnabled() const = 0;
+ virtual OUString getAutoIncrementValue() const = 0;
+
+ OUString BoolStringPersistent(std::u16string_view rUIString) const;
+ OUString BoolStringUI(const OUString& rPersistentString) const;
+
+ const OPropColumnEditCtrl* getColumnCtrl() const { return m_xColumnName.get(); }
+
+ void implFocusLost(weld::Widget* _pWhich);
+
+ public:
+ OFieldDescControl(weld::Container* pPage, OTableDesignHelpBar* pHelpBar);
+ virtual ~OFieldDescControl();
+
+ void DisplayData(OFieldDescription* pFieldDescr );
+
+ void SaveData( OFieldDescription* pFieldDescr );
+
+ void SetControlText( sal_uInt16 nControlId, const OUString& rText );
+ void SetReadOnly( bool bReadOnly );
+
+ void Enable(bool bEnable) { m_xContainer->set_sensitive(bEnable); }
+ void SetHelpId(const OUString& rId) { m_xContainer->set_help_id(rId); }
+
+ virtual bool isCutAllowed() override;
+ virtual bool isCopyAllowed() override;
+ virtual bool isPasteAllowed() override;
+
+ virtual void cut() override;
+ virtual void copy() override;
+ virtual void paste() override;
+
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink)
+ {
+ m_aControlFocusIn = rLink;
+ }
+
+ void Init();
+
+ void GrabFocus();
+
+ bool HasChildPathFocus() const;
+
+ virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() = 0;
+ virtual css::uno::Reference< css::sdbc::XConnection> getConnection() = 0;
+
+ OUString getControlDefault( const OFieldDescription* pFieldDescr, bool _bCheck = true) const;
+ // tdf#138409 take the control default in the UI Locale format, e.g. 12,34 and return a string
+ // suitable as the database default, e.g. 12.34
+ OUString CanonicalizeToControlDefault(const OFieldDescription* pFieldDescr, const OUString& rUserText) const;
+
+ void setEditWidth(sal_Int32 _nWidth) { m_nEditWidth = _nWidth; }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/FieldDescriptions.hxx b/dbaccess/source/ui/inc/FieldDescriptions.hxx
new file mode 100644
index 0000000000..5eccd74309
--- /dev/null
+++ b/dbaccess/source/ui/inc/FieldDescriptions.hxx
@@ -0,0 +1,111 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <editeng/svxenum.hxx>
+#include "TypeInfo.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+
+namespace dbaui
+{
+ class OFieldDescription
+ {
+ private:
+ css::uno::Any m_aControlDefault; // the value which the control inserts as default
+ css::uno::Any m_aWidth; // sal_Int32 or void
+ css::uno::Any m_aRelativePosition; // sal_Int32 or void
+
+ TOTypeInfoSP m_pType;
+
+ css::uno::Reference< css::beans::XPropertySet > m_xDest;
+ css::uno::Reference< css::beans::XPropertySetInfo > m_xDestInfo;
+
+ OUString m_sName;
+ OUString m_sTypeName;
+ OUString m_sDescription;
+ OUString m_sHelpText;
+
+ OUString m_sAutoIncrementValue;
+ sal_Int32 m_nType; // only used when m_pType is null
+ sal_Int32 m_nPrecision;
+ sal_Int32 m_nScale;
+ sal_Int32 m_nIsNullable;
+ sal_Int32 m_nFormatKey;
+ SvxCellHorJustify m_eHorJustify;
+ bool m_bIsAutoIncrement;
+ bool m_bIsPrimaryKey;
+ bool m_bIsCurrency;
+ bool m_bHidden;
+
+ public:
+ OFieldDescription();
+ OFieldDescription( const OFieldDescription& rDescr );
+ OFieldDescription(const css::uno::Reference< css::beans::XPropertySet >& _xAffectedCol
+ ,bool _bUseAsDest = false);
+ ~OFieldDescription();
+
+ void SetName(const OUString& _rName);
+ void SetDescription(const OUString& _rDescription);
+ void SetHelpText(const OUString& _sHelptext);
+ void SetDefaultValue(const css::uno::Any& _rDefaultValue);
+ void SetControlDefault(const css::uno::Any& _rControlDefault);
+ void SetAutoIncrementValue(const OUString& _sAutoIncValue);
+ void SetType(const TOTypeInfoSP& _pType);
+ void SetTypeValue(sal_Int32 _nType);
+ void SetTypeName(const OUString& _sTypeName);
+ void SetPrecision(sal_Int32 _rPrecision);
+ void SetScale(sal_Int32 _rScale);
+ void SetIsNullable(sal_Int32 _rIsNullable);
+ void SetFormatKey(sal_Int32 _rFormatKey);
+ void SetHorJustify(const SvxCellHorJustify& _rHorJustify);
+ void SetAutoIncrement(bool _bAuto);
+ void SetPrimaryKey(bool _bPKey);
+ void SetCurrency(bool _bIsCurrency);
+
+ /** copies the content of the field description into the column
+ @param _rxColumn the dest
+ */
+ void copyColumnSettingsTo(const css::uno::Reference< css::beans::XPropertySet >& _rxColumn);
+
+ void FillFromTypeInfo(const TOTypeInfoSP& _pType,bool _bForce,bool _bReset);
+
+ OUString GetName() const;
+ OUString GetDescription() const;
+ OUString GetHelpText() const;
+ css::uno::Any GetControlDefault() const;
+ OUString GetAutoIncrementValue() const;
+ sal_Int32 GetType() const;
+ OUString GetTypeName() const;
+ sal_Int32 GetPrecision() const;
+ sal_Int32 GetScale() const;
+ sal_Int32 GetIsNullable() const;
+ sal_Int32 GetFormatKey() const;
+ SvxCellHorJustify GetHorJustify() const;
+ const TOTypeInfoSP& getTypeInfo() const { return m_pType;}
+ TOTypeInfoSP getSpecialTypeInfo() const;
+ bool IsAutoIncrement() const;
+ bool IsPrimaryKey() const { return m_bIsPrimaryKey;}
+ bool IsCurrency() const { return m_bIsCurrency;}
+ bool IsNullable() const;
+ };
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/GeneralUndo.hxx b/dbaccess/source/ui/inc/GeneralUndo.hxx
new file mode 100644
index 0000000000..1bbb593e33
--- /dev/null
+++ b/dbaccess/source/ui/inc/GeneralUndo.hxx
@@ -0,0 +1,40 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <svl/undo.hxx>
+#include <core_resource.hxx>
+
+namespace dbaui
+{
+ // SbaCommentUndoAction - Undo base class for actions whose GetComment provides
+ // a string loaded from a Sba resource
+
+ class OCommentUndoAction : public SfxUndoAction
+ {
+ OUString m_strComment; // undo, redo comment
+
+ public:
+ OCommentUndoAction(TranslateId pCommentID) { m_strComment = DBA_RES(pCommentID); }
+
+ virtual OUString GetComment() const override { return m_strComment; }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/HtmlReader.hxx b/dbaccess/source/ui/inc/HtmlReader.hxx
new file mode 100644
index 0000000000..5c4ddde13f
--- /dev/null
+++ b/dbaccess/source/ui/inc/HtmlReader.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 .
+ */
+#pragma once
+
+#include "DExport.hxx"
+#include <svtools/parhtml.hxx>
+#include <editeng/svxenum.hxx>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+class SvStream;
+
+namespace dbaui
+{
+ class OHTMLReader final : public HTMLParser, public ODatabaseExport
+ {
+ OUString m_sCurrent;
+ sal_Int32 m_nTableCount;
+ sal_Int16 m_nColumnWidth; ///< maximum column width
+
+ virtual void NextToken( HtmlTokenId nToken ) override; // base class
+ bool CreateTable( HtmlTokenId nToken );
+ virtual TypeSelectionPageFactory
+ getTypeSelectionPageFactory() override;
+
+ void TableDataOn(SvxCellHorJustify& eVal);
+ void TableFontOn(css::awt::FontDescriptor& _rFont, Color &_rTextColor);
+ sal_Int16 GetWidthPixel( const HTMLOption& rOption );
+ void setTextEncoding();
+ void fetchOptions();
+ virtual ~OHTMLReader() override;
+
+ public:
+ OHTMLReader(SvStream& rIn,
+ const SharedConnection& _rxConnection,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+ // required for automatic type recognition
+ OHTMLReader(SvStream& rIn,
+ sal_Int32 nRows,
+ TPositions&& _rColumnPositions,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const TColumnVector* rList,
+ const OTypeInfoMap* _pInfoMap,
+ bool _bAutoIncrementEnabled);
+
+ virtual SvParserState CallParser() override;// base class
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/IClipBoardTest.hxx b/dbaccess/source/ui/inc/IClipBoardTest.hxx
new file mode 100644
index 0000000000..e3eb049627
--- /dev/null
+++ b/dbaccess/source/ui/inc/IClipBoardTest.hxx
@@ -0,0 +1,40 @@
+/* -*- 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 .
+ */
+#pragma once
+#include <sal/types.h>
+
+namespace dbaui
+{
+ class SAL_NO_VTABLE IClipboardTest
+ {
+ public:
+ virtual bool isCutAllowed() = 0;
+ virtual bool isCopyAllowed() = 0;
+ virtual bool isPasteAllowed() = 0;
+
+ virtual void copy() = 0;
+ virtual void cut() = 0;
+ virtual void paste() = 0;
+
+ protected:
+ ~IClipboardTest() {}
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/IItemSetHelper.hxx b/dbaccess/source/ui/inc/IItemSetHelper.hxx
new file mode 100644
index 0000000000..cdc1026eaf
--- /dev/null
+++ b/dbaccess/source/ui/inc/IItemSetHelper.hxx
@@ -0,0 +1,72 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace com::sun::star {
+ namespace sdbc {
+ class XConnection;
+ class XDriver;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}
+
+class SfxItemSet;
+namespace dbaui
+{
+ class SAL_NO_VTABLE IItemSetHelper
+ {
+ public:
+ virtual const SfxItemSet* getOutputSet() const = 0;
+ virtual SfxItemSet* getWriteOutputSet() = 0;
+
+ protected:
+ ~IItemSetHelper() {}
+ };
+
+ class SAL_NO_VTABLE IDatabaseSettingsDialog
+ {
+ public:
+ virtual css::uno::Reference< css::uno::XComponentContext > getORB() const = 0;
+ virtual std::pair< css::uno::Reference< css::sdbc::XConnection >,bool> createConnection() = 0;
+ virtual css::uno::Reference< css::sdbc::XDriver > getDriver() = 0;
+ virtual OUString getDatasourceType(const SfxItemSet& _rSet) const = 0;
+ virtual void clearPassword() = 0;
+ virtual void saveDatasource() = 0;
+ virtual void setTitle(const OUString& _sTitle) = 0;
+
+ /** enables or disables the user's possibility to confirm the settings
+
+ In a wizard, disabling this will usually disable the "Finish" button.
+ In a normal tab dialog, this will usually disable the "OK" button.
+ */
+ virtual void enableConfirmSettings( bool _bEnable ) = 0;
+
+ protected:
+ ~IDatabaseSettingsDialog() {}
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/IUpdateHelper.hxx b/dbaccess/source/ui/inc/IUpdateHelper.hxx
new file mode 100644
index 0000000000..e6ef24a967
--- /dev/null
+++ b/dbaccess/source/ui/inc/IUpdateHelper.hxx
@@ -0,0 +1,44 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Time.hpp>
+
+namespace dbaui
+{
+ class SAL_NO_VTABLE IUpdateHelper
+ {
+ public:
+ virtual void updateString(sal_Int32 _nPos, const OUString& _sValue) = 0;
+ virtual void updateDouble(sal_Int32 _nPos,const double& _nValue) = 0;
+ virtual void updateInt(sal_Int32 _nPos, sal_Int32 _nValue) = 0;
+ virtual void updateNull(sal_Int32 _nPos, ::sal_Int32 sqlType) = 0;
+ virtual void updateDate(sal_Int32 _nPos,const css::util::Date& _nValue) = 0;
+ virtual void updateTime(sal_Int32 _nPos,const css::util::Time& _nValue) = 0;
+ virtual void updateTimestamp(sal_Int32 _nPos,const css::util::DateTime& _nValue) = 0;
+ virtual void insertRow() = 0;
+
+ protected:
+ ~IUpdateHelper() {}
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/JAccess.hxx b/dbaccess/source/ui/inc/JAccess.hxx
new file mode 100644
index 0000000000..6d0d52ec02
--- /dev/null
+++ b/dbaccess/source/ui/inc/JAccess.hxx
@@ -0,0 +1,64 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "JoinTableView.hxx"
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <vcl/vclptr.hxx>
+
+namespace dbaui
+{
+ class OJoinTableView;
+ /** the class OJoinDesignViewAccess represents the accessible object for join views
+ like the QueryDesign and the RelationDesign
+ */
+ class OJoinDesignViewAccess : public cppu::ImplInheritanceHelper<VCLXAccessibleComponent, css::accessibility::XAccessible>
+ {
+ VclPtr<OJoinTableView> m_pTableView; // the window which I should give accessibility to
+
+ public:
+ /** OJoinDesignViewAccess needs a valid view
+ */
+ OJoinDesignViewAccess( OJoinTableView* _pTableView);
+
+ virtual OUString SAL_CALL getImplementationName() override;
+
+ // XAccessible
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
+
+ // XAccessibleContext
+ virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
+
+ void notifyAccessibleEvent(
+ const sal_Int16 _nEventId,
+ const css::uno::Any& _rOldValue,
+ const css::uno::Any& _rNewValue
+ )
+ {
+ NotifyAccessibleEvent(_nEventId,_rOldValue,_rNewValue);
+ }
+
+ void clearTableView();
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx
new file mode 100644
index 0000000000..9410823222
--- /dev/null
+++ b/dbaccess/source/ui/inc/JoinController.hxx
@@ -0,0 +1,154 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "singledoccontroller.hxx"
+#include "JoinTableView.hxx"
+#include "JoinDesignView.hxx"
+#include "TableConnectionData.hxx"
+#include "TableWindowData.hxx"
+#include <memory>
+
+namespace comphelper
+{
+ class NamedValueCollection;
+}
+
+namespace dbaui
+{
+ class OAddTableDlg;
+ class AddTableDialogContext;
+ class OTableWindow;
+ typedef OSingleDocumentController OJoinController_BASE;
+
+ class OJoinController : public OJoinController_BASE
+ {
+ protected:
+ TTableConnectionData m_vTableConnectionData;
+ TTableWindowData m_vTableData;
+
+ ::dbtools::SQLExceptionInfo m_aExceptionInfo;
+
+ std::shared_ptr<OAddTableDlg> m_xAddTableDialog;
+ std::unique_ptr< AddTableDialogContext > m_pDialogContext;
+ Point m_aMinimumTableViewSize;
+
+ // state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
+ virtual FeatureState GetState(sal_uInt16 nId) const override;
+ // execute a feature
+ virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+
+ /** loads the information for the windows.
+ @param i_rViewSettings
+ The properties which comes from the layout information.
+ */
+ void loadTableWindows( const ::comphelper::NamedValueCollection& i_rViewSettings );
+
+ /** loads the information for one window.
+ @param _rTable
+ The properties which comes from the layout information.
+ */
+ void loadTableWindow( const ::comphelper::NamedValueCollection& i_rTableWindowSettings );
+
+ /** saves the TableWindows structure in a sequence of property values
+ @param _rViewProps
+ Contains the new sequence.
+ */
+ void saveTableWindows( ::comphelper::NamedValueCollection& o_rViewSettings ) const;
+
+ virtual ~OJoinController() override;
+ public:
+ OJoinController(const css::uno::Reference< css::uno::XComponentContext >& _rM);
+
+ // attribute access
+ TTableWindowData& getTableWindowData() { return m_vTableData; }
+ TTableConnectionData& getTableConnectionData() { return m_vTableConnectionData;}
+ OAddTableDlg* getAddTableDialog()const { return m_xAddTableDialog.get(); }
+
+ // OSingleDocumentController overridables
+ virtual void reconnect( bool _bUI ) override;
+ virtual void impl_onModifyChanged() override;
+
+ // own overridables
+ /** determines whether or not it's allowed for database views to participate in the game
+ */
+ virtual bool allowViews() const = 0;
+
+ /** determines whether or not it's allowed for queries to participate in the game
+ */
+ virtual bool allowQueries() const = 0;
+
+ /** provides access to the OJoinDesignView belonging to the controller, which might
+ or might not be the direct view (getView)
+ */
+ virtual OJoinDesignView* getJoinView();
+
+ /** erase the data in the data vector
+ @param _pData
+ the data which should be erased
+ */
+ void removeConnectionData(const TTableConnectionData::value_type& _pData);
+
+ void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, tools::Long nOffsetX, tools::Long nOffsetY );
+
+ static void SaveTabWinPosSize(OTableWindow const * pTabWin, tools::Long nOffsetX, tools::Long nOffsetY);
+
+ // UNO interface overridables
+ // XEventListener
+ using OJoinController_BASE::disposing;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL disposing() override;
+ // css::frame::XController
+ virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override;
+
+ // misc
+ /** only defines a method to save a SQLException in d&d methods to show the error at a later state
+ set the internal member m_aExceptionInfo to _rInfo
+ */
+ void setErrorOccurred(const ::dbtools::SQLExceptionInfo& _rInfo)
+ {
+ m_aExceptionInfo = _rInfo;
+ }
+ /**
+ just returns the internal member and clears it
+ */
+ ::dbtools::SQLExceptionInfo clearOccurredError()
+ {
+ ::dbtools::SQLExceptionInfo aInfo = m_aExceptionInfo;
+ m_aExceptionInfo = ::dbtools::SQLExceptionInfo();
+ return aInfo;
+ }
+
+ // show the dialog
+ void runDialogAsync();
+
+ protected:
+ TTableWindowData::value_type createTableWindowData(const OUString& _sComposedName,const OUString& _sTableName,const OUString& _sWindowName);
+ // ask the user if the design should be saved when it is modified
+ virtual short saveModified() = 0;
+ // called when the original state should be reset (first time load)
+ virtual void reset() = 0;
+ virtual void describeSupportedFeatures() override;
+
+ AddTableDialogContext& impl_getDialogContext() const;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/JoinDesignView.hxx b/dbaccess/source/ui/inc/JoinDesignView.hxx
new file mode 100644
index 0000000000..f4871e9df5
--- /dev/null
+++ b/dbaccess/source/ui/inc/JoinDesignView.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 .
+ */
+
+#pragma once
+
+#include <dbaccess/dataview.hxx>
+
+class Splitter;
+
+namespace dbaui
+{
+ class OJoinController;
+ class OScrollWindowHelper;
+ class OJoinTableView;
+ class OTableWindow;
+
+ class OJoinDesignView : public ODataView
+ {
+ protected:
+ VclPtr<OScrollWindowHelper> m_pScrollWindow; // contains only the scrollbars
+ VclPtr<OJoinTableView> m_pTableView; // presents the upper window
+ OJoinController& m_rController;
+
+ public:
+ OJoinDesignView(vcl::Window* pParent,
+ OJoinController& _rController,
+ const css::uno::Reference< css::uno::XComponentContext >& );
+ virtual ~OJoinDesignView() override;
+ virtual void dispose() override;
+
+ // set the view readonly or not
+ virtual void setReadOnly(bool _bReadOnly);
+ // set the statement for representation
+ /// late construction
+ virtual void Construct() override;
+ virtual void initialize() override;
+ virtual void KeyInput( const KeyEvent& rEvt ) override;
+
+ void SaveTabWinUIConfig(OTableWindow const * pWin);
+ OJoinController& getController() const { return m_rController; }
+ // called when fields are deleted
+
+ OJoinTableView* getTableView() const { return m_pTableView; }
+ OScrollWindowHelper* getScrollHelper() const { return m_pScrollWindow; }
+ protected:
+ // return the Rectangle where I can paint myself
+ virtual void resizeDocumentView(tools::Rectangle& rRect) override;
+ };
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/JoinExchange.hxx b/dbaccess/source/ui/inc/JoinExchange.hxx
new file mode 100644
index 0000000000..7401ec886e
--- /dev/null
+++ b/dbaccess/source/ui/inc/JoinExchange.hxx
@@ -0,0 +1,62 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "TableWindowListBox.hxx"
+
+#include <vcl/transfer.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace dbaui
+{
+ // OJoinExchObj: Additional data to create Joins in the JoinShell
+
+ typedef ::cppu::ImplHelper1< css::lang::XUnoTunnel > OJoinExchObj_Base;
+ class OJoinExchObj final : public TransferDataContainer, public OJoinExchObj_Base
+ {
+ bool m_bFirstEntry;
+
+ OJoinExchangeData m_jxdSourceDescription;
+
+ virtual ~OJoinExchObj() override;
+
+ public:
+ OJoinExchObj();
+ void setDescriptors(const OJoinExchangeData& jxdSource, bool _bFirstEntry);
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
+ virtual void SAL_CALL acquire( ) noexcept override;
+ virtual void SAL_CALL release( ) noexcept override;
+
+ // XUnoTunnel
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override;
+
+ static OJoinExchangeData GetSourceDescription(const css::uno::Reference< css::datatransfer::XTransferable >& _rxObject);
+ static bool isFormatAvailable( const DataFlavorExVector& _rFormats ,SotClipboardFormatId _nSlotID=SotClipboardFormatId::SBA_JOIN);
+
+ private:
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx
new file mode 100644
index 0000000000..9e2e2bf57e
--- /dev/null
+++ b/dbaccess/source/ui/inc/JoinTableView.hxx
@@ -0,0 +1,325 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <svtools/scrolladaptor.hxx>
+#include <vcl/window.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/idle.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/transfer.hxx>
+
+#include "callbacks.hxx"
+#include "TableConnectionData.hxx"
+#include "TableWindowData.hxx"
+
+#include <map>
+#include <vector>
+
+struct AcceptDropEvent;
+struct ExecuteDropEvent;
+class SfxUndoAction;
+
+namespace dbaui
+{
+ class OTableConnection;
+ class OTableWindow;
+ struct OJoinExchangeData;
+ class OJoinDesignView;
+ class OTableWindowData;
+ class OJoinDesignViewAccess;
+
+ // this class contains only the scrollbars to avoid that
+ // the tablewindows clip the scrollbars
+ class OJoinTableView;
+ class OScrollWindowHelper : public vcl::Window
+ {
+ VclPtr<ScrollAdaptor> m_aHScrollBar;
+ VclPtr<ScrollAdaptor> m_aVScrollBar;
+ VclPtr<OJoinTableView> m_pTableView;
+
+ protected:
+ virtual void Resize() override;
+
+ public:
+ OScrollWindowHelper( vcl::Window* pParent);
+ virtual ~OScrollWindowHelper() override;
+ virtual void dispose() override;
+
+ void setTableView(OJoinTableView* _pTableView);
+
+ void resetRange(const Point& _aSize);
+
+ // own methods
+ ScrollAdaptor& GetHScrollBar() { return *m_aHScrollBar; }
+ ScrollAdaptor& GetVScrollBar() { return *m_aVScrollBar; }
+ };
+
+
+ class OJoinTableView : public vcl::Window,
+ public IDragTransferableListener,
+ public DropTargetHelper
+ {
+ friend class OJoinMoveTabWinUndoAct;
+
+ public:
+ typedef std::map<OUString, VclPtr<OTableWindow> > OTableWindowMap;
+
+ private:
+ OTableWindowMap m_aTableMap;
+ std::vector<VclPtr<OTableConnection> > m_vTableConnection;
+
+ Idle m_aDragScrollIdle;
+ tools::Rectangle m_aDragRect;
+ tools::Rectangle m_aSizingRect;
+ Point m_aDragOffset;
+ Point m_aScrollOffset;
+ Point m_ptPrevDraggingPos;
+ Size m_aOutputSize;
+
+
+ VclPtr<OTableWindow> m_pDragWin;
+ VclPtr<OTableWindow> m_pSizingWin;
+ VclPtr<OTableConnection> m_pSelectedConn;
+
+
+ DECL_LINK(OnDragScrollTimer, Timer*, void);
+
+ protected:
+ VclPtr<OTableWindow> m_pLastFocusTabWin;
+ VclPtr<OJoinDesignView> m_pView;
+ rtl::Reference<OJoinDesignViewAccess> m_pAccessible;
+
+ public:
+ OJoinTableView( vcl::Window* pParent, OJoinDesignView* pView );
+ virtual ~OJoinTableView() override;
+ virtual void dispose() override;
+
+ // window override
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+ virtual void KeyInput( const KeyEvent& rEvt ) override;
+ // Accessibility
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+
+ // own methods
+ ScrollAdaptor& GetHScrollBar() { return static_cast<OScrollWindowHelper*>(GetParent())->GetHScrollBar(); }
+ ScrollAdaptor& GetVScrollBar() { return static_cast<OScrollWindowHelper*>(GetParent())->GetVScrollBar(); }
+ DECL_LINK(VertScrollHdl, weld::Scrollbar&, void);
+ DECL_LINK(HorzScrollHdl, weld::Scrollbar&, void);
+
+ void DrawConnections(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+ void InvalidateConnections();
+
+ void BeginChildMove( OTableWindow* pTabWin, const Point& rMousePos );
+ void BeginChildSizing( OTableWindow* pTabWin, PointerStyle nPointer );
+
+ void NotifyTitleClicked( OTableWindow* pTabWin, const Point& rMousePos );
+
+ virtual void AddTabWin(const OUString& _rComposedName, const OUString& rWinName, bool bNewTable = false);
+ virtual void RemoveTabWin( OTableWindow* pTabWin );
+
+ // hide all TabWins (does NOT delete them; they are put in an UNDO action)
+ void HideTabWins();
+
+ virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest) = 0;
+
+ /** RemoveConnection allows to remove connections from join table view
+
+ it implies that the same as addConnection
+
+ @param rConnection the connection which should be removed
+ @param bDelete when true then the connection will be deleted
+
+ @return an iterator to next valid connection, so it can be used in any loop
+ */
+ virtual bool RemoveConnection(VclPtr<OTableConnection>& rConnection, bool bDelete);
+
+ /** allows to add new connections to join table view
+
+ it implies an invalidation of the features ID_BROWSER_ADDTABLE and
+ SID_RELATION_ADD_RELATION also the modified flag will be set to true
+
+ @param _pConnection the connection which should be added
+ @param _bAddData when true then the data should also be appended
+ */
+ void addConnection(OTableConnection* _pConnection,bool _bAddData = true);
+
+ bool ScrollPane( tools::Long nDelta, bool bHoriz, bool bPaintScrollBars );
+ sal_Int64 GetTabWinCount() const;
+ const Point& GetScrollOffset() const { return m_aScrollOffset; }
+
+ OJoinDesignView* getDesignView() const { return m_pView; }
+ OTableWindow* GetTabWindow( const OUString& rName );
+
+ VclPtr<OTableConnection>& GetSelectedConn() { return m_pSelectedConn; }
+ /** @note NULL is explicitly allowed (then no-op) */
+ void DeselectConn(OTableConnection* pConn);
+ void SelectConn(OTableConnection* pConn);
+
+ OTableWindowMap& GetTabWinMap() { return m_aTableMap; }
+
+ /** gives a read only access to the connection vector
+ */
+ const std::vector<VclPtr<OTableConnection> >& getTableConnections() const { return m_vTableConnection; }
+
+ bool ExistsAConn(const OTableWindow* pFromWin) const;
+
+ /** search for all connections of a table
+
+ @param _pFromWin the table for which connections should be found
+ @return an iterator which can be used to travel all connections of the table
+ */
+ std::vector<VclPtr<OTableConnection> >::const_iterator getTableConnections(const OTableWindow* _pFromWin) const;
+
+ /** how many connection belongs to single table
+
+ @param _pFromWin the table for which connections should be found
+ @return the count of connections which belongs to this table
+ */
+ sal_Int32 getConnectionCount(const OTableWindow* _pFromWin) const;
+
+ OTableConnection* GetTabConn(const OTableWindow* pLhs,const OTableWindow* pRhs,bool _bSuppressCrossOrNaturalJoin = false) const;
+
+ /** clear the window map and connection vector without destroying it
+
+ that means that the data of the windows and connection will be
+ untouched
+ */
+ void clearLayoutInformation();
+
+ /** set the focus to that tab win which most recently had it
+ (or to the first available one) **/
+ void GrabTabWinFocus();
+
+ /** take all WinData and ConnData from the document and create the
+ corresponding Wins and Conns */
+ virtual void ReSync() { }
+
+ /** Hard deletion
+
+ That means that all Conns and Wins are deleted from their respective
+ lists and the corresponding Data removed from the document */
+ virtual void ClearAll();
+
+ /** @note used by AddTabDlg to see if more tables can be added */
+ virtual bool IsAddAllowed();
+ virtual bool PreNotify(NotifyEvent& rNEvt) override;
+
+ // DnD stuff
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+
+ /** @note can be used for special ui handling after d&d */
+ virtual void lookForUiActivities();
+
+ /** Hook that is called after moving/resizing TabWins
+
+ The position is 'virtual': the container has a virtual area of
+ which only a part - changeable by scroll bar - is visible.
+ Therefore: ptOldPosition is always positive, even if it represents
+ a point with a negative physical ordinate above the visible area
+
+ @note The standard implementation just passes the new data to the
+ Wins
+ */
+ void TabWinMoved(OTableWindow* ptWhich, const Point& ptOldPosition);
+
+ void TabWinSized(OTableWindow* ptWhich, const Point& ptOldPosition, const Size& szOldSize);
+
+ void modified();
+
+ /** check if the given window is visible.
+
+ @param _rPoint The Point to check
+ @param _rSize The Size to be check as well
+ @return true if the area is visible, false otherwise
+ */
+ bool isMovementAllowed(const Point& _rPoint,const Size& _rSize);
+
+ const Size& getRealOutputSize() const { return m_aOutputSize; }
+
+ virtual void EnsureVisible(const OTableWindow* _pWin);
+ void EnsureVisible(const Point& _rPoint,const Size& _rSize);
+
+ TTableWindowData::value_type createTableWindowData(const OUString& _rComposedName
+ ,const OUString& _sTableName
+ ,const OUString& _rWinName);
+
+ protected:
+ virtual void MouseButtonUp( const MouseEvent& rEvt ) override;
+ virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
+ virtual void Tracking( const TrackingEvent& rTEvt ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void ConnDoubleClicked(VclPtr<OTableConnection>& rConnection);
+ void SetDefaultTabWinPosSize( OTableWindow* pTabWin );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ virtual void Resize() override;
+
+ virtual void dragFinished( ) override;
+ /// @note here the physical position (that can be changed while
+ /// resizing) is used, as no scrolling can take place while resizing
+ virtual void Command(const CommandEvent& rEvt) override;
+
+ virtual std::shared_ptr<OTableWindowData> CreateImpl(const OUString& _rComposedName
+ ,const OUString& _sTableName
+ ,const OUString& _rWinName);
+
+ /** factory method to create table windows
+
+ @param _pData The data corresponding to the window.
+ @return The new TableWindow
+ */
+ virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) = 0;
+
+ /** determines whether the classes Init method should accept a query
+ name, or only table names */
+ virtual bool allowQueries() const;
+
+ /** called when init fails at the tablewindowdata because the m_xTable
+ object could not provide columns, but no exception was thrown.
+ Expected to throw. */
+ virtual void onNoColumns_throw();
+
+ virtual bool suppressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const;
+
+ private:
+ void InitColors();
+ void ScrollWhileDragging();
+
+ /** opens the context menu to delete a connection
+ @param _aPos the position where the popup menu should appear
+ @param _pSelConnection the connection which should be deleted
+ */
+ void executePopup(const Point& _aPos, VclPtr<OTableConnection>& rSelConnection);
+
+ /** invalidates this window without children and set the controller
+ modified
+ @param _pAction a possible undo action to add at the controller
+ */
+ void invalidateAndModify(std::unique_ptr<SfxUndoAction> _pAction);
+
+ private:
+ using Window::Scroll;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QEnumTypes.hxx b/dbaccess/source/ui/inc/QEnumTypes.hxx
new file mode 100644
index 0000000000..b889870c9b
--- /dev/null
+++ b/dbaccess/source/ui/inc/QEnumTypes.hxx
@@ -0,0 +1,79 @@
+/* -*- 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 .
+ */
+#pragma once
+
+namespace dbaui
+{
+ enum EOrderDir
+ {
+ ORDER_NONE=0,
+ ORDER_ASC,
+ ORDER_DESC
+ };
+
+ enum EFunctionType
+ {
+ FKT_NONE =0x00000000,
+ FKT_OTHER =0x00000001,
+ FKT_AGGREGATE =0x00000002,
+ FKT_CONDITION =0x00000004,
+ FKT_NUMERIC =0x00000008
+ // if this function type is set, it is either EXISTS or UNIQUE,
+ // the FieldName contains the complete statement
+ };
+
+ enum EConnectionSide
+ {
+ JTCS_FROM=0,
+ JTCS_TO
+ };
+
+ enum ETableFieldType
+ {
+ TAB_NORMAL_FIELD=0,
+ TAB_PRIMARY_FIELD
+ };
+
+ enum EJoinType
+ {
+ FULL_JOIN=0,
+ LEFT_JOIN,
+ RIGHT_JOIN,
+ CROSS_JOIN,
+ INNER_JOIN
+ };
+
+ enum EControlType
+ {
+ tpDefault = 0,
+ tpRequired,
+ tpTextLen,
+ tpNumType,
+ tpLength,
+ tpScale,
+ tpFormat,
+ tpAutoIncrement,
+ tpBoolDefault,
+ tpColumnName,
+ tpType,
+ tpAutoIncrementValue
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx
new file mode 100644
index 0000000000..efef444e86
--- /dev/null
+++ b/dbaccess/source/ui/inc/QueryDesignView.hxx
@@ -0,0 +1,154 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "JoinDesignView.hxx"
+#include <vcl/split.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "querycontroller.hxx"
+
+namespace connectivity
+{
+ class OSQLParseNode;
+}
+namespace weld
+{
+ class ComboBox;
+}
+namespace dbaui
+{
+ enum SqlParseError
+ {
+ eIllegalJoin,
+ eStatementTooLong,
+ eNoConnection,
+ eNoSelectStatement,
+ eStatementTooComplex,
+ eNoColumnInLike,
+ eColumnNotFound,
+ eNativeMode,
+ eTooManyTables,
+ eTooManyColumns,
+ eIllegalJoinCondition,
+ eOk
+ };
+
+ class OSelectionBrowseBox;
+ class OQueryContainerWindow;
+ class OQueryController;
+
+ class OQueryDesignView : public OJoinDesignView
+ {
+ enum ChildFocusState
+ {
+ SELECTION,
+ TABLEVIEW,
+ NONE
+ };
+
+ VclPtr<Splitter> m_aSplitter;
+
+ css::lang::Locale m_aLocale;
+ OUString m_sDecimalSep;
+
+ VclPtr<OSelectionBrowseBox> m_pSelectionBox; // presents the lower window
+ ChildFocusState m_eChildFocus;
+ bool m_bInSplitHandler;
+
+ public:
+ OQueryDesignView(OQueryContainerWindow* pParent, OQueryController& _rController, const css::uno::Reference< css::uno::XComponentContext >& );
+ virtual ~OQueryDesignView() override;
+ virtual void dispose() override;
+
+ bool isCutAllowed() const;
+ bool isPasteAllowed() const;
+ bool isCopyAllowed() const;
+ void copy();
+ void cut();
+ void paste();
+ // clears the whole query
+ void clear();
+ // set the view readonly or not
+ virtual void setReadOnly(bool _bReadOnly) override;
+ // check if the statement is correct when not returning false
+ bool checkStatement();
+ // returns the current sql statement
+ OUString getStatement();
+ /// late construction
+ virtual void Construct() override;
+ virtual void initialize() override;
+ // Window overrides
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual void GetFocus() override;
+
+ bool isSlotEnabled(sal_Int32 _nSlotId);
+ void setSlotEnabled(sal_Int32 _nSlotId, bool _bEnable);
+ void setNoneVisibleRow(sal_Int32 _nRows);
+
+ const css::lang::Locale& getLocale() const { return m_aLocale;}
+ const OUString& getDecimalSeparator() const { return m_sDecimalSep;}
+
+ SqlParseError InsertField( const OTableFieldDescRef& rInfo, bool bActivate = true);
+ bool HasFieldByAliasName(std::u16string_view rFieldName, OTableFieldDescRef const & rInfo) const;
+ // called when a table from tabview was deleted
+ void TableDeleted(const OUString& rAliasName);
+
+ sal_Int32 getColWidth( sal_uInt16 _nColPos) const;
+ void fillValidFields(std::u16string_view strTableName, weld::ComboBox& rFieldList);
+
+ void SaveUIConfig();
+ void stopTimer();
+ void startTimer();
+ void reset();
+
+ /** initializes the view from the current parser / parse iterator of the controller
+
+ @param _pErrorInfo
+ When not <NULL/>, the instance pointed to by this parameter takes the error
+ which happened during the initialization.
+ If it is not <NULL/>, then any such error will be displayed, using the controller's
+ showError method.
+
+ @return <TRUE/> if and only if the initialization was successful
+ */
+ bool initByParseIterator( ::dbtools::SQLExceptionInfo* _pErrorInfo );
+
+ void initByFieldDescriptions(
+ const css::uno::Sequence< css::beans::PropertyValue >& i_rFieldDescriptions
+ );
+
+ std::unique_ptr<::connectivity::OSQLParseNode> getPredicateTreeFromEntry( const OTableFieldDescRef& pEntry,
+ const OUString& _sCriteria,
+ OUString& _rsErrorMessage,
+ css::uno::Reference< css::beans::XPropertySet>& _rxColumn) const;
+
+ void fillFunctionInfo( const ::connectivity::OSQLParseNode* pNode
+ ,const OUString& sFunctionTerm
+ ,OTableFieldDescRef& aInfo);
+ protected:
+ // return the Rectangle where I can paint myself
+ virtual void resizeDocumentView(tools::Rectangle& rRect) override;
+ DECL_LINK( SplitHdl, Splitter*, void );
+
+ private:
+ using OJoinDesignView::SaveTabWinUIConfig;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx b/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx
new file mode 100644
index 0000000000..2d8bb80dcf
--- /dev/null
+++ b/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx
@@ -0,0 +1,45 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+
+namespace dbaui
+{
+
+/**
+ * Dialog to set such properties of a query as distinct values and limit
+ * It can be opened from Edit menu in Query Design View
+ */
+class QueryPropertiesDialog : public weld::GenericDialogController
+{
+
+public:
+
+ QueryPropertiesDialog(
+ weld::Window* pParent, const bool bDistinct, const sal_Int64 nLimit );
+ virtual ~QueryPropertiesDialog() override;
+ bool getDistinct() const
+ {
+ return m_xRB_Distinct->get_active();
+ }
+
+ sal_Int64 getLimit() const;
+
+private:
+
+ std::unique_ptr<weld::RadioButton> m_xRB_Distinct;
+ std::unique_ptr<weld::RadioButton> m_xRB_NonDistinct;
+ std::unique_ptr<weld::ComboBox> m_xLB_Limit;
+};
+
+} ///dbaui namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryTableView.hxx b/dbaccess/source/ui/inc/QueryTableView.hxx
new file mode 100644
index 0000000000..26133d2cca
--- /dev/null
+++ b/dbaccess/source/ui/inc/QueryTableView.hxx
@@ -0,0 +1,116 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "JoinTableView.hxx"
+#include "TableFieldDescription.hxx"
+
+namespace dbaui
+{
+ class OQueryTabWinUndoAct;
+ class OQueryTableConnection;
+ class OQueryTableWindow;
+ class OQueryDesignView;
+
+ class OQueryTableView : public OJoinTableView
+ {
+ protected:
+ virtual void ConnDoubleClicked(VclPtr<OTableConnection>& rConnection) override;
+
+ virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) override;
+
+ /** called when init fails at the tablewindowdata because the m_xTable
+ object could not provide columns, but no exception was thrown.
+ Expected to throw. */
+ virtual void onNoColumns_throw() override;
+
+ virtual bool suppressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const override;
+
+ public:
+ OQueryTableView(vcl::Window* pParent,OQueryDesignView* pView);
+
+ /// base class overwritten: create and delete windows
+ /// (not really delete, as it becomes an UndoAction)
+ bool ContainsTabWin(const OTableWindow& rTabWin); // #i122589# Allow to check if OTableWindow is registered
+ virtual void AddTabWin( const OUString& _rTableName, const OUString& _rAliasName, bool bNewTable = false ) override;
+ virtual void RemoveTabWin(OTableWindow* pTabWin) override;
+
+ /// AddTabWin, setting an alias
+ void AddTabWin(const OUString& strDatabase, const OUString& strTableName, const OUString& strAlias, bool bNewTable);
+ /// search TabWin
+ OQueryTableWindow* FindTable(const OUString& rAliasName);
+ bool FindTableFromField(const OUString& rFieldName, OTableFieldDescRef const & rInfo, sal_uInt16& rCnt);
+
+ /// base class overwritten: create and delete Connections
+ virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest) override;
+
+ virtual bool RemoveConnection(VclPtr<OTableConnection>& rConn, bool bDelete) override;
+
+ // transfer of connections from and to UndoAction
+
+ /// Inserting a Connection the structure
+ void GetConnection(OQueryTableConnection* pConn);
+ /** Removing a Connection from the structure
+
+ This results effectively in complete reset of request form, as all
+ windows are hidden, as are all Connections to these windows and all
+ request columns based on those tables */
+ void DropConnection(VclPtr<OQueryTableConnection> const & rConn);
+
+ // show and hide TabWin (NOT create or delete)
+ bool ShowTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction, bool _bAppend);
+ void HideTabWin(OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction);
+
+ /// ensure visibility of TabWins (+ and invalidate connections)
+ virtual void EnsureVisible(const OTableWindow* _pWin) override;
+
+ /// how many tables with a certain alias do I already have?
+ sal_Int32 CountTableAlias(const OUString& rName, sal_Int32& rMax);
+
+ /// insert field (simply passed to parents)
+ void InsertField(const OTableFieldDescRef& rInfo);
+
+ /// rebuild everything (TabWins, Connections)
+ /// (PRECONDITION: ClearAll was called previously)
+ virtual void ReSync() override;
+
+ /// delete everything hard (TabWins, Connections), without any notifications
+ virtual void ClearAll() override;
+
+ // used by AddTabDlg to see if tables can still be added
+ //virtual sal_Bool IsAddAllowed();
+
+ /// announce new Connection and insert it, if not existing yet
+ void NotifyTabConnection(const OQueryTableConnection& rNewConn, bool _bCreateUndoAction = true);
+
+ bool ExistsAVisitedConn(const OQueryTableWindow* pFrom) const;
+
+ virtual std::shared_ptr<OTableWindowData> CreateImpl(const OUString& _rComposedName
+ ,const OUString& _sTableName
+ ,const OUString& _rWinName) override;
+
+ /** opens the join dialog and allows to create a new join connection */
+ void createNewConnection();
+
+ private:
+ using OJoinTableView::EnsureVisible;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryTextView.hxx b/dbaccess/source/ui/inc/QueryTextView.hxx
new file mode 100644
index 0000000000..33f66342b2
--- /dev/null
+++ b/dbaccess/source/ui/inc/QueryTextView.hxx
@@ -0,0 +1,69 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/InterimItemWindow.hxx>
+#include "querycontainerwindow.hxx"
+#include "sqledit.hxx"
+
+namespace dbaui
+{
+ class OQueryTextView final : public InterimItemWindow
+ {
+ friend class OQueryViewSwitch;
+
+ OQueryController& m_rController;
+ std::unique_ptr<SQLEditView> m_xSQL;
+ std::unique_ptr<weld::CustomWeld> m_xSQLEd;
+
+ Timer m_timerUndoActionCreation;
+ OUString m_strOrigText; // is restored on undo
+ Timer m_timerInvalidate;
+ bool m_bStopTimer;
+
+ DECL_LINK(OnUndoActionTimer, Timer*, void);
+ DECL_LINK(OnInvalidateTimer, Timer*, void);
+ DECL_LINK(ModifyHdl, LinkParamNone*, void);
+
+ public:
+ OQueryTextView(OQueryContainerWindow* pParent, OQueryController& rController);
+ virtual ~OQueryTextView() override;
+ virtual void dispose() override;
+
+ void SetSQLText(const OUString& rNewText);
+ OUString GetSQLText() const;
+
+ virtual void GetFocus() override;
+
+ bool isCutAllowed() const;
+ void copy();
+ void cut();
+ void paste();
+ // clears the whole query
+ void clear();
+ // set the statement for representation
+ void setStatement(const OUString& _rsStatement);
+ OUString getStatement() const;
+
+ void stopTimer();
+ void startTimer();
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryViewSwitch.hxx b/dbaccess/source/ui/inc/QueryViewSwitch.hxx
new file mode 100644
index 0000000000..0f17d40bdc
--- /dev/null
+++ b/dbaccess/source/ui/inc/QueryViewSwitch.hxx
@@ -0,0 +1,94 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <tools/gen.hxx>
+#include <vcl/vclptr.hxx>
+
+namespace dbtools
+{
+ class SQLExceptionInfo;
+}
+
+namespace dbaui
+{
+ class OQueryDesignView;
+ class OQueryTextView;
+ class OAddTableDlg;
+ class OQueryContainerWindow;
+ class OQueryController;
+
+ class OQueryViewSwitch final
+ {
+ VclPtr<OQueryDesignView> m_pDesignView;
+ VclPtr<OQueryTextView> m_pTextView;
+ bool m_bAddTableDialogWasVisible; // true if so
+ public:
+ OQueryViewSwitch(OQueryContainerWindow* pParent, OQueryController& _rController,const css::uno::Reference< css::uno::XComponentContext >& );
+ ~OQueryViewSwitch();
+
+ bool isCutAllowed() const;
+ bool isPasteAllowed() const;
+ bool isCopyAllowed() const;
+ void copy();
+ void cut();
+ void paste();
+ // clears the whole query
+ void clear();
+ // check if the statement is correct when not returning false
+ bool checkStatement();
+ // set the statement for representation
+ void setStatement(const OUString& _rsStatement);
+ // returns the current sql statement
+ OUString getStatement();
+ /// late construction
+ void Construct();
+ void initialize();
+ /** show the text or the design view
+ @return
+ <TRUE/> if and only if the view could be successfully, switched, <FALSE/> otherwise
+ (In the latter case, the controller will issue another switchView call to restore the
+ old state)
+ */
+ bool switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo );
+ void forceInitialView();
+ bool isSlotEnabled(sal_Int32 _nSlotId);
+ void setSlotEnabled(sal_Int32 _nSlotId, bool _bEnable);
+ void setNoneVisibleRow(sal_Int32 _nRows);
+ void SaveUIConfig();
+ void reset();
+ void GrabFocus();
+
+ // returns the add table dialog from the design view
+ OAddTableDlg* getAddTableDialog();
+
+ OQueryDesignView* getDesignView() const { return m_pDesignView; }
+ OQueryContainerWindow* getContainer() const;
+
+ void SetPosSizePixel( Point _rPt,Size _rSize);
+ css::uno::Reference< css::uno::XComponentContext > const & getORB() const;
+
+ private:
+ void impl_forceSQLView();
+ bool impl_postViewSwitch( const bool i_bGraphicalDesign, const bool i_bSuccess );
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RTableConnectionData.hxx b/dbaccess/source/ui/inc/RTableConnectionData.hxx
new file mode 100644
index 0000000000..0dd40e2fab
--- /dev/null
+++ b/dbaccess/source/ui/inc/RTableConnectionData.hxx
@@ -0,0 +1,79 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "TableConnectionData.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "QEnumTypes.hxx"
+
+namespace dbaui
+{
+ enum class Cardinality {
+ Undefined, OneMany, ManyOne, OneOne
+ };
+
+ class OConnectionLineData;
+ class ORelationTableConnectionData final : public OTableConnectionData
+ {
+ friend bool operator==(const ORelationTableConnectionData& lhs, const ORelationTableConnectionData& rhs);
+
+ ::osl::Mutex m_aMutex;
+
+ // @see com.sun.star.sdbc.KeyRule
+ sal_Int32 m_nUpdateRules;
+ sal_Int32 m_nDeleteRules;
+ Cardinality m_nCardinality;
+
+ bool checkPrimaryKey(const css::uno::Reference< css::beans::XPropertySet>& i_xTable, EConnectionSide _eEConnectionSide) const;
+ bool IsSourcePrimKey() const { return checkPrimaryKey(getReferencingTable()->getTable(),JTCS_FROM); }
+ bool IsDestPrimKey() const { return checkPrimaryKey(getReferencedTable()->getTable(),JTCS_TO); }
+
+ ORelationTableConnectionData& operator=( const ORelationTableConnectionData& rConnData );
+ public:
+ ORelationTableConnectionData();
+ ORelationTableConnectionData( const ORelationTableConnectionData& rConnData );
+ ORelationTableConnectionData( const TTableWindowData::value_type& _pReferencingTable,
+ const TTableWindowData::value_type& _pReferencedTable,
+ const OUString& rConnName = OUString() );
+ virtual ~ORelationTableConnectionData() override;
+
+ virtual void CopyFrom(const OTableConnectionData& rSource) override;
+ virtual std::shared_ptr<OTableConnectionData> NewInstance() const override { return std::make_shared<ORelationTableConnectionData>(); }
+
+ /** Update create a new relation
+
+ @return true if successful
+ */
+ virtual bool Update() override;
+
+ void SetCardinality();
+ void SetUpdateRules( sal_Int32 nAttr ){ m_nUpdateRules = nAttr; }
+ void SetDeleteRules( sal_Int32 nAttr ){ m_nDeleteRules = nAttr; }
+
+ sal_Int32 GetUpdateRules() const { return m_nUpdateRules; }
+ sal_Int32 GetDeleteRules() const { return m_nDeleteRules; }
+ Cardinality GetCardinality() const { return m_nCardinality; }
+
+ void IsConnectionPossible();
+ void ChangeOrientation();
+ void DropRelation();
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelControliFace.hxx b/dbaccess/source/ui/inc/RelControliFace.hxx
new file mode 100644
index 0000000000..65ef79db0d
--- /dev/null
+++ b/dbaccess/source/ui/inc/RelControliFace.hxx
@@ -0,0 +1,40 @@
+/* -*- 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 .
+ */
+#pragma once
+
+namespace dbaui
+{
+ class IRelationControlInterface
+ {
+ public:
+ virtual ~IRelationControlInterface(){}
+
+ /** setValid set the valid inside, can be used for OK buttons
+ @param _bValid true when the using control allows an update
+ */
+ virtual void setValid(bool _bValid) = 0;
+
+ /** notifyConnectionChange is callback which is called when the table selection has changed and a new connection exists
+ @param _pConnectionData the connection which exists between the new tables
+ */
+ virtual void notifyConnectionChange() = 0;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelationControl.hxx b/dbaccess/source/ui/inc/RelationControl.hxx
new file mode 100644
index 0000000000..5d4edee2aa
--- /dev/null
+++ b/dbaccess/source/ui/inc/RelationControl.hxx
@@ -0,0 +1,91 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/weld.hxx>
+#include "JoinTableView.hxx"
+
+namespace dbaui
+{
+ class OTableListBoxControl;
+ class IRelationControlInterface;
+ class ORelationControl;
+
+ class OTableListBoxControl final
+ {
+ std::unique_ptr<weld::ComboBox> m_xLeftTable;
+ std::unique_ptr<weld::ComboBox> m_xRightTable;
+ std::unique_ptr<weld::Container> m_xTable;
+ css::uno::Reference<css::awt::XWindow> m_xTableCtrlParent;
+ VclPtr<ORelationControl> m_xRC_Tables;
+
+ const OJoinTableView::OTableWindowMap* m_pTableMap;
+ IRelationControlInterface* m_pParentDialog;
+ OUString m_strCurrentLeft;
+ OUString m_strCurrentRight;
+ DECL_LINK( OnTableChanged, weld::ComboBox&, void );
+ public:
+ OTableListBoxControl(weld::Builder* _pParent,
+ const OJoinTableView::OTableWindowMap* _pTableMap,
+ IRelationControlInterface* _pParentDialog);
+ ~OTableListBoxControl();
+
+ /** fillListBoxes fills the list boxes with the table windows
+ */
+ void fillListBoxes();
+
+ /** fillAndDisable fill the listboxes only with one entry and then disable them
+ @param _pConnectionData
+ contains the data which should be filled into the listboxes
+ */
+ void fillAndDisable(const TTableConnectionData::value_type& _pConnectionData);
+
+ /** enables the relation control
+ *
+ * \param _bEnable when sal_True enables it, otherwise disable it.
+ */
+ void enableRelation(bool _bEnable);
+
+ /** NotifyCellChange notifies the browse control that the connection data has changed
+ */
+ void NotifyCellChange();
+
+ /** Init is a call through to the control inside this one
+ @param _pConnData
+ the connection data which is used to init the control
+ */
+ void Init(const TTableConnectionData::value_type& _pConnData);
+ void lateUIInit();
+ void lateInit();
+
+ void Disable();
+ void Invalidate();
+
+ void SaveModified();
+
+ TTableWindowData::value_type const & getReferencingTable() const;
+
+ /** getContainer returns the container interface
+ @return the interface of the container
+ */
+ IRelationControlInterface* getContainer() const { return m_pParentDialog; }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelationController.hxx b/dbaccess/source/ui/inc/RelationController.hxx
new file mode 100644
index 0000000000..a457f38b80
--- /dev/null
+++ b/dbaccess/source/ui/inc/RelationController.hxx
@@ -0,0 +1,79 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <memory>
+#include <string_view>
+
+#include "JoinController.hxx"
+
+namespace weld
+{
+ class WaitObject;
+}
+
+namespace dbaui
+{
+ class ORelationController : public OJoinController
+ {
+ css::uno::Reference< css::container::XNameAccess > m_xTables;
+ std::unique_ptr<weld::WaitObject> m_xWaitObject;
+ sal_uLong m_nThreadEvent;
+ bool m_bRelationsPossible;
+ protected:
+ // all the features which should be handled by this class
+ virtual void describeSupportedFeatures() override;
+ // state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
+ virtual FeatureState GetState(sal_uInt16 nId) const override;
+ // execute a feature
+ virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+
+ void loadData();
+ TTableWindowData::value_type existsTable(std::u16string_view _rComposedTableName) const;
+
+ // load the window positions out of the datasource
+ void loadLayoutInformation();
+ public:
+ ORelationController(const css::uno::Reference< css::uno::XComponentContext >& _rM);
+
+ virtual ~ORelationController() override;
+
+ void mergeData(const TTableConnectionData& _aConnectionData);
+
+ virtual bool Construct(vcl::Window* pParent) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // OJoinController overridables
+ virtual bool allowViews() const override;
+ virtual bool allowQueries() const override;
+
+ private:
+ // ask the user if the design should be saved when it is modified
+ virtual short saveModified() override;
+ virtual void reset() override;
+ virtual void impl_initialize() override;
+ virtual OUString getPrivateTitle( ) const override;
+ DECL_LINK( OnThreadFinished, void*, void );
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelationDesignView.hxx b/dbaccess/source/ui/inc/RelationDesignView.hxx
new file mode 100644
index 0000000000..2fba88be08
--- /dev/null
+++ b/dbaccess/source/ui/inc/RelationDesignView.hxx
@@ -0,0 +1,45 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include "JoinDesignView.hxx"
+
+namespace dbaui
+{
+ class ORelationController;
+
+ class ORelationDesignView : public OJoinDesignView
+ {
+ public:
+ ORelationDesignView(vcl::Window* pParent, ORelationController& _rController,const css::uno::Reference< css::uno::XComponentContext >& );
+
+ // set the statement for representation
+ /// late construction
+ virtual void Construct() override;
+ virtual void initialize() override;
+
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual void GetFocus() override;
+ };
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelationDlg.hxx b/dbaccess/source/ui/inc/RelationDlg.hxx
new file mode 100644
index 0000000000..c4285f04aa
--- /dev/null
+++ b/dbaccess/source/ui/inc/RelationDlg.hxx
@@ -0,0 +1,74 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <memory>
+#include <vcl/weld.hxx>
+#include "JoinTableView.hxx"
+#include "RelControliFace.hxx"
+#include "RelationControl.hxx"
+
+namespace dbaui
+{
+ class OJoinTableView;
+ class ORelationDialog final : public weld::GenericDialogController
+ , public IRelationControlInterface
+ {
+ VclPtr<OJoinTableView> m_pParent;
+ TTableConnectionData::value_type m_pConnData;
+ TTableConnectionData::value_type m_pOrigConnData;
+ bool m_bTriedOneUpdate;
+
+ std::unique_ptr<weld::RadioButton> m_xRB_NoCascUpd;
+ std::unique_ptr<weld::RadioButton> m_xRB_CascUpd;
+ std::unique_ptr<weld::RadioButton> m_xRB_CascUpdNull;
+ std::unique_ptr<weld::RadioButton> m_xRB_CascUpdDefault;
+ std::unique_ptr<weld::RadioButton> m_xRB_NoCascDel;
+ std::unique_ptr<weld::RadioButton> m_xRB_CascDel;
+ std::unique_ptr<weld::RadioButton> m_xRB_CascDelNull;
+ std::unique_ptr<weld::RadioButton> m_xRB_CascDelDefault;
+ std::unique_ptr<weld::Button> m_xPB_OK;
+
+ std::unique_ptr<OTableListBoxControl> m_xTableControl;
+
+ public:
+ ORelationDialog(OJoinTableView* pParent,
+ const TTableConnectionData::value_type& pConnectionData,
+ bool bAllowTableSelect = false );
+ virtual ~ORelationDialog() override;
+
+ virtual short run() override;
+
+ /** setValid set the valid inside, can be used for OK buttons
+ @param _bValid true when the using control allows an update
+ */
+ virtual void setValid(bool _bValid) override;
+
+ /** notifyConnectionChange is callback which is called when the table selection has changed and a new connection exists
+ @param _pConnectionData the connection which exists between the new tables
+ */
+ virtual void notifyConnectionChange() override;
+ private:
+ void Init(const TTableConnectionData::value_type& _pConnectionData);
+
+ DECL_LINK(OKClickHdl, weld::Button&, void);
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RelationTableView.hxx b/dbaccess/source/ui/inc/RelationTableView.hxx
new file mode 100644
index 0000000000..6c178a3de9
--- /dev/null
+++ b/dbaccess/source/ui/inc/RelationTableView.hxx
@@ -0,0 +1,74 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "JoinTableView.hxx"
+#include <comphelper/containermultiplexer.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <rtl/ref.hxx>
+
+namespace dbaui
+{
+ class ORelationDesignView;
+
+ class ORelationTableView : public ::cppu::BaseMutex,
+ public OJoinTableView,
+ public ::comphelper::OContainerListener
+ {
+ VclPtr<OTableConnection> m_pExistingConnection; ///< is set when a connection was dragged on an existing connection
+ TTableConnectionData::value_type m_pCurrentlyTabConnData; ///< set when we creating a connection with more than one keycolumn
+ ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener;
+ bool m_bInRemove;
+
+ virtual void ConnDoubleClicked(VclPtr<OTableConnection>& rConnection) override;
+ virtual void AddTabWin(const OUString& _rComposedName, const OUString& rWinName, bool bNewTable = false) override;
+
+ virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) override;
+
+ /** determines whether the classes Init method should accept a query
+ name, or only table names */
+ virtual bool allowQueries() const override;
+
+ // OContainerListener
+ virtual void _elementInserted( const css::container::ContainerEvent& _rEvent ) override;
+ virtual void _elementRemoved( const css::container::ContainerEvent& _rEvent ) override;
+ virtual void _elementReplaced( const css::container::ContainerEvent& _rEvent ) override;
+
+ public:
+ ORelationTableView( vcl::Window* pParent, ORelationDesignView* pView );
+ virtual ~ORelationTableView() override;
+ virtual void dispose() override;
+
+ virtual void RemoveTabWin( OTableWindow* pTabWin ) override;
+ virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest) override;
+ virtual bool RemoveConnection(VclPtr<OTableConnection>& rConn, bool _bDelete) override;
+
+ virtual void ReSync() override;
+
+ /// Creates a dialogue for a completely new relation.
+ void AddNewRelation();
+
+ /// used by AddTabDlg to check if tables can be added
+ virtual bool IsAddAllowed() override;
+
+ virtual void lookForUiActivities() override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/RtfReader.hxx b/dbaccess/source/ui/inc/RtfReader.hxx
new file mode 100644
index 0000000000..58f6aa26ba
--- /dev/null
+++ b/dbaccess/source/ui/inc/RtfReader.hxx
@@ -0,0 +1,59 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vector>
+#include <svtools/parrtf.hxx>
+#include "DExport.hxx"
+
+class SvStream;
+
+namespace dbaui
+{
+ class ORTFReader final : public SvRTFParser , public ODatabaseExport
+ {
+ std::vector<Color> m_vecColor;
+
+ bool CreateTable(int nToken);
+ virtual void NextToken( int nToken ) override; // base class
+ virtual TypeSelectionPageFactory
+ getTypeSelectionPageFactory() override;
+
+ virtual ~ORTFReader() override;
+
+ public:
+ ORTFReader( SvStream& rIn,
+ const SharedConnection& _rxConnection,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+ // required for automatic type recognition
+ ORTFReader( SvStream& rIn,
+ sal_Int32 nRows,
+ TPositions&& _rColumnPositions,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const TColumnVector* rList,
+ const OTypeInfoMap* _pInfoMap,
+ bool _bAutoIncrementEnabled);
+
+ virtual SvParserState CallParser() override;// base class
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/SqlNameEdit.hxx b/dbaccess/source/ui/inc/SqlNameEdit.hxx
new file mode 100644
index 0000000000..14d845b4b1
--- /dev/null
+++ b/dbaccess/source/ui/inc/SqlNameEdit.hxx
@@ -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 .
+ */
+#pragma once
+
+#include <svtools/editbrowsebox.hxx>
+#include <utility>
+#include <vcl/weld.hxx>
+
+namespace dbaui
+{
+ class OSQLNameChecker
+ {
+ OUString m_sAllowedChars;
+ bool m_bCheck; // true when we should check for invalid chars
+ public:
+ OSQLNameChecker(OUString _sAllowedChars)
+ :m_sAllowedChars(std::move(_sAllowedChars))
+ ,m_bCheck(true)
+ {
+ }
+
+ void setAllowedChars(const OUString& _rAllowedChars)
+ {
+ m_sAllowedChars = _rAllowedChars;
+ }
+ void setCheck(bool _bCheck)
+ {
+ m_bCheck = _bCheck;
+ }
+ bool checkString(std::u16string_view _sToCheck,OUString& _rsCorrected);
+ };
+
+ class OSQLNameEditControl : public svt::EditControl
+ , public OSQLNameChecker
+ {
+ public:
+ OSQLNameEditControl(BrowserDataWin* pParent, const OUString& rAllowedChars)
+ : svt::EditControl(pParent)
+ , OSQLNameChecker(rAllowedChars)
+ {
+ m_xWidget->connect_changed(LINK(this, OSQLNameEditControl, ModifyHdl));
+ }
+
+ virtual void connect_changed(const Link<weld::Entry&, void>& rLink) override
+ {
+ m_ChainChangedHdl = rLink;
+ }
+
+ private:
+ DECL_LINK(ModifyHdl, weld::Entry&, void);
+
+ Link<weld::Entry&,void> m_ChainChangedHdl;
+ };
+
+ class OWidgetBase
+ {
+ private:
+ weld::Widget* m_pWidget;
+ public:
+ OWidgetBase(weld::Widget *pWidget)
+ : m_pWidget(pWidget)
+ {
+ }
+
+ void hide() { m_pWidget->hide(); }
+ void show() { m_pWidget->show(); }
+ void set_sensitive(bool bSensitive) { m_pWidget->set_sensitive(bSensitive); }
+
+ weld::Widget* GetWidget() { return m_pWidget; }
+
+ virtual bool get_value_changed_from_saved() const = 0;
+ virtual void save_value() = 0;
+
+ virtual ~OWidgetBase() {}
+ };
+
+ class OSQLNameEntry : public OWidgetBase
+ , public OSQLNameChecker
+ {
+ private:
+ std::unique_ptr<weld::Entry> m_xEntry;
+
+ DECL_LINK(ModifyHdl, weld::Entry&, void);
+
+ public:
+ OSQLNameEntry(std::unique_ptr<weld::Entry> xEntry, const OUString& _rAllowedChars = OUString())
+ : OWidgetBase(xEntry.get())
+ , OSQLNameChecker(_rAllowedChars)
+ , m_xEntry(std::move(xEntry))
+ {
+ m_xEntry->connect_changed(LINK(this, OSQLNameEntry, ModifyHdl));
+ }
+
+ OUString get_text() const { return m_xEntry->get_text(); }
+ void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
+ void set_max_length(int nLen) { m_xEntry->set_max_length(nLen); }
+ virtual void save_value() override { m_xEntry->save_value(); }
+ virtual bool get_value_changed_from_saved() const override
+ {
+ return m_xEntry->get_value_changed_from_saved();
+ }
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableConnection.hxx b/dbaccess/source/ui/inc/TableConnection.hxx
new file mode 100644
index 0000000000..a38aa1fe03
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableConnection.hxx
@@ -0,0 +1,98 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vector>
+#include <vcl/window.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include "TableConnectionData.hxx"
+
+class Point;
+namespace tools { class Rectangle; }
+
+namespace dbaui
+{
+ class OTableConnectionData;
+ class OTableWindow;
+ class OJoinTableView;
+ class OConnectionLine;
+
+ class OTableConnection : public vcl::Window
+ {
+ std::vector<std::unique_ptr<OConnectionLine>> m_vConnLine;
+ TTableConnectionData::value_type
+ m_pData;
+ VclPtr<OJoinTableView> m_pParent;
+
+ bool m_bSelected;
+
+ void Init();
+ /** loops through the vector and deletes all lines */
+ void clearLineData();
+
+ public:
+ OTableConnection( OJoinTableView* pContainer, TTableConnectionData::value_type aTabConnData );
+ OTableConnection( const OTableConnection& rConn );
+ /** destructor
+
+ @attention Normally a pointer to OTableConnectionData is given but
+ here, however, one has to create an instance (with
+ OTableConnectionDate::NewInstance) which is never deleted
+ (same like in other cases). Thus, the caller is
+ responsible to check and save the data for deleting it
+ eventually.
+ */
+ virtual ~OTableConnection() override;
+ virtual void dispose() override;
+
+ OTableConnection& operator=( const OTableConnection& rConn );
+
+ void Select();
+ void Deselect();
+ bool IsSelected() const { return m_bSelected; }
+ bool CheckHit( const Point& rMousePos ) const;
+ void InvalidateConnection();
+ void UpdateLineList();
+
+ OTableWindow* GetSourceWin() const;
+ OTableWindow* GetDestWin() const;
+
+ void RecalcLines();
+ /** isTableConnection
+
+ @param _pTable the table where we should check if we belong to it
+ @return true when the source or the destination window are equal
+ */
+ bool isTableConnection(const OTableWindow* _pTable)
+ {
+ return (_pTable == GetSourceWin() || _pTable == GetDestWin());
+ }
+
+ tools::Rectangle GetBoundingRect() const;
+
+ const TTableConnectionData::value_type& GetData() const { return m_pData; }
+ const std::vector<std::unique_ptr<OConnectionLine>>& GetConnLineList() const { return m_vConnLine; }
+ OJoinTableView* GetParent() const { return m_pParent; }
+ virtual void Draw(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+ using Window::Draw;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableConnectionData.hxx b/dbaccess/source/ui/inc/TableConnectionData.hxx
new file mode 100644
index 0000000000..096a6de70a
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableConnectionData.hxx
@@ -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 .
+ */
+#pragma once
+
+#include "ConnectionLineData.hxx"
+#include "TableWindowData.hxx"
+#include <vector>
+#include <memory>
+
+namespace dbaui
+{
+ //===========================================//
+ // ConnData ---------->* ConnLineData //
+ // ^1 ^1 //
+ // | | //
+ // Conn ---------->* ConnLine //
+ //===========================================//
+
+ /** Contains all connection data which exists between two windows */
+ class OTableConnectionData
+ {
+ protected:
+ TTableWindowData::value_type m_pReferencingTable;
+ TTableWindowData::value_type m_pReferencedTable;
+ OUString m_aConnName;
+
+ OConnectionLineDataVec m_vConnLineData;
+
+ void Init();
+
+ OTableConnectionData& operator=( const OTableConnectionData& rConnData );
+ public:
+ OTableConnectionData();
+ OTableConnectionData( TTableWindowData::value_type _aReferencingTable,
+ TTableWindowData::value_type _aReferencedTable );
+ OTableConnectionData( const OTableConnectionData& rConnData );
+ virtual ~OTableConnectionData();
+
+ /// initialise from a source (more comfortable than a virtual assignment operator)
+ virtual void CopyFrom(const OTableConnectionData& rSource);
+
+ /** deliver a new instance of my own type
+
+ derived classes have to deliver an instance of their own type
+
+ @note does NOT have to be initialised
+ */
+ virtual std::shared_ptr<OTableConnectionData> NewInstance() const;
+
+ void SetConnLine( sal_uInt16 nIndex, const OUString& rSourceFieldName, const OUString& rDestFieldName );
+ bool AppendConnLine( const OUString& rSourceFieldName, const OUString& rDestFieldName );
+ /** Deletes list of ConnLines
+ */
+ void ResetConnLines();
+
+ /** moves the empty lines to the back
+ removes duplicated empty lines
+
+ caller is responsible for repainting them
+
+ @return index of first changed line, or one-past-the-end if no change
+ */
+ OConnectionLineDataVec::size_type normalizeLines();
+
+ const OConnectionLineDataVec& GetConnLineDataList() const { return m_vConnLineData; }
+ OConnectionLineDataVec& GetConnLineDataList() { return m_vConnLineData; }
+
+ const TTableWindowData::value_type& getReferencingTable() const { return m_pReferencingTable; }
+ const TTableWindowData::value_type& getReferencedTable() const { return m_pReferencedTable; }
+
+ void setReferencingTable(const TTableWindowData::value_type& _pTable) { m_pReferencingTable = _pTable; }
+ void setReferencedTable(const TTableWindowData::value_type& _pTable) { m_pReferencedTable = _pTable; }
+
+ /** Update create a new connection
+
+ @return true if successful
+ */
+ virtual bool Update(){ return true; }
+ };
+
+ typedef std::vector< std::shared_ptr<OTableConnectionData> > TTableConnectionData;
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx
new file mode 100644
index 0000000000..ce2017b586
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableController.hxx
@@ -0,0 +1,129 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "singledoccontroller.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "TypeInfo.hxx"
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+namespace dbaui
+{
+ class OTableRow;
+ typedef OSingleDocumentController OTableController_BASE;
+ class OTableController final : public OTableController_BASE
+ {
+ private:
+ std::vector< std::shared_ptr<OTableRow> > m_vRowList;
+ OTypeInfoMap m_aTypeInfo;
+ std::vector<OTypeInfoMap::iterator> m_aTypeInfoIndex;
+
+ css::uno::Reference< css::beans::XPropertySet > m_xTable;
+
+ OUString m_sName; // table for update data
+ OUString m_sAutoIncrementValue; // the autoincrement value set in the datasource
+ OUString m_sTypeNames; // these type names are the ones out of the resource file
+ TOTypeInfoSP m_pTypeInfo; // fall back when type is unknown because database driver has a failure
+
+ bool m_bAllowAutoIncrementValue; // no : 1 NO BIT , is true when the datasource has an AutoIncrementValue property in their info property
+ bool m_bNew : 1; // is true when we create a new table
+
+
+ void reSyncRows();
+ void assignTable(); // set the table if a name is given
+ void loadData();
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ bool checkColumns(bool _bNew); // check if we have double column names
+ void appendColumns(css::uno::Reference< css::sdbcx::XColumnsSupplier> const & _rxColSup, bool _bNew, bool _bKeyColumns = false);
+ void appendPrimaryKey(css::uno::Reference< css::sdbcx::XKeysSupplier> const & _rxSup, bool _bNew);
+ void alterColumns();
+ void dropPrimaryKey();
+ css::uno::Reference< css::container::XNameAccess> getKeyColumns() const;
+ OUString createUniqueName(const OUString& _rName);
+
+ void reload();
+
+ // all the features which should be handled by this class
+ virtual void describeSupportedFeatures() override;
+ // state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
+ virtual FeatureState GetState(sal_uInt16 nId) const override;
+ // execute a feature
+ virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+
+ virtual void losingConnection( ) override;
+
+ virtual OUString getPrivateTitle( ) const override;
+
+ void doEditIndexes();
+ bool doSaveDoc(bool _bSaveAs);
+
+ virtual ~OTableController() override;
+ public:
+ OTableController(const css::uno::Reference< css::uno::XComponentContext >& _rM);
+
+ const css::uno::Reference< css::beans::XPropertySet >& getTable() const { return m_xTable;}
+
+ bool isAddAllowed() const;
+ bool isDropAllowed() const;
+ bool isAlterAllowed() const;
+ bool isAutoIncrementPrimaryKey() const;
+
+ bool isAutoIncrementValueEnabled() const { return m_bAllowAutoIncrementValue; }
+ const OUString& getAutoIncrementValue() const { return m_sAutoIncrementValue; }
+
+ virtual void impl_onModifyChanged() override;
+
+ std::vector< std::shared_ptr<OTableRow> >& getRows() { return m_vRowList; }
+
+ /// returns the position of the first empty row
+ sal_Int32 getFirstEmptyRowPosition();
+
+ const OTypeInfoMap& getTypeInfo() const { return m_aTypeInfo; }
+
+ TOTypeInfoSP const & getTypeInfo(sal_Int32 _nPos) const { return m_aTypeInfoIndex[_nPos]->second; }
+ TOTypeInfoSP getTypeInfoByType(sal_Int32 _nDataType) const;
+
+ const TOTypeInfoSP& getTypeInfoFallBack() const { return m_pTypeInfo; }
+
+ virtual bool Construct(vcl::Window* pParent) override;
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // css::frame::XController
+ virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL disposing() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override;
+
+ private:
+ void startTableListening();
+ void stopTableListening();
+ virtual void impl_initialize() override;
+ };
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableCopyHelper.hxx b/dbaccess/source/ui/inc/TableCopyHelper.hxx
new file mode 100644
index 0000000000..b543dade80
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableCopyHelper.hxx
@@ -0,0 +1,188 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "AppElementType.hxx"
+#include "commontypes.hxx"
+#include <svx/dataaccessdescriptor.hxx>
+#include <sot/storage.hxx>
+#include <vcl/transfer.hxx>
+#include <vcl/weld.hxx>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+
+namespace dbaui
+{
+ class OGenericUnoController;
+ /// Functor object for class DataFlavorExVector::value_type returntype is bool
+ struct TAppSupportedSotFunctor
+ {
+ ElementType eEntryType;
+ TAppSupportedSotFunctor(const ElementType& _eEntryType)
+ : eEntryType(_eEntryType)
+ {
+ }
+
+ bool operator()(const DataFlavorExVector::value_type& _aType)
+ {
+ switch (_aType.mnSotId)
+ {
+ case SotClipboardFormatId::RTF: // RTF data descriptions
+ case SotClipboardFormatId::HTML: // HTML data descriptions
+ case SotClipboardFormatId::DBACCESS_TABLE: // table descriptor
+ return (E_TABLE == eEntryType);
+ case SotClipboardFormatId::DBACCESS_QUERY: // query descriptor
+ case SotClipboardFormatId::DBACCESS_COMMAND: // SQL command
+ return E_QUERY == eEntryType;
+ default: break;
+ }
+ return false;
+ }
+ };
+
+ class OTableCopyHelper
+ {
+ private:
+ OGenericUnoController* m_pController;
+ OUString m_sTableNameForAppend;
+
+ public:
+ // is needed to describe the drop target
+ struct DropDescriptor
+ {
+ svx::ODataAccessDescriptor aDroppedData;
+
+ //for transfor the tablename
+ OUString sDefaultTableName;
+
+ OUString aUrl;
+ tools::SvRef<SotTempStream> aHtmlRtfStorage;
+ ElementType nType;
+ std::unique_ptr<weld::TreeIter> xDroppedAt;
+ sal_Int8 nAction;
+ bool bHtml;
+ bool bError;
+
+ DropDescriptor()
+ : nType(E_TABLE)
+ , nAction(DND_ACTION_NONE)
+ , bHtml(false)
+ , bError(false)
+ { }
+ };
+
+ OTableCopyHelper(OGenericUnoController* _pController);
+
+ /** pastes a table into the data source
+ @param _rPasteData
+ The data helper.
+ @param _sDestDataSourceName
+ The name of the dest data source.
+ */
+ void pasteTable( const TransferableDataHelper& _rTransData
+ ,std::u16string_view _sDestDataSourceName
+ ,const SharedConnection& _xConnection);
+
+ /** pastes a table into the data source
+ @param _nFormatId
+ The format which should be copied.
+ @param _rPasteData
+ The data helper.
+ @param _sDestDataSourceName
+ The name of the dest data source.
+ */
+ void pasteTable( SotClipboardFormatId _nFormatId
+ ,const TransferableDataHelper& _rTransData
+ ,std::u16string_view _sDestDataSourceName
+ ,const SharedConnection& _xConnection);
+
+ /** copies a table which was constructed by tags like HTML or RTF
+ @param _rDesc
+ The Drop descriptor
+ @param _bCheck
+ If set to <TRUE/> than the controller checks only if a copy is possible.
+ @param _xConnection
+ The connection
+ */
+ bool copyTagTable( DropDescriptor const & _rDesc,
+ bool _bCheck,
+ const SharedConnection& _xConnection);
+
+ /** copies a table which was constructed by tags like HTML or RTF
+ @param _rDesc
+ The Drop descriptor
+ @param _bCheck
+ If set to <TRUE/> than the controller checks only if a copy is possible.
+ @param _xConnection
+ The connection
+ */
+ void asyncCopyTagTable( DropDescriptor& _rDesc
+ ,std::u16string_view _sDestDataSourceName
+ ,const SharedConnection& _xConnection);
+
+ /** copies a table which was constructed by tags like HTML or RTF
+ @param _aDroppedData
+ The dropped data
+ @param _rDesc
+ IN/OUT parameter
+ @param _xConnection
+ The connection
+ */
+ bool copyTagTable(const TransferableDataHelper& _aDroppedData,
+ DropDescriptor& _rAsyncDrop,
+ const SharedConnection& _xConnection);
+
+ /// returns <TRUE/> if the clipboard supports a table format, otherwise <FALSE/>.
+ static bool isTableFormat(const TransferableDataHelper& _rClipboard);
+
+ void SetTableNameForAppend( const OUString& _rDefaultTableName ) { m_sTableNameForAppend = _rDefaultTableName; }
+ void ResetTableNameForAppend() { SetTableNameForAppend( OUString() ); }
+ const OUString& GetTableNameForAppend() const { return m_sTableNameForAppend ;}
+
+ private:
+ /** pastes a table into the data source
+ @param _rPasteData
+ The data descriptor.
+ @param _sDestDataSourceName
+ The name of the dest data source.
+ */
+ void pasteTable(
+ const svx::ODataAccessDescriptor& _rPasteData,
+ std::u16string_view _sDestDataSourceName,
+ const SharedConnection& _xDestConnection
+ );
+
+ /** insert a table into the data source. The source can either be a table or a query
+ */
+ void insertTable(
+ std::u16string_view i_rSourceDataSource,
+ const css::uno::Reference< css::sdbc::XConnection>& i_rSourceConnection,
+ const OUString& i_rCommand,
+ const sal_Int32 i_nCommandType,
+ const css::uno::Reference< css::sdbc::XResultSet >& i_rSourceRows,
+ const css::uno::Sequence< css::uno::Any >& i_rSelection,
+ const bool i_bBookmarkSelection,
+ std::u16string_view i_rDestDataSource,
+ const css::uno::Reference< css::sdbc::XConnection>& i_rDestConnection
+ );
+
+ };
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableDesignControl.hxx b/dbaccess/source/ui/inc/TableDesignControl.hxx
new file mode 100644
index 0000000000..89debc9e11
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableDesignControl.hxx
@@ -0,0 +1,78 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <svtools/editbrowsebox.hxx>
+
+#include "IClipBoardTest.hxx"
+#include "TypeInfo.hxx"
+
+namespace dbaui
+{
+ class OTableDesignView;
+
+ class OTableRowView : public ::svt::EditBrowseBox, public IClipboardTest
+ {
+ friend class OTableDesignUndoAct;
+
+ protected:
+ tools::Long m_nDataPos; ///< currently needed row
+ tools::Long m_nCurrentPos; ///< current position of selected column
+
+ private:
+ sal_uInt16 m_nCurUndoActId;
+
+ public:
+ OTableRowView(vcl::Window* pParent);
+
+ virtual void SetCellData( sal_Int32 nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo ) = 0;
+ virtual void SetCellData( sal_Int32 nRow, sal_uInt16 nColId, const css::uno::Any& _rNewData ) = 0;
+ virtual css::uno::Any GetCellData( sal_Int32 nRow, sal_uInt16 nColId ) = 0;
+ virtual void SetControlText( sal_Int32 nRow, sal_uInt16 nColId, const OUString& rText ) = 0;
+
+ virtual OTableDesignView* GetView() const = 0;
+
+ sal_uInt16 GetCurUndoActId() const { return m_nCurUndoActId; }
+
+ // IClipboardTest
+ virtual void cut() override;
+ virtual void copy() override;
+ virtual void paste() override;
+
+ protected:
+ void Paste( sal_Int32 nRow );
+
+ virtual void CopyRows() = 0;
+ virtual void DeleteRows() = 0;
+ virtual void InsertRows( sal_Int32 nRow ) = 0;
+ virtual void InsertNewRows( sal_Int32 nRow ) = 0;
+
+ virtual bool IsPrimaryKeyAllowed() = 0;
+ virtual bool IsInsertNewAllowed( sal_Int32 nRow ) = 0;
+ virtual bool IsDeleteAllowed() = 0;
+
+ virtual RowStatus GetRowStatus(sal_Int32 nRow) const override;
+ virtual void KeyInput(const KeyEvent& rEvt) override;
+ virtual void Command( const CommandEvent& rEvt ) override;
+
+ virtual void Init() override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableDesignHelpBar.hxx b/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
new file mode 100644
index 0000000000..db4023d36c
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
@@ -0,0 +1,59 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/weld.hxx>
+#include "IClipBoardTest.hxx"
+
+namespace dbaui
+{
+ class OTableDesignHelpBar final : public IClipboardTest
+ {
+ private:
+ std::unique_ptr<weld::TextView> m_xTextWin;
+
+ public:
+ OTableDesignHelpBar(std::unique_ptr<weld::TextView> xTextWin);
+
+ void SetHelpText( const OUString& rText );
+
+ bool HasFocus() const { return m_xTextWin->has_focus(); }
+
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink)
+ {
+ m_xTextWin->connect_focus_in(rLink);
+ }
+
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink)
+ {
+ m_xTextWin->connect_focus_out(rLink);
+ }
+
+ // IClipboardTest
+ virtual bool isCutAllowed() override;
+ virtual bool isCopyAllowed() override;
+ virtual bool isPasteAllowed() override;
+
+ virtual void copy() override;
+ virtual void cut() override;
+ virtual void paste() override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableDesignView.hxx b/dbaccess/source/ui/inc/TableDesignView.hxx
new file mode 100644
index 0000000000..077eb211e3
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableDesignView.hxx
@@ -0,0 +1,112 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <dbaccess/dataview.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/weld.hxx>
+#include "IClipBoardTest.hxx"
+
+namespace dbaui
+{
+ class OTableController;
+ class OTableDesignView;
+ class OTableFieldDescWin;
+ class OTableEditorCtrl;
+
+ class OTableBorderWindow final : public InterimItemWindow
+ {
+ std::unique_ptr<weld::Paned> m_xHorzSplitter;
+ std::unique_ptr<weld::Container> m_xEditorParent;
+ css::uno::Reference<css::awt::XWindow> m_xEditorParentWin;
+ VclPtr<OTableEditorCtrl> m_xEditorCtrl;
+ std::unique_ptr<weld::Container> m_xFieldDescParent;
+ std::unique_ptr<OTableFieldDescWin> m_xFieldDescWin;
+
+ public:
+ OTableBorderWindow(OTableDesignView* pParent);
+ virtual ~OTableBorderWindow() override;
+ // Window overrides
+ virtual void dispose() override;
+
+ virtual void GetFocus() override;
+ virtual void Layout() override;
+
+ OTableEditorCtrl* GetEditorCtrl() const { return m_xEditorCtrl.get(); }
+ OTableFieldDescWin* GetDescWin() const { return m_xFieldDescWin.get(); }
+ };
+
+ class OTableDesignView : public ODataView
+ , public IClipboardTest
+ {
+ enum ChildFocusState
+ {
+ DESCRIPTION,
+ EDITOR,
+ NONE
+ };
+ private:
+ css::lang::Locale m_aLocale;
+ VclPtr<OTableBorderWindow> m_pWin;
+ OTableController& m_rController;
+ ChildFocusState m_eChildFocus;
+
+ IClipboardTest* getActiveChild() const;
+
+ DECL_LINK( FieldDescFocusIn, weld::Widget&, void );
+ protected:
+
+ // return the Rectangle where I can paint myself
+ virtual void resizeDocumentView(tools::Rectangle& rRect) override;
+
+ public:
+ OTableDesignView( vcl::Window* pParent,
+ const css::uno::Reference< css::uno::XComponentContext >&,
+ OTableController& _rController);
+ virtual ~OTableDesignView() override;
+ virtual void dispose() override;
+
+ // Window overrides
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual void GetFocus() override;
+
+ OTableEditorCtrl* GetEditorCtrl() const { return m_pWin ? m_pWin->GetEditorCtrl() : nullptr; }
+ OTableFieldDescWin* GetDescWin() const { return m_pWin ? m_pWin->GetDescWin() : nullptr; }
+ OTableController& getController() const { return m_rController; }
+
+ const css::lang::Locale& getLocale() const { return m_aLocale;}
+
+ // IClipboardTest
+ virtual bool isCutAllowed() override;
+ virtual bool isCopyAllowed() override;
+ virtual bool isPasteAllowed() override;
+ virtual void copy() override;
+ virtual void cut() override;
+ virtual void paste() override;
+
+ // set the view readonly or not
+ void setReadOnly(bool _bReadOnly);
+
+ virtual void initialize() override;
+ void reSync(); // resync window data with realdata
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableFieldDescription.hxx b/dbaccess/source/ui/inc/TableFieldDescription.hxx
new file mode 100644
index 0000000000..d21ad953ab
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableFieldDescription.hxx
@@ -0,0 +1,150 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vector>
+
+#include "QEnumTypes.hxx"
+#include <rtl/ustring.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <rtl/ref.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/window.hxx>
+
+#include <salhelper/simplereferenceobject.hxx>
+
+namespace comphelper
+{
+ class NamedValueCollection;
+}
+
+namespace vcl { class Window; }
+
+namespace dbaui
+{
+ class OTableFieldDesc : public ::salhelper::SimpleReferenceObject
+ {
+ private:
+ std::vector< OUString >
+ m_aCriteria;
+
+ OUString m_aTableName;
+ OUString m_aAliasName; ///< table range
+ OUString m_aFieldName; ///< column
+ OUString m_aFieldAlias; ///< column alias
+ OUString m_aFunctionName;///< contains the function name (only if m_eFunctionType != FKT_NONE)
+
+ VclPtr<vcl::Window> m_pTabWindow;
+
+ sal_Int32 m_eDataType;
+ sal_Int32 m_eFunctionType;
+ ETableFieldType m_eFieldType;
+ EOrderDir m_eOrderDir;
+ sal_Int32 m_nIndex;
+ sal_Int32 m_nColWidth;
+ sal_uInt16 m_nColumnId;
+ bool m_bGroupBy;
+ bool m_bVisible;
+
+ // when adding new fields, please take care of IsEmpty!
+
+ public:
+ OTableFieldDesc();
+ OTableFieldDesc(const OUString& rTable, const OUString& rField );
+ OTableFieldDesc(const OTableFieldDesc& rRS);
+ virtual ~OTableFieldDesc() override;
+
+ inline bool IsEmpty() const;
+
+ OTableFieldDesc& operator=( const OTableFieldDesc& _aField );
+
+ bool IsVisible() const { return m_bVisible;}
+ bool IsGroupBy() const { return m_bGroupBy;}
+
+ void SetVisible( bool bVis=true ) { m_bVisible = bVis; }
+ void SetGroupBy( bool bGb ) { m_bGroupBy = bGb; }
+ void SetTabWindow( vcl::Window* pWin ){ m_pTabWindow = pWin; }
+ void SetField( const OUString& rF ) { m_aFieldName = rF; }
+ void SetFieldAlias( const OUString& rF ) { m_aFieldAlias = rF; }
+ void SetTable( const OUString& rT ) { m_aTableName = rT; }
+ void SetAlias( const OUString& rT ) { m_aAliasName = rT; }
+ void SetFunction( const OUString& rT ) { m_aFunctionName = rT; }
+ void SetOrderDir( EOrderDir eDir ) { m_eOrderDir = eDir; }
+ void SetDataType( sal_Int32 eTyp ) { m_eDataType = eTyp; }
+ void SetFieldType( ETableFieldType eTyp ) { m_eFieldType = eTyp; }
+ void SetCriteria( sal_uInt16 nIdx, const OUString& rCrit );
+ void SetColWidth( sal_Int32 nWidth ) { m_nColWidth = nWidth; }
+ void SetFieldIndex( sal_Int32 nFieldIndex ) { m_nIndex = nFieldIndex; }
+ void SetFunctionType( sal_Int32 eTyp ) { m_eFunctionType = eTyp; }
+ void SetColumnId(sal_uInt16 _nColumnId) { m_nColumnId = _nColumnId; }
+
+ const OUString& GetField() const { return m_aFieldName;}
+ const OUString& GetFieldAlias() const { return m_aFieldAlias;}
+ const OUString& GetTable() const { return m_aTableName;}
+ const OUString& GetAlias() const { return m_aAliasName;}
+ const OUString& GetFunction() const { return m_aFunctionName;}
+ sal_Int32 GetDataType() const { return m_eDataType; }
+ ETableFieldType GetFieldType() const { return m_eFieldType; }
+ EOrderDir GetOrderDir() const { return m_eOrderDir; }
+ OUString GetCriteria( sal_uInt16 nIdx ) const;
+ sal_Int32 GetColWidth() const { return m_nColWidth; }
+ sal_Int32 GetFieldIndex() const { return m_nIndex; }
+ vcl::Window* GetTabWindow() const { return m_pTabWindow;}
+ sal_Int32 GetFunctionType() const { return m_eFunctionType; }
+ sal_uInt16 GetColumnId() const { return m_nColumnId;}
+
+ bool isAggregateFunction() const { return (m_eFunctionType & FKT_AGGREGATE) == FKT_AGGREGATE; }
+ bool isOtherFunction() const { return (m_eFunctionType & FKT_OTHER) == FKT_OTHER; }
+ bool isNumeric() const { return (m_eFunctionType & FKT_NUMERIC) == FKT_NUMERIC; }
+ bool isNoneFunction() const { return m_eFunctionType == FKT_NONE; }
+ bool isCondition() const { return (m_eFunctionType & FKT_CONDITION) == FKT_CONDITION; }
+ bool isNumericOrAggregateFunction() const { return isNumeric() || isAggregateFunction(); }
+
+ bool HasCriteria() const
+ {
+ for (auto const& criteria : m_aCriteria)
+ {
+ if(!criteria.isEmpty())
+ return true;
+ }
+ return false;
+ }
+
+ const std::vector< OUString>& GetCriteria() const { return m_aCriteria; }
+
+ void Load( const css::beans::PropertyValue& i_rSettings, const bool i_bIncludingCriteria );
+ void Save( ::comphelper::NamedValueCollection& o_rSettings, const bool i_bIncludingCriteria );
+ };
+
+ inline bool OTableFieldDesc::IsEmpty() const
+ {
+ bool bEmpty = (m_aTableName.isEmpty() &&
+ m_aAliasName.isEmpty() &&
+ m_aFieldName.isEmpty() &&
+ m_aFieldAlias.isEmpty() &&
+ m_aFunctionName.isEmpty() &&
+ !HasCriteria());
+ return bEmpty;
+ }
+
+ typedef ::rtl::Reference< OTableFieldDesc> OTableFieldDescRef;
+ typedef std::vector<OTableFieldDescRef> OTableFields;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableGrantCtrl.hxx b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
new file mode 100644
index 0000000000..74a9fd8b58
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
@@ -0,0 +1,104 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <map>
+
+#include <svtools/editbrowsebox.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XAuthorizable.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+class Edit;
+namespace dbaui
+{
+
+class OTableGrantControl : public ::svt::EditBrowseBox
+{
+ typedef struct
+ {
+ sal_Int32 nRights;
+ sal_Int32 nWithGrant;
+ } TPrivileges;
+
+ typedef std::map<OUString, TPrivileges> TTablePrivilegeMap;
+
+ css::uno::Reference< css::container::XNameAccess > m_xUsers;
+ css::uno::Reference< css::container::XNameAccess > m_xTables;
+ css::uno::Reference< css::uno::XComponentContext> m_xContext;
+ css::uno::Reference< css::sdbcx::XAuthorizable> m_xGrantUser;
+ css::uno::Sequence< OUString> m_aTableNames;
+
+ mutable TTablePrivilegeMap m_aPrivMap;
+ OUString m_sUserName;
+ VclPtr<::svt::CheckBoxControl> m_pCheckCell;
+ VclPtr<::svt::EditControl> m_pEdit;
+ tools::Long m_nDataPos;
+ ImplSVEvent * m_nDeactivateEvent;
+
+public:
+ OTableGrantControl(const css::uno::Reference<css::awt::XWindow> &rParent);
+ virtual ~OTableGrantControl() override;
+ virtual void dispose() override;
+ void UpdateTables();
+ void setUserName(const OUString& _sUserName);
+ void setGrantUser(const css::uno::Reference< css::sdbcx::XAuthorizable>& _xGrantUser);
+
+ void setTablesSupplier(const css::uno::Reference< css::sdbcx::XTablesSupplier >& _xTablesSup);
+ void setComponentContext(const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
+
+ virtual void Init() override;
+
+ // IAccessibleTableProvider
+ /** Creates the accessible object of a data table cell.
+ @param nRow The row index of the cell.
+ @param nColumnId The column ID of the cell.
+ @return The XAccessible interface of the specified cell. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ) override;
+
+protected:
+ virtual bool PreNotify(NotifyEvent& rNEvt ) override;
+
+ virtual bool IsTabAllowed(bool bForward) const override;
+ virtual void InitController( ::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol ) override;
+ virtual ::svt::CellController* GetController( sal_Int32 nRow, sal_uInt16 nCol ) override;
+ virtual void PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId ) const override;
+ virtual bool SeekRow( sal_Int32 nRow ) override;
+ virtual bool SaveModified() override;
+ virtual OUString GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const override;
+
+ virtual void CellModified() override;
+
+private:
+ DECL_LINK( AsynchActivate, void*, void );
+ DECL_LINK( AsynchDeactivate, void*, void );
+
+ static bool isAllowed(sal_uInt16 _nColumnId,sal_Int32 _nPrivilege);
+ void fillPrivilege(sal_Int32 _nRow) const;
+ TTablePrivilegeMap::const_iterator findPrivilege(sal_Int32 _nRow) const;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableRow.hxx b/dbaccess/source/ui/inc/TableRow.hxx
new file mode 100644
index 0000000000..4f34a94bf5
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableRow.hxx
@@ -0,0 +1,76 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <tools/long.hxx>
+#include "TypeInfo.hxx"
+
+class SvStream;
+
+namespace dbaui
+{
+ class OFieldDescription;
+ class OTableRow
+ {
+ private:
+ OFieldDescription* m_pActFieldDescr;
+ sal_Int32 m_nPos;
+ bool m_bReadOnly;
+ bool m_bOwnsDescriptions;
+
+ protected:
+ public:
+ OTableRow();
+ OTableRow( const OTableRow& rRow, tools::Long nPosition = -1 );
+ ~OTableRow();
+
+ OFieldDescription* GetActFieldDescr() const { return m_pActFieldDescr; }
+ bool isValid() const { return GetActFieldDescr() != nullptr; }
+
+ void SetFieldType( const TOTypeInfoSP& _pType, bool _bForce = false );
+
+ void SetPrimaryKey( bool bSet );
+ bool IsPrimaryKey() const;
+
+ /** returns the current position in the table.
+ @return
+ the current position in the table
+ */
+ sal_Int32 GetPos() const { return m_nPos; }
+ void SetPos(sal_Int32 _nPos) { m_nPos = _nPos; }
+
+ /** set the row readonly
+ @param _bRead
+ if <TRUE/> then the row is readonly, otherwise not
+ */
+ void SetReadOnly( bool _bRead=true ){ m_bReadOnly = _bRead; }
+
+ /** returns if the row is readonly
+ @return
+ <TRUE/> if readonly, otherwise <FALSE/>
+ */
+ bool IsReadOnly() const { return m_bReadOnly; }
+
+ friend SvStream& WriteOTableRow( SvStream& rStr,const OTableRow& _rRow );
+ friend SvStream& ReadOTableRow( SvStream& rStr, OTableRow& _rRow );
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableRowExchange.hxx b/dbaccess/source/ui/inc/TableRowExchange.hxx
new file mode 100644
index 0000000000..36e2497951
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableRowExchange.hxx
@@ -0,0 +1,40 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/transfer.hxx>
+#include <memory>
+
+namespace dbaui
+{
+ class OTableRow;
+ class OTableRowExchange : public TransferableHelper
+ {
+ std::vector< std::shared_ptr<OTableRow> > m_vTableRow;
+ public:
+ OTableRowExchange(std::vector< std::shared_ptr<OTableRow> >&& _rvTableRow);
+ protected:
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual void ObjectReleased() override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx
new file mode 100644
index 0000000000..2ccf236d0c
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableWindow.hxx
@@ -0,0 +1,183 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "TableWindowTitle.hxx"
+#include <rtl/ref.hxx>
+#include "TableWindowData.hxx"
+#include "TableWindowListBox.hxx"
+#include <vector>
+#include <vcl/window.hxx>
+
+#include <comphelper/containermultiplexer.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+// Flags for the size adjustment of SbaJoinTabWins
+enum class SizingFlags {
+ NONE = 0x0000,
+ Top = 0x0001,
+ Bottom = 0x0002,
+ Left = 0x0004,
+ Right = 0x0008,
+};
+namespace o3tl {
+ template<> struct typed_flags<SizingFlags> : is_typed_flags<SizingFlags, 0x0f> {};
+}
+
+
+namespace dbaui
+{
+ class OJoinDesignView;
+ class OJoinTableView;
+ class OTableWindowAccess;
+
+ class OTableWindow : public ::cppu::BaseMutex
+ ,public ::comphelper::OContainerListener
+ ,public vcl::Window
+ {
+ friend class OTableWindowTitle;
+ friend class OTableWindowListBox;
+ protected:
+ // and the table itself (needed for me as I want to lock it as long as the window is alive)
+ VclPtr<OTableWindowTitle> m_xTitle;
+ VclPtr<OTableWindowListBox> m_xListBox;
+
+ private:
+ TTableWindowData::value_type
+ m_pData;
+ ::rtl::Reference< comphelper::OContainerListenerAdapter>
+ m_pContainerListener;
+ sal_Int32 m_nMoveCount; // how often the arrow keys was pressed
+ sal_Int32 m_nMoveIncrement; // how many pixel we should move
+ SizingFlags m_nSizingFlags;
+
+ // OContainerListener
+ virtual void _elementInserted( const css::container::ContainerEvent& _rEvent ) override;
+ virtual void _elementRemoved( const css::container::ContainerEvent& _rEvent ) override;
+ virtual void _elementReplaced( const css::container::ContainerEvent& _rEvent ) override;
+
+ protected:
+ virtual void Resize() override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void MouseMove( const MouseEvent& rEvt ) override;
+ virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+
+ // called at FIRST Init
+ void FillListBox();
+ // called at EACH Init
+
+ virtual void OnEntryDoubleClicked(weld::TreeIter& /*rEntry*/) { }
+ // called from the DoubleClickHdl of the ListBox
+
+ /** delete the user data with the equal type as created within createUserData
+ @param _pUserData
+ The user data store in the listbox entries. Created with a call to createUserData.
+ _pUserData may be <NULL/>. _pUserData will be set to <NULL/> after call.
+ */
+ virtual void deleteUserData(void*& _pUserData);
+
+ /** creates user information that will be append at the ListBoxentry
+ @param _xColumn
+ The corresponding column, can be <NULL/>.
+ @param _bPrimaryKey
+ <TRUE/> when the column belongs to the primary key
+ @return
+ the user data which will be append at the listbox entry, may be <NULL/>
+ */
+ virtual void* createUserData(const css::uno::Reference<
+ css::beans::XPropertySet>& _xColumn,
+ bool _bPrimaryKey);
+
+ /** updates image
+ */
+ void impl_updateImage();
+
+ OTableWindow( vcl::Window* pParent, TTableWindowData::value_type aTabWinData );
+
+ public:
+ virtual ~OTableWindow() override;
+ virtual void dispose() override;
+
+ // late Constructor, see also CreateListbox and FillListbox
+ virtual bool Init();
+
+ OJoinTableView* getTableView();
+ const OJoinTableView* getTableView() const;
+ OJoinDesignView* getDesignView();
+ void SetPosPixel( const Point& rNewPos ) override;
+ void SetSizePixel( const Size& rNewSize ) override;
+ void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) override;
+
+ OUString getTitle() const;
+ void SetBoldTitle( bool bBold );
+ void setActive(bool _bActive = true);
+
+ void Remove();
+
+ OUString const & GetTableName() const { return m_pData->GetTableName(); }
+ OUString const & GetWinName() const { return m_pData->GetWinName(); }
+ OUString const & GetComposedName() const { return m_pData->GetComposedName(); }
+ const VclPtr<OTableWindowListBox>& GetListBox() const { return m_xListBox; }
+ const TTableWindowData::value_type& GetData() const { return m_pData; }
+ const VclPtr<OTableWindowTitle>& GetTitleCtrl() const { return m_xTitle; }
+
+ /** returns the name which should be used when displaying join or relations
+ @return
+ The composed name or the window name.
+ */
+ virtual OUString GetName() const = 0;
+
+ css::uno::Reference< css::container::XNameAccess > GetOriginalColumns() const { return m_pData->getColumns(); }
+ css::uno::Reference< css::beans::XPropertySet > GetTable() const { return m_pData->getTable(); }
+
+ /** set the sizing flag to the direction
+ @param _rPos
+ The EndPosition after resizing.
+ */
+ void setSizingFlag(const Point& _rPos);
+
+ /** returns the new sizing
+ */
+ tools::Rectangle getSizingRect(const Point& _rPos,const Size& _rOutputSize) const;
+
+ // window override
+ virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual void GetFocus() override;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual void Command(const CommandEvent& rEvt) override;
+
+ // Accessibility
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+
+ // do I have connections to the outside?
+ bool ExistsAConn() const;
+
+ void EnumValidFields(std::vector< OUString>& arrstrFields);
+
+ /** clears the listbox inside. Must be called be the dtor is called.
+ */
+ void clearListBox();
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableWindowAccess.hxx b/dbaccess/source/ui/inc/TableWindowAccess.hxx
new file mode 100644
index 0000000000..09aa268f1e
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableWindowAccess.hxx
@@ -0,0 +1,79 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "TableWindow.hxx"
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <vcl/vclptr.hxx>
+
+namespace dbaui
+{
+ class OTableWindow;
+ /** the class OTableWindowAccess represents the accessible object for table windows
+ like they are used in the QueryDesign and the RelationDesign
+ */
+ class OTableWindowAccess : public cppu::ImplInheritanceHelper<
+ VCLXAccessibleComponent,
+ css::accessibility::XAccessibleRelationSet,
+ css::accessibility::XAccessible>
+ {
+ VclPtr<OTableWindow> m_pTable; // the window which I should give accessibility to
+
+ css::uno::Reference< css::accessibility::XAccessible > getParentChild(sal_Int64 _nIndex);
+ protected:
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing() override;
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
+ public:
+ OTableWindowAccess( OTableWindow* _pTable);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XAccessible
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
+
+ // XAccessibleContext
+ virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
+ virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override;
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
+ virtual OUString SAL_CALL getAccessibleName( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
+
+ // XAccessibleComponent
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
+
+ // XAccessibleExtendedComponent
+ virtual OUString SAL_CALL getTitledBorderText( ) override;
+
+ // XAccessibleRelationSet
+ virtual sal_Int32 SAL_CALL getRelationCount( ) override;
+ virtual css::accessibility::AccessibleRelation SAL_CALL getRelation( sal_Int32 nIndex ) override;
+ virtual sal_Bool SAL_CALL containsRelation( sal_Int16 aRelationType ) override;
+ virtual css::accessibility::AccessibleRelation SAL_CALL getRelationByType( sal_Int16 aRelationType ) override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableWindowData.hxx b/dbaccess/source/ui/inc/TableWindowData.hxx
new file mode 100644
index 0000000000..0160ea7233
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableWindowData.hxx
@@ -0,0 +1,95 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <tools/gen.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <unotools/eventlisteneradapter.hxx>
+#include <memory>
+#include <vector>
+
+namespace dbaui
+{
+ class OTableWindowData : public ::utl::OEventListenerAdapter
+ {
+ mutable ::osl::Mutex m_aMutex;
+
+ void listen();
+
+ // the columns of the table
+ css::uno::Reference< css::beans::XPropertySet > m_xTable; // can either be a table or a query
+ css::uno::Reference< css::container::XIndexAccess> m_xKeys;
+ css::uno::Reference< css::container::XNameAccess > m_xColumns;
+
+ OUString m_aTableName;
+ OUString m_aWinName;
+ OUString m_sComposedName;
+ Point m_aPosition;
+ Size m_aSize;
+ bool m_bShowAll;
+ bool m_bIsQuery;
+ bool m_bIsValid;
+
+ public:
+ explicit OTableWindowData( const css::uno::Reference< css::beans::XPropertySet>& _xTable
+ ,OUString _sComposedName
+ ,OUString strTableName
+ ,OUString sWinName );
+ virtual ~OTableWindowData() override;
+
+ /** late constructor
+ *
+ * \param _xConnection
+ * \param _bAllowQueries when true, queries are allowed
+ * \return false if the table was unaccessible otherwise true
+ */
+ bool init(const css::uno::Reference< css::sdbc::XConnection >& _xConnection
+ ,bool _bAllowQueries);
+
+ const OUString& GetComposedName() const { return m_sComposedName; }
+ const OUString& GetTableName() const { return m_aTableName; }
+ const OUString& GetWinName() const { return m_aWinName; }
+ const Point& GetPosition() const { return m_aPosition; }
+ const Size& GetSize() const { return m_aSize; }
+ bool IsShowAll() const { return m_bShowAll; }
+ bool isQuery() const { return m_bIsQuery; }
+ bool isValid() const { return m_bIsValid; } // it is either a table or query but it is known
+ bool HasPosition() const;
+ bool HasSize() const;
+
+ void SetWinName( const OUString& rWinName ) { m_aWinName = rWinName; }
+ void SetPosition( const Point& rPos ) { m_aPosition=rPos; }
+ void SetSize( const Size& rSize ) { m_aSize = rSize; }
+ void ShowAll( bool bAll ) { m_bShowAll = bAll; }
+
+ css::uno::Reference< css::beans::XPropertySet> getTable() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xTable; }
+ css::uno::Reference< css::container::XIndexAccess> getKeys() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xKeys; }
+ css::uno::Reference< css::container::XNameAccess > getColumns() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xColumns; }
+
+ // OEventListenerAdapter
+ virtual void _disposing( const css::lang::EventObject& _rSource ) override;
+ };
+
+ typedef std::vector< std::shared_ptr<OTableWindowData> > TTableWindowData;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableWindowListBox.hxx b/dbaccess/source/ui/inc/TableWindowListBox.hxx
new file mode 100644
index 0000000000..cdad4947ca
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableWindowListBox.hxx
@@ -0,0 +1,121 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/transfer.hxx>
+#include <vcl/InterimItemWindow.hxx>
+#include "callbacks.hxx"
+
+struct AcceptDropEvent;
+struct ExecuteDropEvent;
+namespace dbaui
+{
+ class OTableWindowListBox;
+ struct OJoinExchangeData
+ {
+ public:
+ VclPtr<OTableWindowListBox> pListBox; // the ListBox inside the same (you can get the TabWin and the WinName out of it)
+ int nEntry; // the entry, which was dragged or to which was dropped on
+
+ OJoinExchangeData(OTableWindowListBox* pBox);
+ OJoinExchangeData() : pListBox(nullptr), nEntry(-1) { }
+ };
+
+ struct OJoinDropData
+ {
+ OJoinExchangeData aSource;
+ OJoinExchangeData aDest;
+ };
+
+ class OJoinExchObj;
+ class OTableWindow;
+ class TableWindowListBoxHelper;
+
+ class OTableWindowListBox
+ : public InterimItemWindow
+ , public IDragTransferableListener
+ {
+ std::unique_ptr<weld::TreeView> m_xTreeView;
+ std::unique_ptr<TableWindowListBoxHelper> m_xDragDropTargetHelper;
+
+ DECL_LINK( OnDoubleClick, weld::TreeView&, bool );
+ DECL_LINK(CommandHdl, const CommandEvent&, bool);
+ DECL_LINK( DropHdl, void*, void );
+ DECL_LINK( LookForUiHdl, void*, void );
+ DECL_LINK( DragBeginHdl, bool&, bool );
+ DECL_LINK( ScrollHdl, weld::TreeView&, void );
+
+ rtl::Reference<OJoinExchObj> m_xHelper;
+
+ VclPtr<OTableWindow> m_pTabWin;
+ ImplSVEvent * m_nDropEvent;
+ ImplSVEvent * m_nUiEvent;
+ OJoinDropData m_aDropInfo;
+
+ protected:
+ virtual void LoseFocus() override;
+ virtual void GetFocus() override;
+
+ virtual void dragFinished( ) override;
+
+ public:
+ OTableWindowListBox(OTableWindow* pParent);
+ virtual ~OTableWindowListBox() override;
+ virtual void dispose() override;
+
+ const weld::TreeView& get_widget() const { return *m_xTreeView; }
+ weld::TreeView& get_widget() { return *m_xTreeView; }
+
+ // DnD stuff
+ sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt);
+ sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt);
+
+ // window
+ virtual void Command(const CommandEvent& rEvt) override;
+
+ OTableWindow* GetTabWin(){ return m_pTabWin; }
+ int GetEntryFromText( std::u16string_view rEntryText );
+ };
+
+ class TableWindowListBoxHelper final : public DropTargetHelper
+ {
+ private:
+ OTableWindowListBox& m_rParent;
+
+ virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override
+ {
+ return m_rParent.AcceptDrop(rEvt);
+ }
+
+ virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override
+ {
+ return m_rParent.ExecuteDrop(rEvt);
+ }
+
+ public:
+ TableWindowListBoxHelper(OTableWindowListBox& rParent, const css::uno::Reference<css::datatransfer::dnd::XDropTarget>& rDropTarget)
+ : DropTargetHelper(rDropTarget)
+ , m_rParent(rParent)
+ {
+ }
+ };
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TableWindowTitle.hxx b/dbaccess/source/ui/inc/TableWindowTitle.hxx
new file mode 100644
index 0000000000..0a3779bd88
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableWindowTitle.hxx
@@ -0,0 +1,44 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/InterimItemWindow.hxx>
+
+namespace dbaui
+{
+ class OTableWindow;
+ class OTableWindowTitle final : public InterimItemWindow
+ {
+ VclPtr<OTableWindow> m_pTabWin;
+ std::unique_ptr<weld::Label> m_xLabel;
+ std::unique_ptr<weld::Image> m_xImage;
+
+ DECL_LINK(MousePressHdl, const MouseEvent&, bool);
+
+ public:
+ OTableWindowTitle( OTableWindow* pParent );
+ virtual ~OTableWindowTitle() override;
+ virtual void dispose() override;
+
+ weld::Label& GetLabel() { return *m_xLabel; }
+ weld::Image& GetImage() { return *m_xImage; }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TablesSingleDlg.hxx b/dbaccess/source/ui/inc/TablesSingleDlg.hxx
new file mode 100644
index 0000000000..c75fa1eb3d
--- /dev/null
+++ b/dbaccess/source/ui/inc/TablesSingleDlg.hxx
@@ -0,0 +1,71 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sfx2/basedlgs.hxx>
+#include "IItemSetHelper.hxx"
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <memory>
+
+namespace com::sun::star {
+ namespace beans {
+ class XPropertySet;
+ }
+ namespace uno {
+ class XComponentContext;
+ }
+}
+
+namespace dbaui
+{
+class ODbDataSourceAdministrationHelper;
+ // OTableSubscriptionDialog
+ class OTableSubscriptionDialog : public SfxSingleTabDialogController, public IItemSetHelper
+ {
+ std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
+ bool m_bStopExecution; // set when the dialog should not be executed
+
+ std::unique_ptr<SfxItemSet> m_pOutSet;
+ public:
+
+ OTableSubscriptionDialog(weld::Window* pParent
+ ,const SfxItemSet* _pItems
+ ,const css::uno::Reference< css::uno::XComponentContext >& _rxORB
+ ,const css::uno::Any& _aDataSourceName
+ );
+ virtual ~OTableSubscriptionDialog() override;
+
+ // forwards from ODbDataSourceAdministrationHelper
+ void successfullyConnected();
+ bool getCurrentSettings(css::uno::Sequence< css::beans::PropertyValue >& _rDriverParams);
+ void clearPassword();
+ css::uno::Reference< css::beans::XPropertySet > const & getCurrentDataSource();
+ void endExecution() { m_bStopExecution = true; }
+
+ virtual const SfxItemSet* getOutputSet() const override;
+ virtual SfxItemSet* getWriteOutputSet() override;
+
+ virtual short run() override;
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx
new file mode 100644
index 0000000000..b82bd71a5f
--- /dev/null
+++ b/dbaccess/source/ui/inc/TokenWriter.hxx
@@ -0,0 +1,206 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "commontypes.hxx"
+
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <vcl/weld.hxx>
+
+namespace com::sun::star {
+ namespace sdbc{
+ class XRowUpdate;
+ }
+}
+
+class SvStream;
+
+namespace dbaui
+{
+ // ODatabaseImportExport base class for import/export
+ class ODatabaseExport;
+ class ODatabaseImportExport : public ::cppu::WeakImplHelper< css::lang::XEventListener>
+ {
+ protected:
+ css::uno::Sequence< css::uno::Any> m_aSelection;
+ bool m_bBookmarkSelection;
+ SvStream* m_pStream;
+ css::awt::FontDescriptor m_aFont;
+ css::uno::Reference< css::beans::XPropertySet > m_xObject; // table/query
+ SharedConnection m_xConnection;
+ css::uno::Reference< css::sdbc::XResultSet > m_xResultSet;
+ css::uno::Reference< css::sdbc::XRow > m_xRow;
+ css::uno::Reference< css::sdbcx::XRowLocate > m_xRowLocate;
+ css::uno::Reference< css::sdbc::XResultSetMetaData > m_xResultSetMetaData;
+ css::uno::Reference< css::container::XIndexAccess > m_xRowSetColumns;
+ css::uno::Reference< css::util::XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ OUString m_sName;
+
+ //for transfor the tablename
+ OUString m_sDefaultTableName;
+
+ OUString m_sDataSourceName;
+ sal_Int32 m_nCommandType;
+ bool m_bNeedToReInitialize;
+
+ rtl_TextEncoding m_eDestEnc;
+ bool m_bInInitialize;
+ bool m_bCheckOnly;
+
+ // export data
+ ODatabaseImportExport( const svx::ODataAccessDescriptor& _aDataDescriptor,
+ const css::uno::Reference< css::uno::XComponentContext >& _rM,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF);
+
+ // import data
+ ODatabaseImportExport( SharedConnection _xConnection,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
+ const css::uno::Reference< css::uno::XComponentContext >& _rM);
+
+ virtual ~ODatabaseImportExport() override;
+
+ virtual void initialize();
+ public:
+ void setStream(SvStream* _pStream){ m_pStream = _pStream; }
+
+ //for set the tablename
+ void setSTableName(const OUString &_sTableName){ m_sDefaultTableName = _sTableName; }
+
+ virtual bool Write(); // Export
+ virtual bool Read(); // Import
+
+ void initialize(const svx::ODataAccessDescriptor& _aDataDescriptor);
+ void dispose();
+
+ void enableCheckOnly() { m_bCheckOnly = true; }
+ bool isCheckEnabled() const { return m_bCheckOnly; }
+
+ private:
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+ void impl_initFromDescriptor( const svx::ODataAccessDescriptor& _aDataDescriptor, bool _bPlusDefaultInit );
+ };
+
+ // RTF Import and Export
+
+ class ORTFImportExport : public ODatabaseImportExport
+ {
+ void appendRow(OString const * pHorzChar,sal_Int32 _nColumnCount,sal_Int32& k,sal_Int32& kk);
+ public:
+ // export data
+ ORTFImportExport( const svx::ODataAccessDescriptor& _aDataDescriptor,
+ const css::uno::Reference< css::uno::XComponentContext >& _rM,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF)
+ : ODatabaseImportExport(_aDataDescriptor,_rM,_rxNumberF) {};
+
+ // import data
+ ORTFImportExport( const SharedConnection& _rxConnection,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
+ const css::uno::Reference< css::uno::XComponentContext >& _rM)
+ : ODatabaseImportExport(_rxConnection,_rxNumberF,_rM)
+ {}
+
+ virtual bool Write() override;
+ virtual bool Read() override;
+ };
+ // HTML Import and Export
+ #define SBA_HTML_FONTSIZES 7
+ const sal_Int16 nIndentMax = 23;
+ class OHTMLImportExport : public ODatabaseImportExport
+ {
+ static const sal_Int16 nCellSpacing;
+ static const char sIndentSource[];
+ char sIndent[nIndentMax+1];
+ sal_Int16 m_nIndent;
+ #if OSL_DEBUG_LEVEL > 0
+ bool m_bCheckFont;
+ #endif
+
+ void WriteHeader();
+ void WriteBody();
+ void WriteTables();
+ void WriteCell( sal_Int32 nFormat,sal_Int32 nWidthPixel,sal_Int32 nHeightPixel,const char* pChar,const OUString& rValue,const char* pHtmlTag);
+ void IncIndent( sal_Int16 nVal );
+ const char* GetIndentStr() const { return sIndent; }
+ void FontOn();
+ inline void FontOff();
+
+ public:
+ // export data
+ OHTMLImportExport( const svx::ODataAccessDescriptor& _aDataDescriptor,
+ const css::uno::Reference< css::uno::XComponentContext >& _rM,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF);
+ // import data
+ OHTMLImportExport( const SharedConnection& _rxConnection,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxNumberF,
+ const css::uno::Reference< css::uno::XComponentContext >& _rM)
+ : ODatabaseImportExport(_rxConnection,_rxNumberF,_rM)
+ , m_nIndent(0)
+ {}
+
+ virtual bool Write() override;
+ virtual bool Read() override;
+
+ };
+ // normal RowSet Import and Export
+
+ class ORowSetImportExport : public ODatabaseImportExport
+ {
+ std::vector<sal_Int32> m_aColumnMapping;
+ std::vector<sal_Int32> m_aColumnTypes;
+ css::uno::Reference< css::sdbc::XResultSetUpdate > m_xTargetResultSetUpdate;
+ css::uno::Reference< css::sdbc::XRowUpdate > m_xTargetRowUpdate;
+ css::uno::Reference< css::sdbc::XResultSetMetaData > m_xTargetResultSetMetaData;
+ weld::Window* m_pParent;
+ bool m_bAlreadyAsked;
+
+ bool insertNewRow();
+ protected:
+ virtual void initialize() override;
+
+ public:
+ // export data
+ ORowSetImportExport(weld::Window* pParent,
+ const css::uno::Reference< css::sdbc::XResultSetUpdate >& xResultSetUpdate,
+ const svx::ODataAccessDescriptor& aDataDescriptor,
+ const css::uno::Reference< css::uno::XComponentContext >& rM);
+
+ virtual bool Write() override;
+ virtual bool Read() override;
+
+ private:
+ using ODatabaseImportExport::initialize;
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/TypeInfo.hxx b/dbaccess/source/ui/inc/TypeInfo.hxx
new file mode 100644
index 0000000000..e9958e8e8d
--- /dev/null
+++ b/dbaccess/source/ui/inc/TypeInfo.hxx
@@ -0,0 +1,121 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ColumnSearch.hpp>
+#include <map>
+#include <memory>
+
+namespace dbaui
+{
+// Based on these ids the language dependent OUString are fetched from the resource
+const sal_uInt16 TYPE_UNKNOWN = 0;
+const sal_uInt16 TYPE_TEXT = 1;
+const sal_uInt16 TYPE_NUMERIC = 2;
+const sal_uInt16 TYPE_DATETIME = 3;
+const sal_uInt16 TYPE_DATE = 4;
+const sal_uInt16 TYPE_TIME = 5;
+const sal_uInt16 TYPE_BOOL = 6;
+const sal_uInt16 TYPE_CURRENCY = 7;
+const sal_uInt16 TYPE_MEMO = 8;
+const sal_uInt16 TYPE_COUNTER = 9;
+const sal_uInt16 TYPE_IMAGE = 10;
+const sal_uInt16 TYPE_CHAR = 11;
+const sal_uInt16 TYPE_DECIMAL = 12;
+const sal_uInt16 TYPE_BINARY = 13;
+const sal_uInt16 TYPE_VARBINARY = 14;
+const sal_uInt16 TYPE_BIGINT = 15;
+const sal_uInt16 TYPE_DOUBLE = 16;
+const sal_uInt16 TYPE_FLOAT = 17;
+const sal_uInt16 TYPE_REAL = 18;
+const sal_uInt16 TYPE_INTEGER = 19;
+const sal_uInt16 TYPE_SMALLINT = 20;
+const sal_uInt16 TYPE_TINYINT = 21;
+const sal_uInt16 TYPE_SQLNULL = 22;
+const sal_uInt16 TYPE_OBJECT = 23;
+const sal_uInt16 TYPE_DISTINCT = 24;
+const sal_uInt16 TYPE_STRUCT = 25;
+const sal_uInt16 TYPE_ARRAY = 26;
+const sal_uInt16 TYPE_BLOB = 27;
+const sal_uInt16 TYPE_CLOB = 28;
+const sal_uInt16 TYPE_REF = 29;
+const sal_uInt16 TYPE_OTHER = 30;
+const sal_uInt16 TYPE_BIT = 31;
+
+ class OTypeInfo
+ {
+ public:
+ OUString aUIName; // the name which is the user see (a combination of resource text and aTypeName)
+ OUString aTypeName; // name of type in database
+ OUString aCreateParams; // parameter for creation
+ OUString aLocalTypeName;
+
+ sal_Int32 nPrecision; // length of type
+ sal_Int32 nNumPrecRadix; // indicating the radix, which is usually 2 or 10
+ sal_Int32 nType; // database type
+
+ sal_Int16 nMaximumScale; // decimal places after decimal point
+ sal_Int16 nMinimumScale; // min decimal places after decimal point
+
+ sal_Int16 nSearchType; // if it is possible to search for type
+
+ bool bCurrency : 1, // currency
+ bAutoIncrement : 1, // if automatic incrementing field
+ bNullable : 1; // if field can be NULL
+
+ OTypeInfo()
+ :nPrecision(0)
+ ,nNumPrecRadix(10)
+ ,nType(css::sdbc::DataType::OTHER)
+ ,nMaximumScale(0)
+ ,nMinimumScale(0)
+ ,nSearchType(css::sdbc::ColumnSearch::FULL)
+ ,bCurrency(false)
+ ,bAutoIncrement(false)
+ ,bNullable(true)
+ {}
+ const OUString& getDBName() const { return aTypeName; }
+
+ };
+
+ typedef std::shared_ptr<OTypeInfo> TOTypeInfoSP;
+ typedef std::multimap<sal_Int32,TOTypeInfoSP> OTypeInfoMap;
+ /** return the most suitable typeinfo for a requested type
+ @param _rTypeInfo contains a map of type to typeinfo
+ @param _nType the requested type
+ @param _sTypeName the typename
+ @param _sCreateParams the create params
+ @param _nPrecision the precision
+ @param _nScale the scale
+ @param _bAutoIncrement if it is an auto increment
+ @param _brForceToType true when type was found which has some differences
+ */
+ TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo,
+ sal_Int32 _nType,
+ const OUString& _sTypeName,
+ const OUString& _sCreateParams,
+ sal_Int32 _nPrecision,
+ sal_Int32 _nScale,
+ bool _bAutoIncrement,
+ bool& _brForceToType);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx
new file mode 100644
index 0000000000..c622c73f65
--- /dev/null
+++ b/dbaccess/source/ui/inc/UITools.hxx
@@ -0,0 +1,396 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <connectivity/dbexception.hxx>
+#include <comphelper/stl_types.hxx>
+#include "TypeInfo.hxx"
+#include <editeng/svxenum.hxx>
+#include <vcl/taskpanelist.hxx>
+#include <connectivity/dbtools.hxx>
+#include <unotools/resmgr.hxx>
+
+#include <memory>
+#include <string_view>
+
+#define RET_ALL 100
+
+// we only need forward decl here
+namespace com::sun::star {
+
+ namespace beans { class XPropertySet;}
+ namespace container
+ {
+ class XNameAccess;
+ class XHierarchicalNameContainer;
+ }
+ namespace lang
+ {
+ class XEventListener;
+ }
+ namespace awt
+ {
+ struct FontDescriptor;
+ class XWindow;
+ }
+ namespace sdbc
+ {
+ class XDatabaseMetaData;
+ class XConnection;
+ }
+ namespace util
+ {
+ struct URL;
+ class XNumberFormatter;
+ }
+ namespace ucb { class XContent; }
+ namespace uno { class XComponentContext; }
+}
+
+namespace svt
+{
+ class EditBrowseBox;
+}
+
+namespace vcl { class Window; }
+namespace weld {
+ class Widget;
+ class Window;
+}
+class ToolBox;
+namespace vcl { class Font; }
+class SvNumberFormatter;
+class SfxFilter;
+
+namespace dbaui
+{
+
+ /** creates a new connection and appends the eventlistener
+ @param _rsDataSourceName name of the datasource
+ @param _xDatabaseContext the database context
+ @param _rxContext the UNO component context
+ @param _rEvtLst the eventlistener which will be added to the new created connection
+ @param _rOUTConnection this parameter will be filled with the new created connection
+ @return SQLExceptionInfo contains a SQLException, SQLContext or a SQLWarning when they araised else .isValid() will return false
+ */
+ ::dbtools::SQLExceptionInfo createConnection(
+ const OUString& _rsDataSourceName,
+ const css::uno::Reference< css::container::XNameAccess >& _xDatabaseContext,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ css::uno::Reference< css::lang::XEventListener> const & _rEvtLst,
+ css::uno::Reference< css::sdbc::XConnection>& _rOUTConnection );
+ /** creates a new connection and appends the eventlistener
+ @param _xDataSource the datasource
+ @param _rxContext the UNO component context
+ @param _rEvtLst the eventlistener which will be added to the new created connection
+ @param _rOUTConnection this parameter will be filled with the new created connection
+ @return SQLExceptionInfo contains a SQLException, SQLContext or a SQLWarning when they araised else .isValid() will return false
+ */
+ ::dbtools::SQLExceptionInfo createConnection(
+ const css::uno::Reference< css::beans::XPropertySet >& _xDataSource,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ css::uno::Reference< css::lang::XEventListener> const & _rEvtLst,
+ css::uno::Reference< css::sdbc::XConnection>& _rOUTConnection );
+
+ /** fills a map and a vector with localized type names
+ @param _rxConnection the connection to access the metadata
+ @param _rsTypeNames a list of localized type names separated with ';'
+ @param _rTypeInfoMap the filled map with the type names
+ @param _rTypeInfoIters the vector filled with map iterators
+ */
+ void fillTypeInfo( const css::uno::Reference< css::sdbc::XConnection>& _rxConnection,
+ std::u16string_view _rsTypeNames,
+ OTypeInfoMap& _rTypeInfoMap,
+ std::vector<OTypeInfoMap::iterator>& _rTypeInfoIters);
+
+ /** fill a column with data of a field description
+ @param _rxColumn the column which should be filled
+ @param _pFieldDesc the source of the data
+ */
+ class OFieldDescription;
+ void setColumnProperties( const css::uno::Reference< css::beans::XPropertySet>& _rxColumn,
+ const OFieldDescription* _pFieldDesc);
+
+ OUString createDefaultName( const css::uno::Reference< css::sdbc::XDatabaseMetaData>& _xMetaData,
+ const css::uno::Reference< css::container::XNameAccess>& _xTables,
+ const OUString& _sName);
+
+ /** checks if the given name exists in the database context
+ */
+ bool checkDataSourceAvailable( const OUString& _sDataSourceName,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+
+ /** maps SvxCellHorJustify to css::awt::TextAlign
+ @param SvxCellHorJustify& _eAlignment
+ @return the corresponding css::awt::TextAlign
+ */
+ sal_Int32 mapTextAlign(const SvxCellHorJustify& _eAlignment);
+
+ /** retrieves a data source given by name or URL, and displays an error if this fails
+
+ Any <type scope="css::sdbc">SQLException</type>s which occur will be displayed.
+ Additionally, and Exceptions which indicate a data source name pointing to a non-existent database
+ URL will also be denoted. Yet more additionally, and other exceptions will be forwarded to
+ a <type scope="css::sdb">InteractionHandler</type>.
+
+ @param _rDataSourceName
+ the URL of the database document, or the name of a registered data source
+ @param _pErrorMessageParent
+ the window to use as parent for error messages
+ @param _rxContext
+ a service factory to use for components to be created
+ @param _pErrorInfo
+ takes the error info in case of failure. If <NULL/>, the error is displayed to the user.
+ */
+ css::uno::Reference< css::sdbc::XDataSource >
+ getDataSourceByName(
+ const OUString& _rDataSourceName,
+ weld::Window* _pErrorMessageParent,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo
+ );
+
+ /** returns either the model when data source is given as parameter,
+ or returns a data source when a model is given.
+ @param _xObject Either a data source or a model.
+ */
+ css::uno::Reference< css::uno::XInterface > getDataSourceOrModel(const css::uno::Reference< css::uno::XInterface >& _xObject);
+
+ /** maps css::awt::TextAlign to SvxCellHorJustify
+ @param css::awt::TextAlign& _nAlignment
+ @return the corresponding SvxCellHorJustify
+ */
+ SvxCellHorJustify mapTextJustify(sal_Int32 _nAlignment);
+
+ /** call the format dialog and set the selected format at the column
+ @param _xAffectedCol Font to be converted
+ @param _xField Font to be converted
+ */
+ void callColumnFormatDialog(const css::uno::Reference< css::beans::XPropertySet>& _xAffectedCol,
+ const css::uno::Reference< css::beans::XPropertySet>& _xField,
+ SvNumberFormatter* _pFormatter,
+ weld::Widget* _pParent);
+
+ /** second variant of the function before
+ */
+ bool callColumnFormatDialog(weld::Widget* _pParent,
+ SvNumberFormatter* _pFormatter,
+ sal_Int32 _nDataType,
+ sal_Int32& _nFormatKey,
+ SvxCellHorJustify& _eJustify,
+ bool _bHasFormat);
+ /** append a name to tablefilter of a datasource
+ @param xConnection the connection is need to get the datasource
+ @param rName the name which should be appended
+ @param rxContext needed to check if datasource is available
+ @param pParent needed when an error must be shown
+ @return false when datsource is not available otherwise true
+ */
+ bool appendToFilter(const css::uno::Reference< css::sdbc::XConnection>& xConnection,
+ const OUString& rName,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ weld::Window* pParent);
+
+ /** notifySystemWindow adds or remove the given window _pToRegister at the Systemwindow found when search _pWindow.
+ @param _pWindow
+ The window which is used to search for the SystemWindow.
+ @param _pToRegister
+ The window which should be added or removed on the TaskPaneList.
+ @param _rMemFunc
+ The member function which should be called at the SystemWindow when found.
+ Possible values are:
+ ::comphelper::mem_fun(&TaskPaneList::AddWindow)
+ ::comphelper::mem_fun(&TaskPaneList::RemoveWindow)
+ */
+ void notifySystemWindow(vcl::Window const * _pWindow,
+ vcl::Window* _pToRegister,
+ const ::comphelper::mem_fun1_t<TaskPaneList,vcl::Window*>& _rMemFunc);
+
+ void adjustBrowseBoxColumnWidth( ::svt::EditBrowseBox* _pBox, sal_uInt16 _nColId );
+
+ /** check if SQL92 name checking is enabled
+ @param _xConnection
+ Used to get the datasource as parent from the connection.
+ @return
+ <TRUE/> if so otherwise <FALSE/>
+ */
+ bool isSQL92CheckEnabled(const css::uno::Reference< css::sdbc::XConnection>& _xConnection);
+
+ /** check if the alias name of the table should be added at select statements
+ @param _xConnection
+ Used to get the datasource as parent from the connection.
+ @return
+ <TRUE/> if so otherwise <FALSE/>
+ */
+ bool isAppendTableAliasEnabled(const css::uno::Reference< css::sdbc::XConnection>& _xConnection);
+
+ /** determines whether when generating SQL statements, AS should be placed before a table alias
+ */
+ bool generateAsBeforeTableAlias( const css::uno::Reference< css::sdbc::XConnection>& _rxConnection );
+
+ /** fills the bool and string value with information out of the datasource info property
+ @param _xDatasource
+ Asked for the properties.
+ @param _rAutoIncrementValueEnabled
+ <OUT/> Set to sal_True when the property was set in the datasource.
+ @param _rsAutoIncrementValue
+ <OUT/> Set to the value when the property was set in the datasource.
+ */
+ void fillAutoIncrementValue(const css::uno::Reference< css::beans::XPropertySet>& _xDatasource
+ ,bool& _rAutoIncrementValueEnabled
+ ,OUString& _rsAutoIncrementValue);
+
+ /** fills the bool and string value with information out of the datasource info property
+ @param _xConnection
+ Used to get the datasource as parent from the connection.
+ @param _rAutoIncrementValueEnabled
+ <OUT/> Set to sal_True when the property was set in the datasource.
+ @param _rsAutoIncrementValue
+ <OUT/> Set to the value when the property was set in the datasource.
+ */
+ void fillAutoIncrementValue(const css::uno::Reference< css::sdbc::XConnection>& _xConnection
+ ,bool& _rAutoIncrementValueEnabled
+ ,OUString& _rsAutoIncrementValue);
+
+ /** set the evaluation flag at the number formatter
+ @param _rxFormatter
+ */
+ void setEvalDateFormatForFormatter(css::uno::Reference< css::util::XNumberFormatter > const & _rxFormatter);
+
+ /** query for a type info which can be used to create a primary key column
+ @param _rTypeInfo
+ The map which contains all available types.
+ @return
+ The type info which can be used to create a primary key column.
+ */
+ TOTypeInfoSP queryPrimaryKeyType(const OTypeInfoMap& _rTypeInfo);
+
+ /** query for a specific type.
+ @param _nDataType
+ The type we are searching.
+ @param _rTypeInfo
+ The map which contains all available types.
+ @return
+ The type or <NULL/> if we can't find it.
+ */
+ TOTypeInfoSP queryTypeInfoByType(sal_Int32 _nDataType,const OTypeInfoMap& _rTypeInfo);
+
+ /** returns the configuration node name of user defined drivers.
+ @return
+ the configuration node name of user defined drivers.
+ */
+
+ /** returns the result of the user action when view the query dialog.
+ @param pParent
+ The parent of the dialog
+ @param pTitle
+ A string resource id for the text which will be displayed as title.
+ @param pText
+ A string resource id for the text which will be displayed above the buttons.
+ When the string contains a #1. This will be replaced by the name.
+ @param bAll
+ When set to <TRUE/>, the all button will be appended.
+ @param rName
+ The name of the object to ask for.
+ @return
+ RET_YES, RET_NO, RET_ALL
+ */
+ sal_Int32 askForUserAction(weld::Window* pParent, TranslateId pTitle, TranslateId pText, bool bAll, std::u16string_view rName);
+
+ /** creates a new view from a query or table
+ @param _sName
+ The name of the view to be created.
+ @param _xConnection
+ The source connection.
+ @param _xSourceObject
+ The object for which a view should be created.
+ @return
+ The created view.
+ */
+ css::uno::Reference< css::beans::XPropertySet> createView( const OUString& _sName
+ ,const css::uno::Reference< css::sdbc::XConnection >& _xConnection
+ ,const css::uno::Reference< css::beans::XPropertySet>& _xSourceObject);
+
+ /** creates a view with the given command
+ */
+ css::uno::Reference< css::beans::XPropertySet> createView(
+ const OUString& _rName,
+ const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ const OUString& _rCommand
+ );
+
+ /** returns the stripped database name.
+ @param _xDataSource
+ The data source
+ @param _rsDatabaseName
+ Will be filled with the original data source if it is empty.
+ @return
+ The stripped database name either the registered name or if it is a file url the last segment.
+ */
+ OUString getStrippedDatabaseName(const css::uno::Reference< css::beans::XPropertySet>& _xDataSource
+ ,OUString& _rsDatabaseName);
+
+ /** returns the standard database filter
+ @return
+ the filter
+ */
+ std::shared_ptr<const SfxFilter> getStandardDatabaseFilter();
+
+ /** opens a save dialog to store a form or report folder in the current hierarchy.
+ @param _pParent
+ The parent of the dialog.
+ @param _rxContext
+ a multi service factory which can be used to instantiate usual global services
+ @param _xNames
+ Where to insert the new object.
+ @param _sParentFolder
+ The name of the parent folder.
+ @param _bForm
+ <TRUE/> if a form should be inserted
+ @param _bCollection
+ A folder should be inserted
+ @param _xContent
+ The content which should be copied.
+ @param _bMove
+ if <TRUE/> the name of the content must be inserted without any change, otherwise not.
+ @return
+ <TRUE/> if the insert operation was successful, otherwise <FALSE/>.
+ */
+ bool insertHierarchyElement(
+ weld::Window* pParent,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const css::uno::Reference< css::container::XHierarchicalNameContainer>& _xNames,
+ const OUString& _sParentFolder,
+ bool _bForm,
+ bool _bCollection = true,
+ const css::uno::Reference< css::ucb::XContent>& _xContent = nullptr,
+ bool _bMove = false
+ );
+
+ /** creates a number formatter
+ @param _rxConnection
+ The connection is needed to create the formatter
+ @param _rxContext
+ The multi service factory
+ */
+ css::uno::Reference< css::util::XNumberFormatter > getNumberFormatter(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/UserAdminDlg.hxx b/dbaccess/source/ui/inc/UserAdminDlg.hxx
new file mode 100644
index 0000000000..95edbe5f55
--- /dev/null
+++ b/dbaccess/source/ui/inc/UserAdminDlg.hxx
@@ -0,0 +1,76 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sfx2/tabdlg.hxx>
+#include "IItemSetHelper.hxx"
+#include <memory>
+
+namespace com::sun::star {
+ namespace sdbc {
+ class XConnection;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}
+
+namespace dbaui
+{
+ class ODbDataSourceAdministrationHelper;
+ // OUserAdminDlg
+
+ /** implements the user admin dialog
+ */
+ class OUserAdminDlg : public SfxTabDialogController, public IItemSetHelper, public IDatabaseSettingsDialog
+ {
+ weld::Window* m_pParent;
+ std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
+ SfxItemSet* m_pItemSet;
+ css::uno::Reference< css::sdbc::XConnection> m_xConnection;
+ bool m_bOwnConnection;
+ protected:
+ virtual void PageCreated(const OUString& rId, SfxTabPage& _rPage) override;
+ public:
+ OUserAdminDlg(weld::Window* pParent, SfxItemSet* pItems,
+ const css::uno::Reference< css::uno::XComponentContext >& rxORB,
+ const css::uno::Any& rDataSourceName,
+ const css::uno::Reference< css::sdbc::XConnection>& rConnection);
+
+ virtual ~OUserAdminDlg() override;
+
+ virtual const SfxItemSet* getOutputSet() const override;
+ virtual SfxItemSet* getWriteOutputSet() override;
+
+ virtual short run() override;
+
+ // forwards to ODbDataSourceAdministrationHelper
+ virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override;
+ virtual std::pair< css::uno::Reference< css::sdbc::XConnection >,bool> createConnection() override;
+ virtual css::uno::Reference< css::sdbc::XDriver > getDriver() override;
+ virtual OUString getDatasourceType(const SfxItemSet& _rSet) const override;
+ virtual void clearPassword() override;
+ virtual void saveDatasource() override;
+ virtual void setTitle(const OUString& _sTitle) override;
+ virtual void enableConfirmSettings( bool _bEnable ) override;
+ };
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WCPage.hxx b/dbaccess/source/ui/inc/WCPage.hxx
new file mode 100644
index 0000000000..69dc96f144
--- /dev/null
+++ b/dbaccess/source/ui/inc/WCPage.hxx
@@ -0,0 +1,78 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "WTabPage.hxx"
+
+namespace dbaui
+{
+ class OWizColumnSelect;
+ class OWizNormalExtend;
+ class OCopyTable final : public OWizardPage
+ {
+ bool m_bPKeyAllowed;
+ bool m_bUseHeaderAllowed;
+ sal_Int16 m_nOldOperation;
+
+ std::unique_ptr<weld::Entry> m_xEdTableName;
+ std::unique_ptr<weld::RadioButton> m_xRB_DefData;
+ std::unique_ptr<weld::RadioButton> m_xRB_Def;
+ std::unique_ptr<weld::RadioButton> m_xRB_View;
+ std::unique_ptr<weld::RadioButton> m_xRB_AppendData;
+ std::unique_ptr<weld::CheckButton> m_xCB_UseHeaderLine;
+ std::unique_ptr<weld::CheckButton> m_xCB_PrimaryColumn;
+ std::unique_ptr<weld::Label> m_xFT_KeyName;
+ std::unique_ptr<weld::Entry> m_xEdKeyName;
+
+ DECL_LINK( RadioChangeHdl, weld::Toggleable&, void );
+ DECL_LINK( KeyClickHdl, weld::Toggleable&, void );
+
+ bool checkAppendData();
+ void SetAppendDataRadio();
+
+ public:
+ virtual void Reset() override;
+ virtual void Activate() override;
+ virtual bool LeavePage() override;
+ virtual OUString GetTitle() const override ;
+
+ OCopyTable(weld::Container* pParent, OCopyTableWizard* pWizard);
+ virtual ~OCopyTable() override;
+
+ bool IsOptionDefData() const { return m_xRB_DefData->get_active(); }
+ bool IsOptionDef() const { return m_xRB_Def->get_active(); }
+ bool IsOptionView() const { return m_xRB_View->get_active(); }
+ OUString GetKeyName() const { return m_xEdKeyName->get_text(); }
+
+ void setCreateStyleAction();
+ void disallowViews()
+ {
+ m_xRB_View->set_sensitive(false);
+ }
+ void disallowUseHeaderLine()
+ {
+ m_bUseHeaderAllowed = false;
+ m_xCB_UseHeaderLine->set_sensitive(false);
+ }
+
+ void setCreatePrimaryKey( bool _bDoCreate, const OUString& _rSuggestedName );
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WColumnSelect.hxx b/dbaccess/source/ui/inc/WColumnSelect.hxx
new file mode 100644
index 0000000000..38b1317fd5
--- /dev/null
+++ b/dbaccess/source/ui/inc/WColumnSelect.hxx
@@ -0,0 +1,82 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "WTabPage.hxx"
+#include "WCopyTable.hxx"
+
+#include <comphelper/stl_types.hxx>
+
+namespace dbaui
+{
+ class OFieldDescription;
+
+ // Wizard Page: OWizColumnSelect
+
+ class OWizColumnSelect : public OWizardPage
+ {
+ std::unique_ptr<weld::TreeView> m_xOrgColumnNames; // left side
+ std::unique_ptr<weld::Button> m_xColumn_RH;
+ std::unique_ptr<weld::Button> m_xColumns_RH;
+ std::unique_ptr<weld::Button> m_xColumn_LH;
+ std::unique_ptr<weld::Button> m_xColumns_LH;
+ std::unique_ptr<weld::TreeView> m_xNewColumnNames; // right side
+
+ DECL_LINK( ButtonClickHdl, weld::Button&, void );
+ DECL_LINK( ListDoubleClickHdl, weld::TreeView&, bool );
+
+ static void clearListBox(weld::TreeView& _rListBox);
+ static void fillColumns(weld::TreeView const * pRight,
+ std::vector< OUString> &_rRightColumns);
+
+ void createNewColumn( weld::TreeView* _pListbox,
+ OFieldDescription const * _pSrcField,
+ std::vector< OUString>& _rRightColumns,
+ const OUString& _sColumnName,
+ std::u16string_view _sExtraChars,
+ sal_Int32 _nMaxNameLen,
+ const ::comphelper::UStringMixEqual& _aCase);
+
+ void moveColumn( weld::TreeView* _pRight,
+ weld::TreeView const * _pLeft,
+ std::vector< OUString>& _rRightColumns,
+ const OUString& _sColumnName,
+ std::u16string_view _sExtraChars,
+ sal_Int32 _nMaxNameLen,
+ const ::comphelper::UStringMixEqual& _aCase);
+
+ void enableButtons();
+
+ sal_Int32 adjustColumnPosition(weld::TreeView const * _pLeft,
+ std::u16string_view _sColumnName,
+ ODatabaseExport::TColumnVector::size_type nCurrentPos,
+ const ::comphelper::UStringMixEqual& _aCase);
+
+ public:
+ virtual void Reset ( ) override;
+ virtual void Activate() override;
+ virtual bool LeavePage() override;
+ virtual OUString GetTitle() const override ;
+
+ OWizColumnSelect(weld::Container* pParent, OCopyTableWizard* pWizard);
+ virtual ~OWizColumnSelect() override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
new file mode 100644
index 0000000000..d3c0672f8e
--- /dev/null
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -0,0 +1,413 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/stl_types.hxx>
+#include "TypeInfo.hxx"
+#include <vcl/roadmapwizard.hxx>
+#include "DExport.hxx"
+#include "WTabPage.hxx"
+#include "FieldDescriptions.hxx"
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <map>
+#include <algorithm>
+
+namespace dbaui
+{
+
+ class TColumnFindFunctor
+ {
+ public:
+ virtual bool operator()(const OUString& _sColumnName) const = 0;
+
+ protected:
+ ~TColumnFindFunctor() {}
+ };
+
+ class TExportColumnFindFunctor : public TColumnFindFunctor
+ {
+ ODatabaseExport::TColumns* m_pColumns;
+ public:
+ TExportColumnFindFunctor(ODatabaseExport::TColumns* _pColumns)
+ {
+ m_pColumns = _pColumns;
+ }
+
+ virtual ~TExportColumnFindFunctor() {}
+
+ bool operator()(const OUString& _sColumnName) const override
+ {
+ return m_pColumns->find(_sColumnName) != m_pColumns->end();
+ }
+ };
+
+ class TMultiListBoxEntryFindFunctor : public TColumnFindFunctor
+ {
+ ::comphelper::UStringMixEqual m_aCase;
+ std::vector< OUString>* m_pVector;
+ public:
+ TMultiListBoxEntryFindFunctor(std::vector< OUString>* _pVector,
+ const ::comphelper::UStringMixEqual& _aCase)
+ :m_aCase(_aCase)
+ ,m_pVector(_pVector)
+ {
+ }
+
+ virtual ~TMultiListBoxEntryFindFunctor() {}
+
+ bool operator()(const OUString& _sColumnName) const override
+ {
+ return std::any_of(m_pVector->begin(),m_pVector->end(),
+ [this, &_sColumnName](const OUString& lhs)
+ { return m_aCase(lhs, _sColumnName); });
+ }
+ };
+
+ // ICopyTableSourceObject
+ /** interface to an object to copy to another DB, using the OCopyTableWizard
+
+ when the wizard is used to copy an object to another DB, it usually requires
+ a sdbcx-level or sdb-level object (a css.sdbcx.Table or css.sdb.Query, that is).
+
+ However, to also support copying tables from sdbc-level connections, we allow to
+ work with the object name only. This implies some less features (like copying the
+ UI settings of a table is not done), but still allows to copy definition and data.
+ */
+ class ICopyTableSourceObject
+ {
+ public:
+ /// retrieves the fully qualified name of the object to copy
+ virtual OUString getQualifiedObjectName() const = 0;
+ /// determines whether the object is a view
+ virtual bool isView() const = 0;
+ /** copies the UI settings of the object to the given target object. Might be
+ ignored by implementations which do not have Ui settings.
+ */
+ virtual void copyUISettingsTo( const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const = 0;
+ /// retrieves the column names of the to-be-copied object
+ virtual css::uno::Sequence< OUString >
+ getColumnNames() const = 0;
+ /// retrieves the names of the primary keys of the to-be-copied object
+ virtual css::uno::Sequence< OUString >
+ getPrimaryKeyColumnNames() const = 0;
+ /// creates a OFieldDescription for the given column of the to-be-copied object
+ virtual OFieldDescription* createFieldDescription( const OUString& _rColumnName ) const = 0;
+ /// returns the SELECT statement which can be used to retrieve the data of the to-be-copied object
+ virtual OUString getSelectStatement() const = 0;
+
+ /** copies the filter and sorting
+ *
+ * \return
+ */
+ virtual void copyFilterAndSortingTo(const css::uno::Reference< css::sdbc::XConnection >& _xConnection,const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const = 0;
+
+ /** returns the prepared statement which can be used to retrieve the data of the to-be-copied object
+
+ The default implementation of this method will simply prepare a statement with the return value
+ of ->getSelectStatement.
+ */
+ virtual ::utl::SharedUNOComponent< css::sdbc::XPreparedStatement >
+ getPreparedSelectStatement() const = 0;
+
+ virtual ~ICopyTableSourceObject();
+ };
+
+ // ObjectCopySource
+ class ObjectCopySource : public ICopyTableSourceObject
+ {
+ private:
+ css::uno::Reference< css::sdbc::XConnection > m_xConnection;
+ css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
+ css::uno::Reference< css::beans::XPropertySet > m_xObject;
+ css::uno::Reference< css::beans::XPropertySetInfo > m_xObjectPSI;
+ css::uno::Reference< css::container::XNameAccess > m_xObjectColumns;
+
+ public:
+ ObjectCopySource(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::beans::XPropertySet >& _rxObject
+ );
+
+ // ICopyTableSourceObject overridables
+ virtual OUString getQualifiedObjectName() const override;
+ virtual bool isView() const override;
+ virtual void copyUISettingsTo( const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const override;
+ virtual void copyFilterAndSortingTo(const css::uno::Reference< css::sdbc::XConnection >& _xConnection, const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const override;
+ virtual css::uno::Sequence< OUString >
+ getColumnNames() const override;
+ virtual css::uno::Sequence< OUString >
+ getPrimaryKeyColumnNames() const override;
+ virtual OFieldDescription* createFieldDescription( const OUString& _rColumnName ) const override;
+ virtual OUString getSelectStatement() const override;
+ virtual ::utl::SharedUNOComponent< css::sdbc::XPreparedStatement >
+ getPreparedSelectStatement() const override;
+ };
+
+ // NamedTableCopySource
+ class NamedTableCopySource : public ICopyTableSourceObject
+ {
+ private:
+ css::uno::Reference< css::sdbc::XConnection > m_xConnection;
+ css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
+ OUString m_sTableName;
+ OUString m_sTableCatalog;
+ OUString m_sTableSchema;
+ OUString m_sTableBareName;
+ std::vector< OFieldDescription > m_aColumnInfo;
+ ::utl::SharedUNOComponent< css::sdbc::XPreparedStatement > m_xStatement;
+
+ public:
+ NamedTableCopySource(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ OUString _sTableName
+ );
+
+ // ICopyTableSourceObject overridables
+ virtual OUString getQualifiedObjectName() const override;
+ virtual bool isView() const override;
+ virtual void copyUISettingsTo( const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const override;
+ virtual void copyFilterAndSortingTo(const css::uno::Reference< css::sdbc::XConnection >& _xConnection,const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const override;
+ virtual css::uno::Sequence< OUString >
+ getColumnNames() const override;
+ virtual css::uno::Sequence< OUString >
+ getPrimaryKeyColumnNames() const override;
+ virtual OFieldDescription* createFieldDescription( const OUString& _rColumnName ) const override;
+ virtual OUString getSelectStatement() const override;
+ virtual ::utl::SharedUNOComponent< css::sdbc::XPreparedStatement >
+ getPreparedSelectStatement() const override;
+
+ private:
+ void impl_ensureColumnInfo_throw();
+ ::utl::SharedUNOComponent< css::sdbc::XPreparedStatement > const &
+ impl_ensureStatement_throw();
+ };
+
+ // Wizard Dialog
+ class OCopyTableWizard : public vcl::RoadmapWizardMachine
+ {
+ friend class OWizColumnSelect;
+ friend class OWizTypeSelect;
+ friend class OWizTypeSelectControl;
+ friend class OCopyTable;
+ friend class OWizNameMatching;
+
+ public:
+ typedef std::map<OUString, OUString, ::comphelper::UStringMixLess> TNameMapping;
+
+ enum Wizard_Button_Style
+ {
+ WIZARD_NEXT,
+ WIZARD_PREV,
+ WIZARD_FINISH,
+
+ WIZARD_NONE
+ };
+
+ private:
+ ODatabaseExport::TColumns m_vDestColumns; // contains the columns
+ ODatabaseExport::TColumnVector m_aDestVec; // the order to insert the columns
+ ODatabaseExport::TColumns m_vSourceColumns;
+ ODatabaseExport::TColumnVector m_vSourceVec;
+
+ OTypeInfoMap m_aTypeInfo;
+ std::vector<OTypeInfoMap::iterator> m_aTypeInfoIndex;
+ OTypeInfoMap m_aDestTypeInfo;
+ std::vector<OTypeInfoMap::iterator> m_aDestTypeInfoIndex;
+ TNameMapping m_mNameMapping;
+
+ ODatabaseExport::TPositions m_vColumnPositions;
+ std::vector<sal_Int32> m_vColumnTypes;
+
+ css::uno::Reference< css::sdbc::XConnection > m_xDestConnection;
+
+ const ICopyTableSourceObject& m_rSourceObject;
+
+ css::uno::Reference< css::util::XNumberFormatter > m_xFormatter;
+ css::uno::Reference< css::uno::XComponentContext> m_xContext;
+ css::uno::Reference< css::task::XInteractionHandler> m_xInteractionHandler;
+
+ OUString m_sTypeNames; // these type names are the ones out of the resource file
+ sal_uInt32 m_nPageCount;
+ bool m_bDeleteSourceColumns;
+ bool m_bInterConnectionCopy; // are we copying between different connections?
+
+ css::lang::Locale m_aLocale;
+ OUString m_sName; // for a table the name is composed
+ OUString m_sSourceName;
+ OUString m_aKeyName;
+ TOTypeInfoSP m_pTypeInfo; // default type
+ bool m_bAddPKFirstTime;
+ sal_Int16 m_nOperation;
+ Wizard_Button_Style m_ePressed;
+ bool m_bCreatePrimaryKeyColumn;
+ bool m_bUseHeaderLine;
+
+ private:
+ DECL_LINK( ImplPrevHdl, weld::Button&, void );
+ DECL_LINK( ImplNextHdl, weld::Button&, void);
+ DECL_LINK( ImplOKHdl, weld::Button&, void );
+ bool CheckColumns(sal_Int32& _rnBreakPos);
+ void loadData( const ICopyTableSourceObject& _rSourceObject,
+ ODatabaseExport::TColumns& _rColumns,
+ ODatabaseExport::TColumnVector& _rColVector );
+ void construct();
+ // need for table creation
+ static void appendColumns( css::uno::Reference< css::sdbcx::XColumnsSupplier> const & _rxColSup, const ODatabaseExport::TColumnVector* _pVec, bool _bKeyColumns = false );
+ static void appendKey(css::uno::Reference< css::sdbcx::XKeysSupplier> const & _rxSup,const ODatabaseExport::TColumnVector* _pVec);
+ // checks if the type is supported in the destination database
+ bool supportsType(sal_Int32 _nDataType,sal_Int32& _rNewDataType);
+
+ virtual std::unique_ptr<BuilderPage> createPage(vcl::WizardTypes::WizardState /*nState*/) override
+ {
+ assert(false);
+ return nullptr;
+ }
+
+ virtual void ActivatePage() override;
+
+ sal_uInt16 GetCurLevel() const { return getCurrentState(); }
+
+ weld::Container* CreatePageContainer();
+
+ public:
+ // used for copy tables or queries
+ OCopyTableWizard(
+ weld::Window * pParent,
+ const OUString& _rDefaultName,
+ sal_Int16 _nOperation,
+ const ICopyTableSourceObject& _rSourceObject,
+ const css::uno::Reference< css::sdbc::XConnection >& _xSourceConnection,
+ const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const css::uno::Reference< css::task::XInteractionHandler>& _xInteractionHandler
+ );
+
+ // used for importing rtf/html sources
+ OCopyTableWizard(
+ weld::Window* pParent,
+ OUString _sDefaultName,
+ sal_Int16 _nOperation,
+ ODatabaseExport::TColumns&& _rDestColumns,
+ const ODatabaseExport::TColumnVector& _rSourceColVec,
+ const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ const css::uno::Reference< css::util::XNumberFormatter >& _xFormatter,
+ TypeSelectionPageFactory _pTypeSelectionPageFactory,
+ SvStream& _rTypeSelectionPageArg,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext
+ );
+
+ virtual ~OCopyTableWizard() override;
+
+ virtual bool DeactivatePage() override;
+ weld::Button& GetOKButton() { return *m_xFinish; }
+ Wizard_Button_Style GetPressedButton() const { return m_ePressed; }
+ void EnableNextButton(bool bEnable);
+ void AddWizardPage(std::unique_ptr<OWizardPage> xPage); // delete page from OCopyTableWizard
+ void CheckButtons(); // checks which button can be disabled, enabled
+
+ // returns a vector where the position of a column and if the column is in the selection
+ // when not the value is COLUMN_POSITION_NOT_FOUND.
+ const ODatabaseExport::TPositions& GetColumnPositions() const { return m_vColumnPositions; }
+ const std::vector<sal_Int32>& GetColumnTypes() const { return m_vColumnTypes; }
+ bool UseHeaderLine() const { return m_bUseHeaderLine; }
+ void setUseHeaderLine(bool _bUseHeaderLine) { m_bUseHeaderLine = _bUseHeaderLine; }
+
+ void insertColumn(sal_Int32 _nPos,OFieldDescription* _pField);
+
+ /** replaces a field description with another one. The name must not be known so far.
+ @param _nPos
+ The pos inside the vector, 0 based.
+ @param _pField
+ The field to set.
+ @param _sOldName
+ The name of column to be replaced.
+ */
+ void replaceColumn(sal_Int32 _nPos,OFieldDescription* _pField,const OUString& _sOldName);
+
+ /** returns whether a primary key should be created in the target database
+ */
+ bool shouldCreatePrimaryKey() const { return m_bCreatePrimaryKeyColumn;}
+ void setCreatePrimaryKey( bool _bDoCreate, const OUString& _rSuggestedName );
+
+ static bool supportsPrimaryKey( const css::uno::Reference< css::sdbc::XConnection >& _rxConnection );
+ bool supportsPrimaryKey() const { return supportsPrimaryKey( m_xDestConnection ); }
+
+ static bool supportsViews( const css::uno::Reference< css::sdbc::XConnection >& _rxConnection );
+ bool supportsViews() const { return supportsViews( m_xDestConnection ); }
+
+ /** returns the name of the primary key
+ @return
+ The name of the primary key.
+ */
+ const OUString& getPrimaryKeyName() const { return m_aKeyName; }
+
+ const OTypeInfoMap& getTypeInfo() const { return m_aTypeInfo; }
+
+ TOTypeInfoSP const & getDestTypeInfo(sal_Int32 _nPos) const { return m_aDestTypeInfoIndex[_nPos]->second; }
+ const OTypeInfoMap& getDestTypeInfo() const { return m_aDestTypeInfo; }
+
+ const css::lang::Locale& GetLocale() const { return m_aLocale; }
+ const css::uno::Reference< css::util::XNumberFormatter >& GetFormatter() const { return m_xFormatter; }
+ const css::uno::Reference< css::uno::XComponentContext>& GetComponentContext() const { return m_xContext; }
+
+ const ODatabaseExport::TColumns& getSourceColumns() const{ return m_vSourceColumns; }
+ const ODatabaseExport::TColumnVector& getSrcVector() const { return m_vSourceVec; }
+ ODatabaseExport::TColumns& getDestColumns() { return m_vDestColumns; }
+ const ODatabaseExport::TColumnVector& getDestVector() const { return m_aDestVec; }
+ const OUString& getName() const { return m_sName; }
+
+ /** clears the dest vectors
+ */
+ void clearDestColumns();
+
+ css::uno::Reference< css::beans::XPropertySet > returnTable();
+ css::uno::Reference< css::beans::XPropertySet > getTable() const;
+ css::uno::Reference< css::beans::XPropertySet > createTable();
+ css::uno::Reference< css::beans::XPropertySet > createView() const;
+ sal_Int32 getMaxColumnNameLength() const;
+
+ void setOperation( const sal_Int16 _nOperation );
+ sal_Int16 getOperation() const { return m_nOperation;}
+
+ OUString convertColumnName( const TColumnFindFunctor& _rCmpFunctor,
+ const OUString& _sColumnName,
+ std::u16string_view _sExtraChars,
+ sal_Int32 _nMaxNameLen);
+ TOTypeInfoSP convertType(const TOTypeInfoSP&_pType, bool& _bNotConvert);
+
+ OUString createUniqueName(const OUString& _sName);
+
+ // displays an error message that a column type is not supported
+ void showColumnTypeNotSupported(std::u16string_view _rColumnName);
+
+ void removeColumnNameFromNameMap(const OUString& _sName);
+ void showError(const OUString& _sErrorMessage);
+ void showError(const css::uno::Any& _aError);
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WExtendPages.hxx b/dbaccess/source/ui/inc/WExtendPages.hxx
new file mode 100644
index 0000000000..7d75f2cc1a
--- /dev/null
+++ b/dbaccess/source/ui/inc/WExtendPages.hxx
@@ -0,0 +1,69 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "WTypeSelect.hxx"
+
+class SvStream;
+namespace dbaui
+{
+ class OCopyTableWizard;
+
+ // Wizard Page: OWizHTMLExtend
+ class OWizHTMLExtend : public OWizTypeSelect
+ {
+ protected:
+ virtual void createReaderAndCallParser(sal_Int32 _nRows) override;
+ public:
+ OWizHTMLExtend(weld::Container* pPage, OCopyTableWizard* pWizard, SvStream& rStream)
+ : OWizTypeSelect(pPage, pWizard, &rStream)
+ {
+ }
+
+ static std::unique_ptr<OWizTypeSelect> Create(weld::Container* pPage, OCopyTableWizard* pWizard, SvStream& rInput ) { return std::make_unique<OWizHTMLExtend>(pPage, pWizard, rInput); }
+ };
+ // Wizard Page: OWizRTFExtend
+ class OWizRTFExtend : public OWizTypeSelect
+ {
+ protected:
+ virtual void createReaderAndCallParser(sal_Int32 _nRows) override;
+ public:
+ OWizRTFExtend(weld::Container* pPage, OCopyTableWizard* pWizard, SvStream& rStream)
+ : OWizTypeSelect(pPage, pWizard, &rStream)
+ {
+ }
+
+ static std::unique_ptr<OWizTypeSelect> Create(weld::Container* pPage, OCopyTableWizard* pWizard, SvStream& rInput) { return std::make_unique<OWizRTFExtend>(pPage, pWizard, rInput); }
+ };
+
+ // Wizard Page: OWizNormalExtend
+ class OWizNormalExtend : public OWizTypeSelect
+ {
+ protected:
+ virtual void createReaderAndCallParser(sal_Int32 _nRows) override;
+ public:
+ OWizNormalExtend(weld::Container* pPage, OCopyTableWizard* pWizard)
+ : OWizTypeSelect(pPage, pWizard)
+ {
+ EnableAuto(false);
+ }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WNameMatch.hxx b/dbaccess/source/ui/inc/WNameMatch.hxx
new file mode 100644
index 0000000000..d108c043c6
--- /dev/null
+++ b/dbaccess/source/ui/inc/WNameMatch.hxx
@@ -0,0 +1,63 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "WTabPage.hxx"
+#include "DExport.hxx"
+#include "WCopyTable.hxx"
+
+namespace dbaui
+{
+ // Wizard Page: OWizNameMatching
+ // Name matching for data appending
+ class OWizNameMatching : public OWizardPage
+ {
+ std::unique_ptr<weld::Label> m_xTABLE_LEFT;
+ std::unique_ptr<weld::Label> m_xTABLE_RIGHT;
+ std::unique_ptr<weld::TreeView> m_xCTRL_LEFT; // left side
+ std::unique_ptr<weld::TreeView> m_xCTRL_RIGHT; // right side
+ std::unique_ptr<weld::Button> m_xColumn_up;
+ std::unique_ptr<weld::Button> m_xColumn_down;
+ std::unique_ptr<weld::Button> m_xColumn_up_right;
+ std::unique_ptr<weld::Button> m_xColumn_down_right;
+ std::unique_ptr<weld::Button> m_xAll;
+ std::unique_ptr<weld::Button> m_xNone;
+ OUString m_sSourceText;
+ OUString m_sDestText;
+
+ DECL_LINK( ButtonClickHdl, weld::Button&, void );
+ DECL_LINK( RightButtonClickHdl, weld::Button&, void );
+ DECL_LINK( AllNoneClickHdl, weld::Button&, void );
+ DECL_LINK( TableListClickHdl, weld::TreeView&, void );
+ DECL_LINK( TableListRightSelectHdl, weld::TreeView&, void );
+
+ static void FillListBox(weld::TreeView& rTreeView, const ODatabaseExport::TColumnVector& rList, bool bCheckButtons);
+
+ public:
+ virtual void Reset ( ) override;
+ virtual void Activate() override;
+ virtual bool LeavePage() override;
+ virtual OUString GetTitle() const override ;
+
+ OWizNameMatching(weld::Container* pPage, OCopyTableWizard* pWizard);
+ virtual ~OWizNameMatching() override;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WTabPage.hxx b/dbaccess/source/ui/inc/WTabPage.hxx
new file mode 100644
index 0000000000..ef3d7f23b2
--- /dev/null
+++ b/dbaccess/source/ui/inc/WTabPage.hxx
@@ -0,0 +1,46 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/wizardmachine.hxx>
+
+namespace dbaui
+{
+ // Wizard Page
+ class OCopyTableWizard;
+ class OWizardPage : public ::vcl::OWizardPage
+ {
+ protected:
+ OCopyTableWizard* m_pParent;
+ bool m_bFirstTime; // Page is called the first time; should be set in the reset method
+
+ OWizardPage(weld::Container* pPage, OCopyTableWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID);
+
+ public:
+ virtual ~OWizardPage() override;
+ virtual void Reset ( ) = 0;
+ virtual bool LeavePage() = 0;
+ virtual OUString GetTitle() const = 0;
+
+ bool IsFirstTime() const { return m_bFirstTime; }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/WTypeSelect.hxx b/dbaccess/source/ui/inc/WTypeSelect.hxx
new file mode 100644
index 0000000000..56af0e355d
--- /dev/null
+++ b/dbaccess/source/ui/inc/WTypeSelect.hxx
@@ -0,0 +1,138 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "FieldDescControl.hxx"
+#include "TypeInfo.hxx"
+#include "WTabPage.hxx"
+
+class SvStream;
+
+namespace dbaui
+{
+ class OWizTypeSelect;
+ class OTableDesignHelpBar;
+ // OWizTypeSelectControl
+ class OWizTypeSelectControl final : public OFieldDescControl
+ {
+ OWizTypeSelect* m_pParentTabPage;
+ virtual void ActivateAggregate( EControlType eType ) override;
+ virtual void DeactivateAggregate( EControlType eType ) override;
+
+ virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId ) override;
+
+ virtual css::lang::Locale GetLocale() const override;
+ virtual css::uno::Reference< css::util::XNumberFormatter > GetFormatter() const override;
+ virtual TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) override;
+ virtual const OTypeInfoMap* getTypeInfo() const override;
+ virtual bool isAutoIncrementValueEnabled() const override;
+ virtual OUString getAutoIncrementValue() const override;
+
+ public:
+ OWizTypeSelectControl(weld::Container* pPage, OWizTypeSelect* pParentTabPage);
+ virtual ~OWizTypeSelectControl() override;
+
+ virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() override;
+ virtual css::uno::Reference< css::sdbc::XConnection> getConnection() override;
+ };
+
+ // Wizard Page: OWizTypeSelectList
+ // just defines the css::ucb::Command for the Contextmenu
+ class OWizTypeSelectList
+ {
+ std::unique_ptr<weld::TreeView> m_xControl;
+ bool m_bPKey;
+ bool IsPrimaryKeyAllowed() const;
+ void setPrimaryKey( OFieldDescription* _pFieldDescr,
+ sal_uInt16 _nPos,
+ bool _bSet = false);
+
+ DECL_LINK(CommandHdl, const CommandEvent&, bool);
+
+ Link<weld::TreeView&, void> m_aChangeHdl;
+
+ public:
+ OWizTypeSelectList(std::unique_ptr<weld::TreeView> xControl);
+ void SetPKey(bool bPKey) { m_bPKey = bPKey; }
+ weld::TreeView* GetWidget() { return m_xControl.get(); }
+ OUString get_selected_id() const { return m_xControl->get_selected_id(); }
+ void clear() { m_xControl->clear(); }
+ void append(const OUString& rId, const OUString& rStr)
+ {
+ m_xControl->append(rId, rStr);
+ }
+ void set_image(int nRow, const OUString& rImage)
+ {
+ m_xControl->set_image(nRow, rImage);
+ }
+ void set_selection_mode(SelectionMode eMode) { m_xControl->set_selection_mode(eMode); }
+ int count_selected_rows() const { return m_xControl->count_selected_rows(); }
+ void select(int pos) { m_xControl->select(pos); }
+ void connect_changed(const Link<weld::TreeView&, void>& rLink)
+ {
+ m_aChangeHdl = rLink;
+ m_xControl->connect_changed(rLink);
+ }
+ };
+
+ // Wizard Page: OWizTypeSelect
+ // Serves as base class for different copy properties.
+ // Calls FillColumnList, when button AUTO is triggered
+ class OWizTypeSelect : public OWizardPage
+ {
+ friend class OWizTypeSelectControl;
+ friend class OWizTypeSelectList;
+
+ DECL_LINK( ColumnSelectHdl, weld::TreeView&, void );
+ DECL_LINK( ButtonClickHdl, weld::Button&, void );
+ protected:
+ std::unique_ptr<OWizTypeSelectList> m_xColumnNames;
+ std::unique_ptr<weld::Container> m_xControlContainer;
+ std::unique_ptr<OWizTypeSelectControl> m_xTypeControl;
+ std::unique_ptr<weld::Label> m_xAutoType;
+ std::unique_ptr<weld::Label> m_xAutoFt;
+ std::unique_ptr<weld::SpinButton> m_xAutoEt;
+ std::unique_ptr<weld::Button> m_xAutoPb;
+
+ SvStream* m_pParserStream; // stream to read the tokens from or NULL
+ OUString m_sAutoIncrementValue;
+ sal_Int32 m_nDisplayRow;
+ bool m_bAutoIncrementEnabled;
+ bool m_bDuplicateName;
+
+ virtual void createReaderAndCallParser(sal_Int32 _nRows) = 0;
+
+ void EnableAuto(bool bEnable);
+ public:
+ virtual void Reset ( ) override;
+ virtual void Activate( ) override;
+ virtual bool LeavePage() override;
+ virtual OUString GetTitle() const override;
+
+ OWizTypeSelect(weld::Container* pParent, OCopyTableWizard* pWizard, SvStream* pStream = nullptr);
+ virtual ~OWizTypeSelect() override;
+
+ void setDisplayRow(sal_Int32 _nRow) { m_nDisplayRow = _nRow - 1; }
+ void setDuplicateName(bool _bDuplicateName) { m_bDuplicateName = _bDuplicateName; }
+ };
+
+ typedef std::unique_ptr<OWizTypeSelect> (*TypeSelectionPageFactory)(weld::Container*, OCopyTableWizard*, SvStream&);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/adtabdlg.hxx b/dbaccess/source/ui/inc/adtabdlg.hxx
new file mode 100644
index 0000000000..5fe1d7c1da
--- /dev/null
+++ b/dbaccess/source/ui/inc/adtabdlg.hxx
@@ -0,0 +1,98 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <memory>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <vcl/weld.hxx>
+#include "tabletree.hxx"
+
+namespace dbaui
+{
+ /** unifies the access to a list of table/query objects
+ */
+ class TableObjectListFacade
+ {
+ public:
+ virtual void updateTableObjectList( bool _bAllowViews ) = 0;
+ virtual OUString getSelectedName( OUString& _out_rAliasName ) const = 0;
+ virtual bool isLeafSelected() const = 0;
+
+ virtual ~TableObjectListFacade();
+ };
+
+ class IAddTableDialogContext
+ {
+ public:
+ virtual css::uno::Reference< css::sdbc::XConnection >
+ getConnection() const = 0;
+ virtual bool allowViews() const = 0;
+ virtual bool allowQueries() const = 0;
+ virtual bool allowAddition() const = 0;
+ virtual void addTableWindow( const OUString& _rQualifiedTableName, const OUString& _rAliasName ) = 0;
+ virtual void onWindowClosing() = 0;
+
+ protected:
+ ~IAddTableDialogContext() {}
+ };
+
+ class OAddTableDlg : public weld::GenericDialogController
+ {
+ IAddTableDialogContext& m_rContext;
+ std::unique_ptr< TableObjectListFacade > m_xCurrentList;
+
+ std::unique_ptr<weld::RadioButton> m_xCaseTables;
+ std::unique_ptr<weld::RadioButton> m_xCaseQueries;
+
+ std::unique_ptr<OTableTreeListBox> m_xTableList;
+ std::unique_ptr<weld::TreeView> m_xQueryList;
+
+ std::unique_ptr<weld::Button> m_xAddButton;
+ std::unique_ptr<weld::Button> m_xCloseButton;
+
+ DECL_LINK( AddClickHdl, weld::Button&, void );
+ DECL_LINK( CloseClickHdl, weld::Button&, void);
+ DECL_LINK( TableListDoubleClickHdl, weld::TreeView&, bool );
+ DECL_LINK( TableListSelectHdl, weld::TreeView&, void );
+ DECL_LINK( OnTypeSelected, weld::Toggleable&, void );
+
+ public:
+ OAddTableDlg(weld::Window* _pParent,
+ IAddTableDialogContext& _rContext);
+ virtual ~OAddTableDlg() override;
+
+ void Update();
+ void OnClose();
+
+ static OUString getDialogTitleForContext(
+ IAddTableDialogContext const & _rContext );
+
+ private:
+ bool impl_isAddAllowed();
+
+ enum ObjectList
+ {
+ Tables,
+ Queries
+ };
+ void impl_switchTo( ObjectList _eList );
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
new file mode 100644
index 0000000000..7c38562145
--- /dev/null
+++ b/dbaccess/source/ui/inc/advancedsettingsdlg.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 .
+ */
+
+#pragma once
+
+#include "IItemSetHelper.hxx"
+#include <sfx2/tabdlg.hxx>
+#include <memory>
+
+namespace dbaui
+{
+
+ // AdvancedSettingsDialog
+ class ODbDataSourceAdministrationHelper;
+ /** implements the advanced page dlg of the data source properties.
+ */
+ class AdvancedSettingsDialog : public SfxTabDialogController
+ , public IItemSetHelper
+ , public IDatabaseSettingsDialog
+ {
+ std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
+
+ protected:
+ virtual void PageCreated(const OUString& rId, SfxTabPage& _rPage) override;
+ virtual short Ok() override;
+
+ public:
+ AdvancedSettingsDialog(weld::Window* pParent,
+ SfxItemSet* _pItems,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
+ const css::uno::Any& _aDataSourceName);
+
+ virtual ~AdvancedSettingsDialog() override;
+
+ /// determines whether or not the given data source type has any advanced setting
+ static bool doesHaveAnyAdvancedSettings( const OUString& _sURL );
+
+ virtual const SfxItemSet* getOutputSet() const override;
+ virtual SfxItemSet* getWriteOutputSet() override;
+
+ // forwards to ODbDataSourceAdministrationHelper
+ virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override;
+ virtual std::pair< css::uno::Reference< css::sdbc::XConnection >,bool> createConnection() override;
+ virtual css::uno::Reference< css::sdbc::XDriver > getDriver() override;
+ virtual OUString getDatasourceType(const SfxItemSet& _rSet) const override;
+ virtual void clearPassword() override;
+ virtual void saveDatasource() override;
+ virtual void setTitle(const OUString& _sTitle) override;
+ virtual void enableConfirmSettings( bool _bEnable ) override;
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/asyncmodaldialog.hxx b/dbaccess/source/ui/inc/asyncmodaldialog.hxx
new file mode 100644
index 0000000000..483dfb7c16
--- /dev/null
+++ b/dbaccess/source/ui/inc/asyncmodaldialog.hxx
@@ -0,0 +1,47 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+
+namespace dbaui
+{
+
+ // AsyncDialogExecutor
+ /** helper class for executing (UNO) dialogs modal, but asynchronously
+ */
+ class AsyncDialogExecutor
+ {
+ public:
+ /** executes the given dialog asynchronously, but still modal
+
+ @throws IllegalArgumentException
+ if the given dialog is <NULL/>
+ @todo
+ allow for a callback for the result
+ */
+ static void executeModalDialogAsync(
+ const css::uno::Reference< css::ui::dialogs::XExecutableDialog >& _rxDialog
+ );
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/browserids.hxx b/dbaccess/source/ui/inc/browserids.hxx
new file mode 100644
index 0000000000..0c510497de
--- /dev/null
+++ b/dbaccess/source/ui/inc/browserids.hxx
@@ -0,0 +1,98 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <svx/svxids.hrc>
+#include <dbaccess_slotid.hrc>
+
+#define ID_BROWSER_COPY SID_COPY
+#define ID_BROWSER_CUT SID_CUT
+#define ID_BROWSER_EDITDOC SID_EDITDOC
+#define ID_BROWSER_UNDORECORD SID_FM_RECORD_UNDO
+#define ID_BROWSER_SAVERECORD SID_FM_RECORD_SAVE
+#define ID_BROWSER_PASTE SID_PASTE
+#define ID_BROWSER_CLIPBOARD_FORMAT_ITEMS SID_CLIPBOARD_FORMAT_ITEMS
+#define ID_BROWSER_REDO SID_REDO
+#define ID_BROWSER_SAVEDOC SID_SAVEDOC
+#define ID_BROWSER_SAVEASDOC SID_SAVEASDOC
+#define ID_BROWSER_TITLE SID_DOCINFO_TITLE
+#define ID_BROWSER_UNDO SID_UNDO
+#define ID_BROWSER_INSERTCOLUMNS SID_SBA_BRW_INSERT
+#define ID_BROWSER_FORMLETTER SID_SBA_BRW_MERGE
+#define ID_BROWSER_INSERTCONTENT SID_SBA_BRW_UPDATE
+
+#define ID_BROWSER_SEARCH SID_FM_SEARCH
+#define ID_BROWSER_SORTUP SID_FM_SORTUP
+#define ID_BROWSER_SORTDOWN SID_FM_SORTDOWN
+#define ID_BROWSER_AUTOFILTER SID_FM_AUTOFILTER
+#define ID_BROWSER_FILTERCRIT SID_FM_FILTERCRIT
+#define ID_BROWSER_ORDERCRIT SID_FM_ORDERCRIT
+#define ID_BROWSER_REMOVEFILTER SID_FM_REMOVE_FILTER_SORT
+#define ID_BROWSER_FILTERED SID_FM_FORM_FILTERED
+#define ID_BROWSER_REFRESH SID_FM_REFRESH
+#define ID_BROWSER_COLATTRSET 10020 // column formatting
+#define ID_BROWSER_COLWIDTH 10021 // column width
+#define ID_BROWSER_TABLEATTR 10022 // table format attributes
+#define ID_BROWSER_ROWHEIGHT 10023 // row height
+#define ID_BROWSER_ADDTABLE SID_FM_ADDTABLE
+#define ID_BROWSER_EXPLORER SID_DSBROWSER_EXPLORER
+#define ID_BROWSER_DOCUMENT_DATASOURCE SID_DOCUMENT_DATA_SOURCE
+
+// The following ids are local to special components (e.g. menus), so they don't need to be unique
+// overall. Please have this in mind when changing anything
+#define ID_TREE_EDIT_DATABASE 1
+#define ID_TREE_CLOSE_CONN 2
+ // FREE
+#define ID_TREE_ADMINISTRATE 4
+
+#define ID_REPORT_NEW_TEXT 14
+#define ID_FORM_NEW_TEXT 15
+#define ID_FORM_NEW_CALC 16
+#define ID_FORM_NEW_IMPRESS 17
+#define ID_NEW_QUERY_DESIGN 20
+#define ID_EDIT_QUERY_DESIGN 21
+#define ID_NEW_QUERY_SQL 22
+#define ID_EDIT_QUERY_SQL 23
+#define ID_NEW_TABLE_DESIGN 25
+#define ID_NEW_VIEW_DESIGN 28
+#define ID_DIRECT_SQL 32
+#define ID_BROWSER_REFRESH_REBUILD 34
+#define ID_INDEX_NEW 36
+#define ID_INDEX_DROP 37
+#define ID_INDEX_RENAME 38
+#define ID_INDEX_SAVE 39
+#define ID_INDEX_RESET 40
+#define ID_DOCUMENT_CREATE_REPWIZ 41
+#define ID_BROWSER_SQL 42
+
+#define ID_APP_NEW_QUERY_AUTO_PILOT 44
+#define ID_NEW_TABLE_DESIGN_AUTO_PILOT 45
+#define ID_NEW_VIEW_DESIGN_AUTO_PILOT 46
+
+
+// other
+#define ID_BROWSER_QUERY_EXECUTE SID_FM_EXECUTE
+
+#define ID_BROWSER_CLOSE SID_CLOSEWIN
+#define ID_BROWSER_ESCAPEPROCESSING SID_FM_NATIVESQL
+
+#define ID_BROWSER_INSERT_ROW (SID_SBA_START + 46) // insert row
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx
new file mode 100644
index 0000000000..e5e1db401a
--- /dev/null
+++ b/dbaccess/source/ui/inc/brwctrlr.hxx
@@ -0,0 +1,332 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <dbaccess/genericcontroller.hxx>
+#include "brwview.hxx"
+#include "sbagrid.hxx"
+
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/sdb/XSQLErrorListener.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/form/XResetListener.hpp>
+#include <com/sun/star/form/XDatabaseParameterListener.hpp>
+#include <com/sun/star/form/XConfirmDeleteListener.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/frame/XModule.hpp>
+
+#include <vcl/timer.hxx>
+#include <vcl/transfer.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <svtools/cliplistener.hxx>
+
+struct FmFoundRecordInformation;
+struct FmSearchContext;
+
+namespace dbtools
+{
+ class SQLExceptionInfo;
+}
+
+namespace dbaui
+{
+
+ typedef ::cppu::ImplInheritanceHelper < OGenericUnoController
+ , css::sdb::XSQLErrorListener
+ , css::form::XDatabaseParameterListener
+ , css::form::XConfirmDeleteListener
+ , css::form::XLoadListener
+ , css::form::XResetListener
+ , css::awt::XFocusListener
+ , css::container::XContainerListener
+ , css::beans::XPropertyChangeListener
+ , css::frame::XModule
+ > SbaXDataBrowserController_Base;
+
+ class SbaXDataBrowserController :public SbaXDataBrowserController_Base
+ ,public SbaGridListener
+ {
+ // attributes
+ private:
+ // for implementing the XFormController
+ class FormControllerImpl;
+ friend class FormControllerImpl;
+
+ css::uno::Reference< css::sdbc::XRowSet > m_xRowSet; // our rowset
+ css::uno::Reference< css::sdbcx::XColumnsSupplier > m_xColumnsSupplier; // queried from the rowset member
+ css::uno::Reference< css::form::XLoadable > m_xLoadable; // queried from the rowset member as well
+ css::uno::Reference< css::form::XFormComponent > m_xGridModel; // the model of our grid
+ css::uno::Reference< css::util::XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier
+ mutable css::uno::Reference< css::sdb::XSingleSelectQueryComposer >
+ m_xParser; // for sorting 'n filtering
+
+ sal_Int32 m_nRowSetPrivileges; // cached Privileges property of m_xRowSet
+
+ AutoTimer m_aInvalidateClipboard; // for testing the state of the CUT/COPY/PASTE-slots
+
+ TransferableDataHelper m_aSystemClipboard; // content of the clipboard
+ rtl::Reference<TransferableClipboardListener>
+ m_pClipboardNotifier; // notifier for changes in the clipboard
+
+ OAsynchronousLink m_aAsyncGetCellFocus;
+ OAsynchronousLink m_aAsyncDisplayError;
+ ::dbtools::SQLExceptionInfo m_aCurrentError;
+
+ OUString m_sStateSaveRecord;
+ OUString m_sStateUndoRecord;
+ OUString m_sModuleIdentifier;
+
+ // members for asynchronous load operations
+ rtl::Reference<FormControllerImpl> m_xFormControllerImpl; // implementing the XFormController
+
+ sal_uInt16 m_nFormActionNestingLevel; // see enter-/leaveFormAction
+
+ bool m_bLoadCanceled : 1; // the load was canceled somehow
+ bool m_bCannotSelectUnfiltered : 1; // received a DATA_CANNOT_SELECT_UNFILTERED error
+
+ protected:
+ class FormErrorHelper final
+ {
+ SbaXDataBrowserController* m_pOwner;
+ public:
+ FormErrorHelper(SbaXDataBrowserController* pOwner) : m_pOwner(pOwner) { m_pOwner->enterFormAction(); }
+ ~FormErrorHelper() { m_pOwner->leaveFormAction(); }
+ };
+ friend class FormErrorHelper;
+
+ // attribute access
+ protected:
+ const css::uno::Reference< css::sdbc::XRowSet >& getRowSet() const { return m_xRowSet; }
+ const css::uno::Reference< css::form::XLoadable >& getLoadable() const { return m_xLoadable; }
+
+ const css::uno::Reference< css::form::XFormComponent >& getFormComponent() const { return m_xGridModel; }
+ css::uno::Reference< css::awt::XControlModel > getControlModel() const { return css::uno::Reference< css::awt::XControlModel > (m_xGridModel, css::uno::UNO_QUERY); }
+ const css::uno::Reference< css::util::XNumberFormatter >& getNumberFormatter()const { return m_xFormatter; }
+
+ bool isValid() const { return m_xRowSet.is() && m_xGridModel.is(); }
+ bool isValidCursor() const; // checks the css::data::XDatabaseCursor-interface of m_xRowSet
+ bool isLoaded() const;
+ bool loadingCancelled() const { return m_bLoadCanceled; }
+ void onStartLoading( const css::uno::Reference< css::form::XLoadable >& _rxLoadable );
+ void setLoadingCancelled() { m_bLoadCanceled = true; }
+
+ public:
+ SbaXDataBrowserController(const css::uno::Reference< css::uno::XComponentContext >& _rM);
+
+ UnoDataBrowserView* getBrowserView() const { return static_cast< UnoDataBrowserView*>(getView()); }
+ // late construction
+ virtual bool Construct(vcl::Window* pParent) override;
+
+ // UNO
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ // css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ // css::util::XModifyListener
+ virtual void SAL_CALL modified(const css::lang::EventObject& aEvent) override;
+
+ // css::container::XContainerListener
+ virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& Event) override;
+ virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& Event) override;
+ virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& Event) override;
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& evt ) override;
+
+ // XModule
+ virtual void SAL_CALL setIdentifier( const OUString& Identifier ) override;
+ virtual OUString SAL_CALL getIdentifier( ) override;
+
+ // css::awt::XFocusListener
+ virtual void SAL_CALL focusGained(const css::awt::FocusEvent& e) override;
+ virtual void SAL_CALL focusLost(const css::awt::FocusEvent& e) override;
+
+ // css::frame::XController
+ virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL disposing() override;
+
+ // css::frame::XFrameActionListener
+ virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) override;
+
+ // css::sdb::XSQLErrorListener
+ virtual void SAL_CALL errorOccured(const css::sdb::SQLErrorEvent& aEvent) override;
+
+ // css::form::XDatabaseParameterListener
+ virtual sal_Bool SAL_CALL approveParameter(const css::form::DatabaseParameterEvent& aEvent) override;
+
+ // css::form::XConfirmDeleteListener
+ virtual sal_Bool SAL_CALL confirmDelete(const css::sdb::RowChangeEvent& aEvent) override;
+
+ // css::form::XLoadListener
+ virtual void SAL_CALL loaded(const css::lang::EventObject& aEvent) override;
+ virtual void SAL_CALL unloading(const css::lang::EventObject& aEvent) override;
+ virtual void SAL_CALL unloaded(const css::lang::EventObject& aEvent) override;
+ virtual void SAL_CALL reloading(const css::lang::EventObject& aEvent) override;
+ virtual void SAL_CALL reloaded(const css::lang::EventObject& aEvent) override;
+
+ // css::form::XResetListener
+ virtual sal_Bool SAL_CALL approveReset(const css::lang::EventObject& rEvent) override;
+ virtual void SAL_CALL resetted(const css::lang::EventObject& rEvent) override;
+
+ // SbaGridListener
+ virtual void RowChanged() override;
+ virtual void ColumnChanged() override;
+ virtual void SelectionChanged() override;
+ virtual void CellActivated() override;
+ virtual void CellDeactivated() override;
+ virtual void BeforeDrop() override;
+ virtual void AfterDrop() override;
+
+ public:
+
+ protected:
+ virtual ~SbaXDataBrowserController() override;
+
+ // all the features which should be handled by this class
+ virtual void describeSupportedFeatures() override;
+ // state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
+ virtual FeatureState GetState(sal_uInt16 nId) const override;
+ // execute a feature
+ virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+
+ virtual void startFrameListening( const css::uno::Reference< css::frame::XFrame >& _rxFrame ) override;
+ virtual void stopFrameListening( const css::uno::Reference< css::frame::XFrame >& _rxFrame ) override;
+
+ virtual css::uno::Reference< css::sdbc::XRowSet > CreateForm();
+ // our default implementation simply instantiates a stardiv.one.form.component.Form service
+ // (probably this needs not to be overridden, but you may return anything you want as long as it
+ // supports the css::form::DatabaseForm service. For instance you may want to create an adapter here which
+ // is synchronized with a foreign css::form::DatabaseForm you got elsewhere)
+ virtual bool InitializeForm(
+ const css::uno::Reference< css::beans::XPropertySet >& i_formProperties ) = 0;
+ // called immediately after a successful CreateForm
+ // do any initialization (data source etc.) here. the form should be fully functional after that.
+ // return sal_False if you didn't succeed (don't throw exceptions, they won't be caught)
+
+ css::uno::Reference< css::form::XFormComponent > CreateGridModel();
+ // our default implementation simply instantiates a stardiv.one.form.component.Grid service
+ // you most probably don't want to override this behavior
+
+ // the default implementation of disposing distributes the events to the following disposingXXX functions
+ void disposingFormModel(const css::lang::EventObject& Source);
+ void disposingColumnModel(const css::lang::EventObject& Source);
+
+ // want to be a listener to the grid control ? use this !
+ void addControlListeners(const css::uno::Reference< css::awt::XControl > & _xGridControl);
+ void removeControlListeners(const css::uno::Reference< css::awt::XControl > & _xGridControl);
+
+ // want to be a listener to the grid model ? use this !
+ virtual void addModelListeners(const css::uno::Reference< css::awt::XControlModel > & _xGridControlModel);
+ virtual void removeModelListeners(const css::uno::Reference< css::awt::XControlModel > & _xGridControlModel);
+
+ // want to be a listener grid columns ? use this !
+ virtual void AddColumnListener(const css::uno::Reference< css::beans::XPropertySet > & xCol);
+ virtual void RemoveColumnListener(const css::uno::Reference< css::beans::XPropertySet > & xCol);
+
+ // call after "major changes" (e.g. the completion of the async load).
+ // invalidates all toolbox slots and all supported features.
+
+ virtual bool LoadForm();
+ // load the form
+ // the default implementation does a direct load or starts a load thread, depending on the multithread capabilities
+ // of the data source.
+ // the default implementation also calls LoadFinished after a synchronous load, so be sure to do the same if you override
+ // this method and don't call the base class' method
+
+ virtual void LoadFinished(bool bWasSynch);
+ // called if the loading (the _complete_ loading process) is done (no matter if synchron or asynchron).
+
+ virtual void criticalFail();
+ // called whenever a reload operation on the rowset failed
+ // (an "operation" is not only a simple reload: if the user sets a filter, and reloading the form
+ // after setting this filter fails, the filter is reset and the form is reloaded, again. Only the
+ // whole process (_both_ XLoadable::reload calls _together_) form the "reload operation"
+
+ // empty the frame where our view resides
+ bool CommitCurrent();
+ // commit the current column (i.e. cell)
+ bool SaveModified(bool bAskFor = true);
+ // save the modified record
+
+ css::uno::Reference< css::beans::XPropertySet > getBoundField() const;
+ // a PropertySet corresponding to the cursor field a column is bound to.
+ // The field for the current column will be retrieved.
+
+ void enterFormAction();
+ void leaveFormAction();
+
+ // init the formatter if form changes
+ void initFormatter();
+
+ /// loads or reloads the form
+ bool reloadForm(const css::uno::Reference< css::form::XLoadable >& _rxLoadable);
+
+ virtual bool preReloadForm(){ return false; }
+ virtual void postReloadForm(){}
+
+ css::uno::Reference< css::sdb::XSingleSelectQueryComposer >
+ createParser_nothrow();
+
+ private:
+ void setCurrentModified( bool _bSet );
+
+ // execute the filter or sort slot
+ void ExecuteFilterSortCrit(bool bFilter);
+
+ // execute the search slot
+ void ExecuteSearch();
+
+ void initializeParser() const; // changes the mutable member m_xParser
+ void applyParserFilter(const OUString& _rOldFilter, bool _bOldFilterApplied,const ::OUString& _sOldHaving,const css::uno::Reference< css::sdb::XSingleSelectQueryComposer >& _xParser);
+ void applyParserOrder(const OUString& _rOldOrder,const css::uno::Reference< css::sdb::XSingleSelectQueryComposer >& _xParser);
+
+ sal_Int16 getCurrentColumnPosition() const;
+ void setCurrentColumnPosition( sal_Int16 _nPos );
+ void addColumnListeners(const css::uno::Reference< css::awt::XControlModel > & _xGridControlModel);
+
+ void impl_checkForCannotSelectUnfiltered( const ::dbtools::SQLExceptionInfo& _rError );
+
+ // time to check the CUT/COPY/PASTE-slot-states
+ DECL_LINK( OnInvalidateClipboard, Timer*, void );
+ DECL_LINK( OnClipboardChanged, TransferableDataHelper*, void );
+
+ // search callbacks
+ DECL_LINK(OnSearchContextRequest, FmSearchContext&, sal_uInt32);
+ DECL_LINK(OnFoundData, FmFoundRecordInformation&, void);
+ DECL_LINK(OnCanceledNotFound, FmFoundRecordInformation&, void);
+
+ DECL_LINK( OnAsyncGetCellFocus, void*, void );
+ DECL_LINK( OnAsyncDisplayError, void*, void );
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/brwview.hxx b/dbaccess/source/ui/inc/brwview.hxx
new file mode 100644
index 0000000000..0933861b8c
--- /dev/null
+++ b/dbaccess/source/ui/inc/brwview.hxx
@@ -0,0 +1,96 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/window.hxx>
+
+#include <dbaccess/dataview.hxx>
+#include <unotools/eventlisteneradapter.hxx>
+#include "dbtreelistbox.hxx"
+
+namespace com::sun::star::awt {
+ class XControl;
+ class XControlContainer;
+ class XControlModel;
+}
+
+class Splitter;
+
+namespace dbaui
+{
+ class SbaGridControl;
+
+ class UnoDataBrowserView final : public ODataView, public ::utl::OEventListenerAdapter
+ {
+ css::uno::Reference< css::awt::XControl > m_xGrid; // our grid's UNO representation
+ css::uno::Reference< css::awt::XControlContainer > m_xMe; // our own UNO representation
+ VclPtr<InterimDBTreeListBox> m_pTreeView;
+ VclPtr<Splitter> m_pSplitter;
+ mutable VclPtr<SbaGridControl> m_pVclControl; // our grid's VCL representation
+
+ DECL_LINK( SplitHdl, Splitter*, void );
+ // attribute access
+ public:
+ const css::uno::Reference< css::awt::XControl >& getGridControl() const { return m_xGrid; }
+ SbaGridControl* getVclControl() const;
+
+ UnoDataBrowserView( vcl::Window* pParent,
+ IController& _rController,
+ const css::uno::Reference< css::uno::XComponentContext >& );
+ virtual ~UnoDataBrowserView() override;
+ virtual void dispose() override;
+
+ /// late construction
+ void Construct(const css::uno::Reference< css::awt::XControlModel >& xModel);
+
+ /** as columns may be hidden there is a difference between a columns model pos and its view pos
+ so we you may use these translation function
+ */
+ sal_uInt16 View2ModelPos(sal_uInt16 nPos) const;
+ /// for the same reason the view column count isn't the same as the model column count
+
+ void setSplitter(Splitter* pSplitter);
+ void setTreeView(InterimDBTreeListBox* pTreeView);
+
+ void showStatus( const OUString& _rStatus );
+ void hideStatus();
+
+ const css::uno::Reference< css::awt::XControlContainer >& getContainer() const { return m_xMe; }
+
+ private:
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+ virtual void GetFocus() override;
+ virtual void resizeDocumentView(tools::Rectangle& rRect) override;
+ virtual void _disposing( const css::lang::EventObject& _rSource ) override;
+
+ using ODataView::Construct;
+ };
+
+ class BrowserViewStatusDisplay final
+ {
+ VclPtr<UnoDataBrowserView> m_pView;
+
+ public:
+ BrowserViewStatusDisplay( UnoDataBrowserView* _pView, const OUString& _rStatus );
+ ~BrowserViewStatusDisplay( );
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/callbacks.hxx b/dbaccess/source/ui/inc/callbacks.hxx
new file mode 100644
index 0000000000..e380b2671d
--- /dev/null
+++ b/dbaccess/source/ui/inc/callbacks.hxx
@@ -0,0 +1,123 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sot/exchange.hxx>
+
+class Point;
+struct AcceptDropEvent;
+struct ExecuteDropEvent;
+
+namespace comphelper { class OInterfaceContainerHelper2; }
+
+namespace vcl
+{
+ class Window;
+}
+
+namespace weld
+{
+ class TreeIter;
+ class TreeView;
+}
+
+namespace dbaui
+{
+
+ class IController;
+ // IControlActionListener
+ class SAL_NO_VTABLE IControlActionListener
+ {
+ public:
+ /** requests a quick help text to display
+ @return <FALSE/> if the default quick help text should be used
+ */
+ virtual bool requestQuickHelp(const void* pUserData, OUString& rText) const = 0;
+
+ /** handler for StartDrag requests
+ @return <TRUE/> if a drag operation was started
+ */
+ virtual bool requestDrag(const weld::TreeIter& rEntry) = 0;
+
+ /** check whether or not a drop request should be accepted
+ */
+ virtual sal_Int8 queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors ) = 0;
+
+ /** execute a drop request
+ */
+ virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) = 0;
+
+ protected:
+ ~IControlActionListener() {}
+ };
+
+ // IContextMenuProvider
+ class SAL_NO_VTABLE IContextMenuProvider
+ {
+ public:
+ /** returns the context menu resource name for the control
+
+ Supposed to be a valid name from uiconfig/<module>/popupmenu folder.
+ */
+ virtual OUString getContextMenuResourceName() const = 0;
+
+ /** returns the controller which is responsible for providing states of certain features,
+ and executing them.
+ */
+ virtual IController& getCommandController() = 0;
+
+ /** returns the container of registered context menu interceptors, or NULL if the implementation
+ does not support context menu interception
+ */
+ virtual ::comphelper::OInterfaceContainerHelper2*
+ getContextMenuInterceptors() = 0;
+
+ /** returns the current selection in the given control
+
+ This selection is used for filling a ContextMenuExecuteEvent event for the given
+ control.
+ */
+ virtual css::uno::Any getCurrentSelection(weld::TreeView& rControl) const = 0;
+
+ virtual vcl::Window* getMenuParent() const = 0;
+
+ /** adjust rPos which is initially relative to rControl to be relative to
+ the window of getMenuParent
+ */
+ virtual void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const = 0;
+
+ protected:
+ ~IContextMenuProvider() {}
+ };
+
+ // IDragTransferableListener
+ class SAL_NO_VTABLE IDragTransferableListener
+ {
+ public:
+ /// called when a drag operation done with a Transferable has been finished
+ virtual void dragFinished( ) = 0;
+
+ protected:
+ ~IDragTransferableListener() {}
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/charsetlistbox.hxx b/dbaccess/source/ui/inc/charsetlistbox.hxx
new file mode 100644
index 0000000000..a12b425cd9
--- /dev/null
+++ b/dbaccess/source/ui/inc/charsetlistbox.hxx
@@ -0,0 +1,50 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <svl/typedwhich.hxx>
+#include <vcl/weld.hxx>
+#include "charsets.hxx"
+
+class SfxItemSet;
+class SfxStringItem;
+
+namespace dbaui
+{
+ // CharSetListBox
+ class CharSetListBox
+ {
+ public:
+ CharSetListBox(std::unique_ptr<weld::ComboBox> xControl);
+
+ void SelectEntryByIanaName( std::u16string_view _rIanaName );
+ bool StoreSelectedCharSet( SfxItemSet& _rSet, TypedWhichId<SfxStringItem> _nItemId );
+
+ weld::ComboBox* get_widget() { return m_xControl.get(); }
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
+ void show() { m_xControl->show(); }
+
+ private:
+ OCharsetDisplay m_aCharSets;
+ std::unique_ptr<weld::ComboBox> m_xControl;
+ };
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/charsets.hxx b/dbaccess/source/ui/inc/charsets.hxx
new file mode 100644
index 0000000000..49977bd562
--- /dev/null
+++ b/dbaccess/source/ui/inc/charsets.hxx
@@ -0,0 +1,105 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <connectivity/dbcharset.hxx>
+#include <rtl/ustring.hxx>
+
+namespace dbaui
+{
+
+ // OCharsetDisplay
+ typedef ::dbtools::OCharsetMap OCharsetDisplay_Base;
+ class OCharsetDisplay final : protected OCharsetDisplay_Base
+ {
+ private:
+ OUString m_aSystemDisplayName;
+
+ public:
+ class ExtendedCharsetIterator;
+ friend class OCharsetDisplay::ExtendedCharsetIterator;
+
+ typedef ExtendedCharsetIterator iterator;
+ typedef ExtendedCharsetIterator const_iterator;
+
+ OCharsetDisplay();
+
+ // various find operations
+ const_iterator findEncoding(const rtl_TextEncoding _eEncoding) const;
+ const_iterator findIanaName(std::u16string_view _rIanaName) const;
+ const_iterator findDisplayName(const OUString& _rDisplayName) const;
+
+ /// get access to the first element of the charset collection
+ const_iterator begin() const;
+ /// get access to the (last + 1st) element of the charset collection
+ const_iterator end() const;
+
+ private:
+ virtual bool approveEncoding( const rtl_TextEncoding _eEncoding, const rtl_TextEncodingInfo& _rInfo ) const override;
+
+ using OCharsetDisplay_Base::find;
+ };
+
+ //- CharsetDisplayDerefHelper
+ typedef ::dbtools::CharsetIteratorDerefHelper CharsetDisplayDerefHelper_Base;
+ class CharsetDisplayDerefHelper final : protected CharsetDisplayDerefHelper_Base
+ {
+ friend class OCharsetDisplay::ExtendedCharsetIterator;
+
+ OUString m_sDisplayName;
+
+ public:
+ CharsetDisplayDerefHelper(const CharsetDisplayDerefHelper& _rSource);
+
+ OUString const & getIanaName() const { return CharsetDisplayDerefHelper_Base::getIanaName(); }
+ const OUString& getDisplayName() const { return m_sDisplayName; }
+
+ private:
+ CharsetDisplayDerefHelper(const ::dbtools::CharsetIteratorDerefHelper& _rBase, OUString _sDisplayName);
+ };
+
+ //- OCharsetDisplay::ExtendedCharsetIterator
+ class OCharsetDisplay::ExtendedCharsetIterator
+ {
+ friend class OCharsetDisplay;
+
+ friend bool operator==(const ExtendedCharsetIterator& lhs, const ExtendedCharsetIterator& rhs);
+ friend bool operator!=(const ExtendedCharsetIterator& lhs, const ExtendedCharsetIterator& rhs) { return !(lhs == rhs); }
+
+ typedef ::dbtools::OCharsetMap container;
+ typedef container::CharsetIterator base_iterator;
+
+ protected:
+ const OCharsetDisplay* m_pContainer;
+ base_iterator m_aPosition;
+
+ public:
+ CharsetDisplayDerefHelper operator*() const;
+
+ /// prefix increment
+ const ExtendedCharsetIterator& operator++();
+
+ protected:
+ ExtendedCharsetIterator( const OCharsetDisplay* _pContainer, base_iterator _aPosition );
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/commontypes.hxx b/dbaccess/source/ui/inc/commontypes.hxx
new file mode 100644
index 0000000000..50c5670104
--- /dev/null
+++ b/dbaccess/source/ui/inc/commontypes.hxx
@@ -0,0 +1,39 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <unotools/sharedunocomponent.hxx>
+
+namespace com::sun::star {
+ namespace sdbc {
+ class XConnection;
+ }
+}
+
+namespace dbaui
+{
+
+ typedef ::utl::SharedUNOComponent< css::sdbc::XConnection > SharedConnection;
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/curledit.hxx b/dbaccess/source/ui/inc/curledit.hxx
new file mode 100644
index 0000000000..6042f761ce
--- /dev/null
+++ b/dbaccess/source/ui/inc/curledit.hxx
@@ -0,0 +1,102 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+#include <dsntypes.hxx>
+
+namespace dbaui
+{
+
+class OConnectionURLEdit
+{
+ OUString m_sSavedValue;
+
+ ::dbaccess::ODsnTypeCollection* m_pTypeCollection;
+ OUString m_sSaveValueNoPrefix;
+ bool m_bShowPrefix; // when <TRUE> the prefix will be visible, otherwise not
+
+ std::unique_ptr<weld::Entry> m_xEntry;
+ std::unique_ptr<weld::Label> m_xForcedPrefix;
+
+public:
+ OConnectionURLEdit(std::unique_ptr<weld::Entry> xEntry, std::unique_ptr<weld::Label> xForcedPrefix);
+ ~OConnectionURLEdit();
+
+public:
+ bool get_visible() const { return m_xEntry->get_visible(); }
+ void connect_changed(const Link<weld::Entry&, void>& rLink) { m_xEntry->connect_changed(rLink); }
+ void set_help_id(const OUString& rName) { m_xEntry->set_help_id(rName); }
+ void hide()
+ {
+ m_xEntry->hide();
+ if (m_bShowPrefix)
+ m_xForcedPrefix->hide();
+ }
+ void show()
+ {
+ m_xEntry->show();
+ if (m_bShowPrefix)
+ m_xForcedPrefix->show();
+ }
+ void save_value() { m_sSavedValue = GetText(); }
+ bool get_value_changed_from_saved() const { return m_sSavedValue != GetText(); }
+ void grab_focus()
+ {
+ m_xEntry->grab_focus();
+ }
+ void set_sensitive(bool bSensitive)
+ {
+ m_xEntry->set_sensitive(bSensitive);
+ if (m_bShowPrefix)
+ m_xForcedPrefix->set_sensitive(bSensitive);
+ }
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink)
+ {
+ m_xEntry->connect_focus_in(rLink);
+ }
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink)
+ {
+ m_xEntry->connect_focus_out(rLink);
+ }
+
+ // Edit overridables
+ void SetText(const OUString& _rStr);
+ void SetText(const OUString& _rStr, const Selection& _rNewSelection);
+ OUString GetText() const;
+
+ /** Shows the Prefix
+ @param _bShowPrefix
+ If <TRUE/> than the prefix will be visible, otherwise not.
+ */
+ void ShowPrefix(bool _bShowPrefix);
+ /// get the currently set text, excluding the prefix indicating the type
+ OUString GetTextNoPrefix() const;
+ /// set a new text, leave the current prefix unchanged
+ void SetTextNoPrefix(const OUString& _rText);
+
+ void SaveValueNoPrefix() { m_sSaveValueNoPrefix = GetTextNoPrefix(); }
+ const OUString& GetSavedValueNoPrefix() const { return m_sSaveValueNoPrefix; }
+ void SetTypeCollection(::dbaccess::ODsnTypeCollection* _pTypeCollection) { m_pTypeCollection = _pTypeCollection; }
+};
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/databaseobjectview.hxx b/dbaccess/source/ui/inc/databaseobjectview.hxx
new file mode 100644
index 0000000000..46df991816
--- /dev/null
+++ b/dbaccess/source/ui/inc/databaseobjectview.hxx
@@ -0,0 +1,230 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/namedvaluecollection.hxx>
+
+namespace dbaui
+{
+ /** encapsulates access to the view of a database object.
+
+ @todo
+ this is to be merged with the OLinkedDocumentAccess class
+ */
+ class DatabaseObjectView
+ {
+ private:
+ css::uno::Reference< css::uno::XComponentContext >
+ m_xORB;
+ css::uno::Reference< css::frame::XFrame >
+ m_xParentFrame;
+ css::uno::Reference< css::frame::XComponentLoader >
+ m_xFrameLoader;
+ css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >
+ m_xApplication;
+ OUString m_sComponentURL;
+
+ private:
+ css::uno::Reference< css::lang::XComponent >
+ doDispatch(
+ const ::comphelper::NamedValueCollection& i_rDispatchArgs
+ );
+
+ protected:
+ /** creates the desired view
+
+ The default implementation will call <member>fillDispatchArgs</member>, followed
+ by <member>doDispatch</member>.
+
+ @param _rDataSource
+ the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
+ @param _rObjectName
+ the name of the object for which the view is to be opened,
+ or an empty string if a view for a new object should be created.
+ @param _rCreationArgs
+ the arguments for the view's creation
+ */
+ virtual css::uno::Reference< css::lang::XComponent > doCreateView(
+ const css::uno::Any& _rDataSource,
+ const OUString& _rObjectName,
+ const ::comphelper::NamedValueCollection& i_rCreationArgs
+ );
+
+ virtual void fillDispatchArgs(
+ ::comphelper::NamedValueCollection& i_rDispatchArgs,
+ const css::uno::Any& _rDataSource,
+ const OUString& _rObjectName
+ );
+
+ const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >&
+ getApplicationUI() const { return m_xApplication; }
+ css::uno::Reference< css::sdbc::XConnection >
+ getConnection() const;
+
+ public:
+ DatabaseObjectView(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
+ const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
+ const css::uno::Reference< css::frame::XFrame >& _rxParentFrame,
+ OUString _sComponentURL
+ );
+ virtual ~DatabaseObjectView(){}
+
+ /** sets the target frame into which the view should be loaded.
+
+ By default, the view is loaded into a top-level frame not being part of the
+ Desktop.
+ */
+ void setTargetFrame( const css::uno::Reference< css::frame::XFrame >& _rxFrame )
+ {
+ m_xFrameLoader.set( _rxFrame, css::uno::UNO_QUERY );
+ }
+
+ /** opens a view for a to-be-created object
+
+ @param _xDataSource
+ the data source for which a new object is to be created
+ @return
+ the controller of the newly created document
+ */
+ css::uno::Reference< css::lang::XComponent >
+ createNew(
+ const css::uno::Reference< css::sdbc::XDataSource >& _xDataSource,
+ const ::comphelper::NamedValueCollection& i_rDispatchArgs = ::comphelper::NamedValueCollection()
+ );
+
+ /** opens a view for an existent object
+
+ @param _xDataSource
+ the data source for which a new object is to be created
+ @param _rObjectName
+ the name of the object to be edited
+ @param _rArgs
+ Additional settings which should be forwarded to the frame
+ @return
+ the frame into which the view has been loaded
+ */
+ css::uno::Reference< css::lang::XComponent >
+ openExisting(
+ const css::uno::Any& _aDataSource,
+ const OUString& _rName,
+ const ::comphelper::NamedValueCollection& i_rDispatchArgs
+ );
+ };
+
+ // QueryDesigner
+ class QueryDesigner final : public DatabaseObjectView
+ {
+ sal_Int32 m_nCommandType;
+
+ virtual void fillDispatchArgs(
+ ::comphelper::NamedValueCollection& i_rDispatchArgs,
+ const css::uno::Any& _aDataSource,
+ const OUString& _rObjectName
+ ) override;
+
+ public:
+ QueryDesigner(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
+ const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
+ const css::uno::Reference< css::frame::XFrame >& _rxParentFrame,
+ bool _bCreateView
+ );
+ };
+
+ // TableDesigner
+ class TableDesigner : public DatabaseObjectView
+ {
+ protected:
+ virtual void fillDispatchArgs(
+ ::comphelper::NamedValueCollection& i_rDispatchArgs,
+ const css::uno::Any& _aDataSource,
+ const OUString& _rObjectName
+ ) override;
+
+ virtual css::uno::Reference< css::lang::XComponent > doCreateView(
+ const css::uno::Any& _rDataSource,
+ const OUString& _rObjectName,
+ const ::comphelper::NamedValueCollection& i_rCreationArgs
+ ) override;
+
+ public:
+ TableDesigner(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
+ const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
+ const css::uno::Reference< css::frame::XFrame >& _rxParentFrame
+ );
+
+ private:
+ /** retrieves the table designer component as provided by the connection, if any
+ @param _rTableName
+ the name of the table for which a designer is to be obtained
+ @return
+ the designer component, as provided by the connection, or <NULL/>, if the connection
+ does not provide a specialized designer.
+ @see css::sdb::application::XTableUIProvider
+ */
+ css::uno::Reference< css::uno::XInterface >
+ impl_getConnectionProvidedDesigner_nothrow( const OUString& _rTableName );
+ };
+
+ // ResultSetBrowser
+ class ResultSetBrowser : public DatabaseObjectView
+ {
+ private:
+ bool m_bTable;
+
+ protected:
+ virtual void fillDispatchArgs(
+ ::comphelper::NamedValueCollection& i_rDispatchArgs,
+ const css::uno::Any& _aDataSource,
+ const OUString& _rQualifiedName
+ ) override;
+
+ public:
+ ResultSetBrowser(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
+ const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
+ const css::uno::Reference< css::frame::XFrame >& _rxParentFrame,
+ bool _bTable
+ );
+
+ };
+ // RelationDesigner
+ class RelationDesigner : public DatabaseObjectView
+ {
+ public:
+ RelationDesigner(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
+ const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& _rxApplication,
+ const css::uno::Reference< css::frame::XFrame >& _rxParentFrame
+ );
+ };
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/datasourceconnector.hxx b/dbaccess/source/ui/inc/datasourceconnector.hxx
new file mode 100644
index 0000000000..56f7bf2f06
--- /dev/null
+++ b/dbaccess/source/ui/inc/datasourceconnector.hxx
@@ -0,0 +1,76 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+
+namespace dbtools
+{
+ class SQLExceptionInfo;
+}
+
+namespace weld { class Window; }
+namespace dbaui
+{
+
+ // ODatasourceConnector
+ class ODatasourceConnector final
+ {
+ weld::Window* m_pErrorMessageParent;
+ css::uno::Reference< css::uno::XComponentContext >
+ m_xContext;
+ OUString m_sContextInformation;
+
+ public:
+ ODatasourceConnector(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ weld::Window* _pMessageParent
+ );
+ ODatasourceConnector(
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ weld::Window* _pMessageParent,
+ OUString _sContextInformation
+ );
+
+ /// returns <TRUE/> if the object is able to create data source connections
+ bool isValid() const { return m_xContext.is(); }
+
+ /** creates a connection to the data source, displays the possible error to the user, or returns it
+ */
+ css::uno::Reference< css::sdbc::XConnection >
+ connect(
+ const OUString& _rDataSourceName,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo
+ ) const;
+
+ /** creates a connection to the data source, displays the possible error to the user, or returns it
+ */
+ css::uno::Reference< css::sdbc::XConnection >
+ connect(
+ const css::uno::Reference< css::sdbc::XDataSource>& _xDataSource,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo
+ ) const;
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx
new file mode 100644
index 0000000000..53222a6afc
--- /dev/null
+++ b/dbaccess/source/ui/inc/dbadmin.hxx
@@ -0,0 +1,114 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sfx2/tabdlg.hxx>
+#include <dsntypes.hxx>
+#include "IItemSetHelper.hxx"
+#include <unotools/resmgr.hxx>
+#include <memory>
+
+namespace com::sun::star {
+ namespace beans {
+ class XPropertySet;
+ }
+ namespace sdbc {
+ class XConnection;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}
+
+namespace dbaui
+{
+
+// ODbAdminDialog
+class ODbDataSourceAdministrationHelper;
+/** tab dialog for administrating the office wide registered data sources
+*/
+class ODbAdminDialog final : public SfxTabDialogController, public IItemSetHelper, public IDatabaseSettingsDialog
+{
+private:
+ std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
+
+ OUString m_sMainPageID;
+
+public:
+ /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
+ after the dialog has been destroyed
+ */
+ ODbAdminDialog(weld::Window* pParent, SfxItemSet const * _pItems,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+ virtual ~ODbAdminDialog() override;
+
+ /** create and return an item set for use with the dialog.
+ @param _pTypeCollection pointer to an <type>ODatasourceMap</type>. May be NULL, in this case
+ the pool will not contain a typecollection default.
+ */
+ static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection);
+ /** destroy and item set / item pool / pool defaults previously created by <method>createItemSet</method>
+ */
+ static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults);
+
+ /** selects the DataSource
+ @param _rName
+ The name of the data source
+ */
+ void selectDataSource(const css::uno::Any& _aDataSourceName);
+
+ virtual const SfxItemSet* getOutputSet() const override;
+ virtual SfxItemSet* getWriteOutputSet() override;
+
+ // forwards to ODbDataSourceAdministrationHelper
+ virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override;
+ virtual std::pair< css::uno::Reference< css::sdbc::XConnection >,bool> createConnection() override;
+ virtual css::uno::Reference< css::sdbc::XDriver > getDriver() override;
+ virtual OUString getDatasourceType(const SfxItemSet& _rSet) const override;
+ virtual void clearPassword() override;
+ virtual void saveDatasource() override;
+ virtual void setTitle(const OUString& _sTitle) override;
+ virtual void enableConfirmSettings( bool _bEnable ) override;
+
+private:
+ // adds a new detail page and remove all the old ones
+ void addDetailPage(const OUString& rPageId, TranslateId pTextId, CreateTabPage pCreateFunc);
+
+ virtual void PageCreated(const OUString& rId, SfxTabPage& _rPage) override;
+ virtual short Ok() override;
+
+ /// select a datasource with a given name, adjust the item set accordingly, and everything like that ..
+ void impl_selectDataSource(const css::uno::Any& _aDataSourceName);
+ /// reset the tag pages according to m_sCurrentDatasource and <arg>_rxDatasource</arg>
+ void impl_resetPages(const css::uno::Reference< css::beans::XPropertySet >& _rxDatasource);
+
+ enum ApplyResult
+ {
+ AR_LEAVE_MODIFIED, // something was modified and has successfully been committed
+ AR_KEEP // don't leave the page (e.g. because an error occurred)
+ };
+ /** apply all changes made
+ */
+ ApplyResult implApplyChanges();
+};
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx
new file mode 100644
index 0000000000..7fb0c6ee0b
--- /dev/null
+++ b/dbaccess/source/ui/inc/dbexchange.hxx
@@ -0,0 +1,83 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "TokenWriter.hxx"
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <svx/dbaexchange.hxx>
+
+#include <rtl/ref.hxx>
+
+namespace com::sun::star::uno {
+ class XComponentContext;
+}
+
+namespace dbaui
+{
+
+ class ORTFImportExport;
+ class OHTMLImportExport;
+
+ class ODataClipboard : public svx::ODataAccessObjectTransferable
+
+ {
+ ::rtl::Reference< OHTMLImportExport > m_pHtml;
+ ::rtl::Reference< ORTFImportExport > m_pRtf;
+
+ public:
+ ODataClipboard();
+
+ ODataClipboard(
+ const css::uno::Reference< css::beans::XPropertySet >& i_rAliveForm,
+ const css::uno::Sequence< css::uno::Any >& i_rSelectedRows,
+ const bool i_bBookmarkSelection,
+ const css::uno::Reference< css::uno::XComponentContext >& i_rORB
+ );
+
+ void Update(
+ const OUString& _rDatasource,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxFormatter,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB
+ );
+
+ void Update(
+ const OUString& _rDatasource,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ const css::uno::Reference< css::util::XNumberFormatter >& _rxFormatter,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxORB
+ );
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ protected:
+ virtual void AddSupportedFormats() override;
+ virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
+ virtual void ObjectReleased() override;
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
+ };
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx
new file mode 100644
index 0000000000..7682841a23
--- /dev/null
+++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx
@@ -0,0 +1,164 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/transfer.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/weld.hxx>
+
+#include <memory>
+
+namespace dbaui
+{
+ class IEntryFilter
+ {
+ public:
+ virtual bool includeEntry(const void* pUserData) const = 0;
+
+ protected:
+ ~IEntryFilter() {}
+ };
+
+ class IControlActionListener;
+ class IContextMenuProvider;
+
+ class TreeListBox;
+
+ class TreeListBoxDropTarget : public DropTargetHelper
+ {
+ private:
+ TreeListBox& m_rTreeView;
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+
+ public:
+ TreeListBoxDropTarget(TreeListBox& rTreeView);
+ };
+
+ class TreeListBox
+ {
+ protected:
+ std::unique_ptr<weld::TreeView> m_xTreeView;
+ TreeListBoxDropTarget m_aDropTargetHelper;
+
+ std::unique_ptr<weld::TreeIter> m_xDragedEntry;
+ IControlActionListener* m_pActionListener;
+ IContextMenuProvider* m_pContextMenuProvider;
+
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+ DECL_LINK(SelectHdl, weld::TreeView&, void);
+ DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
+ DECL_LINK(CommandHdl, const CommandEvent&, bool);
+ DECL_LINK(DragBeginHdl, bool&, bool);
+
+ private:
+ Timer m_aTimer; // is needed for table updates
+ rtl::Reference<TransferDataContainer> m_xHelper;
+
+ Link<LinkParamNone*,void> m_aSelChangeHdl; // handler to be called (asynchronously) when the selection changes in any way
+ Link<LinkParamNone*,void> m_aCopyHandler; // called when someone press CTRL+C
+ Link<LinkParamNone*,void> m_aPasteHandler; // called when someone press CTRL+V
+ Link<LinkParamNone*,void> m_aDeleteHandler; // called when someone press DELETE Key
+
+ DECL_LINK(OnTimeOut, Timer*, void);
+
+ protected:
+ void implStopSelectionTimer();
+ void implStartSelectionTimer();
+
+ virtual bool DoChildKeyInput(const KeyEvent& rKEvt);
+
+ public:
+ TreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bSQLType);
+ virtual ~TreeListBox();
+
+ std::unique_ptr<weld::TreeIter> GetEntryPosByName(std::u16string_view rName,
+ const weld::TreeIter* pStart = nullptr,
+ const IEntryFilter* pFilter = nullptr) const;
+
+ std::unique_ptr<weld::TreeIter> GetRootLevelParent(const weld::TreeIter* pEntry) const;
+
+ void setControlActionListener(IControlActionListener* pListener) { m_pActionListener = pListener; }
+ void setContextMenuProvider(IContextMenuProvider* pContextMenuProvider) { m_pContextMenuProvider = pContextMenuProvider; }
+
+ weld::TreeView& GetWidget() { return *m_xTreeView; }
+ const weld::TreeView& GetWidget() const { return *m_xTreeView; }
+
+ TransferDataContainer& GetDataTransfer() { return *m_xHelper; }
+
+ sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt);
+ sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt);
+
+ void SetSelChangeHdl( const Link<LinkParamNone*,void>& _rHdl ) { m_aSelChangeHdl = _rHdl; }
+ void setCopyHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aCopyHandler = _rHdl; }
+ void setPasteHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aPasteHandler = _rHdl; }
+ void setDeleteHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aDeleteHandler = _rHdl; }
+ };
+
+ class InterimDBTreeListBox : public InterimItemWindow
+ , public TreeListBox
+ {
+ private:
+ std::unique_ptr<weld::Label> m_xStatusBar;
+ public:
+ InterimDBTreeListBox(vcl::Window* pParent);
+ virtual void dispose() override;
+ weld::Label& GetStatusBar() { return *m_xStatusBar; }
+ virtual ~InterimDBTreeListBox() override;
+ void show_container() { m_xContainer->show(); }
+ protected:
+ virtual bool DoChildKeyInput(const KeyEvent& rKEvt) override;
+ };
+
+ class DBTreeViewBase
+ {
+ protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<TreeListBox> m_xTreeListBox;
+ public:
+ DBTreeViewBase(weld::Container* pContainer);
+ virtual ~DBTreeViewBase();
+
+ weld::TreeView& GetWidget() { return m_xTreeListBox->GetWidget(); }
+ const weld::TreeView& GetWidget() const { return m_xTreeListBox->GetWidget(); }
+
+ TreeListBox& getListBox() const { return *m_xTreeListBox; }
+
+ void hide() { m_xContainer->hide(); }
+ void show() { m_xContainer->show(); }
+ bool get_visible() const { return m_xContainer->get_visible(); }
+ };
+
+ class DBTreeView final : public DBTreeViewBase
+ {
+ public:
+ DBTreeView(weld::Container* pContainer, bool bSQLType);
+ };
+
+ class DBTableTreeView final : public DBTreeViewBase
+ {
+ public:
+ DBTableTreeView(weld::Container* pContainer);
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbu_dlg.hxx b/dbaccess/source/ui/inc/dbu_dlg.hxx
new file mode 100644
index 0000000000..ed97c4c937
--- /dev/null
+++ b/dbaccess/source/ui/inc/dbu_dlg.hxx
@@ -0,0 +1,24 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#define WIZARD_PAGE_X 56
+#define WIZARD_PAGE_Y 30
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx
new file mode 100644
index 0000000000..744c308a68
--- /dev/null
+++ b/dbaccess/source/ui/inc/dbwiz.hxx
@@ -0,0 +1,100 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <dsntypes.hxx>
+#include "IItemSetHelper.hxx"
+#include <vcl/wizardmachine.hxx>
+#include <memory>
+
+namespace com::sun::star {
+ namespace beans {
+ class XPropertySet;
+ }
+ namespace sdbc {
+ class XConnection;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}
+
+using vcl::WizardTypes::WizardState;
+
+namespace dbaccess
+{
+ class ODsnTypeCollection;
+}
+namespace dbaui
+{
+
+// ODbTypeWizDialog
+class OGeneralPage;
+class ODbDataSourceAdministrationHelper;
+/** tab dialog for administrating the office wide registered data sources
+*/
+class ODbTypeWizDialog : public vcl::WizardMachine , public IItemSetHelper, public IDatabaseSettingsDialog
+{
+private:
+ std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
+ std::unique_ptr<SfxItemSet> m_pOutSet;
+ ::dbaccess::ODsnTypeCollection*
+ m_pCollection; /// the DSN type collection instance
+ OUString m_eType;
+
+public:
+ /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
+ after the dialog has been destroyed
+ */
+ ODbTypeWizDialog(weld::Window* pParent
+ ,SfxItemSet const * _pItems
+ ,const css::uno::Reference< css::uno::XComponentContext >& _rxORB
+ ,const css::uno::Any& _aDataSourceName
+ );
+ virtual ~ODbTypeWizDialog() override;
+
+ virtual const SfxItemSet* getOutputSet() const override;
+ virtual SfxItemSet* getWriteOutputSet() override;
+
+ // forwards to ODbDataSourceAdministrationHelper
+ virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override;
+ virtual std::pair< css::uno::Reference< css::sdbc::XConnection >,bool> createConnection() override;
+ virtual css::uno::Reference< css::sdbc::XDriver > getDriver() override;
+ virtual OUString getDatasourceType(const SfxItemSet& _rSet) const override;
+ virtual void clearPassword() override;
+ virtual void saveDatasource() override;
+ virtual void setTitle(const OUString& _sTitle) override;
+ virtual void enableConfirmSettings( bool _bEnable ) override;
+
+protected:
+ /// to override to create new pages
+ virtual std::unique_ptr<BuilderPage> createPage(WizardState _nState) override;
+ virtual WizardState determineNextState(WizardState _nCurrentState) const override;
+ virtual bool leaveState(WizardState _nState) override;
+ virtual ::vcl::IWizardPageController* getPageController(BuilderPage* pCurrentPage) const override;
+ virtual bool onFinish() override;
+
+private:
+ DECL_LINK(OnTypeSelected, OGeneralPage&, void);
+};
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
new file mode 100644
index 0000000000..50f463fac4
--- /dev/null
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -0,0 +1,170 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <dsntypes.hxx>
+#include "IItemSetHelper.hxx"
+#include <tools/urlobj.hxx>
+#include <memory>
+#include <vcl/roadmapwizard.hxx>
+
+namespace com::sun::star {
+ namespace beans {
+ class XPropertySet;
+ }
+ namespace sdbc {
+ class XConnection;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}
+
+using vcl::WizardTypes::WizardState;
+using vcl::RoadmapWizardTypes::PathId;
+
+namespace dbaui
+{
+
+class OGenericAdministrationPage;
+
+// ODbTypeWizDialogSetup
+class OGeneralPage;
+class OGeneralPageWizard;
+class ODbDataSourceAdministrationHelper;
+/** tab dialog for administrating the office wide registered data sources
+*/
+class OMySQLIntroPageSetup;
+class OFinalDBPageSetup;
+
+class ODbTypeWizDialogSetup final : public vcl::RoadmapWizardMachine, public IItemSetHelper, public IDatabaseSettingsDialog
+{
+private:
+ std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
+ std::unique_ptr<SfxItemSet> m_pOutSet;
+ OUString m_sURL;
+ OUString m_sOldURL;
+ bool m_bIsConnectable : 1;
+ OUString m_sRM_IntroText;
+ OUString m_sRM_dBaseText;
+ OUString m_sRM_TextText;
+ OUString m_sRM_MSAccessText;
+ OUString m_sRM_LDAPText;
+ OUString m_sRM_ADOText;
+ OUString m_sRM_JDBCText;
+ OUString m_sRM_MySQLNativePageTitle;
+ OUString m_sRM_OracleText;
+ OUString m_sRM_PostgresText;
+ OUString m_sRM_MySQLText;
+ OUString m_sRM_ODBCText;
+ OUString m_sRM_DocumentOrSpreadSheetText;
+ OUString m_sRM_AuthentificationText;
+ OUString m_sRM_FinalText;
+ INetURLObject m_aDocURL;
+ OUString m_sWorkPath;
+ OGeneralPageWizard* m_pGeneralPage;
+ OMySQLIntroPageSetup* m_pMySQLIntroPage;
+ OFinalDBPageSetup* m_pFinalPage;
+
+ ::dbaccess::ODsnTypeCollection*
+ m_pCollection; /// the DSN type collection instance
+
+public:
+ /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
+ after the dialog has been destroyed
+ */
+ ODbTypeWizDialogSetup(weld::Window* pParent
+ ,SfxItemSet const * _pItems
+ ,const css::uno::Reference< css::uno::XComponentContext >& _rxORB
+ ,const css::uno::Any& _aDataSourceName
+ );
+ virtual ~ODbTypeWizDialogSetup() override;
+
+ virtual const SfxItemSet* getOutputSet() const override;
+ virtual SfxItemSet* getWriteOutputSet() override;
+
+ // forwards to ODbDataSourceAdministrationHelper
+ virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override;
+ virtual std::pair< css::uno::Reference< css::sdbc::XConnection >,bool> createConnection() override;
+ virtual css::uno::Reference< css::sdbc::XDriver > getDriver() override;
+ virtual OUString getDatasourceType(const SfxItemSet& _rSet) const override;
+ virtual void clearPassword() override;
+ virtual void setTitle(const OUString& _sTitle) override;
+ virtual void enableConfirmSettings( bool _bEnable ) override;
+ virtual void saveDatasource() override;
+ virtual OUString getStateDisplayName( WizardState _nState ) const override;
+
+ /** returns <TRUE/> if the database should be opened, otherwise <FALSE/>.
+ */
+ bool IsDatabaseDocumentToBeOpened() const;
+
+ /** returns <TRUE/> if the table wizard should be opened, otherwise <FALSE/>.
+ */
+ bool IsTableWizardToBeStarted() const;
+
+ void SetIntroPage(OMySQLIntroPageSetup* pPage);
+ void SetGeneralPage(OGeneralPageWizard* pPage);
+ void SetFinalPage(OFinalDBPageSetup* pPage);
+
+private:
+ /// to override to create new pages
+ virtual std::unique_ptr<BuilderPage> createPage(WizardState _nState) override;
+ virtual bool leaveState(WizardState _nState) override;
+ virtual void enterState(WizardState _nState) override;
+ virtual ::vcl::IWizardPageController* getPageController(BuilderPage* pCurrentPage) const override;
+ virtual bool onFinish() override;
+
+ void resetPages(const css::uno::Reference< css::beans::XPropertySet >& _rxDatasource);
+
+ /** declares a path with or without authentication, as indicated by the database type
+
+ @param _sURL
+ the data source type for which the path is declared. If this
+ data source type does not support authentication, the PAGE_DBSETUPWIZARD_AUTHENTIFICATION
+ state will be stripped from the sequence of states.
+ @param _nPathId
+ the ID of the path
+ @path
+ the first state in this path, following by an arbitrary number of others, as in
+ RoadmapWizard::declarePath.
+ */
+ void declareAuthDepPath( const OUString& _sURL, PathId _nPathId, const vcl::RoadmapWizardTypes::WizardPath& _rPaths);
+
+ void RegisterDataSourceByLocation(std::u16string_view sPath);
+ bool SaveDatabaseDocument();
+ void activateDatabasePath();
+ OUString createUniqueFileName(const INetURLObject& rURL);
+ void CreateDatabase();
+ void createUniqueFolderName(INetURLObject* pURL);
+ ::dbaccess::DATASOURCE_TYPE VerifyDataSourceType(const ::dbaccess::DATASOURCE_TYPE DatabaseType) const;
+
+ void updateTypeDependentStates();
+ bool callSaveAsDialog();
+ DECL_LINK(OnTypeSelected, OGeneralPage&, void);
+ DECL_LINK(OnChangeCreationMode, OGeneralPageWizard&, void);
+ DECL_LINK(OnRecentDocumentSelected, OGeneralPageWizard&, void);
+ DECL_LINK(OnSingleDocumentChosen, OGeneralPageWizard&, void);
+ DECL_LINK(ImplClickHdl, OMySQLIntroPageSetup*, void);
+ DECL_LINK(ImplModifiedHdl, OGenericAdministrationPage const *, void);
+};
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx b/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx
new file mode 100644
index 0000000000..c75528940e
--- /dev/null
+++ b/dbaccess/source/ui/inc/defaultobjectnamecheck.hxx
@@ -0,0 +1,121 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include "objectnamecheck.hxx"
+
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdb/tools/XConnectionTools.hpp>
+
+#include <memory>
+
+namespace dbaui
+{
+
+ // HierarchicalNameCheck
+ /** class implementing the IObjectNameCheck interface, and checking given object names
+ against a hierarchical name container
+ */
+ class HierarchicalNameCheck :public IObjectNameCheck
+ {
+ private:
+ css::uno::Reference< css::container::XHierarchicalNameAccess > mxHierarchicalNames;
+ OUString msRelativeRoot;
+
+ public:
+ /** constructs a HierarchicalNameCheck instance
+ @param _rxNames
+ the hierarchical container of named objects, against which given names should be
+ checked
+ @param _rRelativeRoot
+ the root in the hierarchy against which given names should be checked
+ @throws css::lang::IllegalArgumentException
+ if the given container is <NULL/>
+ */
+ HierarchicalNameCheck(
+ const css::uno::Reference< css::container::XHierarchicalNameAccess >& _rxNames,
+ const OUString& _rRelativeRoot
+ );
+
+ virtual ~HierarchicalNameCheck() override;
+
+ HierarchicalNameCheck(const HierarchicalNameCheck&) = delete;
+ const HierarchicalNameCheck& operator=(const HierarchicalNameCheck&) = delete;
+
+ // IObjectNameCheck overridables
+ virtual bool isNameValid(
+ const OUString& _rObjectName,
+ ::dbtools::SQLExceptionInfo& _out_rErrorToDisplay
+ ) const override;
+ };
+
+ // DynamicTableOrQueryNameCheck
+ /** class implementing the IObjectNameCheck interface, and checking a given name
+ for being valid as either a query or a table name.
+
+ The class can be parametrized to act as either table name or query name validator.
+
+ For databases which support queries in queries, the name check is implicitly extended
+ to both queries and tables, no matter which category is checked. This prevents, for
+ such databases, that users can create a query with the name of an existing table,
+ or vice versa.
+
+ @seealso dbtools::DatabaseMetaData::supportsSubqueriesInFrom
+ @seealso css::sdb::tools::XObjectNames::checkNameForCreate
+ */
+ class DynamicTableOrQueryNameCheck :public IObjectNameCheck
+ {
+ private:
+ sal_Int32 mnCommandType;
+ css::uno::Reference< css::sdb::tools::XObjectNames > mxObjectNames;
+
+ public:
+ /** constructs a DynamicTableOrQueryNameCheck instance
+ @param _rxSdbLevelConnection
+ a connection supporting the css.sdb.Connection service, in other word, it
+ does expose the XTablesSupplier and XQueriesSupplier interfaces.
+ @param _nCommandType
+ specifies whether table names or query names should be checked. Only valid values
+ are CommandType::TABLE and CommandType::QUERY.
+ @throws css::lang::IllegalArgumentException
+ if the given connection is <NULL/>, or the given command type is neither
+ CommandType::TABLE nor CommandType::QUERY.
+ */
+ DynamicTableOrQueryNameCheck(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxSdbLevelConnection,
+ sal_Int32 _nCommandType
+ );
+
+ virtual ~DynamicTableOrQueryNameCheck() override;
+
+ DynamicTableOrQueryNameCheck(const DynamicTableOrQueryNameCheck&) = delete;
+ const DynamicTableOrQueryNameCheck& operator=(const DynamicTableOrQueryNameCheck&) = delete;
+
+ // IObjectNameCheck overridables
+ virtual bool isNameValid(
+ const OUString& _rObjectName,
+ ::dbtools::SQLExceptionInfo& _out_rErrorToDisplay
+ ) const override;
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx
new file mode 100644
index 0000000000..bfe8195fc5
--- /dev/null
+++ b/dbaccess/source/ui/inc/directsql.hxx
@@ -0,0 +1,113 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <vcl/weld.hxx>
+#include <deque>
+#include <string_view>
+
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <unotools/eventlisteneradapter.hxx>
+#include <osl/mutex.hxx>
+
+#include "sqledit.hxx"
+
+struct ImplSVEvent;
+
+namespace dbaui
+{
+ // DirectSQLDialog
+ class DirectSQLDialog final
+ : public weld::GenericDialogController
+ , public ::utl::OEventListenerAdapter
+ {
+ ::osl::Mutex m_aMutex;
+
+ std::unique_ptr<weld::Button> m_xExecute;
+ std::unique_ptr<weld::ComboBox> m_xSQLHistory;
+ std::unique_ptr<weld::TextView> m_xStatus;
+ std::unique_ptr<weld::CheckButton> m_xDirectSQL;
+ std::unique_ptr<weld::CheckButton> m_xShowOutput;
+ std::unique_ptr<weld::TextView> m_xOutput;
+ std::unique_ptr<weld::Button> m_xClose;
+ std::unique_ptr<SQLEditView> m_xSQL;
+ std::unique_ptr<weld::CustomWeld> m_xSQLEd;
+
+ typedef std::deque< OUString > StringQueue;
+ StringQueue m_aStatementHistory; // previous statements
+ StringQueue m_aNormalizedHistory; // previous statements, normalized to be used in the list box
+
+ sal_Int32 m_nStatusCount;
+
+ css::uno::Reference< css::sdbc::XConnection >
+ m_xConnection;
+
+ ImplSVEvent* m_pClosingEvent;
+
+ public:
+ DirectSQLDialog(
+ weld::Window* _pParent,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConn);
+ virtual ~DirectSQLDialog() override;
+
+ /// number of history entries
+ sal_Int32 getHistorySize() const;
+
+ private:
+ void executeCurrent();
+ void switchToHistory(sal_Int32 _nHistoryPos);
+
+ // OEventListenerAdapter
+ virtual void _disposing( const css::lang::EventObject& _rSource ) override;
+
+ DECL_LINK( OnExecute, weld::Button&, void );
+ DECL_LINK( OnClose, void*, void );
+ DECL_LINK( OnCloseClick, weld::Button&, void );
+ DECL_LINK( OnListEntrySelected, weld::ComboBox&, void );
+ DECL_LINK( OnStatementModified, LinkParamNone*, void );
+
+ /// adds a statement to the statement history
+ void implAddToStatementHistory(const OUString& _rStatement);
+
+ /// ensures that our history has at most m_nHistoryLimit entries
+ void implEnsureHistoryLimit();
+
+ /// executes the statement given, adds the status to the status list
+ void implExecuteStatement(const OUString& _rStatement);
+
+ /// adds a status text to the status list
+ void addStatusText(std::u16string_view _rMessage);
+
+ /// adds a status text to the output list
+ void addOutputText(std::u16string_view _rMessage);
+
+ /// displays resultset
+ void display(const css::uno::Reference< css::sdbc::XResultSet >& xRS);
+
+#ifdef DBG_UTIL
+ const char* impl_CheckInvariants() const;
+#endif
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dlgattr.hxx b/dbaccess/source/ui/inc/dlgattr.hxx
new file mode 100644
index 0000000000..83fe0466e4
--- /dev/null
+++ b/dbaccess/source/ui/inc/dlgattr.hxx
@@ -0,0 +1,41 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <sfx2/tabdlg.hxx>
+
+class SvxNumberInfoItem;
+class SfxItemSet;
+class SvNumberFormatter;
+namespace dbaui
+{
+
+ class SbaSbAttrDlg : public SfxTabDialogController
+ {
+ std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem;
+
+ public:
+ SbaSbAttrDlg(weld::Widget* pParent, const SfxItemSet*, SvNumberFormatter*, bool bHasFormat);
+ virtual ~SbaSbAttrDlg() override;
+
+ virtual void PageCreated(const OUString& rPageId, SfxTabPage& rTabPage) override;
+ };
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dlgsave.hxx b/dbaccess/source/ui/inc/dlgsave.hxx
new file mode 100644
index 0000000000..f3b33a2785
--- /dev/null
+++ b/dbaccess/source/ui/inc/dlgsave.hxx
@@ -0,0 +1,100 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include "SqlNameEdit.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <o3tl/typed_flags_set.hxx>
+#include <vcl/weld.hxx>
+#include <memory>
+
+namespace com::sun::star {
+ namespace sdbc {
+ class XConnection;
+ }
+}
+
+enum class SADFlags {
+ NONE = 0x0000,
+ AdditionalDescription = 0x0001,
+ TitlePasteAs = 0x0100,
+ TitleRename = 0x0200,
+};
+namespace o3tl {
+ template<> struct typed_flags<SADFlags> : is_typed_flags<SADFlags, 0x0301> {};
+}
+
+namespace dbaui
+{
+ class IObjectNameCheck;
+ class OSaveAsDlg : public weld::GenericDialogController
+ {
+ private:
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ OUString m_aName;
+ const IObjectNameCheck& m_rObjectNameCheck;
+ css::uno::Reference< css::sdbc::XDatabaseMetaData> m_xMetaData;
+ sal_Int32 m_nType;
+ SADFlags m_nFlags;
+
+ OSQLNameChecker m_aChecker;
+
+ std::unique_ptr<weld::Label> m_xDescription;
+ std::unique_ptr<weld::Label> m_xCatalogLbl;
+ std::unique_ptr<weld::ComboBox> m_xCatalog;
+ std::unique_ptr<weld::Label> m_xSchemaLbl;
+ std::unique_ptr<weld::ComboBox> m_xSchema;
+ std::unique_ptr<weld::Label> m_xLabel;
+ std::unique_ptr<weld::Entry> m_xTitle;
+ std::unique_ptr<weld::Button> m_xPB_OK;
+
+ DECL_LINK(TextFilterHdl, OUString&, bool);
+
+ public:
+ OSaveAsDlg( weld::Window * pParent, sal_Int32 _rType,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
+ const OUString& rDefault,
+ const IObjectNameCheck& _rObjectNameCheck,
+ SADFlags _nFlags);
+
+ OSaveAsDlg( weld::Window* _pParent,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const OUString& _rDefault,
+ const OUString& _sLabel,
+ const IObjectNameCheck& _rObjectNameCheck,
+ SADFlags _nFlags);
+ virtual ~OSaveAsDlg() override;
+
+ const OUString& getName() const;
+ OUString getCatalog() const;
+ OUString getSchema() const;
+ private:
+ DECL_LINK(ButtonClickHdl, weld::Button&, void);
+ DECL_LINK(EditModifyHdl, weld::Entry&, void);
+
+ void implInitOnlyTitle(const OUString& _rLabel);
+ void implInit();
+ };
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dlgsize.hxx b/dbaccess/source/ui/inc/dlgsize.hxx
new file mode 100644
index 0000000000..5a673d7122
--- /dev/null
+++ b/dbaccess/source/ui/inc/dlgsize.hxx
@@ -0,0 +1,44 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/weld.hxx>
+
+namespace dbaui
+{
+
+ class DlgSize final : public weld::GenericDialogController
+ {
+ private:
+ sal_Int32 m_nPrevValue;
+ void SetValue( sal_Int32 nVal );
+
+ DECL_LINK(CbClickHdl, weld::Toggleable&, void);
+
+ std::unique_ptr<weld::MetricSpinButton> m_xMF_VALUE;
+ std::unique_ptr<weld::CheckButton> m_xCB_STANDARD;
+
+ public:
+ DlgSize(weld::Window * pParent, sal_Int32 nVal, bool bRow, sal_Int32 _nAlternativeStandard = -1);
+ virtual ~DlgSize() override;
+ sal_Int32 GetValue() const;
+ };
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dsitems.hxx b/dbaccess/source/ui/inc/dsitems.hxx
new file mode 100644
index 0000000000..9d2d354432
--- /dev/null
+++ b/dbaccess/source/ui/inc/dsitems.hxx
@@ -0,0 +1,102 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <svl/typedwhich.hxx>
+
+class OptionalBoolItem;
+class SfxBoolItem;
+class SfxInt32Item;
+class SfxStringItem;
+
+typedef sal_Int32 ItemID;
+
+// item ids for the data source administration dialog
+
+#define DSID_NAME TypedWhichId<SfxStringItem>(1) // name of a data source, SfxStringItem
+#define DSID_ORIGINALNAME TypedWhichId<SfxStringItem>(2) // original name, internal, SfxStringItem
+#define DSID_CONNECTURL TypedWhichId<SfxStringItem>(3) // connection URL, SfxStringItem
+#define DSID_TABLEFILTER 4 // table filter, OStringListItem
+#define DSID_TYPECOLLECTION 5 // collection of data source types, ODsnTypeCollection
+#define DSID_INVALID_SELECTION TypedWhichId<SfxBoolItem>(6) // is the selection (thus the set data) invalid?, SfxBoolItem
+#define DSID_READONLY TypedWhichId<SfxBoolItem>(7) // is the selection (thus the set data) readonly?, SfxBoolItem
+#define DSID_USER TypedWhichId<SfxStringItem>(8) // the user name used for logon, SfxStringItem
+#define DSID_PASSWORD TypedWhichId<SfxStringItem>(9) // the password used for logon, SfxStringItem
+#define DSID_ADDITIONALOPTIONS TypedWhichId<SfxStringItem>(10) // additional options used for connecting, SfxStringItem
+#define DSID_CHARSET TypedWhichId<SfxStringItem>(11) // character set to use, SfxStringItem by now
+#define DSID_PASSWORDREQUIRED TypedWhichId<SfxBoolItem>(12) // is the password required to connect?, SfxBoolItem
+#define DSID_SHOWDELETEDROWS TypedWhichId<SfxBoolItem>(13) // show deleted rows?, SfxBoolItem
+#define DSID_ALLOWLONGTABLENAMES TypedWhichId<SfxBoolItem>(14) // allow tables names longer than 8.3?, SfxBoolItem
+#define DSID_JDBCDRIVERCLASS TypedWhichId<SfxStringItem>(15) // JDBC driver class, SfxStringItem
+#define DSID_FIELDDELIMITER TypedWhichId<SfxStringItem>(16) // field delimiter, SfxUInt16Item
+#define DSID_TEXTDELIMITER TypedWhichId<SfxStringItem>(17) // text delimiter, SfxUInt16Item
+#define DSID_DECIMALDELIMITER TypedWhichId<SfxStringItem>(18) // decimal delimiter, SfxUInt16Item
+#define DSID_THOUSANDSDELIMITER TypedWhichId<SfxStringItem>(19) // thousands delimiter, SfxUInt16Item
+#define DSID_TEXTFILEEXTENSION TypedWhichId<SfxStringItem>(20) // extension for text files, SfxStringItem
+#define DSID_TEXTFILEHEADER TypedWhichId<SfxBoolItem>(21) // the text file contains a header?, SfxBoolItem
+#define DSID_PARAMETERNAMESUBST TypedWhichId<SfxBoolItem>(22)
+#define DSID_CONN_PORTNUMBER TypedWhichId<SfxInt32Item>(23)
+#define DSID_SUPPRESSVERSIONCL TypedWhichId<SfxBoolItem>(24) // meta data: sal_True if the data source described by the set is to-be-deleted
+#define DSID_CONN_SHUTSERVICE TypedWhichId<SfxBoolItem>(25)
+#define DSID_CONN_DATAINC TypedWhichId<SfxInt32Item>(26)
+#define DSID_CONN_CACHESIZE TypedWhichId<SfxInt32Item>(27)
+#define DSID_CONN_CTRLUSER TypedWhichId<SfxStringItem>(28)
+#define DSID_CONN_CTRLPWD TypedWhichId<SfxStringItem>(29)
+#define DSID_USECATALOG TypedWhichId<SfxBoolItem>(30) // should the driver use the catalog name when the database is filebased
+#define DSID_CONN_HOSTNAME TypedWhichId<SfxStringItem>(31)
+#define DSID_CONN_LDAP_BASEDN TypedWhichId<SfxStringItem>(32)
+#define DSID_CONN_LDAP_PORTNUMBER TypedWhichId<SfxInt32Item>(33)
+#define DSID_CONN_LDAP_ROWCOUNT TypedWhichId<SfxInt32Item>(34)
+#define DSID_SQL92CHECK TypedWhichId<SfxBoolItem>(35)
+#define DSID_AUTOINCREMENTVALUE TypedWhichId<SfxStringItem>(36)
+#define DSID_AUTORETRIEVEVALUE TypedWhichId<SfxStringItem>(37)
+#define DSID_AUTORETRIEVEENABLED TypedWhichId<SfxBoolItem>(38)
+#define DSID_APPEND_TABLE_ALIAS TypedWhichId<SfxBoolItem>(39)
+#define DSID_MYSQL_PORTNUMBER TypedWhichId<SfxInt32Item>(40)
+#define DSID_IGNOREDRIVER_PRIV TypedWhichId<SfxBoolItem>(41)
+#define DSID_BOOLEANCOMPARISON TypedWhichId<SfxInt32Item>(42)
+#define DSID_ORACLE_PORTNUMBER TypedWhichId<SfxInt32Item>(43)
+#define DSID_ENABLEOUTERJOIN TypedWhichId<SfxBoolItem>(44)
+#define DSID_CATALOG TypedWhichId<SfxBoolItem>(45)
+#define DSID_SCHEMA TypedWhichId<SfxBoolItem>(46)
+#define DSID_INDEXAPPENDIX TypedWhichId<SfxBoolItem>(47)
+#define DSID_CONN_LDAP_USESSL TypedWhichId<SfxBoolItem>(48)
+#define DSID_DOCUMENT_URL TypedWhichId<SfxStringItem>(49)
+#define DSID_DOSLINEENDS TypedWhichId<SfxBoolItem>(50)
+#define DSID_DATABASENAME TypedWhichId<SfxStringItem>(51)
+#define DSID_AS_BEFORE_CORRNAME TypedWhichId<SfxBoolItem>(52)
+#define DSID_CHECK_REQUIRED_FIELDS TypedWhichId<SfxBoolItem>(53)
+#define DSID_IGNORECURRENCY TypedWhichId<SfxBoolItem>(54)
+#define DSID_CONN_SOCKET TypedWhichId<SfxStringItem>(55)
+#define DSID_ESCAPE_DATETIME TypedWhichId<SfxBoolItem>(56)
+#define DSID_NAMED_PIPE TypedWhichId<SfxStringItem>(57)
+#define DSID_PRIMARY_KEY_SUPPORT TypedWhichId<OptionalBoolItem>(58)
+#define DSID_MAX_ROW_SCAN TypedWhichId<SfxInt32Item>(59)
+#define DSID_RESPECTRESULTSETTYPE TypedWhichId<SfxBoolItem>(60)
+#define DSID_POSTGRES_PORTNUMBER TypedWhichId<SfxInt32Item>(61)
+ // don't forget to adjust DSID_LAST_ITEM_ID below!
+
+// item range. Adjust this if you introduce new items above
+
+#define DSID_FIRST_ITEM_ID DSID_NAME
+#define DSID_LAST_ITEM_ID DSID_POSTGRES_PORTNUMBER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx
new file mode 100644
index 0000000000..0c8646a53c
--- /dev/null
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -0,0 +1,124 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <set>
+
+#include "dsitems.hxx"
+
+#include <rtl/ustring.hxx>
+
+#include <memory>
+
+namespace dbaui
+{
+
+ // AuthenticationMode
+ enum AuthenticationMode
+ {
+ AuthNone,
+ AuthUserPwd,
+ AuthPwd
+ };
+
+ // DataSourceMetaData
+ class FeatureSet;
+ /** encapsulates meta data for a data source
+
+ On the long run, this class should a) encapsulate *all* meta data which
+ currently is hard coded somewhere in the program logic and b) be initialized
+ from the configuration.
+
+ At the moment, the data a) is still hard coded in the, well, code and b)
+ contains meta data about the advanced settings only.
+ */
+ class DataSourceMetaData
+ {
+ public:
+ DataSourceMetaData( const OUString& _sURL );
+ ~DataSourceMetaData();
+
+ /// returns a struct describing this data source type's support for our known advanced settings
+ const FeatureSet& getFeatureSet() const;
+
+ /// determines whether or not the data source requires authentication
+ static AuthenticationMode getAuthentication( const OUString& _sURL );
+
+ private:
+ OUString m_sURL;
+ };
+
+ // FeatureSet
+ /** can be used to ask for (UI) support for certain advanced features
+ */
+ class FeatureSet
+ {
+ public:
+ typedef std::set< ItemID >::const_iterator const_iterator;
+
+ public:
+ FeatureSet() { }
+
+ void put( const ItemID _id ) { m_aContent.insert( _id ); }
+ bool has( const ItemID _id ) const { return m_aContent.find( _id ) != m_aContent.end(); }
+
+ inline bool supportsAnySpecialSetting() const;
+ inline bool supportsGeneratedValues() const;
+
+ const_iterator begin() const { return m_aContent.begin(); }
+ const_iterator end() const { return m_aContent.end(); }
+
+ private:
+ std::set< ItemID > m_aContent;
+ };
+
+ inline bool FeatureSet::supportsGeneratedValues() const
+ {
+ return has( DSID_AUTORETRIEVEENABLED );
+ }
+
+ inline bool FeatureSet::supportsAnySpecialSetting() const
+ {
+ return has( DSID_SQL92CHECK )
+ || has( DSID_APPEND_TABLE_ALIAS )
+ || has( DSID_AS_BEFORE_CORRNAME )
+ || has( DSID_ENABLEOUTERJOIN )
+ || has( DSID_IGNOREDRIVER_PRIV )
+ || has( DSID_PARAMETERNAMESUBST )
+ || has( DSID_SUPPRESSVERSIONCL )
+ || has( DSID_CATALOG )
+ || has( DSID_SCHEMA )
+ || has( DSID_INDEXAPPENDIX )
+ || has( DSID_DOSLINEENDS )
+ || has( DSID_BOOLEANCOMPARISON )
+ || has( DSID_CHECK_REQUIRED_FIELDS )
+ || has( DSID_IGNORECURRENCY )
+ || has( DSID_ESCAPE_DATETIME )
+ || has( DSID_PRIMARY_KEY_SUPPORT )
+ || has( DSID_MAX_ROW_SCAN )
+ || has( DSID_RESPECTRESULTSETTYPE )
+ ;
+ }
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/exsrcbrw.hxx b/dbaccess/source/ui/inc/exsrcbrw.hxx
new file mode 100644
index 0000000000..0ecda1ed64
--- /dev/null
+++ b/dbaccess/source/ui/inc/exsrcbrw.hxx
@@ -0,0 +1,96 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include "brwctrlr.hxx"
+
+#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/uno3.hxx>
+
+// SbaExternalSourceBrowser
+
+namespace dbaui
+{
+ class SbaXFormAdapter;
+ class SbaExternalSourceBrowser final
+ :public SbaXDataBrowserController
+ ,public css::util::XModifyBroadcaster
+ {
+ ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> m_aModifyListeners;
+ // for multiplexing the modify events
+ rtl::Reference<SbaXFormAdapter> m_pDataSourceImpl;
+ bool m_bInQueryDispatch;
+ // our queryDispatch will ask our frame, which first will ask our queryDispatch, so we need to protect against
+ // recursion
+
+ public:
+ SbaExternalSourceBrowser(const css::uno::Reference< css::uno::XComponentContext >& _rM);
+
+ // UNO
+ DECLARE_UNO3_DEFAULTS(SbaExternalSourceBrowser, SbaXDataBrowserController)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+ // virtual css::uno::Sequence< css::uno::Reference< css::reflection::XIdlClass > > getIdlClasses();
+
+ // static css::uno::Reference< css::reflection::XIdlClass > getStaticIdlClass();
+
+ // css::frame::XDispatch
+ virtual void SAL_CALL dispatch(const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+
+ // css::frame::XDispatchProvider
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags) override;
+
+ // css::util::XModifyListener
+ virtual void SAL_CALL modified(const css::lang::EventObject& aEvent) override;
+
+ // css::util::XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > & aListener) override;
+ virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > & aListener) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL disposing() override;
+
+ // css::form::XLoadListener
+ virtual void SAL_CALL unloading(const css::lang::EventObject& aEvent) override;
+
+ // css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ private:
+ virtual ~SbaExternalSourceBrowser() override;
+
+ virtual css::uno::Reference< css::sdbc::XRowSet > CreateForm() override;
+ virtual bool InitializeForm( const css::uno::Reference< css::beans::XPropertySet >& i_formProperties ) override;
+
+ virtual bool LoadForm() override;
+
+ void Attach(const css::uno::Reference< css::sdbc::XRowSet > & xMaster);
+
+ void ClearView();
+
+ void startListening();
+ void stopListening();
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/formadapter.hxx b/dbaccess/source/ui/inc/formadapter.hxx
new file mode 100644
index 0000000000..c6d5658962
--- /dev/null
+++ b/dbaccess/source/ui/inc/formadapter.hxx
@@ -0,0 +1,436 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include "sbamultiplex.hxx"
+
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XParameters.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <com/sun/star/sdbc/XRowUpdate.hpp>
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbcx/XDeleteRows.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
+#include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp>
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/sdb/XResultSetAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include <com/sun/star/form/XSubmit.hpp>
+#include <com/sun/star/form/XDatabaseParameterBroadcaster.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/implbase12.hxx>
+#include <cppuhelper/implbase10.hxx>
+
+namespace dbaui
+{
+ // SbaXFormAdapter
+
+ typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaDataSupplier
+ , css::sdb::XResultSetAccess
+ , css::sdbc::XResultSetUpdate
+ , css::sdbc::XRowSet
+ , css::sdb::XRowSetApproveBroadcaster
+ , css::sdbcx::XRowLocate
+ , css::sdbc::XRowUpdate
+ , css::sdbc::XRow
+ , css::sdbcx::XColumnsSupplier
+ , css::sdbc::XColumnLocate
+ // --- stardiv::one::form::component::DatabaseForm ---
+ , css::sdbc::XParameters
+ , css::sdbcx::XDeleteRows
+ > SbaXFormAdapter_BASE1;
+ typedef ::cppu::ImplHelper12 < css::sdbc::XWarningsSupplier
+ , css::sdbc::XCloseable
+ , css::form::XLoadable
+ , css::sdb::XSQLErrorBroadcaster
+ , css::form::XDatabaseParameterBroadcaster
+ // --- stardiv::one::form::component::Form ---
+ , css::form::XForm
+ , css::form::XSubmit
+ , css::awt::XTabControllerModel
+ // --- stardiv::one::form::FormComponent ---
+ , css::lang::XComponent
+ , css::beans::XFastPropertySet
+ // already present : css::form::XFormComponent (base of css::form::XForm)
+ , css::beans::XMultiPropertySet
+ , css::container::XNamed
+ > SbaXFormAdapter_BASE2;
+ typedef ::cppu::ImplHelper10 < css::io::XPersistObject
+ , css::beans::XPropertySet
+ // --- stardiv::one::data::DatabaseCursor ---
+ , css::util::XCancellable
+ // already present : css::beans::XPropertySet
+ // --- stardiv::one::data::DatabaseComponent ---
+ // already present : css::lang::XComponent
+ // already present : css::container::XChild (base of css::form::XForm)
+ // interfaces I don't know the service which they belong to ;)
+ // (they are supported by FmXDatabaseForm, se we support it, too)
+ , css::beans::XPropertyState
+ , css::form::XReset
+ , css::container::XNameContainer
+ , css::container::XIndexContainer
+ , css::container::XContainer
+ , css::container::XEnumerationAccess
+ // interfaces we need because of other reasons
+ , css::beans::XPropertyChangeListener
+ > SbaXFormAdapter_BASE3;
+
+ class SbaXFormAdapter final
+ :public SbaXFormAdapter_BASE1
+ ,public SbaXFormAdapter_BASE2
+ ,public SbaXFormAdapter_BASE3
+ {
+ private:
+ css::uno::Reference< css::sdbc::XRowSet > m_xMainForm;
+ ::osl::Mutex m_aMutex;
+
+ SbaXLoadMultiplexer m_aLoadListeners;
+ SbaXRowSetMultiplexer m_aRowSetListeners;
+ SbaXRowSetApproveMultiplexer m_aRowSetApproveListeners;
+ SbaXSQLErrorMultiplexer m_aErrorListeners;
+ SbaXParameterMultiplexer m_aParameterListeners;
+ SbaXSubmitMultiplexer m_aSubmitListeners;
+ SbaXResetMultiplexer m_aResetListeners;
+
+ SbaXPropertyChangeMultiplexer m_aPropertyChangeListeners;
+ SbaXVetoableChangeMultiplexer m_aVetoablePropertyChangeListeners;
+ SbaXPropertiesChangeMultiplexer m_aPropertiesChangeListeners;
+
+ ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> m_aDisposeListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener> m_aContainerListeners;
+
+ // hierarchy administration
+ css::uno::Reference< css::uno::XInterface > m_xParent;
+ std::vector< css::uno::Reference< css::form::XFormComponent > > m_aChildren;
+ std::vector< OUString > m_aChildNames;
+
+ // properties
+ OUString m_sName;
+ sal_Int32 m_nNamePropHandle;
+
+ public:
+ const css::uno::Reference< css::sdbc::XRowSet >& getAttachedForm() const { return m_xMainForm; }
+
+ public:
+ SbaXFormAdapter();
+ virtual ~SbaXFormAdapter() override;
+
+ // css::uno::Reference< css::reflection::XIdlClass > getIdlClass();
+ // css::uno::Sequence<css::uno::Reference< css::reflection::XIdlClass > > getIdlClasses();
+
+ void AttachForm(const css::uno::Reference< css::sdbc::XRowSet >& xNewMaster);
+
+ // UNO
+ DECLARE_UNO3_DEFAULTS(SbaXFormAdapter, SbaXFormAdapter_BASE1)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ // css::sdbc::XCloseable
+ virtual void SAL_CALL close() override;
+
+ // css::sdbc::XResultSetMetaDataSupplier
+ virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override;
+
+ // css::sdbc::XColumnLocate
+ virtual sal_Int32 SAL_CALL findColumn(const OUString& columnName) override;
+
+ // css::sdbcx::XColumnsSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns() override;
+
+ // css::sdbc::XRow
+ virtual sal_Bool SAL_CALL wasNull() override;
+ virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override;
+ virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override;
+ virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override;
+ virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override;
+ virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override;
+ virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override;
+ virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override;
+ virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override;
+ virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override;
+ virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override;
+ virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override;
+ virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override;
+ virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override;
+ virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap) override;
+ virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override;
+ virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override;
+ virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override;
+ virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override;
+
+ // css::sdbcx::XRowLocate
+ virtual css::uno::Any SAL_CALL getBookmark() override;
+ virtual sal_Bool SAL_CALL moveToBookmark(const css::uno::Any& bookmark) override;
+ virtual sal_Bool SAL_CALL moveRelativeToBookmark(const css::uno::Any& bookmark, sal_Int32 rows) override;
+ virtual sal_Int32 SAL_CALL compareBookmarks(const css::uno::Any& first, const css::uno::Any& second) override;
+ virtual sal_Bool SAL_CALL hasOrderedBookmarks() override;
+ virtual sal_Int32 SAL_CALL hashBookmark(const css::uno::Any& bookmark) override;
+
+ // css::sdbc::XRowUpdate
+ virtual void SAL_CALL updateNull(sal_Int32 columnIndex) override;
+ virtual void SAL_CALL updateBoolean(sal_Int32 columnIndex, sal_Bool x) override;
+ virtual void SAL_CALL updateByte(sal_Int32 columnIndex, sal_Int8 x) override;
+ virtual void SAL_CALL updateShort(sal_Int32 columnIndex, sal_Int16 x) override;
+ virtual void SAL_CALL updateInt(sal_Int32 columnIndex, sal_Int32 x) override;
+ virtual void SAL_CALL updateLong(sal_Int32 columnIndex, sal_Int64 x) override;
+ virtual void SAL_CALL updateFloat(sal_Int32 columnIndex, float x) override;
+ virtual void SAL_CALL updateDouble(sal_Int32 columnIndex, double x) override;
+ virtual void SAL_CALL updateString(sal_Int32 columnIndex, const OUString& x) override;
+ virtual void SAL_CALL updateBytes(sal_Int32 columnIndex, const css::uno::Sequence< sal_Int8 >& x) override;
+ virtual void SAL_CALL updateDate(sal_Int32 columnIndex, const css::util::Date& x) override;
+ virtual void SAL_CALL updateTime(sal_Int32 columnIndex, const css::util::Time& x) override;
+ virtual void SAL_CALL updateTimestamp(sal_Int32 columnIndex, const css::util::DateTime& x) override;
+ virtual void SAL_CALL updateBinaryStream(sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length) override;
+ virtual void SAL_CALL updateCharacterStream(sal_Int32 columnIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length) override;
+ virtual void SAL_CALL updateObject(sal_Int32 columnIndex, const css::uno::Any& x) override;
+ virtual void SAL_CALL updateNumericObject(sal_Int32 columnIndex, const css::uno::Any& x, sal_Int32 scale) override;
+
+ // css::sdbc::XResultSet
+ virtual sal_Bool SAL_CALL next() override;
+ virtual sal_Bool SAL_CALL isBeforeFirst() override;
+ virtual sal_Bool SAL_CALL isAfterLast() override;
+ virtual sal_Bool SAL_CALL isFirst() override;
+ virtual sal_Bool SAL_CALL isLast() override;
+ virtual void SAL_CALL beforeFirst() override;
+ virtual void SAL_CALL afterLast() override;
+ virtual sal_Bool SAL_CALL first() override;
+ virtual sal_Bool SAL_CALL last() override;
+ virtual sal_Int32 SAL_CALL getRow() override;
+ virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override;
+ virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override;
+ virtual sal_Bool SAL_CALL previous() override;
+ virtual void SAL_CALL refreshRow() override;
+ virtual sal_Bool SAL_CALL rowUpdated() override;
+ virtual sal_Bool SAL_CALL rowInserted() override;
+ virtual sal_Bool SAL_CALL rowDeleted() override;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override;
+
+ // css::sdbc::XResultSetUpdate
+ virtual void SAL_CALL insertRow() override;
+ virtual void SAL_CALL updateRow() override;
+ virtual void SAL_CALL deleteRow() override;
+ virtual void SAL_CALL cancelRowUpdates() override;
+ virtual void SAL_CALL moveToInsertRow() override;
+ virtual void SAL_CALL moveToCurrentRow() override;
+
+ // css::sdbc::XRowSet
+ virtual void SAL_CALL execute() override;
+ virtual void SAL_CALL addRowSetListener(const css::uno::Reference< css::sdbc::XRowSetListener >& listener) override;
+ virtual void SAL_CALL removeRowSetListener(const css::uno::Reference< css::sdbc::XRowSetListener >& listener) override;
+
+ // css::sdbcx::XDeleteRows
+ virtual css::uno::Sequence<sal_Int32> SAL_CALL deleteRows(const css::uno::Sequence< css::uno::Any >& rows) override;
+
+ // css::sdbc::XWarningsSupplier
+ virtual css::uno::Any SAL_CALL getWarnings() override;
+ virtual void SAL_CALL clearWarnings() override;
+
+ // css::sdb::XRowSetApproveBroadcaster
+ virtual void SAL_CALL addRowSetApproveListener(const css::uno::Reference< css::sdb::XRowSetApproveListener >& listener) override;
+ virtual void SAL_CALL removeRowSetApproveListener(const css::uno::Reference< css::sdb::XRowSetApproveListener >& listener) override;
+
+ // css::sdbc::XSQLErrorBroadcaster
+ virtual void SAL_CALL addSQLErrorListener(const css::uno::Reference< css::sdb::XSQLErrorListener >& _rListener) override;
+ virtual void SAL_CALL removeSQLErrorListener(const css::uno::Reference< css::sdb::XSQLErrorListener >& _rListener) override;
+
+ // css::sdb::XResultSetAccess
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL createResultSet() override;
+
+ // css::form::XLoadable
+ virtual void SAL_CALL load() override;
+ virtual void SAL_CALL unload() override;
+ virtual void SAL_CALL reload() override;
+ virtual sal_Bool SAL_CALL isLoaded() override;
+ virtual void SAL_CALL addLoadListener(const css::uno::Reference< css::form::XLoadListener >& aListener) override;
+ virtual void SAL_CALL removeLoadListener(const css::uno::Reference< css::form::XLoadListener >& aListener) override;
+
+ // css::sdbc::XParameters
+ virtual void SAL_CALL setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) override;
+ virtual void SAL_CALL setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName) override;
+ virtual void SAL_CALL setBoolean(sal_Int32 parameterIndex, sal_Bool x) override;
+ virtual void SAL_CALL setByte(sal_Int32 parameterIndex, sal_Int8 x) override;
+ virtual void SAL_CALL setShort(sal_Int32 parameterIndex, sal_Int16 x) override;
+ virtual void SAL_CALL setInt(sal_Int32 parameterIndex, sal_Int32 x) override;
+ virtual void SAL_CALL setLong(sal_Int32 parameterIndex, sal_Int64 x) override;
+ virtual void SAL_CALL setFloat(sal_Int32 parameterIndex, float x) override;
+ virtual void SAL_CALL setDouble(sal_Int32 parameterIndex, double x) override;
+ virtual void SAL_CALL setString(sal_Int32 parameterIndex, const OUString& x) override;
+ virtual void SAL_CALL setBytes(sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x) override;
+ virtual void SAL_CALL setDate(sal_Int32 parameterIndex, const css::util::Date& x) override;
+ virtual void SAL_CALL setTime(sal_Int32 parameterIndex, const css::util::Time& x) override;
+ virtual void SAL_CALL setTimestamp(sal_Int32 parameterIndex, const css::util::DateTime& x) override;
+ virtual void SAL_CALL setBinaryStream(sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length) override;
+ virtual void SAL_CALL setCharacterStream(sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length) override;
+ virtual void SAL_CALL setObject(sal_Int32 parameterIndex, const css::uno::Any& x) override;
+ virtual void SAL_CALL setObjectWithInfo(sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale) override;
+ virtual void SAL_CALL setRef(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x) override;
+ virtual void SAL_CALL setBlob(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x) override;
+ virtual void SAL_CALL setClob(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x) override;
+ virtual void SAL_CALL setArray(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x) override;
+ virtual void SAL_CALL clearParameters() override;
+
+ // css::form::XDatabaseParameterBroadcaster
+ virtual void SAL_CALL addParameterListener(const css::uno::Reference< css::form::XDatabaseParameterListener >& aListener) override;
+ virtual void SAL_CALL removeParameterListener(const css::uno::Reference< css::form::XDatabaseParameterListener >& aListener) override;
+
+ // css::container::XChild
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override;
+ virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface >& Parent) override;
+
+ // css::form::XSubmit
+ virtual void SAL_CALL submit(const css::uno::Reference< css::awt::XControl >& aControl, const css::awt::MouseEvent& aMouseEvt) override;
+ virtual void SAL_CALL addSubmitListener(const css::uno::Reference< css::form::XSubmitListener >& aListener) override;
+ virtual void SAL_CALL removeSubmitListener(const css::uno::Reference< css::form::XSubmitListener >& aListener) override;
+
+ // css::awt::XTabControllerModel
+ virtual sal_Bool SAL_CALL getGroupControl() override;
+ virtual void SAL_CALL setGroupControl(sal_Bool GroupControl) override;
+ virtual void SAL_CALL setControlModels(const css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& Controls) override;
+ virtual css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > > SAL_CALL getControlModels() override;
+ virtual void SAL_CALL setGroup(const css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& _rGroup, const OUString& GroupName) override;
+ virtual sal_Int32 SAL_CALL getGroupCount() override;
+ virtual void SAL_CALL getGroup(sal_Int32 nGroup, css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& _rGroup, OUString& Name) override;
+ virtual void SAL_CALL getGroupByName(const OUString& Name, css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& _rGroup) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL dispose() override;
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& xListener) override;
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener) override;
+
+ // css::beans::XFastPropertySet
+ virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const css::uno::Any& aValue) override;
+ virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) override;
+
+ // css::container::XNamed
+ virtual OUString SAL_CALL getName() override;
+ virtual void SAL_CALL setName(const OUString& aName) 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;
+
+ // css::beans::XMultiPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
+ virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString >& PropertyNames, const css::uno::Sequence< css::uno::Any >& Values) override;
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(const css::uno::Sequence< OUString >& aPropertyNames) override;
+ virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener) override;
+ virtual void SAL_CALL removePropertiesChangeListener(const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener) override;
+ virtual void SAL_CALL firePropertiesChangeEvent(const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener) override;
+
+ // css::beans::XPropertySet
+ virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName, const css::uno::Any& aValue) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName) override;
+ virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
+ virtual void SAL_CALL removePropertyChangeListener(const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener) override;
+ virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener) override;
+ virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener) override;
+
+ // css::util::XCancellable
+ virtual void SAL_CALL cancel() override;
+
+ // css::beans::XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString& PropertyName) override;
+ virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString >& aPropertyName) override;
+ virtual void SAL_CALL setPropertyToDefault(const OUString& PropertyName) override;
+ virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString& aPropertyName) override;
+
+ // css::form::XReset
+ virtual void SAL_CALL reset() override;
+ virtual void SAL_CALL addResetListener(const css::uno::Reference< css::form::XResetListener >& aListener) override;
+ virtual void SAL_CALL removeResetListener(const css::uno::Reference< css::form::XResetListener >& aListener) override;
+
+ // css::container::XNameContainer
+ virtual void SAL_CALL insertByName(const OUString& aName, const css::uno::Any& aElement) override;
+ virtual void SAL_CALL removeByName(const OUString& Name) override;
+
+ // css::container::XNameReplace
+ virtual void SAL_CALL replaceByName(const OUString& aName, const css::uno::Any& aElement) override;
+
+ // css::container::XNameAccess
+ virtual css::uno::Any SAL_CALL getByName(const OUString& aName) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
+ virtual sal_Bool SAL_CALL hasByName(const OUString& aName) override;
+
+ // css::container::XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() override ;
+ virtual sal_Bool SAL_CALL hasElements() override;
+
+ // css::container::XIndexContainer
+ virtual void SAL_CALL insertByIndex(sal_Int32 _rIndex, const css::uno::Any& Element) override;
+ virtual void SAL_CALL removeByIndex(sal_Int32 _rIndex) override;
+
+ // css::container::XIndexReplace
+ virtual void SAL_CALL replaceByIndex(sal_Int32 _rIndex, const css::uno::Any& Element) override;
+
+ // css::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() override;
+ virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) override;
+
+ // css::container::XContainer
+ virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener >& xListener) override;
+ virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener >& xListener) override;
+
+ // css::container::XEnumerationAccess
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override;
+
+ // css::lang::XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ // css::beans::XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override;
+
+ private:
+ // container handling
+ /// @throws css::lang::IllegalArgumentException
+ void implInsert(const css::uno::Any& aElement, sal_Int32 nIndex, const OUString* pNewElName = nullptr);
+ sal_Int32 implGetPos(const OUString& rName);
+
+ void StopListening();
+ void StartListening();
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/imageprovider.hxx b/dbaccess/source/ui/inc/imageprovider.hxx
new file mode 100644
index 0000000000..28784e6dbf
--- /dev/null
+++ b/dbaccess/source/ui/inc/imageprovider.hxx
@@ -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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+namespace com::sun::star::sdb::application { class XTableUIProvider; }
+
+namespace dbaui
+{
+ /** provides images for database objects such as tables, queries, forms, reports ...
+
+ At the moment, this class cares for small icons only, that is, icons which can be used
+ in a tree control. On the medium term, we should extend it with support for different-sized
+ icons.
+ */
+ class ImageProvider
+ {
+ public:
+ /** creates a semi-functional ImageProvider instance
+
+ The resulting instance is not able to provide any concrete object images,
+ but only default images.
+ */
+ ImageProvider();
+
+ /** creates an ImageProvider instance
+
+ @param _rxConnection
+ denotes the connection to work for. Must not be <NULL/>.
+ */
+ ImageProvider(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
+ );
+
+ /** returns the image to be used for a database object with the given name
+
+ @param _nDatabaseObjectType
+ the type of the object. Must be one of the css.sdb.application.DatabaseObject
+ constants.
+ @param _rName
+ the name of the object
+ @return
+ the name of the image to be used for the object.
+ */
+ OUString getImageId(
+ const OUString& _rName,
+ const sal_Int32 _nDatabaseObjectType
+ );
+
+ // check whether the connection can give us an icon
+ css::uno::Reference<css::graphic::XGraphic> getXGraphic(const OUString& _rName,
+ const sal_Int32 _nDatabaseObjectType);
+
+ /** returns the resource ID for the default image to be used for a database object
+
+ In opposite to getImageId, this method does not check the concrete object
+ for its image, but returns a default image to be used for all objects of the given
+ type.
+
+ @param _nDatabaseObjectType
+ the type of the object. Must be one of the css.sdb.application.DatabaseObject
+ constants.
+ @return
+ the resource image name to be used for the object type.
+ */
+ static OUString getDefaultImageResourceID(sal_Int32 _nDatabaseObjectType);
+
+ static OUString getFolderImageId(
+ sal_Int32 _nDatabaseObjectType
+ );
+
+ /** retrieves the image to be used for a database as a whole.
+ @return
+ the image to be used for folders of this type
+ */
+ static OUString getDatabaseImage();
+ private:
+ /// the connection we work with
+ css::uno::Reference< css::sdbc::XConnection > mxConnection;
+ /// the views of the connection, if the DB supports views
+ css::uno::Reference< css::container::XNameAccess > mxViews;
+ /// interface for providing table's UI
+ css::uno::Reference< css::sdb::application::XTableUIProvider > mxTableUI;
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/indexcollection.hxx b/dbaccess/source/ui/inc/indexcollection.hxx
new file mode 100644
index 0000000000..3d227b0b38
--- /dev/null
+++ b/dbaccess/source/ui/inc/indexcollection.hxx
@@ -0,0 +1,93 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "indexes.hxx"
+
+namespace dbaui
+{
+
+ // OIndexCollection
+ class OIndexCollection
+ {
+ css::uno::Reference< css::container::XNameAccess >
+ m_xIndexes;
+
+ // cached information
+ Indexes m_aIndexes;
+
+ public:
+ // construction
+ OIndexCollection();
+ OIndexCollection(const OIndexCollection& _rSource);
+ // OIndexCollection(const css::uno::Reference< css::container::XNameAccess >& _rxIndexes);
+
+ OIndexCollection& operator=(const OIndexCollection& _rSource);
+
+ // iterating through the collection
+ typedef OIndex* iterator;
+ typedef OIndex const* const_iterator;
+
+ /// get access to the first element of the index collection
+ Indexes::const_iterator begin() const { return m_aIndexes.begin(); }
+ /// get access to the first element of the index collection
+ Indexes::iterator begin() { return m_aIndexes.begin(); }
+ /// get access to the (last + 1st) element of the index collection
+ Indexes::const_iterator end() const { return m_aIndexes.end(); }
+ /// get access to the (last + 1st) element of the index collection
+ Indexes::iterator end() { return m_aIndexes.end(); }
+
+ // searching
+ Indexes::const_iterator find(const OUString& _rName) const;
+ Indexes::iterator find(const OUString& _rName);
+ Indexes::const_iterator findOriginal(const OUString& _rName) const;
+ Indexes::iterator findOriginal(const OUString& _rName);
+
+ // inserting without committing
+ // the OriginalName of the newly inserted index will be empty, thus indicating that it's new
+ Indexes::iterator insert(const OUString& _rName);
+ // commit a new index, which is already part if the collection, but does not have an equivalent in the
+ // data source, yet
+ void commitNewIndex(const Indexes::iterator& _rPos);
+
+ // reset the data for the given index
+ void resetIndex(const Indexes::iterator& _rPos);
+
+ // attach to a new key container
+ void attach(const css::uno::Reference< css::container::XNameAccess >& _rxIndexes);
+ // detach from the container
+ void detach();
+
+ /// drop an index, and remove it from the collection
+ bool drop(const Indexes::iterator& _rPos);
+ /// simply drop the index described by the name, but don't remove the descriptor from the collection
+ bool dropNoRemove(const Indexes::iterator& _rPos);
+
+ protected:
+ void implConstructFrom(const css::uno::Reference< css::container::XNameAccess >& _rxIndexes);
+ static void implFillIndexInfo(OIndex& _rIndex, const css::uno::Reference< css::beans::XPropertySet >& _rxDescriptor);
+ void implFillIndexInfo(OIndex& _rIndex);
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/indexdialog.hxx b/dbaccess/source/ui/inc/indexdialog.hxx
new file mode 100644
index 0000000000..b3ba37936e
--- /dev/null
+++ b/dbaccess/source/ui/inc/indexdialog.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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <vcl/weld.hxx>
+#include "indexes.hxx"
+
+namespace dbaui
+{
+ // DbaIndexDialog
+ class IndexFieldsControl;
+ class OIndexCollection;
+ class DbaIndexDialog final : public weld::GenericDialogController
+ {
+ css::uno::Reference< css::sdbc::XConnection > m_xConnection;
+
+ std::unique_ptr<OIndexCollection> m_xIndexes;
+ std::unique_ptr<weld::TreeIter> m_xPreviousSelection;
+ bool m_bEditingActive;
+ bool m_bEditAgain;
+ bool m_bNoHandlerCall;
+
+ css::uno::Reference< css::uno::XComponentContext >
+ m_xContext;
+
+ std::unique_ptr<weld::Toolbar> m_xActions;
+ std::unique_ptr<weld::TreeView> m_xIndexList;
+ std::unique_ptr<weld::Label> m_xIndexDetails;
+ std::unique_ptr<weld::Label> m_xDescriptionLabel;
+ std::unique_ptr<weld::Label> m_xDescription;
+ std::unique_ptr<weld::CheckButton> m_xUnique;
+ std::unique_ptr<weld::Label> m_xFieldsLabel;
+ std::unique_ptr<weld::Button> m_xClose;
+ std::unique_ptr<weld::Container> m_xTable;
+ css::uno::Reference<css::awt::XWindow> m_xTableCtrlParent;
+ VclPtr<IndexFieldsControl> m_xFields;
+
+ public:
+ DbaIndexDialog(
+ weld::Window* _pParent,
+ const css::uno::Sequence< OUString >& _rFieldNames,
+ const css::uno::Reference< css::container::XNameAccess >& _rxIndexes,
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+ virtual ~DbaIndexDialog() override;
+
+ typedef std::pair<const weld::TreeIter&, OUString> IterString;
+ private:
+ void fillIndexList();
+ void updateToolbox();
+ void updateControls(const weld::TreeIter* pEntry);
+
+ void IndexSelected();
+
+ DECL_LINK( OnIndexSelected, weld::TreeView&, void );
+ DECL_LINK( OnIndexAction, const OUString&, void );
+ DECL_LINK( OnEntryEditing, const weld::TreeIter&, bool );
+ DECL_LINK( OnEntryEdited, const IterString&, bool );
+ DECL_LINK( OnModifiedClick, weld::Toggleable&, void );
+ DECL_LINK( OnModified, IndexFieldsControl&, void );
+ DECL_LINK( OnCloseDialog, weld::Button&, void );
+
+ DECL_LINK( OnEditIndexAgain, void*, void );
+
+ void OnNewIndex();
+ void OnDropIndex(bool _bConfirm = true);
+ void OnRenameIndex();
+ void OnSaveIndex();
+ void OnResetIndex();
+
+ bool implCommit(const weld::TreeIter* pEntry);
+ bool implSaveModified(bool _bPlausibility = true);
+ bool implCommitPreviouslySelected();
+
+ bool implDropIndex(const weld::TreeIter* pEntry, bool _bRemoveFromCollection);
+
+ bool implCheckPlausibility(const Indexes::const_iterator& _rPos);
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/indexes.hxx b/dbaccess/source/ui/inc/indexes.hxx
new file mode 100644
index 0000000000..75bd5b44ba
--- /dev/null
+++ b/dbaccess/source/ui/inc/indexes.hxx
@@ -0,0 +1,81 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <rtl/ustring.hxx>
+
+#include <vector>
+
+namespace dbaui
+{
+ // OIndexField
+ struct OIndexField
+ {
+ OUString sFieldName;
+ bool bSortAscending;
+
+ OIndexField() : bSortAscending(true) { }
+ };
+
+ typedef std::vector<OIndexField> IndexFields;
+
+ // OIndex
+ struct GrantIndexAccess
+ {
+ friend class OIndexCollection;
+ private:
+ GrantIndexAccess() { }
+ };
+
+ struct OIndex final
+ {
+ OUString sOriginalName;
+ bool bModified;
+
+ public:
+ OUString sName;
+ OUString sDescription;
+ bool bPrimaryKey;
+ bool bUnique;
+ IndexFields aFields;
+
+ OIndex(const OUString& _rOriginalName)
+ : sOriginalName(_rOriginalName), bModified(false), sName(_rOriginalName), bPrimaryKey(false), bUnique(false)
+ {
+ }
+
+ const OUString& getOriginalName() const { return sOriginalName; }
+
+ bool isModified() const { return bModified; }
+ void setModified(bool _bModified) { bModified = _bModified; }
+ void clearModified() { setModified(false); }
+
+ bool isNew() const { return getOriginalName().isEmpty(); }
+ void flagAsNew(const GrantIndexAccess&) { sOriginalName.clear(); }
+ void flagAsCommitted(const GrantIndexAccess&) { sOriginalName = sName; }
+ };
+
+ typedef std::vector<OIndex> Indexes;
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/indexfieldscontrol.hxx b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
new file mode 100644
index 0000000000..90ae7172e3
--- /dev/null
+++ b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
@@ -0,0 +1,91 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <svtools/editbrowsebox.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "indexes.hxx"
+
+namespace dbaui
+{
+
+ class DbaMouseDownListBoxController;
+
+ // IndexFieldsControl
+ class IndexFieldsControl final : public ::svt::EditBrowseBox
+ {
+ IndexFields m_aSavedValue;
+
+ IndexFields m_aFields; // !! order matters !!
+ IndexFields::const_iterator m_aSeekRow; // !!
+
+ Link<IndexFieldsControl&,void> m_aModifyHdl;
+
+ VclPtr< ::svt::ListBoxControl> m_pSortingCell;
+ VclPtr< ::svt::ListBoxControl> m_pFieldNameCell;
+
+ OUString m_sAscendingText;
+ OUString m_sDescendingText;
+
+ bool m_bAddIndexAppendix;
+
+ public:
+ IndexFieldsControl(const css::uno::Reference<css::awt::XWindow> &rParent);
+ virtual ~IndexFieldsControl() override;
+ virtual void dispose() override;
+
+ void Init(const css::uno::Sequence< OUString >& _rAvailableFields, bool _bAddIndexAppendix);
+
+ void initializeFrom(IndexFields&& _rFields);
+ void commitTo(IndexFields& _rFields);
+
+ bool SaveModified() override;
+ using EditBrowseBox::IsModified;
+
+ const IndexFields& GetSavedValue() const { return m_aSavedValue; }
+ void SaveValue() { m_aSavedValue = m_aFields; }
+
+ void SetModifyHdl(const Link<IndexFieldsControl&,void>& _rHdl) { m_aModifyHdl = _rHdl; }
+ virtual OUString GetCellText(sal_Int32 _nRow,sal_uInt16 nColId) const override;
+
+ private:
+ // EditBrowseBox overridables
+ virtual void PaintCell( OutputDevice& _rDev, const tools::Rectangle& _rRect, sal_uInt16 _nColumnId ) const override;
+ virtual bool SeekRow(sal_Int32 nRow) override;
+ virtual sal_uInt32 GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId) override;
+ virtual bool IsTabAllowed(bool bForward) const override;
+
+ ::svt::CellController* GetController(sal_Int32 _nRow, sal_uInt16 _nColumnId) override;
+ void InitController(::svt::CellControllerRef&, sal_Int32 _nRow, sal_uInt16 _nColumnId) override;
+
+ OUString GetRowCellText(const IndexFields::const_iterator& _rRow,sal_uInt16 nColId) const;
+ bool implGetFieldDesc(sal_Int32 _nRow, IndexFields::const_iterator& _rPos);
+
+ bool isNewField() const { return GetCurRow() >= static_cast<sal_Int32>(m_aFields.size()); }
+
+ DECL_LINK( OnListEntrySelected, DbaMouseDownListBoxController&, void );
+
+ using ::svt::EditBrowseBox::Init;
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx
new file mode 100644
index 0000000000..c20f3a87ae
--- /dev/null
+++ b/dbaccess/source/ui/inc/linkeddocuments.hxx
@@ -0,0 +1,108 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include "AppElementType.hxx"
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
+#include <comphelper/namedvaluecollection.hxx>
+
+namespace weld { class Window; }
+namespace dbaui
+{
+
+ // OLinkedDocumentsAccess
+ class OLinkedDocumentsAccess final
+ {
+ css::uno::Reference< css::uno::XComponentContext >
+ m_xContext;
+ css::uno::Reference< css::container::XNameAccess >
+ m_xDocumentContainer;
+ css::uno::Reference< css::sdbc::XConnection>
+ m_xConnection;
+ css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >
+ m_xDocumentUI;
+ weld::Window* m_pDialogParent;
+ OUString m_sDataSourceName;
+
+ public:
+ OLinkedDocumentsAccess(
+ weld::Window* pDialogParent,
+ const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& i_rDocumentUI,
+ const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
+ const css::uno::Reference< css::container::XNameAccess >& _rxContainer,
+ const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
+ OUString _sDataSourceName
+ );
+ ~OLinkedDocumentsAccess();
+
+ bool isConnected() const { return m_xConnection.is(); }
+
+ css::uno::Reference< css::lang::XComponent>
+ open(
+ const OUString& _rLinkName,
+ css::uno::Reference< css::lang::XComponent>& _xDefinition,
+ ElementOpenMode _eOpenMode,
+ const ::comphelper::NamedValueCollection& _rAdditionalArgs
+ );
+
+ css::uno::Reference< css::lang::XComponent >
+ newDocument(
+ sal_Int32 i_nActionID,
+ const ::comphelper::NamedValueCollection& i_rCreationArgs,
+ css::uno::Reference< css::lang::XComponent >& o_rDefinition
+ );
+
+ void newFormWithPilot(
+ const sal_Int32 _nCommandType,
+ const OUString& _rObjectName
+ );
+ void newReportWithPilot(
+ const sal_Int32 _nCommandType,
+ const OUString& _rObjectName
+ );
+ void newQueryWithPilot();
+ void newTableWithPilot();
+
+ private:
+ css::uno::Reference< css::lang::XComponent >
+ impl_open(
+ const OUString& _rLinkName,
+ css::uno::Reference< css::lang::XComponent >& _xDefinition,
+ ElementOpenMode _eOpenMode,
+ const ::comphelper::NamedValueCollection& _rAdditionalArgs
+ );
+
+ void
+ impl_newWithPilot(
+ const char* _pWizardService,
+ const sal_Int32 _nCommandType,
+ const OUString& _rObjectName
+ );
+
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/objectnamecheck.hxx b/dbaccess/source/ui/inc/objectnamecheck.hxx
new file mode 100644
index 0000000000..52f639e534
--- /dev/null
+++ b/dbaccess/source/ui/inc/objectnamecheck.hxx
@@ -0,0 +1,57 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+namespace dbtools { class SQLExceptionInfo; }
+
+namespace dbaui
+{
+
+ // IObjectNameCheck
+ /** interface encapsulating the check for the validity of an object name
+ */
+ class IObjectNameCheck
+ {
+ public:
+ /** determines whether a given object name is valid
+
+ @param _rObjectName
+ the name to check
+ @param _out_rErrorToDisplay
+ output parameter taking an error message describing why the name is not
+ valid, if applicable.
+
+ @return
+ <TRUE/> if and only if the given name is valid.
+ */
+ virtual bool isNameValid(
+ const OUString& _rObjectName,
+ ::dbtools::SQLExceptionInfo& _out_rErrorToDisplay
+ ) const = 0;
+
+ public:
+ virtual ~IObjectNameCheck() { }
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/opendoccontrols.hxx b/dbaccess/source/ui/inc/opendoccontrols.hxx
new file mode 100644
index 0000000000..8448a047dc
--- /dev/null
+++ b/dbaccess/source/ui/inc/opendoccontrols.hxx
@@ -0,0 +1,78 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+#include <rtl/ustring.hxx>
+
+namespace dbaui
+{
+
+ // OpenDocumentButton
+ /** a button which can be used to open a document
+
+ The text of the button is the same as for the "Open" command in the application
+ UI. Additionally, the icon for this command is also displayed on the button.
+ */
+ class OpenDocumentButton
+ {
+ private:
+ OUString m_sModule;
+
+ std::unique_ptr<weld::Button> m_xControl;
+ public:
+ OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const char* _pAsciiModuleName);
+
+ void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
+ void connect_clicked(const Link<weld::Button&, void>& rLink) { m_xControl->connect_clicked(rLink); }
+
+ private:
+ void impl_init( const char* _pAsciiModuleName );
+ };
+
+ // OpenDocumentListBox
+ class OpenDocumentListBox
+ {
+ private:
+ typedef std::pair< OUString, OUString > StringPair;
+
+ std::vector<StringPair> m_aURLs;
+
+ std::unique_ptr<weld::ComboBox> m_xControl;
+
+ public:
+ OpenDocumentListBox(std::unique_ptr<weld::ComboBox> xControl, const char* _pAsciiModuleName);
+
+ OUString GetSelectedDocumentURL() const;
+
+ void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
+ int get_count() const { return m_xControl->get_count(); }
+ void set_active(int nPos) { m_xControl->set_active(nPos); }
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
+
+ private:
+ const StringPair & impl_getDocumentAtIndex( sal_uInt16 _nListIndex ) const;
+
+ void impl_init( const char* _pAsciiModuleName );
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/paramdialog.hxx b/dbaccess/source/ui/inc/paramdialog.hxx
new file mode 100644
index 0000000000..489a621e60
--- /dev/null
+++ b/dbaccess/source/ui/inc/paramdialog.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 .
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+#include <vcl/timer.hxx>
+
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <connectivity/predicateinput.hxx>
+#include <svx/ParseContext.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace connectivity
+{
+ class OSQLParseNode;
+}
+
+enum class VisitFlags {
+ NONE = 0x00,
+ Visited = 0x01,
+ Dirty = 0x02,
+};
+namespace o3tl {
+ template<> struct typed_flags<VisitFlags> : is_typed_flags<VisitFlags, 0x03> {};
+}
+
+namespace dbaui
+{
+ // OParameterDialog
+ class OParameterDialog final
+ : public weld::GenericDialogController
+ , public ::svxform::OParseContextClient
+ {
+ sal_Int32 m_nCurrentlySelected;
+
+ css::uno::Reference< css::container::XIndexAccess >
+ m_xParams;
+ css::uno::Reference< css::sdbc::XConnection >
+ m_xConnection;
+ css::uno::Reference< css::util::XNumberFormatter >
+ m_xFormatter;
+ ::dbtools::OPredicateInputController
+ m_aPredicateInput;
+
+ std::vector<VisitFlags> m_aVisitedParams;
+ Timer m_aResetVisitFlag;
+ // we reset the "visited flag" 1 second after and entry has been selected
+
+ css::uno::Sequence< css::beans::PropertyValue >
+ m_aFinalValues; /// the final values as entered by the user
+
+ // the controls
+ std::unique_ptr<weld::TreeView> m_xAllParams;
+ std::unique_ptr<weld::Entry> m_xParam;
+ std::unique_ptr<weld::Button> m_xTravelNext;
+ std::unique_ptr<weld::Button> m_xOKBtn;
+ std::unique_ptr<weld::Button> m_xCancelBtn;
+
+ public:
+ OParameterDialog(weld::Window* _pParent,
+ const css::uno::Reference< css::container::XIndexAccess > & _rParamContainer,
+ const css::uno::Reference< css::sdbc::XConnection > & _rxConnection,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext);
+ virtual ~OParameterDialog() override;
+
+ const css::uno::Sequence< css::beans::PropertyValue >&
+ getValues() const { return m_aFinalValues; }
+
+ private:
+ void Construct();
+
+ DECL_LINK(OnVisitedTimeout, Timer*, void);
+ DECL_LINK(OnValueModified, weld::Entry&, void);
+ DECL_LINK(OnEntryListBoxSelected, weld::TreeView&, void);
+ DECL_LINK(OnButtonClicked, weld::Button&, void);
+ DECL_LINK(OnValueLoseFocusHdl, weld::Widget&, void);
+ bool CheckValueForError();
+ bool OnEntrySelected();
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/propertystorage.hxx b/dbaccess/source/ui/inc/propertystorage.hxx
new file mode 100644
index 0000000000..35d9f24d6e
--- /dev/null
+++ b/dbaccess/source/ui/inc/propertystorage.hxx
@@ -0,0 +1,54 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/Any.hxx>
+#include <map>
+#include <memory>
+
+class SfxItemSet;
+
+namespace dbaui
+{
+
+ /** a PropertyStorage implementation which stores the value in an item set
+ */
+ class SetItemPropertyStorage
+ {
+ public:
+ SetItemPropertyStorage( SfxItemSet& _rItemSet, const sal_uInt16 _nItemID )
+ :m_rItemSet( _rItemSet )
+ ,m_nItemID( _nItemID )
+ {
+ }
+
+ void getPropertyValue( css::uno::Any& _out_rValue ) const;
+ void setPropertyValue( const css::uno::Any& _rValue );
+
+ private:
+ SfxItemSet& m_rItemSet;
+ const sal_uInt16 m_nItemID;
+ };
+
+ typedef std::map< sal_Int32, std::shared_ptr< SetItemPropertyStorage > > PropertyValues;
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/querycontainerwindow.hxx b/dbaccess/source/ui/inc/querycontainerwindow.hxx
new file mode 100644
index 0000000000..12583ec0c0
--- /dev/null
+++ b/dbaccess/source/ui/inc/querycontainerwindow.hxx
@@ -0,0 +1,104 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/window.hxx>
+#include <vcl/split.hxx>
+#include <dbaccess/dataview.hxx>
+#include <com/sun/star/frame/XFrame2.hpp>
+#include "QueryViewSwitch.hxx"
+#include <vcl/dockwin.hxx>
+
+namespace dbaui
+{
+
+ // OBeamer
+ // temporary class until the beamer is implemented
+ class OBeamer : public DockingWindow
+ {
+ public:
+ OBeamer(vcl::Window* _pParent) : DockingWindow(_pParent,0){}
+ };
+
+ // OQueryContainerWindow
+ class OQueryContainerWindow : public ODataView
+ {
+ OQueryViewSwitch* m_pViewSwitch;
+ VclPtr<OBeamer> m_pBeamer;
+ VclPtr<Splitter> m_pSplitter;
+ css::uno::Reference< css::frame::XFrame2 > m_xBeamer;
+
+ DECL_LINK( SplitHdl, Splitter*, void );
+ public:
+ OQueryContainerWindow(vcl::Window* pParent, OQueryController& _rController,const css::uno::Reference< css::uno::XComponentContext >&);
+ virtual ~OQueryContainerWindow() override;
+ virtual void dispose() override;
+
+ virtual void Construct() override;
+
+ virtual bool PreNotify( NotifyEvent& rNEvt ) override;
+
+ // show the beamer
+ void showPreview(const css::uno::Reference< css::frame::XFrame >& _xFrame);
+ // called when the beamer has been disposed
+ void disposingPreview();
+
+ const css::uno::Reference< css::frame::XFrame2 >&
+ getPreviewFrame() const { return m_xBeamer; }
+
+ OQueryDesignView* getDesignView() { return m_pViewSwitch->getDesignView(); }
+
+ bool isCutAllowed() const { return m_pViewSwitch->isCutAllowed(); }
+ bool isPasteAllowed() const { return m_pViewSwitch->isPasteAllowed(); }
+ bool isCopyAllowed() const { return m_pViewSwitch->isCopyAllowed(); }
+ void copy() { m_pViewSwitch->copy(); }
+ void cut() { m_pViewSwitch->cut(); }
+ void paste() { m_pViewSwitch->paste(); }
+
+ void clear() { m_pViewSwitch->clear(); }
+ bool isSlotEnabled( sal_Int32 _nSlotId ) { return m_pViewSwitch->isSlotEnabled( _nSlotId ); }
+ void setSlotEnabled( sal_Int32 _nSlotId, bool _bEnable ) { m_pViewSwitch->setSlotEnabled( _nSlotId, _bEnable ); }
+ void setNoneVisibleRow(sal_Int32 _nRows) { m_pViewSwitch->setNoneVisibleRow( _nRows); }
+
+ bool checkStatement() { return m_pViewSwitch->checkStatement( ); }
+ OUString getStatement() { return m_pViewSwitch->getStatement( ); }
+ void setStatement( const OUString& _rsStatement ) { m_pViewSwitch->setStatement( _rsStatement ); }
+
+ void initialize() override { m_pViewSwitch->initialize(); }
+ void SaveUIConfig() { m_pViewSwitch->SaveUIConfig(); }
+ void reset() { m_pViewSwitch->reset(); }
+
+ bool switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo );
+ void forceInitialView();
+
+ virtual void GetFocus() override;
+
+ protected:
+ // re-arrange the controls belonging to the document itself
+ virtual void resizeAll( const tools::Rectangle& _rPlayground ) override;
+
+ // arrange derived classes controls in the rectangle given
+ virtual void resizeDocumentView(tools::Rectangle& _rPlayground) override;
+ };
+ // end of temp classes
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx
new file mode 100644
index 0000000000..94bb5d8f4f
--- /dev/null
+++ b/dbaccess/source/ui/inc/querycontroller.hxx
@@ -0,0 +1,217 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include "JoinController.hxx"
+#include "querycontainerwindow.hxx"
+#include <svx/ParseContext.hxx>
+#include "TableFieldDescription.hxx"
+
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
+#include <com/sun/star/sdbcx/XAlterView.hpp>
+
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/uno3.hxx>
+#include <connectivity/sqliterator.hxx>
+#include <connectivity/sqlparse.hxx>
+
+namespace comphelper
+{
+ class NamedValueCollection;
+}
+
+namespace dbaui
+{
+ class OQueryContainerWindow;
+
+ typedef ::comphelper::OPropertyContainer OQueryController_PBase;
+ typedef ::comphelper::OPropertyArrayUsageHelper< OQueryController > OQueryController_PABase;
+ class OQueryController :public OJoinController
+ ,public OQueryController_PBase
+ ,public OQueryController_PABase
+ {
+ OTableFields m_vTableFieldDesc;
+ OTableFields m_vUnUsedFieldsDesc; // contains fields which aren't visible and don't have any criteria
+
+ css::uno::Sequence< css::beans::PropertyValue > m_aFieldInformation;
+
+ std::unique_ptr<::svxform::OSystemParseContext> m_pParseContext;
+ ::connectivity::OSQLParser m_aSqlParser;
+ std::unique_ptr<::connectivity::OSQLParseTreeIterator> m_pSqlIterator;
+
+ css::uno::Reference< css::sdb::XSQLQueryComposer > m_xComposer;
+ /// if we're editing an existing view, this is non-NULL
+ css::uno::Reference< css::sdbcx::XAlterView > m_xAlterView;
+
+ OUString m_sStatement; // contains the current sql statement
+ OUString m_sUpdateCatalogName; // catalog for update data
+ OUString m_sUpdateSchemaName; // schema for update data
+ mutable OUString
+ m_sName; // name of the query
+
+ sal_Int64 m_nLimit; // the limit of the query result (All==-1)
+
+ sal_Int32 m_nVisibleRows; // which rows the selection browse should show
+ sal_Int32 m_nSplitPos; // the position of the splitter
+ sal_Int32 m_nCommandType; // the type of the object we're designing
+ bool m_bGraphicalDesign; // are we in the graphical design mode (sal_True) or in the text design (sal_False)?
+ bool m_bDistinct; // true when you want "select distinct" otherwise false
+ bool m_bEscapeProcessing;// is true when we shouldn't parse the statement
+
+
+ /** returns the container of queries, views, or command definitions, depending on what object type
+ we design currently.
+
+ Not allowed to be called if we design an independent SQL command.
+ */
+ css::uno::Reference< css::container::XNameAccess >
+ getObjectContainer() const;
+
+ bool editingView() const { return m_nCommandType == css::sdb::CommandType::TABLE; }
+ bool editingQuery() const { return m_nCommandType == css::sdb::CommandType::QUERY; }
+ bool editingCommand() const { return m_nCommandType == css::sdb::CommandType::COMMAND; }
+
+ bool askForNewName( const css::uno::Reference< css::container::XNameAccess>& _xElements,
+ bool _bSaveAs);
+ // creates the querycomposer
+ void setQueryComposer();
+ void deleteIterator();
+ void executeQuery();
+ bool doSaveAsDoc(bool _bSaveAs);
+
+ void saveViewSettings( ::comphelper::NamedValueCollection& o_rViewSettings, const bool i_includingCriteria ) const;
+ void loadViewSettings( const ::comphelper::NamedValueCollection& o_rViewSettings );
+ OUString translateStatement( bool _bFireStatementChange = true );
+
+ void execute_QueryPropDlg();
+
+ protected:
+ // all the features which should be handled by this class
+ virtual void describeSupportedFeatures() override;
+ // state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
+ virtual FeatureState GetState(sal_uInt16 nId) const override;
+ // execute a feature
+ virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+
+ virtual void reconnect( bool _bUI ) override;
+ virtual OUString getPrivateTitle( ) const override;
+
+ OQueryContainerWindow* getContainer() const { return static_cast< OQueryContainerWindow* >( getView() ); }
+
+ public:
+ OQueryController(const css::uno::Reference< css::uno::XComponentContext >& _rM);
+
+ virtual ~OQueryController() override;
+ OTableFields& getTableFieldDesc() { return m_vTableFieldDesc; }
+ OTableFields& getUnUsedFields() { return m_vUnUsedFieldsDesc; }
+
+ void clearFields();
+
+ virtual void impl_onModifyChanged() override;
+
+ // should the statement be parsed by our own sql parser
+ bool isEscapeProcessing() const { return m_bEscapeProcessing; }
+ bool isGraphicalDesign() const { return m_bGraphicalDesign; }
+ bool isDistinct() const { return m_bDistinct; }
+ sal_Int64 getLimit() const { return m_nLimit; }
+
+ const OUString& getStatement() const { return m_sStatement; }
+ sal_Int32 getSplitPos() const { return m_nSplitPos;}
+ sal_Int32 getVisibleRows() const { return m_nVisibleRows; }
+
+ void setDistinct(bool _bDistinct) { m_bDistinct = _bDistinct;}
+ void setLimit(const sal_Int64 _nLimit) { m_nLimit = _nLimit;}
+ void setSplitPos(sal_Int32 _nSplitPos) { m_nSplitPos = _nSplitPos;}
+ void setVisibleRows(sal_Int32 _nVisibleRows) { m_nVisibleRows = _nVisibleRows;}
+
+ sal_Int32 getColWidth(sal_uInt16 _nColPos) const;
+
+ const css::uno::Sequence< css::beans::PropertyValue >&
+ getFieldInformation() const { return m_aFieldInformation; }
+
+ ::connectivity::OSQLParser& getParser() { return m_aSqlParser; }
+ ::connectivity::OSQLParseTreeIterator& getParseIterator() { return *m_pSqlIterator; }
+
+ virtual bool Construct(vcl::Window* pParent) override;
+
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+ // XPropertySet
+ virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL disposing() override;
+
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XController
+ virtual css::uno::Any SAL_CALL getViewData() override;
+ virtual void SAL_CALL restoreViewData(const css::uno::Any& Data) override;
+
+ private:
+ virtual void onLoadedMenu(const css::uno::Reference< css::frame::XLayoutManager >& _xLayoutManager) override;
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+
+ // OPropertySetHelper
+ virtual void SAL_CALL getFastPropertyValue(
+ css::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const override;
+
+ virtual OJoinDesignView* getJoinView() override;
+ // ask the user if the design should be saved when it is modified
+ virtual short saveModified() override;
+ virtual void reset() override;
+ virtual void impl_initialize() override;
+
+ void impl_reset( const bool i_bIgnoreQuerySettings = false );
+ /// tells the user that we needed to switch to SQL view automatically
+ void impl_showAutoSQLViewError( const css::uno::Any& _rErrorDetails );
+
+ /** switches to the graphical or SQL view mode, as determined by m_bGraphicalDesign
+ */
+ void impl_setViewMode( ::dbtools::SQLExceptionInfo* _pErrorInfo );
+
+ /// sets m_sStatement, and notifies our respective property change listeners
+ void setStatement_fireEvent( const OUString& _rNewStatement, bool _bFireStatementChange = true );
+ /// sets the m_bEscapeProcessing member, and notifies our respective property change listeners
+ void setEscapeProcessing_fireEvent( const bool _bEscapeProcessing );
+
+ // OJoinController overridables
+ virtual bool allowViews() const override;
+ virtual bool allowQueries() const override;
+
+ private:
+ DECL_LINK( OnExecuteAddTable, void*, void );
+
+ private:
+ using OQueryController_PBase::getFastPropertyValue;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/queryfilter.hxx b/dbaccess/source/ui/inc/queryfilter.hxx
new file mode 100644
index 0000000000..396778f229
--- /dev/null
+++ b/dbaccess/source/ui/inc/queryfilter.hxx
@@ -0,0 +1,109 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+#include <connectivity/sqliterator.hxx>
+
+#include <connectivity/predicateinput.hxx>
+#include <svx/ParseContext.hxx>
+
+namespace com::sun::star {
+ namespace sdb
+ {
+ class XSingleSelectQueryComposer;
+ }
+ namespace sdbc
+ {
+ class XConnection;
+ class XDatabaseMetaData;
+ }
+ namespace container
+ {
+ class XNameAccess;
+ }
+ namespace beans
+ {
+ struct PropertyValue;
+ }
+}
+
+// DlgFilterCrit
+namespace dbaui
+{
+ class DlgFilterCrit final : public weld::GenericDialogController
+ , public ::svxform::OParseContextClient
+ {
+ private:
+ std::vector<OUString> m_aSTR_COMPARE_OPERATORS;
+
+ css::uno::Reference< css::sdb::XSingleSelectQueryComposer> m_xQueryComposer;
+ css::uno::Reference< css::container::XNameAccess> m_xColumns;
+ css::uno::Reference< css::sdbc::XConnection> m_xConnection;
+ css::uno::Reference< css::sdbc::XDatabaseMetaData> m_xMetaData;
+
+ ::dbtools::OPredicateInputController m_aPredicateInput;
+
+ std::unique_ptr<weld::ComboBox> m_xLB_WHEREFIELD1;
+ std::unique_ptr<weld::ComboBox> m_xLB_WHERECOMP1;
+ std::unique_ptr<weld::Entry> m_xET_WHEREVALUE1;
+
+ std::unique_ptr<weld::ComboBox> m_xLB_WHERECOND2;
+ std::unique_ptr<weld::ComboBox> m_xLB_WHEREFIELD2;
+ std::unique_ptr<weld::ComboBox> m_xLB_WHERECOMP2;
+ std::unique_ptr<weld::Entry> m_xET_WHEREVALUE2;
+
+ std::unique_ptr<weld::ComboBox> m_xLB_WHERECOND3;
+ std::unique_ptr<weld::ComboBox> m_xLB_WHEREFIELD3;
+ std::unique_ptr<weld::ComboBox> m_xLB_WHERECOMP3;
+ std::unique_ptr<weld::Entry> m_xET_WHEREVALUE3;
+
+ static void SelectField(weld::ComboBox& rBox, std::u16string_view rField);
+ DECL_LINK(ListSelectHdl, weld::ComboBox&, void);
+ DECL_LINK(ListSelectCompHdl, weld::ComboBox&, void);
+
+ void SetLine( int nIdx, const css::beans::PropertyValue& _rItem, bool _bOr );
+ void EnableLines();
+ sal_Int32 GetOSQLPredicateType( std::u16string_view _rSelectedPredicate ) const;
+ static sal_Int32 GetSelectionPos(sal_Int32 eType, const weld::ComboBox& rListBox);
+ bool getCondition(const weld::ComboBox& _rField, const weld::ComboBox& _rComp, const weld::Entry& _rValue, css::beans::PropertyValue& _rFilter) const;
+ void fillLines(int &i, const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& _aValues);
+
+ css::uno::Reference< css::beans::XPropertySet > getMatchingColumn( const weld::Entry& _rValueInput ) const;
+ css::uno::Reference< css::beans::XPropertySet > getColumn( const OUString& _rFieldName ) const;
+ css::uno::Reference< css::beans::XPropertySet > getQueryColumn( const OUString& _rFieldName ) const;
+
+ public:
+ DlgFilterCrit(weld::Window * pParent,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::sdbc::XConnection>& _rxConnection,
+ const css::uno::Reference< css::sdb::XSingleSelectQueryComposer>& _rxComposer,
+ const css::uno::Reference< css::container::XNameAccess>& _rxCols);
+ virtual ~DlgFilterCrit() override;
+
+ void BuildWherePart();
+
+ private:
+ DECL_LINK(PredicateLoseFocus, weld::Widget&, void);
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/queryorder.hxx b/dbaccess/source/ui/inc/queryorder.hxx
new file mode 100644
index 0000000000..523d84f31f
--- /dev/null
+++ b/dbaccess/source/ui/inc/queryorder.hxx
@@ -0,0 +1,81 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/weld.hxx>
+
+#define DOG_ROWS 3
+
+namespace com::sun::star{
+ namespace sdb
+ {
+ class XSingleSelectQueryComposer;
+ }
+ namespace sdbc
+ {
+ class XConnection;
+ }
+ namespace container
+ {
+ class XNameAccess;
+ }
+}
+
+// DlgOrderCrit
+namespace dbaui
+{
+ class DlgOrderCrit final : public weld::GenericDialogController
+ {
+ OUString m_sOrgOrder;
+
+ css::uno::Reference< css::sdb::XSingleSelectQueryComposer> m_xQueryComposer;
+ css::uno::Reference< css::container::XNameAccess> m_xColumns;
+ css::uno::Reference< css::sdbc::XConnection> m_xConnection;
+
+ weld::ComboBox* m_aColumnList[DOG_ROWS];
+ weld::ComboBox* m_aValueList[DOG_ROWS];
+
+ std::unique_ptr<weld::ComboBox> m_xLB_ORDERFIELD1;
+ std::unique_ptr<weld::ComboBox> m_xLB_ORDERVALUE1;
+ std::unique_ptr<weld::ComboBox> m_xLB_ORDERFIELD2;
+ std::unique_ptr<weld::ComboBox> m_xLB_ORDERVALUE2;
+ std::unique_ptr<weld::ComboBox> m_xLB_ORDERFIELD3;
+ std::unique_ptr<weld::ComboBox> m_xLB_ORDERVALUE3;
+
+ DECL_LINK(FieldListSelectHdl, weld::ComboBox&, void);
+ void EnableLines();
+
+ public:
+ DlgOrderCrit(weld::Window * pParent,
+ const css::uno::Reference< css::sdbc::XConnection>& _rxConnection,
+ const css::uno::Reference< css::sdb::XSingleSelectQueryComposer>& _rxComposer,
+ const css::uno::Reference< css::container::XNameAccess>& _rxCols);
+ virtual ~DlgOrderCrit() override;
+
+ void BuildOrderPart();
+
+ OUString GetOrderList( ) const;
+ const OUString& GetOriginalOrder() const { return m_sOrgOrder; }
+
+ private:
+ void impl_initializeOrderList_nothrow();
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/sbagrid.hrc b/dbaccess/source/ui/inc/sbagrid.hrc
new file mode 100644
index 0000000000..921faa6a9b
--- /dev/null
+++ b/dbaccess/source/ui/inc/sbagrid.hrc
@@ -0,0 +1,37 @@
+/* -*- 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 DBACCESS_SBA_GRID_HRC
+#define DBACCESS_SBA_GRID_HRC
+
+//----------------Menueitems-------------------------------------------------
+// Table
+#define SBA_WHICHID_START 100
+
+// Columns
+// Formatting
+#define SBA_DEF_RANGEFORMAT TypedWhichId<SfxRangeItem>(SBA_WHICHID_START+143) // RangeItem
+#define SBA_DEF_FMTVALUE TypedWhichId<SfxUInt32Item>(SBA_WHICHID_START+144) // SfxULONG, Format
+
+// Justification
+#define SBA_ATTR_ALIGN_HOR_JUSTIFY (SBA_WHICHID_START + 145) // SvxHorJustifyItem
+
+#endif // DBACCESS_SBA_GRID_HRC
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx
new file mode 100644
index 0000000000..ae96bb291b
--- /dev/null
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -0,0 +1,291 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <svx/fmgridcl.hxx>
+
+#include <svx/fmgridif.hxx>
+
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <comphelper/multiinterfacecontainer4.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <comphelper/uno3.hxx>
+#include "sbamultiplex.hxx"
+#include <svx/dataaccessdescriptor.hxx>
+#include <rtl/ref.hxx>
+#include <map>
+#include <queue>
+
+class SvNumberFormatter;
+
+namespace com::sun::star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}
+
+namespace dbaui
+{
+ struct SbaURLCompare
+ {
+ bool operator() (const css::util::URL& x, const css::util::URL& y) const { return x.Complete == y.Complete; }
+ };
+
+ class SbaXStatusMultiplexer;
+ class SbaXGridControl
+ :public FmXGridControl
+ ,public css::frame::XDispatch
+ {
+ typedef std::map<css::util::URL, rtl::Reference<SbaXStatusMultiplexer>, SbaURLCompare> StatusMultiplexerArray;
+ StatusMultiplexerArray m_aStatusMultiplexer;
+
+ public:
+ SbaXGridControl(const css::uno::Reference< css::uno::XComponentContext >&);
+ virtual ~SbaXGridControl() override;
+
+ // UNO
+ DECLARE_UNO3_AGG_DEFAULTS(SbaXGridControl, FmXGridControl)
+ virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type& _rType) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ // css::lang::XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // css::frame::XDispatch
+ virtual void SAL_CALL dispatch(const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs) override;
+ virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL) override;
+ virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL dispose() override;
+
+ virtual void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit > & rToolkit, const css::uno::Reference< css::awt::XWindowPeer > & rParentPeer) override;
+
+ protected:
+ virtual rtl::Reference<FmXGridPeer> imp_CreatePeer(vcl::Window* pParent) override;
+ };
+
+ // SbaXGridPeer
+
+ class SbaXGridPeer final
+ :public FmXGridPeer
+ ,public css::frame::XDispatch
+ {
+ comphelper::OMultiTypeInterfaceContainerHelperVar4< css::util::URL, css::frame::XStatusListener,
+ SbaURLCompare> m_aStatusListeners;
+
+ public:
+ SbaXGridPeer(const css::uno::Reference< css::uno::XComponentContext >&);
+ virtual ~SbaXGridPeer() override;
+
+ // UNO
+ virtual void SAL_CALL acquire() noexcept override { FmXGridPeer::acquire(); }
+ virtual void SAL_CALL release() noexcept override { FmXGridPeer::release(); }
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+
+ // css::frame::XDispatch
+ virtual void SAL_CALL dispatch(const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs) override;
+ virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL) override;
+ virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL) override;
+
+ // css::frame::XDispatchProvider
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL dispose() override;
+
+ private:
+ virtual VclPtr<FmGridControl> imp_CreateControl(vcl::Window* pParent, WinBits nStyle) override;
+ void NotifyStatusChanged(const css::util::URL& aUrl, const css::uno::Reference< css::frame::XStatusListener > & xControl);
+
+ // for any execution of XDispatch::dispatch
+ struct DispatchArgs
+ {
+ css::util::URL aURL;
+ css::uno::Sequence< css::beans::PropertyValue > aArgs;
+ };
+ std::queue< DispatchArgs > m_aDispatchArgs;
+ DECL_LINK( OnDispatchEvent, void*, void );
+
+ // for dynamic states of our 4 dispatchable URLs
+ enum DispatchType
+ {
+ dtBrowserAttribs,
+ dtRowHeight,
+ dtColumnAttribs,
+ dtColumnWidth,
+
+ dtUnknown
+ };
+ static DispatchType classifyDispatchURL( const css::util::URL& _rURL );
+
+ typedef std::map<DispatchType, bool> MapDispatchToBool;
+ MapDispatchToBool m_aDispatchStates;
+ };
+
+ // SbaGridHeader
+
+ class SbaGridHeader
+ :public FmGridHeader
+ ,public DragSourceHelper
+ {
+ public:
+ SbaGridHeader(BrowseBox* pParent);
+ virtual void dispose() override;
+ virtual ~SbaGridHeader() override;
+ protected:
+
+ // FmGridHeader overridables
+ virtual void PreExecuteColumnContextMenu(sal_uInt16 nColId, weld::Menu& rMenu,
+ weld::Menu& rInsertMenu, weld::Menu& rChangeMenu,
+ weld::Menu& rShowMenu) override;
+ virtual void PostExecuteColumnContextMenu(sal_uInt16 nColId, const weld::Menu& rMenu, const OUString& rExecutionResult) override;
+
+ private:
+ // DragSourceHelper overridables
+ virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) override;
+
+ // Window overridables
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+
+ void ImplStartColumnDrag(sal_Int8 _nAction, const Point& _rMousePos);
+ };
+
+ // interfaces for communication between the vcl grid control and a controller
+ class SbaGridListener
+ {
+ public:
+ virtual void RowChanged() = 0;
+ virtual void ColumnChanged() = 0;
+ virtual void SelectionChanged() = 0;
+ virtual void CellActivated() = 0;
+ virtual void CellDeactivated() = 0;
+ virtual void BeforeDrop() = 0;
+ virtual void AfterDrop() = 0;
+
+ protected:
+ ~SbaGridListener() {}
+ };
+
+ // SbaGridControl
+ class SbaGridControl final : public FmGridControl
+ {
+ friend class SbaGridHeader;
+ friend class SbaXGridPeer;
+
+ // Attributes
+ svx::ODataAccessDescriptor m_aDataDescriptor;
+ SbaGridListener* m_pMasterListener;
+
+ ImplSVEvent * m_nAsyncDropEvent;
+
+ bool m_bActivatingForDrop;
+
+ public:
+ SbaGridControl(css::uno::Reference< css::uno::XComponentContext > const & _rM, Window* pParent, FmXGridPeer* _pPeer, WinBits nBits);
+ virtual ~SbaGridControl() override;
+ virtual void dispose() override;
+
+ virtual void Select() override;
+
+ void SetMasterListener(SbaGridListener* pListener) { m_pMasterListener = pListener; }
+
+ virtual void ActivateCell(sal_Int32 nRow, sal_uInt16 nCol, bool bSetCellFocus = true) override;
+ virtual void DeactivateCell(bool bUpdate = true) override;
+ using FmGridControl::ActivateCell;
+
+ bool IsAllSelected() const { return (GetSelectRowCount() == GetRowCount()) && (GetRowCount() > 0); }
+
+ HeaderBar* GetHeaderBar() const { return FmGridControl::GetHeaderBar(); }
+
+ /** return the description of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar column/row cell
+ @return
+ The description of the specified object.
+ */
+ virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
+
+ using FmGridControl::DeleteSelectedRows;
+ /** copies the currently selected rows to the clipboard
+ @precond
+ at least one row is selected
+ */
+ void CopySelectedRowsToClipboard();
+
+ private:
+ // DragSourceHelper overridables
+ virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) override;
+
+ // BrowseBox overridables
+ virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt ) override;
+ virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt ) override;
+ virtual void MouseButtonDown( const BrowserMouseEvent& rMEvt) override;
+
+ // EditBrowseBox overridables
+ virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) override;
+ virtual ::svt::CellController* GetController(sal_Int32 nRow, sal_uInt16 nCol) override;
+
+ // DbGridControl overridables
+ virtual void PreExecuteRowContextMenu(weld::Menu& rMenu) override;
+ virtual void PostExecuteRowContextMenu(const OUString& rExecutionResult) override;
+
+ // DbGridControl overridables
+ virtual void onRowChange() override;
+ virtual void onColumnChange() override;
+
+ // get a fields property set from a model pos
+ css::uno::Reference< css::beans::XPropertySet > getField(sal_uInt16 nModelPos);
+
+ // get my data source
+ css::uno::Reference< css::beans::XPropertySet > getDataSource() const;
+
+ // drag events
+ void DoColumnDrag(sal_uInt16 nColumnPos);
+ void DoFieldDrag(sal_uInt16 nColumnPos, sal_Int16 nRowPos);
+
+ void SetBrowserAttrs();
+ void SetColWidth(sal_uInt16 nColId);
+ void SetRowHeight();
+ void SetColAttrs(sal_uInt16 nColId);
+
+ SvNumberFormatter* GetDatasourceFormatter();
+
+ DECL_LINK(AsynchDropEvent, void*, void);
+
+ bool IsReadOnlyDB() const;
+ void implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfClipboardFalseIfDrag );
+
+ using FmGridControl::AcceptDrop;
+ using FmGridControl::ExecuteDrop;
+ using FmGridControl::MouseButtonDown;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/sbamultiplex.hxx b/dbaccess/source/ui/inc/sbamultiplex.hxx
new file mode 100644
index 0000000000..47fd753d4a
--- /dev/null
+++ b/dbaccess/source/ui/inc/sbamultiplex.hxx
@@ -0,0 +1,305 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/beans/XVetoableChangeListener.hpp>
+#include <com/sun/star/form/XDatabaseParameterListener.hpp>
+#include <com/sun/star/form/XLoadListener.hpp>
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/form/XSubmitListener.hpp>
+#include <com/sun/star/form/XResetListener.hpp>
+#include <com/sun/star/sdb/XSQLErrorListener.hpp>
+#include <com/sun/star/sdb/XRowSetApproveListener.hpp>
+#include <com/sun/star/sdbc/XRowSetListener.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <comphelper/uno3.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/multiinterfacecontainer3.hxx>
+#include <cppuhelper/weak.hxx>
+
+namespace dbaui
+{
+ // TODO : replace this class if MM provides a WeakSubObject in cppu
+ class OSbaWeakSubObject : public ::cppu::OWeakObject
+ {
+ protected:
+ ::cppu::OWeakObject& m_rParent;
+
+ public:
+ OSbaWeakSubObject(::cppu::OWeakObject& rParent) : m_rParent(rParent) { }
+
+ virtual void SAL_CALL acquire() noexcept override { m_rParent.acquire(); }
+ virtual void SAL_CALL release() noexcept override { m_rParent.release(); }
+ };
+
+ // some listener multiplexers
+ // css::frame::XStatusListener
+ class SbaXStatusMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::frame::XStatusListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::frame::XStatusListener>
+ {
+ public:
+ SbaXStatusMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXStatusMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& e) override;
+
+ private:
+ css::frame::FeatureStateEvent m_aLastKnownStatus;
+ public:
+ const css::frame::FeatureStateEvent& getLastEvent( ) const { return m_aLastKnownStatus; }
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
+
+ // css::form::XLoadListener
+ class SbaXLoadMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::form::XLoadListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::form::XLoadListener>
+ {
+ public:
+ SbaXLoadMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXLoadMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ virtual void SAL_CALL loaded(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL unloaded(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL unloading(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL reloading(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL reloaded(const css::lang::EventObject& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
+
+ // css::form::XDatabaseParameterListener
+ class SbaXParameterMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::form::XDatabaseParameterListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::form::XDatabaseParameterListener>
+ {
+ public:
+ SbaXParameterMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXParameterMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual sal_Bool SAL_CALL approveParameter(const css::form::DatabaseParameterEvent& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
+
+ // css::form::XSubmitListener
+ class SbaXSubmitMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::form::XSubmitListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::form::XSubmitListener>
+ {
+ public:
+ SbaXSubmitMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXSubmitMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual sal_Bool SAL_CALL approveSubmit(const css::lang::EventObject& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
+
+ // css::form::XResetListener
+ class SbaXResetMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::form::XResetListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::form::XResetListener>
+ {
+ public:
+ SbaXResetMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXResetMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual sal_Bool SAL_CALL approveReset(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL resetted(const css::lang::EventObject& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
+
+ // css::sdbc::XRowSetListener
+ class SbaXRowSetMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::sdbc::XRowSetListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::sdbc::XRowSetListener>
+ {
+ public:
+ SbaXRowSetMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXRowSetMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual void SAL_CALL cursorMoved(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL rowChanged(const css::lang::EventObject& e) override;
+ virtual void SAL_CALL rowSetChanged(const css::lang::EventObject& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
+
+ // css::sdb::XRowSetApproveListener
+ class SbaXRowSetApproveMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::sdb::XRowSetApproveListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::sdb::XRowSetApproveListener>
+ {
+ public:
+ SbaXRowSetApproveMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXRowSetApproveMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual sal_Bool SAL_CALL approveCursorMove(const css::lang::EventObject& e) override;
+ virtual sal_Bool SAL_CALL approveRowChange(const css::sdb::RowChangeEvent& e) override;
+ virtual sal_Bool SAL_CALL approveRowSetChange(const css::lang::EventObject& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
+
+ // css::sdb::XSQLErrorListener
+ class SbaXSQLErrorMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::sdb::XSQLErrorListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::sdb::XSQLErrorListener>
+ {
+ public:
+ SbaXSQLErrorMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXSQLErrorMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual void SAL_CALL errorOccured(const css::sdb::SQLErrorEvent& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
+
+ // css::beans::XPropertyChangeListener
+ class SbaXPropertyChangeMultiplexer final
+ :public OSbaWeakSubObject
+ ,public css::beans::XPropertyChangeListener
+ {
+ typedef ::comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XPropertyChangeListener, OUString> ListenerContainerMap;
+ ListenerContainerMap m_aListeners;
+
+ public:
+ SbaXPropertyChangeMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS(SbaXPropertyChangeMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& e) override;
+
+ void addInterface(const OUString& rName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rListener);
+ void removeInterface(const OUString& rName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rListener);
+
+ void disposeAndClear();
+
+ sal_Int32 getOverallLen() const;
+
+ ::comphelper::OInterfaceContainerHelper3<css::beans::XPropertyChangeListener>* getContainer(const OUString& rName)
+ { return m_aListeners.getContainer(rName); }
+
+ private:
+ void Notify(::comphelper::OInterfaceContainerHelper3<css::beans::XPropertyChangeListener>& rListeners, const css::beans::PropertyChangeEvent& e);
+ };
+
+ // css::beans::XVetoableChangeListener
+ class SbaXVetoableChangeMultiplexer final
+ :public OSbaWeakSubObject
+ ,public css::beans::XVetoableChangeListener
+ {
+ typedef ::comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XVetoableChangeListener, OUString > ListenerContainerMap;
+ ListenerContainerMap m_aListeners;
+
+ public:
+ SbaXVetoableChangeMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS(SbaXVetoableChangeMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ virtual void SAL_CALL vetoableChange(const css::beans::PropertyChangeEvent& e) override;
+
+ void addInterface(const OUString& rName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rListener);
+ void removeInterface(const OUString& rName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rListener);
+
+ void disposeAndClear();
+
+ sal_Int32 getOverallLen() const;
+
+ private:
+ void Notify(::comphelper::OInterfaceContainerHelper3<css::beans::XVetoableChangeListener>& rListeners, const css::beans::PropertyChangeEvent& e);
+ };
+
+ // css::beans::XPropertiesChangeListener
+ class SbaXPropertiesChangeMultiplexer
+ :public OSbaWeakSubObject
+ ,public css::beans::XPropertiesChangeListener
+ ,public ::comphelper::OInterfaceContainerHelper3<css::beans::XPropertiesChangeListener>
+ {
+ public:
+ SbaXPropertiesChangeMultiplexer(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(SbaXPropertiesChangeMultiplexer, OSbaWeakSubObject)
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ /* css::lang::XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+ virtual void SAL_CALL propertiesChange(const css::uno::Sequence< css::beans::PropertyChangeEvent >& e) override;
+ /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper2 have these memory operators */
+ using OSbaWeakSubObject::operator new;
+ using OSbaWeakSubObject::operator delete;
+ };
+ // the SbaXPropertiesChangeMultiplexer doesn't care about the property names a listener logs on for, it simply
+ // forwards _all_ changes to _all_ listeners
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/singledoccontroller.hxx b/dbaccess/source/ui/inc/singledoccontroller.hxx
new file mode 100644
index 0000000000..6b535882bc
--- /dev/null
+++ b/dbaccess/source/ui/inc/singledoccontroller.hxx
@@ -0,0 +1,78 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <dbaccess/dbsubcomponentcontroller.hxx>
+
+#include <com/sun/star/document/XUndoManagerSupplier.hpp>
+
+#include <cppuhelper/implbase.hxx>
+
+class SfxUndoAction;
+class SfxUndoManager;
+
+namespace dbaui
+{
+class UndoManager;
+
+ typedef ::cppu::ImplInheritanceHelper< DBSubComponentController
+ , css::document::XUndoManagerSupplier
+ > OSingleDocumentController_Base;
+ class OSingleDocumentController : public OSingleDocumentController_Base
+ {
+ protected:
+ OSingleDocumentController( const css::uno::Reference< css::uno::XComponentContext>& _rxORB );
+ virtual ~OSingleDocumentController() override;
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+
+ public:
+ /// need for undo's and redo's
+ SfxUndoManager& GetUndoManager() const;
+
+ /// complete clears the Undo/Redo stacks
+ void ClearUndoManager();
+
+ /** addUndoActionAndInvalidate adds an undo action to the undoManager,
+ additionally invalidates the UNDO and REDO slot
+ @param pAction the undo action to add
+ */
+ void addUndoActionAndInvalidate( std::unique_ptr<SfxUndoAction> pAction );
+
+ // OGenericUnoController
+ virtual FeatureState GetState( sal_uInt16 nId ) const override;
+ virtual void Execute( sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs ) override;
+
+ // XUndoManagerSupplier
+ virtual css::uno::Reference< css::document::XUndoManager > SAL_CALL getUndoManager( ) override;
+
+ // XEventListener
+ using OSingleDocumentController_Base::disposing;
+
+ private:
+ // no Reference! see UndoManager::acquire
+ std::unique_ptr<UndoManager> m_pUndoManager;
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/sqledit.hxx b/dbaccess/source/ui/inc/sqledit.hxx
new file mode 100644
index 0000000000..d0f8672cc6
--- /dev/null
+++ b/dbaccess/source/ui/inc/sqledit.hxx
@@ -0,0 +1,100 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <comphelper/syntaxhighlight.hxx>
+#include <rtl/ref.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svx/weldeditview.hxx>
+#include <vcl/timer.hxx>
+#include <mutex>
+
+namespace com::sun::star::beans { class XMultiPropertySet; }
+
+namespace dbaui
+{
+ class SQLEditView final : public WeldEditView, public utl::ConfigurationListener
+ {
+ private:
+ class ChangesListener;
+ friend class ChangesListener;
+
+ std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
+ Link<LinkParamNone*,void> m_aModifyLink;
+ const svtools::ColorConfig m_aColorConfig;
+ Timer m_aUpdateDataTimer;
+ const SyntaxHighlighter m_aHighlighter;
+ svtools::ColorConfig m_ColorConfig;
+ rtl::Reference<SfxItemPool> m_pItemPool;
+
+ rtl::Reference<ChangesListener> m_listener;
+ std::mutex m_mutex;
+ css::uno::Reference<css::beans::XMultiPropertySet> m_notifier;
+
+ bool m_bInUpdate;
+ bool m_bDisableInternalUndo;
+
+ DECL_LINK(ModifyHdl, LinkParamNone*, void);
+ DECL_LINK(ImplUpdateDataHdl, Timer*, void);
+ DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
+ DECL_LINK(EditStatusHdl, EditStatus&, void);
+
+ Color GetColorValue(TokenType aToken);
+
+ void ImplSetFont();
+
+ void DoBracketHilight(sal_uInt16 nKey);
+
+ static void SetItemPoolFont(SfxItemPool* pItemPool);
+
+ void UpdateData();
+
+ void SetScrollBarRange();
+ void DoScroll();
+
+ virtual void EditViewScrollStateChange() override;
+
+ public:
+ SQLEditView(std::unique_ptr<weld::ScrolledWindow> xScrolledWindow);
+ virtual void makeEditEngine() override;
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual ~SQLEditView() override;
+
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
+ virtual bool Command(const CommandEvent& rCEvt) override;
+
+ void SetTextAndUpdate(const OUString& rNewText);
+
+ void SetModifyHdl(const Link<LinkParamNone*,void>& rLink)
+ {
+ m_aModifyLink = rLink;
+ }
+
+ void DisableInternalUndo();
+
+ static Color GetSyntaxHighlightColor(const svtools::ColorConfig& rColorConfig, HighlighterLanguage eLanguage, TokenType aToken);
+
+ virtual void ConfigurationChanged(utl::ConfigurationBroadcaster*, ConfigurationHints) override;
+ };
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/sqlmessage.hxx b/dbaccess/source/ui/inc/sqlmessage.hxx
new file mode 100644
index 0000000000..481732985d
--- /dev/null
+++ b/dbaccess/source/ui/inc/sqlmessage.hxx
@@ -0,0 +1,145 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <connectivity/dbexception.hxx>
+#include <vcl/weld.hxx>
+#include <memory>
+
+// some forwards
+namespace com::sun::star {
+ namespace sdb {
+ class SQLContext;
+ }
+ namespace sdbc {
+ class SQLException;
+ }
+}
+
+namespace dbaui
+{
+
+enum MessageType
+{
+ Info,
+ Error,
+ Warning,
+ Query,
+ AUTO
+};
+
+enum class MessBoxStyle {
+ NONE = 0x0000,
+ Ok = 0x0001,
+ OkCancel = 0x0002,
+ YesNo = 0x0004,
+ YesNoCancel = 0x0008,
+ RetryCancel = 0x0010,
+ DefaultOk = 0x0020,
+ DefaultCancel = 0x0040,
+ DefaultRetry = 0x0080,
+ DefaultYes = 0x0100,
+ DefaultNo = 0x0200,
+};
+
+}
+
+namespace o3tl {
+ template<> struct typed_flags<dbaui::MessBoxStyle> : is_typed_flags<dbaui::MessBoxStyle, 0x03ff> {};
+}
+
+
+namespace dbaui
+{
+
+// OSQLMessageBox
+struct SQLMessageBox_Impl;
+class OSQLMessageBox : public weld::DialogController
+{
+ std::unique_ptr<weld::MessageDialog> m_xDialog;
+ std::unique_ptr<weld::Button> m_xMoreButton;
+ std::unique_ptr<SQLMessageBox_Impl> m_pImpl;
+ OUString m_sHelpURL;
+
+ virtual weld::Dialog* getDialog() override { return m_xDialog.get(); }
+public:
+ /** display an SQLException with auto-recognizing a main and a detailed message
+
+ The first two messages from the exception chain are used as main and detailed message (recognizing the
+ detailed field of an <type scope="css::sdb">SQLContext</type>).
+ */
+ OSQLMessageBox(
+ weld::Window* pParent,
+ const dbtools::SQLExceptionInfo& _rException,
+ MessBoxStyle _nStyle = MessBoxStyle::Ok | MessBoxStyle::DefaultOk,
+ OUString _sHelpURL = OUString()
+ );
+
+ /** display a database related error message
+
+ @param rTitle the title to display
+ @param rMessage the detailed message to display
+ @param _eType determines the image to use. AUTO is disallowed in this constructor version
+ */
+ OSQLMessageBox(weld::Window* pParent,
+ const OUString& rTitle,
+ const OUString& rMessage,
+ MessBoxStyle nStyle = MessBoxStyle::Ok | MessBoxStyle::DefaultOk,
+ MessageType _eType = Info,
+ const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = nullptr );
+
+ void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
+ void add_button(const OUString& rText, int nResponse, const OUString& rHelpId = {}) { m_xDialog->add_button(rText, nResponse, rHelpId); }
+ void set_default_response(int nResponse) { m_xDialog->set_default_response(nResponse); }
+
+ virtual ~OSQLMessageBox() override;
+
+private:
+ void Construct(weld::Window* pParent, MessBoxStyle nStyle, MessageType eImage);
+
+ DECL_LINK(ButtonClickHdl, weld::Button&, void);
+
+private:
+ void impl_fillMessages();
+ void impl_createStandardButtons( MessBoxStyle _nStyle );
+ void impl_addDetailsButton();
+};
+
+// OSQLWarningBox
+class OSQLWarningBox : public OSQLMessageBox
+{
+public:
+ OSQLWarningBox( weld::Window* pParent,
+ const OUString& _rMessage,
+ MessBoxStyle _nStyle = MessBoxStyle::Ok | MessBoxStyle::DefaultOk,
+ const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = nullptr );
+};
+
+// OSQLErrorBox
+class OSQLErrorBox : public OSQLMessageBox
+{
+public:
+ OSQLErrorBox( weld::Window* pParent,
+ const OUString& _rMessage );
+};
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/stringlistitem.hxx b/dbaccess/source/ui/inc/stringlistitem.hxx
new file mode 100644
index 0000000000..3d16f6770c
--- /dev/null
+++ b/dbaccess/source/ui/inc/stringlistitem.hxx
@@ -0,0 +1,48 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <svl/poolitem.hxx>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+
+namespace dbaui
+{
+// OStringListItem
+/** <type>SfxPoolItem</type> which transports a sequence of <type scope="rtl">OUString</type>'s
+*/
+class OStringListItem : public SfxPoolItem
+{
+ css::uno::Sequence<OUString> m_aList;
+
+public:
+ OStringListItem(sal_Int16 nWhich, const css::uno::Sequence<OUString>& _rList);
+ OStringListItem(const OStringListItem& _rSource);
+
+ virtual bool operator==(const SfxPoolItem& _rItem) const override;
+ virtual OStringListItem* Clone(SfxItemPool* _pPool = nullptr) const override;
+
+ const css::uno::Sequence<OUString>& getList() const { return m_aList; }
+};
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/tabletree.hxx b/dbaccess/source/ui/inc/tabletree.hxx
new file mode 100644
index 0000000000..ebfbf7d29c
--- /dev/null
+++ b/dbaccess/source/ui/inc/tabletree.hxx
@@ -0,0 +1,155 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include "imageprovider.hxx"
+#include "dbtreelistbox.hxx"
+
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
+#include <memory>
+
+namespace dbaui
+{
+
+// OTableTreeListBox
+class OTableTreeListBox : public TreeListBox
+{
+ css::uno::Reference< css::sdbc::XConnection >
+ m_xConnection; // the connection we're working for, set in implOnNewConnection, called by UpdateTableList
+ std::unique_ptr< ImageProvider >
+ m_xImageProvider; // provider for our images
+ bool m_bVirtualRoot; // should the first entry be visible
+ bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed?
+ bool m_bShowToggles; // show toggle buttons
+
+public:
+ OTableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bShowToggles);
+
+ void init() { m_bVirtualRoot = true; }
+
+ typedef std::pair< OUString, bool > TTableViewName;
+ typedef std::vector< TTableViewName > TNames;
+
+ void SuppressEmptyFolders() { m_bNoEmptyFolders = true; }
+
+ /** determines whether the given entry denotes a tables folder
+ */
+ bool isFolderEntry(const weld::TreeIter& rEntry) const;
+
+ /** fill the table list with the tables belonging to the connection described by the parameters
+ @param _rxConnection
+ the connection, which must support the service com.sun.star.sdb.Connection
+ @throws
+ <type scope="css::sdbc">SQLException</type> if no connection could be created
+ */
+ void UpdateTableList(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
+ );
+
+ /** fill the table list with the tables and views determined by the two given containers.
+ The views sequence is used to determine which table is of type view.
+ @param _rxConnection the connection where you got the object names from. Must not be NULL.
+ Used to split the full qualified names into its parts.
+ @param _rTables table/view sequence
+ @param _rViews view sequence
+ */
+ void UpdateTableList(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const css::uno::Sequence< OUString>& _rTables,
+ const css::uno::Sequence< OUString>& _rViews
+ );
+
+ /** to be used if a foreign instance added a table
+ */
+ std::unique_ptr<weld::TreeIter> addedTable( const OUString& _rName );
+
+ /** to be used if a foreign instance removed a table
+ */
+ void removedTable( const OUString& _rName );
+
+ std::unique_ptr<weld::TreeIter> getAllObjectsEntry() const;
+
+ /** does a wildcard check of the given entry
+ <p>There are two different 'checked' states: If the user checks all children of an entry, this is different
+ from checking the entry itself. The second is called 'wildcard' checking, 'cause in the resulting
+ table filter it's represented by a wildcard.</p>
+ */
+ void checkWildcard(const weld::TreeIter& rEntry);
+
+ /** determine if the given entry is 'wildcard checked'
+ @see checkWildcard
+ */
+ bool isWildcardChecked(const weld::TreeIter& rEntry);
+
+ void CheckButtons(); // make the button states consistent (bottom-up)
+
+ void checkedButton_noBroadcast(const weld::TreeIter& rEntry);
+private:
+ TriState implDetermineState(const weld::TreeIter& rEntry);
+
+ void implEmphasize(const weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants = true, bool _bUpdateAncestors = true);
+
+ /** adds the given entry to our list
+ @precond
+ our image provider must already have been reset to the connection to which the meta data
+ belong.
+ */
+ std::unique_ptr<weld::TreeIter> implAddEntry(
+ const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxMeta,
+ const OUString& _rTableName,
+ bool _bCheckName = true
+ );
+
+ void implOnNewConnection( const css::uno::Reference< css::sdbc::XConnection >& _rxConnection );
+
+ bool impl_getAndAssertMetaData( css::uno::Reference< css::sdbc::XDatabaseMetaData >& _out_rMetaData ) const;
+
+ bool haveVirtualRoot() const { return m_bVirtualRoot; }
+
+public:
+ /** fill the table list with the tables and views determined by the two given containers
+ @param _rxConnection the connection where you got the object names from. Must not be NULL.
+ Used to split the full qualified names into its parts.
+ @param _rTables table/view sequence, the second argument is <TRUE/> if it is a table, otherwise it is a view.
+ */
+ void UpdateTableList(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ const TNames& _rTables
+ );
+
+ /** returns a NamedDatabaseObject record which describes the given entry
+ */
+ css::sdb::application::NamedDatabaseObject
+ describeObject(const weld::TreeIter& rEntry);
+
+ /** returns the fully qualified name of a table entry
+ @param _pEntry
+ the entry whose name is to be obtained. Must not denote a folder entry.
+ */
+ OUString getQualifiedTableName(const weld::TreeIter& rEntry) const;
+
+ std::unique_ptr<weld::TreeIter> getEntryByQualifiedName(const OUString& rName);
+};
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/textconnectionsettings.hxx b/dbaccess/source/ui/inc/textconnectionsettings.hxx
new file mode 100644
index 0000000000..9d21c87956
--- /dev/null
+++ b/dbaccess/source/ui/inc/textconnectionsettings.hxx
@@ -0,0 +1,59 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include "propertystorage.hxx"
+#include <vcl/weld.hxx>
+#include <memory>
+
+class SfxItemSet;
+namespace dbaui
+{
+
+ class OTextConnectionHelper;
+
+ // TextConnectionSettingsDialog
+ class TextConnectionSettingsDialog : public weld::GenericDialogController
+ {
+ public:
+ TextConnectionSettingsDialog(weld::Window* _pParent, SfxItemSet& rItems);
+ virtual ~TextConnectionSettingsDialog() override;
+
+ /** initializes a set of PropertyStorage instances, which are bound to
+ the text-connection relevant items in our item sets
+ */
+ static void bindItemStorages( SfxItemSet& _rSet, PropertyValues& _rValues );
+
+ virtual short run() override;
+
+ private:
+ SfxItemSet& m_rItems;
+
+ std::unique_ptr<weld::Widget> m_xContainer;
+ std::unique_ptr<weld::Button> m_xOK;
+ std::unique_ptr<OTextConnectionHelper> m_xTextConnectionHelper;
+
+ private:
+ DECL_LINK(OnOK, weld::Button&, void);
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/undosqledit.hxx b/dbaccess/source/ui/inc/undosqledit.hxx
new file mode 100644
index 0000000000..2b760bbada
--- /dev/null
+++ b/dbaccess/source/ui/inc/undosqledit.hxx
@@ -0,0 +1,45 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include "GeneralUndo.hxx"
+#include <strings.hrc>
+
+namespace dbaui
+{
+ class OQueryTextView;
+
+ // OSqlEditUndoAct - Undo-class for changing sql text
+ class OSqlEditUndoAct final : public OCommentUndoAction
+ {
+ OQueryTextView& m_rOwner;
+ OUString m_strNextText;
+
+ virtual void Undo() override { ToggleText(); }
+ virtual void Redo() override { ToggleText(); }
+
+ void ToggleText();
+ public:
+ OSqlEditUndoAct(OQueryTextView& rEdit) : OCommentUndoAction(STR_QUERY_UNDO_MODIFYSQLEDIT), m_rOwner(rEdit) { }
+
+ void SetOriginalText(const OUString& strText) { m_strNextText = strText; }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/unoadmin.hxx b/dbaccess/source/ui/inc/unoadmin.hxx
new file mode 100644
index 0000000000..944dccf87a
--- /dev/null
+++ b/dbaccess/source/ui/inc/unoadmin.hxx
@@ -0,0 +1,59 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <svtools/genericunodialog.hxx>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <dsntypes.hxx>
+
+class SfxItemSet;
+class SfxItemPool;
+class SfxPoolItem;
+
+namespace dbaui
+{
+
+// ODatabaseAdministrationDialog
+typedef ::svt::OGenericUnoDialog ODatabaseAdministrationDialogBase;
+class ODatabaseAdministrationDialog
+ :public ODatabaseAdministrationDialogBase
+{
+protected:
+ std::unique_ptr<SfxItemSet> m_pDatasourceItems; // item set for the dialog
+ rtl::Reference<SfxItemPool> m_pItemPool; // item pool for the item set for the dialog
+ std::vector<SfxPoolItem*>*
+ m_pItemPoolDefaults; // pool defaults
+ std::unique_ptr<::dbaccess::ODsnTypeCollection>
+ m_pCollection; // datasource type collection
+
+ css::uno::Any m_aInitialSelection;
+ css::uno::Reference< css::sdbc::XConnection > m_xActiveConnection;
+
+protected:
+ ODatabaseAdministrationDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+ virtual ~ODatabaseAdministrationDialog() override;
+protected:
+// OGenericUnoDialog overridables
+ virtual void implInitialize(const css::uno::Any& _rValue) override;
+};
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
new file mode 100644
index 0000000000..093cb8bb6a
--- /dev/null
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -0,0 +1,448 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <memory>
+#include "brwctrlr.hxx"
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/i18n/XCollator.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/document/XScriptInvocationContext.hpp>
+#include <com/sun/star/ui/XContextMenuInterception.hpp>
+#include <com/sun/star/sdb/application/DatabaseObject.hpp>
+#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
+#include <com/sun/star/sdb/XDatabaseRegistrationsListener.hpp>
+#include <comphelper/interfacecontainer2.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include "callbacks.hxx"
+#include <utility>
+#include <vcl/transfer.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include "TableCopyHelper.hxx"
+#include "commontypes.hxx"
+
+class Splitter;
+class ODataClipboard;
+
+namespace com::sun::star::container { class XNameContainer; }
+
+namespace dbaui
+{
+ struct DBTreeEditedEntry;
+ struct DBTreeListUserData;
+ class ImageProvider;
+
+ typedef ::cppu::ImplHelper5 < css::frame::XStatusListener
+ , css::view::XSelectionSupplier
+ , css::document::XScriptInvocationContext
+ , css::ui::XContextMenuInterception
+ , css::sdb::XDatabaseRegistrationsListener
+ > SbaTableQueryBrowser_Base;
+ class SbaTableQueryBrowser final
+ :public SbaXDataBrowserController
+ ,public SbaTableQueryBrowser_Base
+ ,public IControlActionListener
+ ,public IContextMenuProvider
+ {
+ css::uno::Reference< css::i18n::XCollator > m_xCollator;
+ css::uno::Reference< css::frame::XFrame > m_xCurrentFrameParent;
+ css::uno::Reference< css::awt::XWindow > m_xMainToolbar;
+
+ struct ExternalFeature
+ {
+ css::util::URL aURL;
+ css::uno::Reference< css::frame::XDispatch >
+ xDispatcher;
+ bool bEnabled;
+
+ ExternalFeature() : bEnabled( false ) { }
+ ExternalFeature( css::util::URL _aURL ) : aURL(std::move( _aURL )), bEnabled( false ) { }
+ };
+
+ typedef std::map< sal_uInt16, ExternalFeature > ExternalFeaturesMap;
+ ExternalFeaturesMap m_aExternalFeatures;
+
+ svx::ODataAccessDescriptor m_aDocumentDataSource;
+ // if we're part of a document, this is the state of the DocumentDataSource slot
+
+ ::comphelper::OInterfaceContainerHelper2 m_aSelectionListeners;
+ ::comphelper::OInterfaceContainerHelper2 m_aContextMenuInterceptors;
+
+ OTableCopyHelper::DropDescriptor m_aAsyncDrop;
+ OTableCopyHelper m_aTableCopyHelper;
+
+ OUString m_sQueryCommand; // the command of the query currently loaded (if any)
+ //OUString m_sToBeLoaded; // contains the element name which should be loaded if any
+
+ VclPtr<InterimDBTreeListBox> m_pTreeView; // contains the datasources of the registry
+ VclPtr<Splitter> m_pSplitter;
+ std::unique_ptr<weld::TreeIter> m_xCurrentlyDisplayed;
+ ImplSVEvent * m_nAsyncDrop;
+
+ bool m_bQueryEscapeProcessing : 1; // the escape processing flag of the query currently loaded (if any)
+ bool m_bShowMenu; // if sal_True the menu should be visible otherwise not
+ bool m_bInSuspend;
+ bool m_bEnableBrowser;
+ ::std::optional< bool >
+ m_aDocScriptSupport; // relevant if and only if we are associated with exactly one DBDoc
+
+ virtual OUString getPrivateTitle( ) const override;
+ // attribute access
+ public:
+ SbaTableQueryBrowser(const css::uno::Reference< css::uno::XComponentContext >& _rM);
+ virtual ~SbaTableQueryBrowser() override;
+
+ enum EntryType
+ {
+ // don't change the above definitions! There are places (in particular SbaTableQueryBrowser::getCurrentSelection)
+ // which rely on the fact that the EntryType values really equal the DatabaseObject(Container) values!
+ etDatasource = css::sdb::application::DatabaseObjectContainer::DATA_SOURCE,
+ etQueryContainer = css::sdb::application::DatabaseObjectContainer::QUERIES,
+ etTableContainer = css::sdb::application::DatabaseObjectContainer::TABLES,
+ etQuery = css::sdb::application::DatabaseObject::QUERY,
+ etTableOrView = css::sdb::application::DatabaseObject::TABLE,
+ etUnknown = -1
+ };
+
+ /** returns a DatabaseObject value corresponding to the given EntryType
+ @param _eType
+ the entry type. Must not be etUnknown.
+ */
+ static sal_Int32 getDatabaseObjectType( EntryType _eType );
+
+ DECLARE_UNO3_DEFAULTS(SbaTableQueryBrowser,SbaXDataBrowserController)
+ // late construction
+ virtual bool Construct(vcl::Window* pParent) override;
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
+
+ // css::beans::XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override;
+
+ // css::frame::XController
+ virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override;
+ virtual void SAL_CALL attachFrame(const css::uno::Reference< css::frame::XFrame > & xFrame) override;
+
+ // css::lang::XComponent
+ virtual void SAL_CALL disposing() override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XSelectionSupplier
+ virtual sal_Bool SAL_CALL select( const css::uno::Any& aSelection ) override;
+ virtual css::uno::Any SAL_CALL getSelection( ) override;
+ virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
+ virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override;
+ virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override;
+ virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
+ // css::frame::XFrameActionListener
+ virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) override;
+
+ // XScriptInvocationContext
+ virtual css::uno::Reference< css::document::XEmbeddedScripts > SAL_CALL getScriptContainer() override;
+
+ // XContextMenuInterception
+ virtual void SAL_CALL registerContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& Interceptor ) override;
+ virtual void SAL_CALL releaseContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& Interceptor ) override;
+
+ // XDatabaseRegistrationsListener
+ virtual void SAL_CALL registeredDatabaseLocation( const css::sdb::DatabaseRegistrationEvent& Event ) override;
+ virtual void SAL_CALL revokedDatabaseLocation( const css::sdb::DatabaseRegistrationEvent& Event ) override;
+ virtual void SAL_CALL changedDatabaseLocation( const css::sdb::DatabaseRegistrationEvent& Event ) override;
+
+ private:
+ // SbaXDataBrowserController overridable
+ virtual bool InitializeForm( const css::uno::Reference< css::beans::XPropertySet >& i_formProperties ) override;
+
+ void InitializeGridModel(const css::uno::Reference< css::form::XFormComponent > & xGrid);
+
+ virtual bool preReloadForm() override;
+ virtual void postReloadForm() override;
+
+ virtual void addModelListeners(const css::uno::Reference< css::awt::XControlModel > & _xGridControlModel) override;
+ virtual void removeModelListeners(const css::uno::Reference< css::awt::XControlModel > & _xGridControlModel) override;
+
+ virtual void AddColumnListener(const css::uno::Reference< css::beans::XPropertySet > & xCol) override;
+ virtual void RemoveColumnListener(const css::uno::Reference< css::beans::XPropertySet > & xCol) override;
+
+ virtual void LoadFinished(bool _bWasSynch) override;
+
+ virtual void criticalFail() override;
+
+ virtual void describeSupportedFeatures() override;
+ virtual FeatureState GetState(sal_uInt16 nId) const override;
+ virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
+
+ // IControlActionListener overridables
+ virtual bool requestQuickHelp(const void* pUserData, OUString& rText) const override;
+ virtual bool requestDrag(const weld::TreeIter& rEntry) override;
+ virtual sal_Int8 queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors ) override;
+ virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override;
+
+ // IContextMenuProvider
+ virtual OUString getContextMenuResourceName() const override;
+ virtual IController& getCommandController() override;
+ virtual ::comphelper::OInterfaceContainerHelper2*
+ getContextMenuInterceptors() override;
+ virtual css::uno::Any getCurrentSelection(weld::TreeView& rControl) const override;
+ virtual vcl::Window* getMenuParent() const override;
+ virtual void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const override;
+
+ virtual void impl_initialize() override;
+
+ // SbaGridListener overridables
+ virtual void RowChanged() override;
+ virtual void ColumnChanged() override;
+ virtual void SelectionChanged() override;
+
+ // methods for showing/hiding the explorer part
+ bool haveExplorer() const;
+ void hideExplorer();
+ void showExplorer();
+ void toggleExplorer() { if (haveExplorer()) hideExplorer(); else showExplorer(); }
+
+ // methods for handling the 'selection' (painting them bold) of SvLBoxEntries
+ // returns <TRUE/> if the entry is selected (which means it's part of the selected path)
+ bool isSelected(const weld::TreeIter& rEntry) const;
+ // select the entry (and only the entry, not the whole path)
+ void select(const weld::TreeIter* pEntry, bool bSelect);
+ // select the path of the entry (which must be an entry without children)
+ void selectPath(const weld::TreeIter* pEntry, bool bSelect = true);
+
+ virtual void loadMenu(const css::uno::Reference< css::frame::XFrame >& _xFrame) override;
+
+ // check the state of the external slot given, update any UI elements if necessary
+ void implCheckExternalSlot( sal_uInt16 _nId );
+
+ // connect to the external dispatchers (if any)
+ void connectExternalDispatches();
+
+ /** get the state of an external slot
+ <p>The slot is available if an external dispatcher is responsible for it, _and_ if this dispatcher
+ told us the slot is available.</p>
+ */
+ bool getExternalSlotState( sal_uInt16 _nId ) const;
+
+ /** add an entry (including the subentries for queries/tables) to the list model
+
+ <p>The given names and images may be empty, in this case they're filled with the correct
+ values. This way they may be reused for the next call, which saves some resource manager calls.</p>
+ */
+ void implAddDatasource(const OUString& _rDbName, OUString& _rDbImage,
+ OUString& _rQueryName, OUString& _rQueryImage,
+ OUString& _rTableName, OUString& _rTableImage,
+ const SharedConnection& _rxConnection
+ );
+
+ void implAddDatasource( const OUString& _rDataSourceName, const SharedConnection& _rxConnection );
+
+ /// removes (and cleans up) the entry for the given data source
+ void impl_cleanupDataSourceEntry( std::u16string_view _rDataSourceName );
+
+ /// clears the tree list box
+ void clearTreeModel();
+
+ /** unloads the form, empties the grid model, cleans up anything related to the currently displayed object
+ @param _bDisposeConnection
+ <TRUE/> if the connection should be disposed
+ @param _bFlushData
+ <TRUE/> if the currently displayed object (if any) should be flushed
+ */
+ void unloadAndCleanup( bool _bDisposeConnection = true );
+
+ // disposes the connection associated with the given entry (which must represent a data source)
+ void disposeConnection(const weld::TreeIter* xpDSEntry);
+
+ /// flushes and disposes the given connection, and de-registers as listener
+ void impl_releaseConnection( SharedConnection& _rxConnection );
+
+ /** close the connection (and collapse the list entries) of the given list entries
+ */
+ void closeConnection(const weld::TreeIter& rEntry, bool bDisposeConnection = true);
+
+ void populateTree(const css::uno::Reference< css::container::XNameAccess>& xNameAccess, const weld::TreeIter& rParent, EntryType eEntryType);
+ void initializeTreeModel();
+
+ /** search in the tree for query- or tablecontainer equal to this interface and return
+ this container entry
+ */
+ std::unique_ptr<weld::TreeIter> getEntryFromContainer(const css::uno::Reference<css::container::XNameAccess>& rxNameAccess);
+
+ // return true when there is connection available
+ bool ensureConnection(const weld::TreeIter* pDSEntry, void * pDSData, SharedConnection& rConnection);
+ bool ensureConnection(const weld::TreeIter* pAnyEntry, SharedConnection& rConnection);
+
+ bool getExistentConnectionFor(const weld::TreeIter* pDSEntry, SharedConnection& rConnection);
+ /** returns an image provider which works with the connection belonging to the given entry
+ */
+ std::unique_ptr<ImageProvider> getImageProviderFor(const weld::TreeIter* pAnyEntry);
+
+ void implAdministrate(const weld::TreeIter& rApplyTo);
+
+ bool implCopyObject(ODataClipboard& rExchange, const weld::TreeIter& rApplyTo, sal_Int32 nCommandType);
+
+ EntryType getEntryType(const weld::TreeIter& rEntry) const;
+ EntryType getChildType(const weld::TreeIter& rEntry) const;
+ static bool isObject( EntryType _eType ) { return ( etTableOrView== _eType ) || ( etQuery == _eType ); }
+ static bool isContainer( EntryType _eType ) { return (etTableContainer == _eType) || (etQueryContainer == _eType); }
+ bool isContainer(const weld::TreeIter& rEntry) const { return isContainer(getEntryType(rEntry)); }
+
+ // ensure that the xObject for the given entry is set on the user data
+ bool ensureEntryObject(const weld::TreeIter& rEntry);
+
+ // get the display text of the entry given
+ OUString GetEntryText(const weld::TreeIter& rEntry) const;
+
+ // is called when a table or a query was selected
+ DECL_LINK( OnSelectionChange, LinkParamNone*, void );
+ DECL_LINK( OnExpandEntry, const weld::TreeIter&, bool );
+
+ DECL_LINK( OnCopyEntry, LinkParamNone*, void );
+
+ int OnTreeEntryCompare(const weld::TreeIter& rLHS, const weld::TreeIter& rRHS);
+
+ DECL_LINK( OnAsyncDrop, void*, void );
+
+ void implRemoveStatusListeners();
+
+ bool implSelect(const svx::ODataAccessDescriptor& _rDescriptor, bool _bSelectDirect = false);
+ bool implSelect(const weld::TreeIter* pEntry);
+
+ /// selects the entry given and loads the grid control with the object's data
+ bool implSelect(
+ const OUString& _rDataSourceName,
+ const OUString& _rCommand,
+ const sal_Int32 _nCommandType,
+ const bool _bEscapeProcessing,
+ const SharedConnection& _rxConnection,
+ bool _bSelectDirect
+ );
+
+ std::unique_ptr<weld::TreeIter> implGetConnectionEntry(const weld::TreeIter& rEntry) const;
+ /// inserts an entry into the tree
+ std::unique_ptr<weld::TreeIter> implAppendEntry(
+ const weld::TreeIter* pParent,
+ const OUString& rName,
+ const DBTreeListUserData* pUserData);
+
+ /// loads the grid control with the data object specified (which may be a table, a query or a command)
+ bool implLoadAnything(const OUString& _rDataSourceName, const OUString& _rCommand,
+ const sal_Int32 _nCommandType, const bool _bEscapeProcessing, const SharedConnection& _rxConnection );
+
+ /** retrieves the tree entry for the object described by <arg>_rDescriptor</arg>
+ @param rDescriptor
+ the object descriptor
+ @param ppDataSourceEntry
+ If not <NULL/>, the data source tree entry will be returned here
+ @param ppContainerEntry
+ If not <NULL/>, the object container tree entry will be returned here
+ */
+ std::unique_ptr<weld::TreeIter> getObjectEntry(const svx::ODataAccessDescriptor& rDescriptor,
+ std::unique_ptr<weld::TreeIter>* ppDataSourceEntry, std::unique_ptr<weld::TreeIter>* ppContainerEntry
+ );
+ /** retrieves the tree entry for the object described by data source name, command and command type
+ @param rDataSource
+ the data source name
+ @param rCommand
+ the command
+ @param nCommandType
+ the command type
+ @param rDescriptor
+ the object descriptor
+ @param ppDataSourceEntry
+ If not <NULL/>, the data source tree entry will be returned here
+ @param ppContainerEntry
+ If not <NULL/>, the object container tree entry will be returned here
+ @param bExpandAncestors
+ If <TRUE/>, all ancestor on the way to the entry will be expanded
+ */
+ std::unique_ptr<weld::TreeIter> getObjectEntry(
+ const OUString& rDataSource, const OUString& rCommand, sal_Int32 nCommandType,
+ std::unique_ptr<weld::TreeIter>* ppDataSourceEntry, std::unique_ptr<weld::TreeIter>* ppContainerEntry,
+ bool _bExpandAncestors = true,
+ const SharedConnection& rxConnection = SharedConnection()
+ );
+
+ /// checks if m_aDocumentDataSource describes a known object
+ void checkDocumentDataSource();
+
+ static void extractDescriptorProps(const svx::ODataAccessDescriptor& _rDescriptor,
+ OUString& _rDataSource, OUString& _rCommand, sal_Int32& _rCommandType, bool& _rEscapeProcessing);
+
+ void transferChangedControlProperty(const OUString& _rProperty, const css::uno::Any& _rNewValue);
+
+ // checks whether the given tree entry denotes a data source
+ bool impl_isDataSourceEntry(const weld::TreeIter* pEntry) const;
+
+ /// retrieves the data source URL/name for the given entry representing a data source
+ OUString getDataSourceAccessor(const weld::TreeIter& rDataSourceEntry) const;
+
+ /** get the signature (command/escape processing) of the query the form is based on
+ <p>If the for is not based on a query or not even loaded, nothing happens and <FALSE/> is returned.</p>
+ */
+ bool implGetQuerySignature( OUString& _rCommand, bool& _bEscapeProcessing );
+
+ bool isEntryCopyAllowed(const weld::TreeIter& rEntry) const;
+
+ void copyEntry(const weld::TreeIter& rEntry);
+
+ // remove all grid columns and dispose them
+ static void clearGridColumns(const css::uno::Reference< css::container::XNameContainer >& _xColContainer);
+
+ /** checks if the currently displayed entry changed
+ @param rName
+ Name of the changed entry
+ @param rContainer
+ The container of the displayed entry
+ @return
+ <TRUE/> if it is the currently displayed otherwise <FALSE/>
+ */
+ bool isCurrentlyDisplayedChanged(std::u16string_view rName, const weld::TreeIter& rContainer);
+
+ /** called whenever the content of the browser is used for preview, as the very last action
+ of the load process
+ */
+ void initializePreviewMode();
+
+ /** checks whether the Order/Filter clauses set at our row set are valid, removes them if not so
+ */
+ void impl_sanitizeRowSetClauses_nothrow();
+ };
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/unosqlmessage.hxx b/dbaccess/source/ui/inc/unosqlmessage.hxx
new file mode 100644
index 0000000000..c084ef240b
--- /dev/null
+++ b/dbaccess/source/ui/inc/unosqlmessage.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 .
+ */
+
+#pragma once
+
+#include <svtools/genericunodialog.hxx>
+#include <comphelper/proparrhlp.hxx>
+
+namespace dbaui
+{
+
+typedef ::svt::OGenericUnoDialog OSQLMessageDialogBase;
+class OSQLMessageDialog final
+ :public OSQLMessageDialogBase
+ ,public ::comphelper::OPropertyArrayUsageHelper< OSQLMessageDialog >
+{
+ // <properties>
+ css::uno::Any m_aException;
+ OUString m_sHelpURL;
+ // </properties>
+
+public:
+ OSQLMessageDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+
+ // 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;
+
+ // 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:
+ virtual void SAL_CALL initialize(css::uno::Sequence< css::uno::Any > const & args) override;
+
+// OPropertySetHelper overridables
+ // (overwriting these three, because we have some special handling for our property)
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& _rConvertedValue, css::uno::Any& _rOldValue, sal_Int32 _nHandle, const css::uno::Any& _rValue) override;
+
+ // OGenericUnoDialog overridables
+ virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+};
+
+} // namespace dbaui
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */