Line data Source code
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_CONDFORMATDLG_HXX
11 : #define INCLUDED_SC_SOURCE_UI_INC_CONDFORMATDLG_HXX
12 :
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>
21 :
22 : #include "rangelst.hxx"
23 : #include "condformathelper.hxx"
24 :
25 : #include <boost/ptr_container/ptr_vector.hpp>
26 : #include <boost/scoped_ptr.hpp>
27 : #include "anyrefdg.hxx"
28 :
29 : class ScDocument;
30 : class ScConditionalFormat;
31 : class ScFormatEntry;
32 : class ScConditionalFormat;
33 : struct ScDataBarFormatData;
34 : class ScCondFrmtEntry;
35 :
36 : namespace condformat {
37 :
38 : namespace dialog {
39 :
40 : enum ScCondFormatDialogType
41 : {
42 : NONE,
43 : CONDITION,
44 : COLORSCALE,
45 : DATABAR,
46 : ICONSET,
47 : DATE
48 : };
49 :
50 : }
51 :
52 : }
53 :
54 : class ScCondFormatDlg;
55 :
56 0 : class ScCondFormatList : public Control
57 : {
58 : private:
59 : typedef boost::ptr_vector<ScCondFrmtEntry> EntryContainer;
60 : EntryContainer maEntries;
61 :
62 : bool mbHasScrollBar;
63 : boost::scoped_ptr<ScrollBar> mpScrollBar;
64 :
65 : ScDocument* mpDoc;
66 : ScAddress maPos;
67 : ScRangeList maRanges;
68 : ScCondFormatDlg* mpDialogParent;
69 :
70 : void DoScroll(long nDiff);
71 :
72 : public:
73 : ScCondFormatList(vcl::Window* pParent, WinBits nStyle);
74 :
75 : void init(ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScConditionalFormat* pFormat,
76 : const ScRangeList& rRanges, const ScAddress& rPos,
77 : condformat::dialog::ScCondFormatDialogType eType);
78 :
79 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
80 : virtual void Resize() SAL_OVERRIDE;
81 :
82 : ScConditionalFormat* GetConditionalFormat() const;
83 : void RecalcAll();
84 :
85 : DECL_LINK( AddBtnHdl, void* );
86 : DECL_LINK( RemoveBtnHdl, void* );
87 : DECL_LINK( ScrollHdl, void* );
88 : DECL_LINK( EntrySelectHdl, ScCondFrmtEntry* );
89 :
90 : DECL_LINK( TypeListHdl, ListBox*);
91 : DECL_LINK( AfterTypeListHdl, ListBox*);
92 : DECL_LINK( ColFormatTypeHdl, ListBox*);
93 : };
94 :
95 : class ScCondFormatDlg : public ScAnyRefModalDlg
96 : {
97 : private:
98 : PushButton* mpBtnAdd;
99 : PushButton* mpBtnRemove;
100 : FixedText* mpFtRange;
101 : formula::RefEdit* mpEdRange;
102 : formula::RefButton* mpRbRange;
103 :
104 : ScCondFormatList* mpCondFormList;
105 :
106 : ScAddress maPos;
107 : ScDocument* mpDoc;
108 :
109 : formula::RefEdit* mpLastEdit;
110 :
111 : DECL_LINK( EdRangeModifyHdl, Edit* );
112 : protected:
113 :
114 : virtual void RefInputDone( bool bForced = false ) SAL_OVERRIDE;
115 :
116 : public:
117 : SC_DLLPUBLIC ScCondFormatDlg(vcl::Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat,
118 : const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
119 : virtual ~ScCondFormatDlg();
120 :
121 : SC_DLLPUBLIC ScConditionalFormat* GetConditionalFormat() const;
122 :
123 : virtual void SetReference(const ScRange&, ScDocument*) SAL_OVERRIDE;
124 : virtual bool IsRefInputMode() const SAL_OVERRIDE;
125 : virtual void SetActive() SAL_OVERRIDE;
126 : virtual bool IsTableLocked() const SAL_OVERRIDE;
127 :
128 : void InvalidateRefData();
129 :
130 : DECL_LINK( RangeGetFocusHdl, formula::RefEdit* );
131 : DECL_LINK( RangeLoseFocusHdl, void* );
132 : };
133 :
134 : #endif
135 :
136 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|