tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / condformatdlg.hxx
blob19b2322bdcaab5ac31ea1f090124f2f5886a5816
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #pragma once
12 #include <rangelst.hxx>
13 #include "condformatdlgdata.hxx"
14 #include "condformatdlgentry.hxx"
16 #include "anyrefdg.hxx"
18 #include <memory>
20 #define DLG_RET_ADD 8
21 #define DLG_RET_EDIT 16
23 class ScDocument;
24 class ScConditionalFormat;
25 class ScViewData;
27 class ScCondFormatDlg;
29 class ScCondFormatList
31 private:
32 std::unique_ptr<weld::ScrolledWindow> mxScrollWindow;
33 std::unique_ptr<weld::Container> mxGrid;
35 typedef std::vector<std::unique_ptr<ScCondFrmtEntry>> EntryContainer;
36 EntryContainer maEntries;
38 bool mbFrozen;
39 bool mbNewEntry;
41 ScDocument& mrDoc;
42 ScAddress maPos;
43 ScRangeList maRanges;
44 ScCondFormatDlg* mpDialogParent;
46 public:
47 ScCondFormatList(ScCondFormatDlg* pParent,
48 ScDocument& rDoc,
49 std::unique_ptr<weld::ScrolledWindow> xWindow,
50 std::unique_ptr<weld::Container> xGrid);
51 weld::Container* GetContainer() { return mxGrid.get(); }
52 ~ScCondFormatList();
54 void init(const ScConditionalFormat* pFormat,
55 const ScRangeList& rRanges, const ScAddress& rPos,
56 condformat::dialog::ScCondFormatDialogType eType);
58 void SetRange(const ScRangeList& rRange);
60 std::unique_ptr<ScConditionalFormat> GetConditionalFormat() const;
61 weld::Window* GetFrameWeld();
62 void Freeze() { mbFrozen = true; }
63 void Thaw() { mbFrozen = false; }
64 void RecalcAll();
66 DECL_LINK( AddBtnHdl, weld::Button&, void );
67 DECL_LINK( RemoveBtnHdl, weld::Button&, void );
68 DECL_LINK( UpBtnHdl, weld::Button&, void );
69 DECL_LINK( DownBtnHdl, weld::Button&, void );
70 DECL_LINK( EntrySelectHdl, ScCondFrmtEntry&, void );
72 DECL_LINK( TypeListHdl, weld::ComboBox&, void );
73 DECL_LINK( AfterTypeListHdl, void*, void );
74 DECL_LINK( ColFormatTypeHdl, weld::ComboBox&, void );
75 DECL_LINK( AfterColFormatTypeHdl, void*, void );
78 class ScCondFormatDlg : public ScAnyRefDlgController
80 private:
81 sal_uInt32 mnKey;
83 ScAddress maPos;
84 ScViewData* mpViewData;
86 std::shared_ptr<ScCondFormatDlgData> mpDlgItem;
88 OUString msBaseTitle;
90 formula::RefEdit* mpLastEdit;
91 std::unique_ptr<weld::Button> mxBtnOk;
92 std::unique_ptr<weld::Button> mxBtnAdd;
93 std::unique_ptr<weld::Button> mxBtnRemove;
94 std::unique_ptr<weld::Button> mxBtnUp;
95 std::unique_ptr<weld::Button> mxBtnDown;
96 std::unique_ptr<weld::Button> mxBtnCancel;
97 std::unique_ptr<weld::Label> mxFtRange;
98 std::unique_ptr<formula::RefEdit> mxEdRange;
99 std::unique_ptr<formula::RefButton> mxRbRange;
100 std::unique_ptr<ScCondFormatList> mxCondFormList;
102 void updateTitle();
103 DECL_LINK( EdRangeModifyHdl, formula::RefEdit&, void );
104 protected:
106 virtual void RefInputDone( bool bForced = false ) override;
107 void OkPressed();
108 void CancelPressed();
110 public:
111 ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pWindow,
112 ScViewData* pViewData, const std::shared_ptr<ScCondFormatDlgData>& rItem);
113 virtual ~ScCondFormatDlg() override;
115 std::unique_ptr<ScConditionalFormat> GetConditionalFormat() const;
117 virtual void SetReference(const ScRange&, ScDocument&) override;
118 virtual bool IsRefInputMode() const override;
119 virtual void SetActive() override;
120 virtual bool IsTableLocked() const override;
121 virtual void Close() override;
123 void InvalidateRefData();
124 void OnSelectionChange(size_t nIndex, size_t nSize, bool bSelected = true);
126 DECL_LINK( BtnPressedHdl, weld::Button&, void );
127 DECL_LINK( RangeGetFocusHdl, formula::RefEdit&, void );
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */