1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <vcl/transfer.hxx>
22 #include <vcl/InterimItemWindow.hxx>
23 #include "callbacks.hxx"
25 struct AcceptDropEvent
;
26 struct ExecuteDropEvent
;
29 class OTableWindowListBox
;
30 struct OJoinExchangeData
33 VclPtr
<OTableWindowListBox
> pListBox
; // the ListBox inside the same (you can get the TabWin and the WinName out of it)
34 int nEntry
; // the entry, which was dragged or to which was dropped on
36 OJoinExchangeData(OTableWindowListBox
* pBox
);
37 OJoinExchangeData() : pListBox(nullptr), nEntry(-1) { }
42 OJoinExchangeData aSource
;
43 OJoinExchangeData aDest
;
48 class TableWindowListBoxHelper
;
50 class OTableWindowListBox
51 : public InterimItemWindow
52 , public IDragTransferableListener
54 std::unique_ptr
<weld::TreeView
> m_xTreeView
;
55 std::unique_ptr
<TableWindowListBoxHelper
> m_xDragDropTargetHelper
;
57 DECL_LINK( OnDoubleClick
, weld::TreeView
&, bool );
58 DECL_LINK(CommandHdl
, const CommandEvent
&, bool);
59 DECL_LINK( DropHdl
, void*, void );
60 DECL_LINK( LookForUiHdl
, void*, void );
61 DECL_LINK( DragBeginHdl
, bool&, bool );
62 DECL_LINK( ScrollHdl
, weld::TreeView
&, void );
64 rtl::Reference
<OJoinExchObj
> m_xHelper
;
66 VclPtr
<OTableWindow
> m_pTabWin
;
67 ImplSVEvent
* m_nDropEvent
;
68 ImplSVEvent
* m_nUiEvent
;
69 OJoinDropData m_aDropInfo
;
72 virtual void LoseFocus() override
;
73 virtual void GetFocus() override
;
75 virtual void dragFinished( ) override
;
78 OTableWindowListBox(OTableWindow
* pParent
);
79 virtual ~OTableWindowListBox() override
;
80 virtual void dispose() override
;
82 const weld::TreeView
& get_widget() const { return *m_xTreeView
; }
83 weld::TreeView
& get_widget() { return *m_xTreeView
; }
86 sal_Int8
AcceptDrop(const AcceptDropEvent
& rEvt
);
87 sal_Int8
ExecuteDrop(const ExecuteDropEvent
& rEvt
);
90 virtual void Command(const CommandEvent
& rEvt
) override
;
92 OTableWindow
* GetTabWin(){ return m_pTabWin
; }
93 int GetEntryFromText( std::u16string_view rEntryText
);
96 class TableWindowListBoxHelper final
: public DropTargetHelper
99 OTableWindowListBox
& m_rParent
;
101 virtual sal_Int8
AcceptDrop(const AcceptDropEvent
& rEvt
) override
103 return m_rParent
.AcceptDrop(rEvt
);
106 virtual sal_Int8
ExecuteDrop(const ExecuteDropEvent
& rEvt
) override
108 return m_rParent
.ExecuteDrop(rEvt
);
112 TableWindowListBoxHelper(OTableWindowListBox
& rParent
, const css::uno::Reference
<css::datatransfer::dnd::XDropTarget
>& rDropTarget
)
113 : DropTargetHelper(rDropTarget
)
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */