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 #ifndef INCLUDED_SC_SOURCE_UI_INC_CONDFORMATMGR_HXX
11 #define INCLUDED_SC_SOURCE_UI_INC_CONDFORMATMGR_HXX
12 
13 #include <vcl/weld.hxx>
14 
15 #include <map>
16 
17 class ScDocument;
18 class ScConditionalFormat;
19 class ScConditionalFormatList;
20 
21 class ScCondFormatManagerWindow
22 {
23 private:
24     void Init();
25     void setColSizes();
26 
27     weld::TreeView& mrTreeView;
28     ScDocument* const mpDoc;
29     ScConditionalFormatList* mpFormatList;
30 
31 public:
32     ScCondFormatManagerWindow(weld::TreeView& rTreeView, ScDocument* pDoc, ScConditionalFormatList* pFormatList);
33 
34     void DeleteSelection();
35     ScConditionalFormat* GetSelection();
36 };
37 
38 class ScCondFormatManagerDlg : public weld::GenericDialogController
39 {
40 public:
41     ScCondFormatManagerDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList);
42     virtual ~ScCondFormatManagerDlg() override;
43 
44     std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList();
45 
46     bool CondFormatsChanged() const;
47     void SetModified();
48 
49     ScConditionalFormat* GetCondFormatSelected();
50 
51 private:
52     bool m_bModified;
53     std::unique_ptr<ScConditionalFormatList> m_xFormatList;
54 
55     std::unique_ptr<weld::Button> m_xBtnAdd;
56     std::unique_ptr<weld::Button> m_xBtnRemove;
57     std::unique_ptr<weld::Button> m_xBtnEdit;
58     std::unique_ptr<weld::TreeView> m_xTreeView;
59     std::unique_ptr<ScCondFormatManagerWindow> m_xCtrlManager;
60 
61     void UpdateButtonSensitivity();
62 
63     DECL_LINK(RemoveBtnHdl, weld::Button&, void);
64     DECL_LINK(EditBtnClickHdl, weld::Button&, void);
65     DECL_LINK(AddBtnHdl, weld::Button&, void);
66     DECL_LINK(EditBtnHdl, weld::TreeView&, bool);
67 };
68 
69 #endif
70 
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
72