summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/inc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-17 17:28:58 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-08-18 12:18:34 +0200
commitbe3b1a8393ca3e77f31bea5d9caa7271fd53e9e4 (patch)
treeee82b947c5b3ba648a664dbc5b4be662ce84906c /dbaccess/source/ui/inc
parentf1a458a508cd300117338f9005bff82a923c4a60 (diff)
weld OAppDetailPageHelper
Change-Id: I0fa9f21c30bba8f781178b0811f3f7d755af1bb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100627 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source/ui/inc')
-rw-r--r--dbaccess/source/ui/inc/adtabdlg.hxx2
-rw-r--r--dbaccess/source/ui/inc/callbacks.hxx10
-rw-r--r--dbaccess/source/ui/inc/dbtreelistbox.hxx42
-rw-r--r--dbaccess/source/ui/inc/tabletree.hxx122
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx5
5 files changed, 71 insertions, 110 deletions
diff --git a/dbaccess/source/ui/inc/adtabdlg.hxx b/dbaccess/source/ui/inc/adtabdlg.hxx
index bad72a5f6830..a57c27ee6677 100644
--- a/dbaccess/source/ui/inc/adtabdlg.hxx
+++ b/dbaccess/source/ui/inc/adtabdlg.hxx
@@ -61,7 +61,7 @@ namespace dbaui
std::unique_ptr<weld::RadioButton> m_xCaseTables;
std::unique_ptr<weld::RadioButton> m_xCaseQueries;
- std::unique_ptr<TableTreeListBox> m_xTableList;
+ std::unique_ptr<OTableTreeListBox> m_xTableList;
std::unique_ptr<weld::TreeView> m_xQueryList;
std::unique_ptr<weld::Button> m_xAddButton;
diff --git a/dbaccess/source/ui/inc/callbacks.hxx b/dbaccess/source/ui/inc/callbacks.hxx
index 8ce83ec2edb9..d55edc6a63cb 100644
--- a/dbaccess/source/ui/inc/callbacks.hxx
+++ b/dbaccess/source/ui/inc/callbacks.hxx
@@ -30,9 +30,15 @@ struct ExecuteDropEvent;
namespace comphelper { class OInterfaceContainerHelper2; }
+namespace vcl
+{
+ class Window;
+}
+
namespace weld
{
class TreeIter;
+ class TreeView;
}
namespace dbaui
@@ -91,7 +97,9 @@ namespace dbaui
This selection is used for filling a ContextMenuExecuteEvent event for the given
control.
*/
- virtual css::uno::Any getCurrentSelection( Control& _rControl ) const = 0;
+ virtual css::uno::Any getCurrentSelection(weld::TreeView& rControl) const = 0;
+
+ virtual vcl::Window* getMenuParent(weld::TreeView& rControl) const = 0;
protected:
~IContextMenuProvider() {}
diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx
index 2c631875dabe..17f6cccce9e3 100644
--- a/dbaccess/source/ui/inc/dbtreelistbox.hxx
+++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx
@@ -77,7 +77,7 @@ namespace dbaui
private:
Timer m_aTimer; // is needed for table updates
- rtl::Reference<ODataClipboard> m_xHelper;
+ 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
@@ -91,10 +91,9 @@ namespace dbaui
void implStartSelectionTimer();
virtual bool DoChildKeyInput(const KeyEvent& rKEvt);
- virtual bool DoContextMenu(const CommandEvent& rCEvt);
public:
- TreeListBox(std::unique_ptr<weld::TreeView> xTreeView);
+ TreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bSQLType);
virtual ~TreeListBox();
std::unique_ptr<weld::TreeIter> GetEntryPosByName(const OUString& rName,
@@ -109,7 +108,7 @@ namespace dbaui
weld::TreeView& GetWidget() { return *m_xTreeView; }
const weld::TreeView& GetWidget() const { return *m_xTreeView; }
- ODataClipboard& GetDataTransfer() { return *m_xHelper; }
+ TransferDataContainer& GetDataTransfer() { return *m_xHelper; }
sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt);
sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt);
@@ -124,12 +123,43 @@ namespace dbaui
, public TreeListBox
{
public:
- InterimDBTreeListBox(vcl::Window* pParent);
+ InterimDBTreeListBox(vcl::Window* pParent, bool bSQLType);
virtual void dispose() override;
virtual ~InterimDBTreeListBox() override;
protected:
virtual bool DoChildKeyInput(const KeyEvent& rKEvt) override;
- virtual bool DoContextMenu(const CommandEvent& rCEvt) 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, bool bShowToggles);
};
}
diff --git a/dbaccess/source/ui/inc/tabletree.hxx b/dbaccess/source/ui/inc/tabletree.hxx
index 93adbb1ee9c5..5c5ec750257a 100644
--- a/dbaccess/source/ui/inc/tabletree.hxx
+++ b/dbaccess/source/ui/inc/tabletree.hxx
@@ -32,7 +32,7 @@ namespace dbaui
{
// OTableTreeListBox
-class OTableTreeListBox final : public InterimDBTreeListBox
+class OTableTreeListBox : public TreeListBox
{
css::uno::Reference< css::sdbc::XConnection >
m_xConnection; // the connection we're working for, set in implOnNewConnection, called by UpdateTableList
@@ -43,12 +43,15 @@ class OTableTreeListBox final : public InterimDBTreeListBox
bool m_bShowToggles; // show toggle buttons
public:
- OTableTreeListBox(vcl::Window* pParent, bool bShowToggles);
- virtual ~OTableTreeListBox();
+ 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;
@@ -76,108 +79,14 @@ public:
const css::uno::Sequence< OUString>& _rViews
);
- std::unique_ptr<weld::TreeIter> getAllObjectsEntry() const;
-
- void CheckButtons(); // make the button states consistent (bottom-up)
-
-private:
- 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(weld::TreeIter& rEntry);
-
/** to be used if a foreign instance added a table
*/
- std::unique_ptr<weld::TreeIter> addedTable(const OUString& rName);
+ std::unique_ptr<weld::TreeIter> addedTable( const OUString& _rName );
/** to be used if a foreign instance removed a table
*/
void removedTable( const OUString& _rName );
- TriState implDetermineState(weld::TreeIter& rEntry);
- // determines the check state of the given entry, by analyzing the states of all descendants
-
- /** 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(weld::TreeIter& rEntry) const;
-
- std::unique_ptr<weld::TreeIter> getEntryByQualifiedName(const OUString& rName);
-};
-
-class TableTreeListBox : 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:
- TableTreeListBox(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; }
-
- /** 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
- );
-
std::unique_ptr<weld::TreeIter> getAllObjectsEntry() const;
/** does a wildcard check of the given entry
@@ -205,7 +114,7 @@ private:
our image provider must already have been reset to the connection to which the meta data
belong.
*/
- void implAddEntry(
+ std::unique_ptr<weld::TreeIter> implAddEntry(
const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxMeta,
const OUString& _rTableName,
bool _bCheckName = true
@@ -213,6 +122,8 @@ private:
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:
@@ -225,6 +136,19 @@ public:
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(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(weld::TreeIter& rEntry) const;
+
+ std::unique_ptr<weld::TreeIter> getEntryByQualifiedName(const OUString& rName);
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index f55efc576f56..d1367bbacf3d 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -46,8 +46,6 @@ namespace com::sun::star::container { class XNameContainer; }
namespace dbaui
{
-
- class DBTreeView;
struct DBTreeEditedEntry;
class ImageProvider;
@@ -218,7 +216,8 @@ namespace dbaui
virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2*
getContextMenuInterceptors() override;
- virtual css::uno::Any getCurrentSelection( Control& _rControl ) const override;
+ virtual css::uno::Any getCurrentSelection(weld::TreeView& rControl) const override;
+ virtual vcl::Window* getMenuParent(weld::TreeView& rControl) const override;
virtual void impl_initialize() override;