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/svtabbx.hxx>
11 #include "svimpbox.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 private:
23 
24 public:
26  : SvHeaderTabListBox(pParent, nWinStyle)
27  {
28  }
29 
31  {
32  m_aEditingEntryHdl = rLink;
33  }
34 
35  void SetEditedEntryHdl(const Link<std::pair<SvTreeListEntry*, OUString>, bool>& rLink)
36  {
37  m_aEditedEntryHdl = rLink;
38  }
39 
41  {
42  return GetDragDropMode();
43  }
44 
45  virtual bool EditingEntry(SvTreeListEntry* pEntry, Selection&) override
46  {
47  return m_aEditingEntryHdl.Call(pEntry);
48  }
49 
50  virtual bool EditedEntry(SvTreeListEntry* pEntry, const OUString& rNewText) override
51  {
52  return m_aEditedEntryHdl.Call(std::pair<SvTreeListEntry*, OUString>(pEntry, rNewText));
53  }
54 };
55 
57 {
63 
64 public:
65  LclTabListBox(vcl::Window* pParent, WinBits nWinStyle)
66  : SvTabListBox(pParent, nWinStyle)
67  {
68  }
69 
70  void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; }
71  void SetStartDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aStartDragHdl = rLink; }
72  void SetEndDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aEndDragHdl = rLink; }
74  {
75  m_aEditingEntryHdl = rLink;
76  }
77  void SetEditedEntryHdl(const Link<std::pair<SvTreeListEntry*, OUString>, bool>& rLink)
78  {
79  m_aEditedEntryHdl = rLink;
80  }
81 
83  {
84  return GetDragDropMode();
85  }
86 
87  virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override
88  {
89  m_aStartDragHdl.Call(this);
90  SvTabListBox::StartDrag(nAction, rPosPixel);
91  }
92 
93  virtual void DragFinished(sal_Int8 nDropAction) override
94  {
95  m_aEndDragHdl.Call(this);
96  SvTabListBox::DragFinished(nDropAction);
97  }
98 
99  virtual void ModelHasCleared() override
100  {
102  m_aModelChangedHdl.Call(this);
103  }
104 
105  virtual void ModelHasInserted(SvTreeListEntry* pEntry) override
106  {
108  m_aModelChangedHdl.Call(this);
109  }
110 
111  virtual void ModelHasInsertedTree(SvTreeListEntry* pEntry) override
112  {
114  m_aModelChangedHdl.Call(this);
115  }
116 
117  virtual void ModelHasMoved(SvTreeListEntry* pSource) override
118  {
120  m_aModelChangedHdl.Call(this);
121  }
122 
123  virtual void ModelHasRemoved(SvTreeListEntry* pEntry) override
124  {
126  m_aModelChangedHdl.Call(this);
127  }
128 
129  virtual SvTreeListEntry* GetDropTarget(const Point& rPos) override
130  {
131  pTargetEntry = pImpl->GetEntry(rPos);
132 
133  // scroll
134  if (rPos.Y() < 12)
135  {
137  ScrollOutputArea(+1);
138  }
139  else
140  {
141  Size aSize(pImpl->GetOutputSize());
142  if (rPos.Y() > aSize.Height() - 12)
143  {
145  ScrollOutputArea(-1);
146  }
147  }
148 
149  return pTargetEntry;
150  }
151 
152  virtual bool EditingEntry(SvTreeListEntry* pEntry, Selection&) override
153  {
154  return m_aEditingEntryHdl.Call(pEntry);
155  }
156 
157  virtual bool EditedEntry(SvTreeListEntry* pEntry, const OUString& rNewText) override
158  {
159  return m_aEditedEntryHdl.Call(std::pair<SvTreeListEntry*, OUString>(pEntry, rNewText));
160  }
161 };
162 
163 /* 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:61
Link< SvTreeListBox *, void > m_aEndDragHdl
Definition: treeglue.hxx:60
virtual void StartDrag(sal_Int8 nAction, const Point &rPosPixel) override
virtual SvTreeListEntry * GetDropTarget(const Point &rPos) override
Definition: treeglue.hxx:129
sal_Int64 WinBits
virtual DragDropMode NotifyStartDrag(TransferDataContainer &, SvTreeListEntry *) override
Definition: treeglue.hxx:82
void ScrollOutputArea(short nDeltaEntries)
DragDropMode
virtual bool EditedEntry(SvTreeListEntry *pEntry, const OUString &rNewText) override
Definition: treeglue.hxx:50
void SetStartDragHdl(const Link< SvTreeListBox *, void > &rLink)
Definition: treeglue.hxx:71
virtual bool EditingEntry(SvTreeListEntry *pEntry, Selection &) override
Definition: treeglue.hxx:45
SvTreeListEntry * pTargetEntry
void SetEditingEntryHdl(const Link< SvTreeListEntry *, bool > &rLink)
Definition: treeglue.hxx:73
LclTabListBox(vcl::Window *pParent, WinBits nWinStyle)
Definition: treeglue.hxx:65
Link< SvTreeListBox *, void > m_aModelChangedHdl
Definition: treeglue.hxx:58
void SetEditedEntryHdl(const Link< std::pair< SvTreeListEntry *, OUString >, bool > &rLink)
Definition: treeglue.hxx:77
Link< SvTreeListEntry *, bool > m_aEditingEntryHdl
Definition: treeglue.hxx:21
virtual void ModelHasInsertedTree(SvTreeListEntry *pEntry) override
Definition: treeglue.hxx:111
std::unique_ptr< SvImpLBox > pImpl
virtual void ModelHasMoved(SvTreeListEntry *pSource) override
Link< SvTreeListBox *, void > m_aStartDragHdl
Definition: treeglue.hxx:59
DragDropMode GetDragDropMode() const
virtual void ModelHasMoved(SvTreeListEntry *pSource) override
Definition: treeglue.hxx:117
void SetEndDragHdl(const Link< SvTreeListBox *, void > &rLink)
Definition: treeglue.hxx:72
virtual bool EditedEntry(SvTreeListEntry *pEntry, const OUString &rNewText) override
Definition: treeglue.hxx:157
virtual void ModelHasInserted(SvTreeListEntry *pEntry) override
Definition: treeglue.hxx:105
virtual void ModelHasCleared() override
virtual void DragFinished(sal_Int8 nDropAction) override
Definition: treeglue.hxx:93
Link< std::pair< SvTreeListEntry *, OUString >, bool > m_aEditedEntryHdl
Definition: treeglue.hxx:62
void SetEditingEntryHdl(const Link< SvTreeListEntry *, bool > &rLink)
Definition: treeglue.hxx:30
virtual void ModelHasCleared() override
Definition: treeglue.hxx:99
virtual DragDropMode NotifyStartDrag(TransferDataContainer &, SvTreeListEntry *) override
Definition: treeglue.hxx:40
virtual bool EditingEntry(SvTreeListEntry *pEntry, Selection &) override
Definition: treeglue.hxx:152
void SetModelChangedHdl(const Link< SvTreeListBox *, void > &rLink)
Definition: treeglue.hxx:70
virtual void ModelHasRemoved(SvTreeListEntry *pEntry) override
void ImplShowTargetEmphasis(SvTreeListEntry *pEntry, bool bShow)
Link< std::pair< SvTreeListEntry *, OUString >, bool > m_aEditedEntryHdl
Definition: treeglue.hxx:22
void SetEditedEntryHdl(const Link< std::pair< SvTreeListEntry *, OUString >, bool > &rLink)
Definition: treeglue.hxx:35
virtual void StartDrag(sal_Int8 nAction, const Point &rPosPixel) override
Definition: treeglue.hxx:87
virtual void ModelHasRemoved(SvTreeListEntry *pEntry) override
Definition: treeglue.hxx:123
long Y() const
LclHeaderTabListBox(vcl::Window *pParent, WinBits nWinStyle)
Definition: treeglue.hxx:25