Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / condformatdlg.hxx
blob6baf33dd33d61e618e9f3d0052322e01f9e74dc1
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 SC_CONDFORMATDLG_HXX
11 #define SC_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"
25 #include <boost/ptr_container/ptr_vector.hpp>
26 #include <boost/scoped_ptr.hpp>
27 #include "anyrefdg.hxx"
29 class ScDocument;
30 class ScConditionalFormat;
31 class ScFormatEntry;
32 class ScConditionalFormat;
33 struct ScDataBarFormatData;
34 class ScCondFrmtEntry;
36 namespace condformat {
38 namespace dialog {
40 enum ScCondFormatDialogType
42 NONE,
43 CONDITION,
44 COLORSCALE,
45 DATABAR,
46 ICONSET,
47 DATE
54 class ScCondFormatList : public Control
56 private:
57 typedef boost::ptr_vector<ScCondFrmtEntry> EntryContainer;
58 EntryContainer maEntries;
60 bool mbHasScrollBar;
61 boost::scoped_ptr<ScrollBar> mpScrollBar;
63 ScDocument* mpDoc;
64 ScAddress maPos;
65 ScRangeList maRanges;
67 void DoScroll(long nDiff);
69 public:
70 ScCondFormatList( Window* pParent, const ResId& rResId, ScDocument* pDoc, const ScConditionalFormat* pFormat,
71 const ScRangeList& rRanges, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
73 ScConditionalFormat* GetConditionalFormat() const;
74 void RecalcAll();
76 DECL_LINK( AddBtnHdl, void* );
77 DECL_LINK( RemoveBtnHdl, void* );
78 DECL_LINK( ScrollHdl, void* );
79 DECL_LINK( EntrySelectHdl, ScCondFrmtEntry* );
81 DECL_LINK( TypeListHdl, ListBox*);
82 DECL_LINK( ColFormatTypeHdl, ListBox*);
85 class ScCondFormatDlg : public ScAnyRefModalDlg
87 private:
88 PushButton maBtnAdd;
89 PushButton maBtnRemove;
90 FixedText maFtRange;
91 formula::RefEdit maEdRange;
92 formula::RefButton maRbRange;
93 OKButton maBtnOk;
94 CancelButton maBtnCancel;
96 ScCondFormatList maCondFormList;
98 ScAddress maPos;
99 ScDocument* mpDoc;
101 formula::RefEdit* mpLastEdit;
103 DECL_LINK( EdRangeModifyHdl, Edit* );
104 protected:
106 virtual void RefInputDone( sal_Bool bForced = false );
109 public:
110 SC_DLLPUBLIC ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat,
111 const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
112 virtual ~ScCondFormatDlg();
114 SC_DLLPUBLIC ScConditionalFormat* GetConditionalFormat() const;
116 virtual void SetReference(const ScRange&, ScDocument*);
117 virtual sal_Bool IsRefInputMode() const;
118 virtual void SetActive();
119 virtual sal_Bool IsTableLocked() const;
121 void InvalidateRefData();
123 DECL_LINK( RangeGetFocusHdl, formula::RefEdit* );
124 DECL_LINK( RangeLoseFocusHdl, void* );
127 #endif
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */