1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 
11 #ifndef INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTTREELISTBASE_HXX
12 #define INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTTREELISTBASE_HXX
13 
14 #include <vcl/transfer.hxx>
15 #include <vcl/weld.hxx>
16 #include <pivot.hxx>
17 
18 class ScPivotLayoutDialog;
19 class ScPivotLayoutTreeListBase;
20 class ScItemValue;
21 
22 class ScPivotLayoutTreeDropTarget : public DropTargetHelper
23 {
24 private:
25     ScPivotLayoutTreeListBase& m_rTreeView;
26 
27     virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
28     virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
29 
30 public:
31     ScPivotLayoutTreeDropTarget(ScPivotLayoutTreeListBase& rTreeView);
32 };
33 
34 class ScPivotLayoutTreeListBase
35 {
36 public:
37     enum SvPivotTreeListType
38     {
39         UNDEFINED,
40         LABEL_LIST,
41         PAGE_LIST,
42         ROW_LIST,
43         COLUMN_LIST
44     };
45 
46 protected:
47     std::unique_ptr<weld::TreeView> mxControl;
48     ScPivotLayoutTreeDropTarget maDropTargetHelper;
49     SvPivotTreeListType meType;
50     ScPivotLayoutDialog* mpParent;
51 
52     DECL_LINK(GetFocusHdl, weld::Widget&, void);
53     DECL_LINK(MnemonicActivateHdl, weld::Widget&, bool);
54     DECL_LINK(LoseFocusHdl, weld::Widget&, void);
55 
56 public:
57     void Setup(ScPivotLayoutDialog* pParent);
58 
59     ScPivotLayoutTreeListBase(std::unique_ptr<weld::TreeView> xControl, SvPivotTreeListType eType = UNDEFINED);
get_widget()60     weld::TreeView& get_widget() { return *mxControl; }
61     virtual ~ScPivotLayoutTreeListBase();
62 
63     void PushEntriesToPivotFieldVector(ScPivotFieldVector& rVector);
64 
65     void RemoveEntryForItem(const ScItemValue* pItemValue);
66 
67     virtual void InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget);
68 };
69 
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
71 
72 #endif
73