Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / ui / inc / condformatdlg.hxx
blob42b39a8bcad1bba8c365bf014038dca10d91cd16
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 #ifndef INCLUDED_SC_SOURCE_UI_INC_CONDFORMATDLG_HXX
11 #define INCLUDED_SC_SOURCE_UI_INC_CONDFORMATDLG_HXX
13 #include <vcl/button.hxx>
14 #include <vcl/dialog.hxx>
15 #include <vcl/lstbox.hxx>
16 #include <vcl/scrbar.hxx>
17 #include <vcl/fixed.hxx>
18 #include <vcl/edit.hxx>
19 #include <svx/fntctrl.hxx>
20 #include <svtools/ctrlbox.hxx>
22 #include "rangelst.hxx"
23 #include "condformathelper.hxx"
24 #include "viewdata.hxx"
25 #include "condformatdlgitem.hxx"
27 #include "anyrefdg.hxx"
29 #include <memory>
31 #define DLG_RET_ADD 8
32 #define DLG_RET_EDIT 16
34 class ScDocument;
35 class ScConditionalFormat;
36 class ScFormatEntry;
37 class ScConditionalFormat;
38 struct ScDataBarFormatData;
39 class ScCondFrmtEntry;
41 class ScCondFormatDlg;
43 class ScCondFormatList : public Control
45 private:
46 typedef std::vector<VclPtr<ScCondFrmtEntry>> EntryContainer;
47 EntryContainer maEntries;
49 bool mbHasScrollBar;
50 VclPtr<ScrollBar> mpScrollBar;
52 ScDocument* mpDoc;
53 ScAddress maPos;
54 ScRangeList maRanges;
55 VclPtr<ScCondFormatDlg> mpDialogParent;
57 void DoScroll(long nDiff);
59 public:
60 ScCondFormatList(vcl::Window* pParent, WinBits nStyle);
61 virtual ~ScCondFormatList();
62 virtual void dispose() override;
64 void init(ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScConditionalFormat* pFormat,
65 const ScRangeList& rRanges, const ScAddress& rPos,
66 condformat::dialog::ScCondFormatDialogType eType);
68 virtual Size GetOptimalSize() const override;
69 virtual void Resize() override;
71 ScConditionalFormat* GetConditionalFormat() const;
72 void RecalcAll();
74 DECL_LINK_TYPED( AddBtnHdl, Button*, void );
75 DECL_LINK_TYPED( RemoveBtnHdl, Button*, void );
76 DECL_LINK_TYPED( ScrollHdl, ScrollBar*, void );
77 DECL_LINK_TYPED( EntrySelectHdl, ScCondFrmtEntry&, void );
79 DECL_LINK_TYPED( TypeListHdl, ListBox&, void );
80 DECL_LINK_TYPED( AfterTypeListHdl, void*, void );
81 DECL_LINK_TYPED( ColFormatTypeHdl, ListBox&, void );
84 class ScCondFormatDlg : public ScAnyRefDlg
86 private:
87 VclPtr<PushButton> mpBtnOk;
88 VclPtr<PushButton> mpBtnAdd;
89 VclPtr<PushButton> mpBtnRemove;
90 VclPtr<PushButton> mpBtnCancel;
91 VclPtr<FixedText> mpFtRange;
92 VclPtr<formula::RefEdit> mpEdRange;
93 VclPtr<formula::RefButton> mpRbRange;
95 VclPtr<ScCondFormatList> mpCondFormList;
96 sal_Int32 mnKey;
98 ScAddress maPos;
99 ScViewData* mpViewData;
101 VclPtr<formula::RefEdit> mpLastEdit;
103 std::shared_ptr<ScCondFormatDlgItem> mpDlgItem;
105 OUString msBaseTitle;
106 void updateTitle();
108 DECL_LINK_TYPED( EdRangeModifyHdl, Edit&, void );
109 protected:
111 virtual void RefInputDone( bool bForced = false ) override;
112 void OkPressed();
113 void CancelPressed();
115 public:
116 SC_DLLPUBLIC ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pWindow,
117 ScViewData* pViewData, const ScCondFormatDlgItem* pDlgItem);
118 virtual ~ScCondFormatDlg();
119 virtual void dispose() override;
121 SC_DLLPUBLIC ScConditionalFormat* GetConditionalFormat() const;
123 virtual void SetReference(const ScRange&, ScDocument*) override;
124 virtual bool IsRefInputMode() const override;
125 virtual void SetActive() override;
126 virtual bool IsTableLocked() const override;
127 virtual bool Close() override;
129 void InvalidateRefData();
131 DECL_LINK_TYPED( BtnPressedHdl, Button*, void );
132 DECL_LINK_TYPED( RangeGetFocusHdl, Control&, void );
135 #endif
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */