LibreOffice Module vcl (master)  1
treeglue.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  */
9 
10 #include <vcl/svimpbox.hxx>
11 #include <vcl/svtabbx.hxx>
12 
13 //the default NotifyStartDrag is weird to me, and defaults to enabling all
14 //possibilities when drag starts, while restricting it to some subset of
15 //the configured drag drop mode would make more sense to me, but I'm not
16 //going to change the baseclass
17 
19 {
20 public:
22  : SvHeaderTabListBox(pParent, nWinStyle)
23  {
24  }
25 
27  {
28  return GetDragDropMode();
29  }
30 };
31 
33 {
39 
40 public:
41  LclTabListBox(vcl::Window* pParent, WinBits nWinStyle)
42  : SvTabListBox(pParent, nWinStyle)
43  {
44  }
45 
46  void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; }
47  void SetStartDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aStartDragHdl = rLink; }
48  void SetEndDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aEndDragHdl = rLink; }
50  {
51  m_aEditingEntryHdl = rLink;
52  }
53  void SetEditedEntryHdl(const Link<std::pair<SvTreeListEntry*, OUString>, bool>& rLink)
54  {
55  m_aEditedEntryHdl = rLink;
56  }
57 
59  {
60  return GetDragDropMode();
61  }
62 
63  virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override
64  {
65  m_aStartDragHdl.Call(this);
66  SvTabListBox::StartDrag(nAction, rPosPixel);
67  }
68 
69  virtual void DragFinished(sal_Int8 nDropAction) override
70  {
71  m_aEndDragHdl.Call(this);
72  SvTabListBox::DragFinished(nDropAction);
73  }
74 
75  virtual void ModelHasCleared() override
76  {
78  m_aModelChangedHdl.Call(this);
79  }
80 
81  virtual void ModelHasInserted(SvTreeListEntry* pEntry) override
82  {
84  m_aModelChangedHdl.Call(this);
85  }
86 
87  virtual void ModelHasInsertedTree(SvTreeListEntry* pEntry) override
88  {
90  m_aModelChangedHdl.Call(this);
91  }
92 
93  virtual void ModelHasMoved(SvTreeListEntry* pSource) override
94  {
96  m_aModelChangedHdl.Call(this);
97  }
98 
99  virtual void ModelHasRemoved(SvTreeListEntry* pEntry) override
100  {
102  m_aModelChangedHdl.Call(this);
103  }
104 
105  virtual SvTreeListEntry* GetDropTarget(const Point& rPos) override
106  {
107  pTargetEntry = pImpl->GetEntry(rPos);
108 
109  // scroll
110  if (rPos.Y() < 12)
111  {
113  ScrollOutputArea(+1);
114  }
115  else
116  {
117  Size aSize(pImpl->GetOutputSize());
118  if (rPos.Y() > aSize.Height() - 12)
119  {
121  ScrollOutputArea(-1);
122  }
123  }
124 
125  return pTargetEntry;
126  }
127 
128  virtual bool EditingEntry(SvTreeListEntry* pEntry, Selection&) override
129  {
130  return m_aEditingEntryHdl.Call(pEntry);
131  }
132 
133  virtual bool EditedEntry(SvTreeListEntry* pEntry, const OUString& rNewText) override
134  {
135  return m_aEditedEntryHdl.Call(std::pair<SvTreeListEntry*, OUString>(pEntry, rNewText));
136  }
137 };
138 
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
virtual void ModelHasInserted(SvTreeListEntry *pEntry) override
virtual void DragFinished(sal_Int8 nDropAction)
virtual void ModelHasInsertedTree(SvTreeListEntry *pEntry) override
signed char sal_Int8
Link< SvTreeListEntry *, bool > m_aEditingEntryHdl
Definition: treeglue.hxx:37
Link< SvTreeListBox *, void > m_aEndDragHdl
Definition: treeglue.hxx:36
virtual void StartDrag(sal_Int8 nAction, const Point &rPosPixel) override
virtual SvTreeListEntry * GetDropTarget(const Point &rPos) override
Definition: treeglue.hxx:105
sal_Int64 WinBits
virtual DragDropMode NotifyStartDrag(TransferDataContainer &, SvTreeListEntry *) override
Definition: treeglue.hxx:58
void ScrollOutputArea(short nDeltaEntries)
DragDropMode
void SetStartDragHdl(const Link< SvTreeListBox *, void > &rLink)
Definition: treeglue.hxx:47
SvTreeListEntry * pTargetEntry
void SetEditingEntryHdl(const Link< SvTreeListEntry *, bool > &rLink)
Definition: treeglue.hxx:49
LclTabListBox(vcl::Window *pParent, WinBits nWinStyle)
Definition: treeglue.hxx:41
Link< SvTreeListBox *, void > m_aModelChangedHdl
Definition: treeglue.hxx:34
void SetEditedEntryHdl(const Link< std::pair< SvTreeListEntry *, OUString >, bool > &rLink)
Definition: treeglue.hxx:53
virtual void ModelHasInsertedTree(SvTreeListEntry *pEntry) override
Definition: treeglue.hxx:87
std::unique_ptr< SvImpLBox > pImpl
virtual void ModelHasMoved(SvTreeListEntry *pSource) override
Link< SvTreeListBox *, void > m_aStartDragHdl
Definition: treeglue.hxx:35
DragDropMode GetDragDropMode() const
virtual void ModelHasMoved(SvTreeListEntry *pSource) override
Definition: treeglue.hxx:93
void SetEndDragHdl(const Link< SvTreeListBox *, void > &rLink)
Definition: treeglue.hxx:48
virtual bool EditedEntry(SvTreeListEntry *pEntry, const OUString &rNewText) override
Definition: treeglue.hxx:133
virtual void ModelHasInserted(SvTreeListEntry *pEntry) override
Definition: treeglue.hxx:81
virtual void ModelHasCleared() override
virtual void DragFinished(sal_Int8 nDropAction) override
Definition: treeglue.hxx:69
Link< std::pair< SvTreeListEntry *, OUString >, bool > m_aEditedEntryHdl
Definition: treeglue.hxx:38
virtual void ModelHasCleared() override
Definition: treeglue.hxx:75
virtual DragDropMode NotifyStartDrag(TransferDataContainer &, SvTreeListEntry *) override
Definition: treeglue.hxx:26
virtual bool EditingEntry(SvTreeListEntry *pEntry, Selection &) override
Definition: treeglue.hxx:128
void SetModelChangedHdl(const Link< SvTreeListBox *, void > &rLink)
Definition: treeglue.hxx:46
virtual void ModelHasRemoved(SvTreeListEntry *pEntry) override
void ImplShowTargetEmphasis(SvTreeListEntry *pEntry, bool bShow)
virtual void StartDrag(sal_Int8 nAction, const Point &rPosPixel) override
Definition: treeglue.hxx:63
virtual void ModelHasRemoved(SvTreeListEntry *pEntry) override
Definition: treeglue.hxx:99
long Y() const
LclHeaderTabListBox(vcl::Window *pParent, WinBits nWinStyle)
Definition: treeglue.hxx:21