[Libreoffice-commits] core.git: dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbaccess.mk
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 4 19:41:37 UTC 2020
dbaccess/UIConfig_dbaccess.mk | 1
dbaccess/source/ui/inc/JoinExchange.hxx | 8
dbaccess/source/ui/inc/TableWindow.hxx | 2
dbaccess/source/ui/inc/TableWindowListBox.hxx | 67 +++-
dbaccess/source/ui/querydesign/ConnectionLine.cxx | 31 +-
dbaccess/source/ui/querydesign/JoinExchange.cxx | 22 -
dbaccess/source/ui/querydesign/JoinTableView.cxx | 36 +-
dbaccess/source/ui/querydesign/QTableWindow.cxx | 26 -
dbaccess/source/ui/querydesign/QTableWindow.hxx | 2
dbaccess/source/ui/querydesign/QueryTableView.cxx | 10
dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 7
dbaccess/source/ui/querydesign/TableWindow.cxx | 84 +++--
dbaccess/source/ui/querydesign/TableWindowAccess.cxx | 1
dbaccess/source/ui/querydesign/TableWindowListBox.cxx | 228 ++++------------
dbaccess/source/ui/querydesign/TableWindowTitle.cxx | 3
dbaccess/source/ui/relationdesign/RelationTableView.cxx | 6
dbaccess/uiconfig/ui/tablelistbox.ui | 71 ++++
17 files changed, 309 insertions(+), 296 deletions(-)
New commits:
commit 67e5f16e53a05587c4f36518a56e931f4708e16b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Aug 2 15:05:27 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 4 21:40:44 2020 +0200
weld OTableWindowListBox
Change-Id: Iae1d2da93fd150d2a333a55bd5b3c06aad0a308f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100030
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk
index d2d30dd9b7fd..74ba080879d8 100644
--- a/dbaccess/UIConfig_dbaccess.mk
+++ b/dbaccess/UIConfig_dbaccess.mk
@@ -70,6 +70,7 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
dbaccess/uiconfig/ui/sqlexception \
dbaccess/uiconfig/ui/tabledesignrowmenu \
dbaccess/uiconfig/ui/tabledesignsavemodifieddialog \
+ dbaccess/uiconfig/ui/tablelistbox \
dbaccess/uiconfig/ui/tablesfilterdialog \
dbaccess/uiconfig/ui/tablesfilterpage \
dbaccess/uiconfig/ui/tablesjoindialog \
diff --git a/dbaccess/source/ui/inc/JoinExchange.hxx b/dbaccess/source/ui/inc/JoinExchange.hxx
index a1a73595ae5c..2412c64c365f 100644
--- a/dbaccess/source/ui/inc/JoinExchange.hxx
+++ b/dbaccess/source/ui/inc/JoinExchange.hxx
@@ -30,7 +30,7 @@ namespace dbaui
// OJoinExchObj: Additional data to create Joins in the JoinShell
typedef ::cppu::ImplHelper1< css::lang::XUnoTunnel > OJoinExchObj_Base;
- class OJoinExchObj final : public TransferableHelper, public OJoinExchObj_Base
+ class OJoinExchObj final : public TransferDataContainer, public OJoinExchObj_Base
{
bool m_bFirstEntry;
@@ -40,8 +40,8 @@ namespace dbaui
virtual ~OJoinExchObj() override;
public:
- OJoinExchObj(const OJoinExchangeData& jxdSource, bool _bFirstEntry);
-
+ OJoinExchObj();
+ void setDescriptors(const OJoinExchangeData& jxdSource, bool _bFirstEntry);
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
@@ -61,8 +61,6 @@ namespace dbaui
virtual void AddSupportedFormats() override;
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
virtual void DragFinished( sal_Int8 nDropAction ) override;
-
- using TransferableHelper::StartDrag;
};
}
#endif
diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx
index e356a5a265f7..83baf38e53fd 100644
--- a/dbaccess/source/ui/inc/TableWindow.hxx
+++ b/dbaccess/source/ui/inc/TableWindow.hxx
@@ -90,7 +90,7 @@ namespace dbaui
void FillListBox();
// called at EACH Init
- virtual void OnEntryDoubleClicked(SvTreeListEntry* /*pEntry*/) { }
+ virtual void OnEntryDoubleClicked(weld::TreeIter& /*rEntry*/) { }
// called from the DoubleClickHdl of the ListBox
/** HandleKeyInput tries to handle the KeyEvent. Movement or deletion
diff --git a/dbaccess/source/ui/inc/TableWindowListBox.hxx b/dbaccess/source/ui/inc/TableWindowListBox.hxx
index 249a1dedf330..5ca01098266b 100644
--- a/dbaccess/source/ui/inc/TableWindowListBox.hxx
+++ b/dbaccess/source/ui/inc/TableWindowListBox.hxx
@@ -19,8 +19,8 @@
#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWLISTBOX_HXX
#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWLISTBOX_HXX
-#include <vcl/treelistbox.hxx>
-#include <vcl/timer.hxx>
+#include <vcl/transfer.hxx>
+#include <vcl/InterimItemWindow.hxx>
#include "callbacks.hxx"
struct AcceptDropEvent;
@@ -32,67 +32,88 @@ namespace dbaui
{
public:
VclPtr<OTableWindowListBox> pListBox; // the ListBox inside the same (you can get the TabWin and the WinName out of it)
- SvTreeListEntry* pEntry; // the entry, which was dragged or to which was dropped on
+ int nEntry; // the entry, which was dragged or to which was dropped on
OJoinExchangeData(OTableWindowListBox* pBox);
- OJoinExchangeData() : pListBox(nullptr), pEntry(nullptr) { }
+ OJoinExchangeData() : pListBox(nullptr), nEntry(-1) { }
};
+
struct OJoinDropData
{
OJoinExchangeData aSource;
OJoinExchangeData aDest;
};
+ class OJoinExchObj;
class OTableWindow;
+ class TableWindowListBoxHelper;
+
class OTableWindowListBox
- :public SvTreeListBox
- ,public IDragTransferableListener
+ : public InterimItemWindow
+ , public IDragTransferableListener
{
- DECL_LINK( OnDoubleClick, SvTreeListBox*, bool );
- DECL_LINK( ScrollUpHdl, Timer*, void );
- DECL_LINK( ScrollDownHdl, Timer*, void );
+ std::unique_ptr<weld::TreeView> m_xTreeView;
+ std::unique_ptr<TableWindowListBoxHelper> m_xDragDropTargetHelper;
+
+ DECL_LINK( OnDoubleClick, weld::TreeView&, bool );
DECL_LINK( DropHdl, void*, void );
DECL_LINK( LookForUiHdl, void*, void );
+ DECL_LINK( DragBeginHdl, bool&, bool );
+ DECL_LINK( ScrollHdl, weld::TreeView&, void );
- Timer m_aScrollTimer;
- Point m_aMousePos;
+ rtl::Reference<OJoinExchObj> m_xHelper;
VclPtr<OTableWindow> m_pTabWin;
ImplSVEvent * m_nDropEvent;
ImplSVEvent * m_nUiEvent;
OJoinDropData m_aDropInfo;
- bool m_bReallyScrolled : 1;
-
protected:
virtual void LoseFocus() override;
virtual void GetFocus() override;
- virtual void NotifyScrolled() override;
- virtual void NotifyEndScroll() override;
-
- virtual bool PreNotify(NotifyEvent& rNEvt) 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
- virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
- virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
- virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+ 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; }
- SvTreeListEntry* GetEntryFromText( const OUString& rEntryText );
+ int GetEntryFromText( const OUString& rEntryText );
+ };
+ class TableWindowListBoxHelper : public DropTargetHelper
+ {
private:
- using SvTreeListBox::ExecuteDrop;
+ 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)
+ {
+ }
};
}
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEWINDOWLISTBOX_HXX
diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
index cf5af7def510..791f89247a52 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLine.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
@@ -55,7 +55,7 @@ namespace
tools::Rectangle aReturn;
if ( pListBox )
{
- const long nRowHeight = pListBox->GetEntryHeight();
+ const long nRowHeight = pListBox->get_widget().get_height_rows(1);
aReturn.SetTop( _aConnPos.Y() - nRowHeight );
aReturn.SetBottom( aReturn.Top() + nRowHeight );
if (_aDescrLinePos.X() < _aConnPos.X())
@@ -74,27 +74,32 @@ namespace
}
/** calcPointsYValue calculate the points Y value in relation to the listbox entry
@param _pWin the corresponding window
- @param _pEntry the source or dest entry
+ @param _nEntry the source or dest entry
@param _rNewConPos (in/out) the connection pos
@param _rNewDescrPos (in/out) the description pos
*/
- void calcPointsYValue(const OTableWindow* _pWin,SvTreeListEntry* _pEntry,Point& _rNewConPos,Point& _rNewDescrPos)
+ void calcPointsYValue(const OTableWindow* _pWin, int _nEntry, Point& _rNewConPos, Point& _rNewDescrPos)
{
const OTableWindowListBox* pListBox = _pWin->GetListBox();
_rNewConPos.setY( _pWin->GetPosPixel().Y() );
- if ( _pEntry )
+ if (_nEntry != -1)
{
- const long nRowHeight = pListBox->GetEntryHeight();
_rNewConPos.AdjustY(pListBox->GetPosPixel().Y() );
- long nEntryPos = pListBox->GetEntryPosition( _pEntry ).Y();
+ const weld::TreeView& rTreeView = pListBox->get_widget();
+ std::unique_ptr<weld::TreeIter> xEntry = rTreeView.make_iterator();
+ rTreeView.get_iter_first(*xEntry);
+ rTreeView.iter_nth_sibling(*xEntry, _nEntry);
+ auto nEntryPos = rTreeView.get_row_area(*xEntry).Center().Y();
if( nEntryPos >= 0 )
{
- _rNewConPos.AdjustY(nEntryPos );
- _rNewConPos.AdjustY(static_cast<long>( 0.5 * nRowHeight ) );
+ _rNewConPos.AdjustY(nEntryPos);
}
else
+ {
+ const auto nRowHeight = rTreeView.get_height_rows(1);
_rNewConPos.AdjustY( -static_cast<long>( 0.5 * nRowHeight ) );
+ }
long nListBoxBottom = _pWin->GetPosPixel().Y()
+ pListBox->GetPosPixel().Y()
@@ -213,8 +218,8 @@ bool OConnectionLine::RecalcLine()
if( !pSourceWin || !pDestWin )
return false;
- SvTreeListEntry* pSourceEntry = pSourceWin->GetListBox()->GetEntryFromText( GetData()->GetSourceFieldName() );
- SvTreeListEntry* pDestEntry = pDestWin->GetListBox()->GetEntryFromText( GetData()->GetDestFieldName() );
+ int nSourceEntry = pSourceWin->GetListBox()->GetEntryFromText( GetData()->GetSourceFieldName() );
+ int nDestEntry = pDestWin->GetListBox()->GetEntryFromText( GetData()->GetDestFieldName() );
// determine X-coordinates
Point aSourceCenter( 0, 0 );
@@ -239,17 +244,17 @@ bool OConnectionLine::RecalcLine()
pSecondDescrPos = &m_aDestDescrLinePos;
}
- if ( pFirstWin == pSecondWin && pSourceEntry != pDestEntry )
+ if (pFirstWin == pSecondWin && nSourceEntry != nDestEntry)
calcPointX2(pFirstWin,*pFirstConPos,*pFirstDescrPos);
else
calcPointX1(pFirstWin,*pFirstConPos,*pFirstDescrPos);
calcPointX2(pSecondWin,*pSecondConPos,*pSecondDescrPos);
// determine aSourceConnPosY
- calcPointsYValue(pSourceWin,pSourceEntry,m_aSourceConnPos,m_aSourceDescrLinePos);
+ calcPointsYValue(pSourceWin, nSourceEntry, m_aSourceConnPos,m_aSourceDescrLinePos);
// determine aDestConnPosY
- calcPointsYValue(pDestWin,pDestEntry,m_aDestConnPos,m_aDestDescrLinePos);
+ calcPointsYValue(pDestWin, nDestEntry, m_aDestConnPos,m_aDestDescrLinePos);
return true;
}
diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx
index 312c9d8e9958..7aec24766901 100644
--- a/dbaccess/source/ui/querydesign/JoinExchange.cxx
+++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx
@@ -28,12 +28,16 @@ namespace dbaui
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::datatransfer;
- OJoinExchObj::OJoinExchObj(const OJoinExchangeData& jxdSource,bool _bFirstEntry)
- :m_bFirstEntry(_bFirstEntry)
- ,m_jxdSourceDescription(jxdSource)
- ,m_pDragListener(nullptr)
+ void OJoinExchObj::setDescriptors(const OJoinExchangeData& jxdSource,bool _bFirstEntry)
+ {
+ m_bFirstEntry = _bFirstEntry;
+ m_jxdSourceDescription = jxdSource;
+ }
+
+ OJoinExchObj::OJoinExchObj()
+ : m_bFirstEntry(false)
+ , m_pDragListener(nullptr)
{
- // add available types to list
}
OJoinExchObj::~OJoinExchObj()
@@ -43,7 +47,7 @@ namespace dbaui
void OJoinExchObj::StartDrag( vcl::Window* _pWindow, sal_Int8 _nDragSourceActions, IDragTransferableListener* _pListener )
{
m_pDragListener = _pListener;
- TransferableHelper::StartDrag(_pWindow, _nDragSourceActions);
+ TransferDataContainer::StartDrag(_pWindow, _nDragSourceActions);
}
void OJoinExchObj::DragFinished( sal_Int8 /*nDropAction*/ )
@@ -108,7 +112,7 @@ namespace dbaui
Any SAL_CALL OJoinExchObj::queryInterface( const Type& _rType )
{
- Any aReturn = TransferableHelper::queryInterface(_rType);
+ Any aReturn = TransferDataContainer::queryInterface(_rType);
if (!aReturn.hasValue())
aReturn = OJoinExchObj_Base::queryInterface(_rType);
return aReturn;
@@ -116,12 +120,12 @@ namespace dbaui
void SAL_CALL OJoinExchObj::acquire( ) throw()
{
- TransferableHelper::acquire( );
+ TransferDataContainer::acquire( );
}
void SAL_CALL OJoinExchObj::release( ) throw()
{
- TransferableHelper::release( );
+ TransferDataContainer::release( );
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 9f3df281d774..5ef30e19aeda 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -33,6 +33,7 @@
#include "QueryMoveTabWinUndoAct.hxx"
#include "QuerySizeTabWinUndoAct.hxx"
#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/menu.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/commandevent.hxx>
@@ -861,11 +862,11 @@ void OJoinTableView::DeselectConn(OTableConnection* pConn)
// deselect the corresponding entries in the ListBox of the table window
OTableWindow* pWin = pConn->GetSourceWin();
if (pWin && pWin->GetListBox())
- pWin->GetListBox()->SelectAll(false);
+ pWin->GetListBox()->get_widget().unselect_all();
pWin = pConn->GetDestWin();
if (pWin && pWin->GetListBox())
- pWin->GetListBox()->SelectAll(false);
+ pWin->GetListBox()->get_widget().unselect_all();
pConn->Deselect();
m_pSelectedConn = nullptr;
@@ -890,11 +891,10 @@ void OJoinTableView::SelectConn(OTableConnection* pConn)
if (!(pSourceBox && pDestBox))
return;
- pSourceBox->SelectAll(false);
- pDestBox->SelectAll(false);
+ pSourceBox->get_widget().unselect_all();
+ pDestBox->get_widget().unselect_all();
- SvTreeListEntry* pFirstSourceVisible = pSourceBox->GetFirstEntryInView();
- SvTreeListEntry* pFirstDestVisible = pDestBox->GetFirstEntryInView();
+ bool bScrolled = false;
const std::vector<std::unique_ptr<OConnectionLine>>& rLines = pConn->GetConnLineList();
auto aIter = rLines.rbegin();
@@ -902,27 +902,29 @@ void OJoinTableView::SelectConn(OTableConnection* pConn)
{
if ((*aIter)->IsValid())
{
- SvTreeListEntry* pSourceEntry = pSourceBox->GetEntryFromText((*aIter)->GetData()->GetSourceFieldName());
- if (pSourceEntry)
+ int nSourceEntry = pSourceBox->GetEntryFromText((*aIter)->GetData()->GetSourceFieldName());
+ if (nSourceEntry != -1)
{
- pSourceBox->Select(pSourceEntry);
- pSourceBox->MakeVisible(pSourceEntry);
+ pSourceBox->get_widget().select(nSourceEntry);
+ pSourceBox->get_widget().scroll_to_row(nSourceEntry);
+ bScrolled = true;
}
- SvTreeListEntry* pDestEntry = pDestBox->GetEntryFromText((*aIter)->GetData()->GetDestFieldName());
- if (pDestEntry)
+ int nDestEntry = pDestBox->GetEntryFromText((*aIter)->GetData()->GetDestFieldName());
+ if (nDestEntry != -1)
{
- pDestBox->Select(pDestEntry);
- pDestBox->MakeVisible(pDestEntry);
+ pDestBox->get_widget().select(nDestEntry);
+ pDestBox->get_widget().scroll_to_row(nDestEntry);
+ bScrolled = true;
}
-
}
}
- if ((pFirstSourceVisible != pSourceBox->GetFirstEntryInView())
- || (pFirstDestVisible != pDestBox->GetFirstEntryInView()))
+ if (bScrolled)
+ {
// scrolling was done -> redraw
Invalidate(InvalidateFlags::NoChildren);
+ }
}
void OJoinTableView::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx
index 6d2916683db9..754c6e169636 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx
@@ -105,22 +105,20 @@ void OQueryTableWindow::deleteUserData(void*& _pUserData)
_pUserData = nullptr;
}
-void OQueryTableWindow::OnEntryDoubleClicked(SvTreeListEntry* pEntry)
+void OQueryTableWindow::OnEntryDoubleClicked(weld::TreeIter& rEntry)
{
- OSL_ENSURE(pEntry != nullptr, "OQueryTableWindow::OnEntryDoubleClicked : pEntry must not be NULL !");
- // you could also scan that and then return, but like this it could possibly hint to faults at the caller
-
if (getTableView()->getDesignView()->getController().isReadOnly())
return;
- OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(pEntry->GetUserData());
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ OTableFieldInfo* pInf = reinterpret_cast<OTableFieldInfo*>(rTreeView.get_id(rEntry).toUInt64());
OSL_ENSURE(pInf != nullptr, "OQueryTableWindow::OnEntryDoubleClicked : field doesn't have FieldInfo !");
// build up DragInfo
- OTableFieldDescRef aInfo = new OTableFieldDesc(GetTableName(), m_xListBox->GetEntryText(pEntry));
+ OTableFieldDescRef aInfo = new OTableFieldDesc(GetTableName(), rTreeView.get_text(rEntry));
aInfo->SetTabWindow(this);
aInfo->SetAlias(GetAliasName());
- aInfo->SetFieldIndex(m_xListBox->GetModel()->GetAbsPos(pEntry));
+ aInfo->SetFieldIndex(rTreeView.get_iter_index_in_parent(rEntry));
aInfo->SetDataType(pInf->GetDataType());
// and insert corresponding field
@@ -135,29 +133,31 @@ bool OQueryTableWindow::ExistsField(const OUString& strFieldName, OTableFieldDes
bool bExists = false;
if(xConnection.is())
{
- SvTreeListEntry* pEntry = m_xListBox->First();
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ bool bEntry = rTreeView.get_iter_first(*xEntry);
try
{
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
::comphelper::UStringMixEqual bCase(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
- while (pEntry)
+ while (bEntry)
{
- if (bCase(strFieldName,m_xListBox->GetEntryText(pEntry)))
+ if (bCase(strFieldName, rTreeView.get_text(*xEntry)))
{
- OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(pEntry->GetUserData());
+ OTableFieldInfo* pInf = reinterpret_cast<OTableFieldInfo*>(rTreeView.get_id(*xEntry).toUInt64());
assert(pInf && "OQueryTableWindow::ExistsField : field doesn't have FieldInfo !");
rInfo->SetTabWindow(this);
rInfo->SetField(strFieldName);
rInfo->SetTable(GetTableName());
rInfo->SetAlias(GetAliasName());
- rInfo->SetFieldIndex(m_xListBox->GetModel()->GetAbsPos(pEntry));
+ rInfo->SetFieldIndex(rTreeView.get_iter_index_in_parent(*xEntry));
rInfo->SetDataType(pInf->GetDataType());
bExists = true;
break;
}
- pEntry = m_xListBox->Next(pEntry);
+ bEntry = rTreeView.iter_next(*xEntry);
}
}
catch(SQLException&)
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.hxx b/dbaccess/source/ui/querydesign/QTableWindow.hxx
index e64fd2e85b7a..536bc65d2431 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.hxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.hxx
@@ -51,7 +51,7 @@ namespace dbaui
protected:
- virtual void OnEntryDoubleClicked(SvTreeListEntry* pEntry) override;
+ virtual void OnEntryDoubleClicked(weld::TreeIter& rEntry) override;
// is called from DoubleClickHdl of the ListBox
/** delete the user data with the equal type as created within createUserData
@param _pUserData
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 1847cfe7b5ee..22a456e81ea9 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -528,8 +528,10 @@ void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJ
OQueryTableWindow* pDestWin = static_cast< OQueryTableWindow*>(jxdDest.pListBox->GetTabWin());
OUString aSourceFieldName, aDestFieldName;
- aSourceFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry);
- aDestFieldName = jxdDest.pListBox->GetEntryText(jxdDest.pEntry);
+ weld::TreeView& rSourceTreeView = jxdSource.pListBox->get_widget();
+ aSourceFieldName = rSourceTreeView.get_text(jxdSource.nEntry);
+ weld::TreeView& rDestTreeView = jxdDest.pListBox->get_widget();
+ aDestFieldName = rDestTreeView.get_text(jxdDest.nEntry);
OTableConnection* pConn = GetTabConn(pSourceWin,pDestWin,true);
if ( !pConn )
@@ -541,9 +543,9 @@ void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJ
// Get name/position of both affected fields ...
// Source
- nSourceFieldIndex = jxdSource.pListBox->GetModel()->GetAbsPos(jxdSource.pEntry);
+ nSourceFieldIndex = jxdSource.nEntry;
// Dest
- nDestFieldIndex = jxdDest.pListBox->GetModel()->GetAbsPos(jxdDest.pEntry);
+ nDestFieldIndex = jxdDest.nEntry;
// ... and set them
xNewConnectionData->SetFieldIndex(JTCS_FROM, nSourceFieldIndex);
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 5a42aec9c842..2b23a3eb226c 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1546,9 +1546,10 @@ OTableFieldDescRef OSelectionBrowseBox::InsertField(const OJoinExchangeData& jxd
return nullptr;
// name and position of the selected field
- OUString aFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry);
- sal_uInt32 nFieldIndex = jxdSource.pListBox->GetModel()->GetAbsPos(jxdSource.pEntry);
- OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(jxdSource.pEntry->GetUserData());
+ weld::TreeView& rTreeView = jxdSource.pListBox->get_widget();
+ OUString aFieldName = rTreeView.get_text(jxdSource.nEntry);
+ sal_uInt32 nFieldIndex = jxdSource.nEntry;
+ OTableFieldInfo* pInf = reinterpret_cast<OTableFieldInfo*>(rTreeView.get_id(jxdSource.nEntry).toUInt64());
// construct DragInfo, such that I use the other InsertField
OTableFieldDescRef aInfo = new OTableFieldDesc(pSourceWin->GetTableName(),aFieldName);
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index 05ea3e744281..cdf27c775608 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -123,7 +123,7 @@ void OTableWindow::dispose()
{
if (m_xListBox)
{
- OSL_ENSURE(m_xListBox->GetEntryCount()==0,"Forgot to call EmptyListbox()!");
+ OSL_ENSURE(m_xListBox->get_widget().n_children()==0,"Forgot to call EmptyListbox()!");
}
m_xListBox.disposeAndClear();
if ( m_pContainerListener.is() )
@@ -179,7 +179,10 @@ void OTableWindow::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
void OTableWindow::FillListBox()
{
- m_xListBox->Clear();
+ clearListBox();
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ assert(!rTreeView.n_children());
+
if ( !m_pContainerListener.is() )
{
Reference< XContainer> xContainer(m_pData->getColumns(),UNO_QUERY);
@@ -188,12 +191,11 @@ void OTableWindow::FillListBox()
}
// mark all primary keys with special image
- Image aPrimKeyImage(StockImage::Yes, BMP_PRIMARY_KEY);
+ OUString aPrimKeyImage(BMP_PRIMARY_KEY);
if (GetData()->IsShowAll())
{
- SvTreeListEntry* pEntry = m_xListBox->InsertEntry( OUString("*") );
- pEntry->SetUserData( createUserData(nullptr,false) );
+ rTreeView.append(OUString::number(reinterpret_cast<sal_uInt64>(createUserData(nullptr,false))), OUString("*"));
}
Reference<XNameAccess> xPKeyColumns;
@@ -214,20 +216,22 @@ void OTableWindow::FillListBox()
const OUString* pIter = aColumns.getConstArray();
const OUString* pEnd = pIter + aColumns.getLength();
- SvTreeListEntry* pEntry = nullptr;
for (; pIter != pEnd; ++pIter)
{
bool bPrimaryKeyColumn = xPKeyColumns.is() && xPKeyColumns->hasByName( *pIter );
- // is this column in the primary key
- if ( bPrimaryKeyColumn )
- pEntry = m_xListBox->InsertEntry(*pIter, aPrimKeyImage, aPrimKeyImage);
- else
- pEntry = m_xListBox->InsertEntry(*pIter);
+ OUString sId;
Reference<XPropertySet> xColumn(xColumns->getByName(*pIter),UNO_QUERY);
- if ( xColumn.is() )
- pEntry->SetUserData( createUserData(xColumn,bPrimaryKeyColumn) );
+ if (xColumn.is())
+ sId = OUString::number(reinterpret_cast<sal_uInt64>(createUserData(xColumn, bPrimaryKeyColumn)));
+
+ rTreeView.append(sId, *pIter);
+
+ // is this column in the primary key
+ if ( bPrimaryKeyColumn )
+ rTreeView.set_image(rTreeView.n_children() - 1, aPrimKeyImage);
}
+
}
}
catch(Exception&)
@@ -252,16 +256,14 @@ void OTableWindow::clearListBox()
if ( !m_xListBox )
return;
- SvTreeListEntry* pEntry = m_xListBox->First();
-
- while(pEntry)
- {
- void* pUserData = pEntry->GetUserData();
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ rTreeView.all_foreach([this, &rTreeView](weld::TreeIter& rEntry){
+ void* pUserData = reinterpret_cast<void*>(rTreeView.get_id(rEntry).toUInt64());
deleteUserData(pUserData);
- SvTreeListEntry* pNextEntry = m_xListBox->Next(pEntry);
- m_xListBox->GetModel()->Remove(pEntry);
- pEntry = pNextEntry;
- }
+ return false;
+ });
+
+ rTreeView.clear();
}
void OTableWindow::impl_updateImage()
@@ -287,8 +289,8 @@ bool OTableWindow::Init()
if ( !m_xListBox )
{
m_xListBox = VclPtr<OTableWindowListBox>::Create(this);
- OSL_ENSURE( m_xListBox != nullptr, "OTableWindow::Init() : CreateListBox returned NULL !" );
- m_xListBox->SetSelectionMode( SelectionMode::Multiple );
+ assert(m_xListBox && "OTableWindow::Init() : CreateListBox returned NULL !");
+ m_xListBox->get_widget().set_selection_mode(SelectionMode::Multiple);
}
// Set the title
@@ -298,9 +300,8 @@ bool OTableWindow::Init()
m_xListBox->Show();
// add the fields to the ListBox
- clearListBox();
FillListBox();
- m_xListBox->SelectAll( false );
+ m_xListBox->get_widget().unselect_all();
impl_updateImage();
@@ -475,8 +476,12 @@ void OTableWindow::GetFocus()
void OTableWindow::setActive(bool _bActive)
{
SetBoldTitle( _bActive );
- if (!_bActive && m_xListBox && m_xListBox->GetSelectionCount() != 0)
- m_xListBox->SelectAll(false);
+ if (_bActive || !m_xListBox)
+ return;
+
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ if (rTreeView.get_selected_index() != -1)
+ rTreeView.unselect_all();
}
void OTableWindow::Remove()
@@ -513,17 +518,13 @@ bool OTableWindow::ExistsAConn() const
void OTableWindow::EnumValidFields(std::vector< OUString>& arrstrFields)
{
arrstrFields.clear();
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+
// This default implementation counts every item in the ListBox ... for any other behaviour it must be over-written
- if ( m_xListBox )
- {
- arrstrFields.reserve(m_xListBox->GetEntryCount());
- SvTreeListEntry* pEntryLoop = m_xListBox->First();
- while (pEntryLoop)
- {
- arrstrFields.push_back(m_xListBox->GetEntryText(pEntryLoop));
- pEntryLoop = m_xListBox->Next(pEntryLoop);
- }
- }
+ rTreeView.all_foreach([&rTreeView, &arrstrFields](weld::TreeIter& rEntry){
+ arrstrFields.push_back(rTreeView.get_text(rEntry));
+ return false;
+ });
}
void OTableWindow::StateChanged( StateChangedType nType )
@@ -567,9 +568,10 @@ void OTableWindow::Command(const CommandEvent& rEvt)
ptWhere = rEvt.GetMousePosPixel();
else
{
- SvTreeListEntry* pCurrent = m_xListBox->GetCurEntry();
- if ( pCurrent )
- ptWhere = m_xListBox->GetEntryPosition(pCurrent);
+ weld::TreeView& rTreeView = m_xListBox->get_widget();
+ std::unique_ptr<weld::TreeIter> xCurrent = rTreeView.make_iterator();
+ if (rTreeView.get_cursor(xCurrent.get()))
+ ptWhere = rTreeView.get_row_area(*xCurrent).Center();
else
ptWhere = m_xTitle->GetPosPixel();
}
diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
index 3cd87ded7a61..1dc69e763d5d 100644
--- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <comphelper/sequence.hxx>
+#include <vcl/vclevent.hxx>
namespace dbaui
{
diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
index a4ba5f0022ae..4224fe1a88a9 100644
--- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
@@ -37,25 +37,25 @@ using namespace ::com::sun::star::datatransfer;
OJoinExchangeData::OJoinExchangeData(OTableWindowListBox* pBox)
: pListBox(pBox)
- , pEntry(pBox->FirstSelected())
-{ }
+ , nEntry(pBox->get_widget().get_selected_index())
+{
+}
-const sal_uLong SCROLLING_TIMESPAN = 500;
-const long LISTBOX_SCROLLING_AREA = 6;
OTableWindowListBox::OTableWindowListBox( OTableWindow* pParent )
- :SvTreeListBox( pParent, WB_HASBUTTONS | WB_BORDER)
- ,m_aMousePos( Point(0,0) )
- ,m_pTabWin( pParent )
- ,m_nDropEvent(nullptr)
- ,m_nUiEvent(nullptr)
- ,m_bReallyScrolled( false )
+ : InterimItemWindow(pParent, "dbaccess/ui/tablelistbox.ui", "TableListBox")
+ , m_xTreeView(m_xBuilder->weld_tree_view("treeview"))
+ , m_xDragDropTargetHelper(new TableWindowListBoxHelper(*this, m_xTreeView->get_drop_target()))
+ , m_pTabWin( pParent )
+ , m_nDropEvent(nullptr)
+ , m_nUiEvent(nullptr)
{
- m_aScrollTimer.SetTimeout( SCROLLING_TIMESPAN );
- SetDoubleClickHdl( LINK(this, OTableWindowListBox, OnDoubleClick) );
-
- SetSelectionMode(SelectionMode::Single);
+ m_xTreeView->connect_row_activated(LINK(this, OTableWindowListBox, OnDoubleClick));
+ m_xTreeView->connect_visible_range_changed(LINK(this, OTableWindowListBox, ScrollHdl));
- SetHighlightRange( );
+ m_xHelper.set(new OJoinExchObj);
+ rtl::Reference<TransferDataContainer> xHelper(m_xHelper.get());
+ m_xTreeView->enable_drag_source(xHelper, DND_ACTION_LINK);
+ m_xTreeView->connect_drag_begin(LINK(this, OTableWindowListBox, DragBeginHdl));
}
void OTableWindowListBox::dragFinished( )
@@ -79,17 +79,15 @@ void OTableWindowListBox::dispose()
Application::RemoveUserEvent(m_nDropEvent);
if (m_nUiEvent)
Application::RemoveUserEvent(m_nUiEvent);
- if( m_aScrollTimer.IsActive() )
- m_aScrollTimer.Stop();
m_pTabWin.clear();
- SvTreeListBox::dispose();
+ m_xDragDropTargetHelper.reset();
+ m_xTreeView.reset();
+ InterimItemWindow::dispose();
}
-SvTreeListEntry* OTableWindowListBox::GetEntryFromText( const OUString& rEntryText )
+int OTableWindowListBox::GetEntryFromText( const OUString& rEntryText )
{
// iterate through the list
- SvTreeList* pTreeList = GetModel();
- SvTreeListEntry* pEntry = pTreeList->First();
OJoinDesignView* pView = m_pTabWin->getDesignView();
OJoinController& rController = pView->getController();
@@ -103,172 +101,76 @@ SvTreeListEntry* OTableWindowListBox::GetEntryFromText( const OUString& rEntryTe
if(xMeta.is())
bCase = xMeta->supportsMixedCaseQuotedIdentifiers();
}
- while( pEntry )
+ for (int nEntry = 0, nCount = m_xTreeView->n_children(); nEntry < nCount; ++nEntry)
{
- if(bCase ? rEntryText == GetEntryText(pEntry) : rEntryText.equalsIgnoreAsciiCase(GetEntryText(pEntry)))
- {
- return pEntry;
- }
- pEntry = pTreeList->Next(pEntry);
+ if (bCase ? rEntryText == m_xTreeView->get_text(nEntry) : rEntryText.equalsIgnoreAsciiCase(m_xTreeView->get_text(nEntry)))
+ return nEntry;
}
}
catch(SQLException&)
{
}
- return nullptr;
-}
-
-void OTableWindowListBox::NotifyScrolled()
-{
- m_bReallyScrolled = true;
-}
-
-void OTableWindowListBox::NotifyEndScroll()
-{
- if (m_bReallyScrolled)
- // connections of this table, if any, should be redrawn
- m_pTabWin->getTableView()->Invalidate(InvalidateFlags::NoChildren);
-
- // without InvalidateFlags::NoChildren all tables would be redrawn,
- // so: flickering
- m_bReallyScrolled = false;
-}
-
-bool OTableWindowListBox::PreNotify(NotifyEvent& rNEvt)
-{
- bool bHandled = false;
- switch (rNEvt.GetType())
- {
- case MouseNotifyEvent::KEYINPUT:
- {
- const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
- const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
-
- if (rCode.GetCode() != KEY_RETURN)
- {
- if(m_pTabWin)
- {
- bHandled = m_pTabWin->HandleKeyInput(*pKeyEvent);
- }
- break;
- }
-
- if (rCode.IsMod1() || rCode.IsMod2() || rCode.IsShift())
- break;
- if (FirstSelected())
- static_cast<OTableWindow*>(Window::GetParent())->OnEntryDoubleClicked(FirstSelected());
- break;
- }
- default:
- break;
- }
-
- if (!bHandled)
- return SvTreeListBox::PreNotify(rNEvt);
- return true;
+ return -1;
}
-IMPL_LINK_NOARG( OTableWindowListBox, ScrollUpHdl, Timer*, void )
+IMPL_LINK_NOARG(OTableWindowListBox, ScrollHdl, weld::TreeView&, void)
{
- SvTreeListEntry* pEntry = GetEntry( m_aMousePos );
- if( !pEntry )
- return;
-
- if( pEntry != Last() )
- {
- ScrollOutputArea( -1 );
- pEntry = GetEntry( m_aMousePos );
- Select( pEntry );
- }
+ // connections of this table, if any, should be redrawn
+ m_pTabWin->getTableView()->Invalidate(InvalidateFlags::NoChildren);
}
-IMPL_LINK_NOARG( OTableWindowListBox, ScrollDownHdl, Timer*, void )
+IMPL_LINK(OTableWindowListBox, DragBeginHdl, bool&, rUnsetDragIcon, bool)
{
- SvTreeListEntry* pEntry = GetEntry( m_aMousePos );
- if( !pEntry )
- return;
-
- if( pEntry != Last() )
+ rUnsetDragIcon = false;
+ if (m_xTreeView->get_selected_index() == -1)
{
- ScrollOutputArea( 1 );
- pEntry = GetEntry( m_aMousePos );
- Select( pEntry );
+ // no drag without a field
+ return true;
}
-}
-void OTableWindowListBox::StartDrag( sal_Int8 /*nAction*/, const Point& /*rPosPixel*/ )
-{
OJoinTableView* pCont = m_pTabWin->getTableView();
if (!pCont->getDesignView()->getController().isReadOnly() && pCont->getDesignView()->getController().isConnected())
{
// asterisk was not allowed to be copied to selection browsebox
- bool bFirstNotAllowed = FirstSelected() == First() && m_pTabWin->GetData()->IsShowAll();
- EndSelection();
+ bool bFirstNotAllowed = m_xTreeView->is_selected(0) && m_pTabWin->GetData()->IsShowAll();
// create a description of the source
OJoinExchangeData jxdSource(this);
- // put it into an exchange object
- rtl::Reference<OJoinExchObj> pJoin = new OJoinExchObj(jxdSource,bFirstNotAllowed);
- pJoin->StartDrag(this, DND_ACTION_LINK, this);
+ // update the exchange object
+ m_xHelper->setDescriptors(jxdSource, bFirstNotAllowed);
+
+ return false;
}
+
+ return true;
}
sal_Int8 OTableWindowListBox::AcceptDrop( const AcceptDropEvent& _rEvt )
{
+ // to enable the autoscroll when we're close to the edges
+ std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
+ bool bHasDestRow = m_xTreeView->get_dest_row_at_pos(_rEvt.maPosPixel, xEntry.get(), true);
+
sal_Int8 nDND_Action = DND_ACTION_NONE;
// check the format
- if ( !OJoinExchObj::isFormatAvailable(GetDataFlavorExVector(),SotClipboardFormatId::SBA_TABID) // this means that the first entry is to be dragged
- && OJoinExchObj::isFormatAvailable(GetDataFlavorExVector()) )
+ if ( !OJoinExchObj::isFormatAvailable(m_xDragDropTargetHelper->GetDataFlavorExVector(),SotClipboardFormatId::SBA_TABID) // this means that the first entry is to be dragged
+ && OJoinExchObj::isFormatAvailable(m_xDragDropTargetHelper->GetDataFlavorExVector()) )
{ // don't drop into the window if it's the drag source itself
// remove the selection if the dragging operation is leaving the window
if (_rEvt.mbLeaving)
- SelectAll(false);
+ m_xTreeView->unselect_all();
else
{
- // hit test
- m_aMousePos = _rEvt.maPosPixel;
- Size aOutputSize = GetOutputSizePixel();
- SvTreeListEntry* pEntry = GetEntry( m_aMousePos );
- if( !pEntry )
+ if (!bHasDestRow)
return DND_ACTION_NONE;
- // Scrolling Areas
- tools::Rectangle aBottomScrollArea( Point(0, aOutputSize.Height()-LISTBOX_SCROLLING_AREA),
- Size(aOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
- tools::Rectangle aTopScrollArea( Point(0,0), Size(aOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
-
- // scroll up if the pointer is on the upper scroll area
- if( aBottomScrollArea.IsInside(m_aMousePos) )
- {
- if( !m_aScrollTimer.IsActive() )
- {
- m_aScrollTimer.SetInvokeHandler( LINK(this, OTableWindowListBox, ScrollUpHdl) );
- ScrollUpHdl( nullptr );
- }
- }
- // scroll down if the pointer is on the lower scroll area
- else if( aTopScrollArea.IsInside(m_aMousePos) )
- {
- if( !m_aScrollTimer.IsActive() )
- {
- m_aScrollTimer.SetInvokeHandler( LINK(this, OTableWindowListBox, ScrollDownHdl) );
- ScrollDownHdl( nullptr );
- }
- }
- else
- {
- if( m_aScrollTimer.IsActive() )
- m_aScrollTimer.Stop();
- }
-
// automatically select right entry when dragging
- if ((FirstSelected() != pEntry) || NextSelected(FirstSelected()))
- SelectAll(false);
- Select(pEntry);
+ m_xTreeView->unselect_all();
+ m_xTreeView->select(*xEntry);
// one cannot drop on the first (*) entry
- if(!( m_pTabWin->GetData()->IsShowAll() && (pEntry==First()) ))
+ if(!( m_pTabWin->GetData()->IsShowAll() && (m_xTreeView->get_iter_index_in_parent(*xEntry) == 0) ))
nDND_Action = DND_ACTION_LINK;
}
}
@@ -318,37 +220,37 @@ sal_Int8 OTableWindowListBox::ExecuteDrop( const ExecuteDropEvent& _rEvt )
void OTableWindowListBox::LoseFocus()
{
- if(m_pTabWin)
+ if (m_pTabWin)
m_pTabWin->setActive(false);
- SvTreeListBox::LoseFocus();
+ InterimItemWindow::LoseFocus();
}
void OTableWindowListBox::GetFocus()
{
- if(m_pTabWin)
+ if (m_pTabWin)
m_pTabWin->setActive();
- if (GetCurEntry() != nullptr)
+ std::unique_ptr<weld::TreeIter> xCurrent = m_xTreeView->make_iterator();
+ if (m_xTreeView->get_cursor(xCurrent.get()))
{
- if ( GetSelectionCount() == 0 || GetCurEntry() != FirstSelected() )
- {
- if ( FirstSelected() )
- Select(FirstSelected(), false);
- Select(GetCurEntry());
- }
- else
- ShowFocusRect(FirstSelected());
+ m_xTreeView->unselect_all();
+ m_xTreeView->select(*xCurrent);
}
- SvTreeListBox::GetFocus();
+
+ InterimItemWindow::GetFocus();
}
-IMPL_LINK_NOARG( OTableWindowListBox, OnDoubleClick, SvTreeListBox *, bool )
+IMPL_LINK_NOARG(OTableWindowListBox, OnDoubleClick, weld::TreeView&, bool)
{
// tell my parent
vcl::Window* pParent = Window::GetParent();
OSL_ENSURE(pParent != nullptr, "OTableWindowListBox::OnDoubleClick : have no Parent !");
- static_cast<OTableWindow*>(pParent)->OnEntryDoubleClicked(GetHdlEntry());
+ std::unique_ptr<weld::TreeIter> xCurrent = m_xTreeView->make_iterator();
+ if (!m_xTreeView->get_cursor(xCurrent.get()))
+ return false;
+
+ static_cast<OTableWindow*>(pParent)->OnEntryDoubleClicked(*xCurrent);
return false;
}
@@ -363,7 +265,7 @@ void OTableWindowListBox::Command(const CommandEvent& rEvt)
break;
}
default:
- SvTreeListBox::Command(rEvt);
+ InterimItemWindow::Command(rEvt);
}
}
diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
index 952063d5d3cc..5157db77eda4 100644
--- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
@@ -127,7 +127,8 @@ void OTableWindowTitle::MouseButtonDown( const MouseEvent& rEvt )
Size aSize(GetTextWidth(GetText()) + 20,
m_pTabWin->GetSizePixel().Height() - m_pTabWin->GetListBox()->GetSizePixel().Height());
- aSize.AdjustHeight((m_pTabWin->GetListBox()->GetEntryCount() + 2) * m_pTabWin->GetListBox()->GetEntryHeight() );
+ weld::TreeView& rTreeView = m_pTabWin->GetListBox()->get_widget();
+ aSize.AdjustHeight(rTreeView.get_height_rows(rTreeView.n_children() + 2));
if(m_pTabWin->GetSizePixel() != aSize)
{
m_pTabWin->SetSizePixel(aSize);
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index a55222096368..9423d1a8470c 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -178,8 +178,10 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
pDestWin->GetData());
// the names of the affected fields
- OUString sSourceFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry);
- OUString sDestFieldName = jxdDest.pListBox->GetEntryText(jxdDest.pEntry);
+ weld::TreeView& rSourceTreeView = jxdSource.pListBox->get_widget();
+ OUString sSourceFieldName = rSourceTreeView.get_text(jxdSource.nEntry);
+ weld::TreeView& rDestTreeView = jxdDest.pListBox->get_widget();
+ OUString sDestFieldName = rDestTreeView.get_text(jxdDest.nEntry);
// the number of PKey-Fields in the source
const Reference< XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(pSourceWin->GetData()->getTable());
diff --git a/dbaccess/uiconfig/ui/tablelistbox.ui b/dbaccess/uiconfig/ui/tablelistbox.ui
new file mode 100644
index 000000000000..f84e011006e3
--- /dev/null
+++ b/dbaccess/uiconfig/ui/tablelistbox.ui
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.36.0 -->
+<interface domain="dba">
+ <requires lib="gtk+" version="3.18"/>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name expander -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkBox" id="TableListBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="border_width">0</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="reorderable">True</property>
+ <property name="search_column">1</property>
+ <property name="enable_tree_lines">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext4"/>
+ <attributes>
+ <attribute name="pixbuf">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+</interface>
More information about the Libreoffice-commits
mailing list