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 : #include <vcl/button.hxx>
11 : #include <vcl/dialog.hxx>
12 : #include <vcl/lstbox.hxx>
13 : #include <vcl/scrbar.hxx>
14 : #include <vcl/fixed.hxx>
15 : #include <vcl/edit.hxx>
16 : #include <svx/fntctrl.hxx>
17 : #include <svtools/ctrlbox.hxx>
18 :
19 : #include "rangelst.hxx"
20 : #include "condformathelper.hxx"
21 :
22 : #include <boost/ptr_container/ptr_vector.hpp>
23 : #include <boost/scoped_ptr.hpp>
24 : #include "anyrefdg.hxx"
25 :
26 : class ScDocument;
27 : class ScConditionalFormat;
28 : class ScFormatEntry;
29 : class ScConditionalFormat;
30 : struct ScDataBarFormatData;
31 : class ScCondFrmtEntry;
32 :
33 : namespace condformat {
34 :
35 : namespace dialog {
36 :
37 : enum ScCondFormatDialogType
38 : {
39 : NONE,
40 : CONDITION,
41 : COLORSCALE,
42 : DATABAR,
43 : ICONSET,
44 : DATE
45 : };
46 :
47 : }
48 :
49 : }
50 :
51 0 : class ScCondFormatList : public Control
52 : {
53 : private:
54 : typedef boost::ptr_vector<ScCondFrmtEntry> EntryContainer;
55 : EntryContainer maEntries;
56 :
57 : bool mbHasScrollBar;
58 : boost::scoped_ptr<ScrollBar> mpScrollBar;
59 :
60 : ScDocument* mpDoc;
61 : ScAddress maPos;
62 : ScRangeList maRanges;
63 :
64 : void DoScroll(long nDiff);
65 :
66 : public:
67 : ScCondFormatList( Window* pParent, const ResId& rResId, ScDocument* pDoc, const ScConditionalFormat* pFormat,
68 : const ScRangeList& rRanges, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
69 :
70 : ScConditionalFormat* GetConditionalFormat() const;
71 : void RecalcAll();
72 :
73 : DECL_LINK( AddBtnHdl, void* );
74 : DECL_LINK( RemoveBtnHdl, void* );
75 : DECL_LINK( ScrollHdl, void* );
76 : DECL_LINK( EntrySelectHdl, ScCondFrmtEntry* );
77 :
78 : DECL_LINK( TypeListHdl, ListBox*);
79 : DECL_LINK( ColFormatTypeHdl, ListBox*);
80 : };
81 :
82 : class ScCondFormatDlg : public ScAnyRefModalDlg
83 : {
84 : private:
85 : PushButton maBtnAdd;
86 : PushButton maBtnRemove;
87 : FixedText maFtRange;
88 : formula::RefEdit maEdRange;
89 : formula::RefButton maRbRange;
90 : OKButton maBtnOk;
91 : CancelButton maBtnCancel;
92 :
93 : ScCondFormatList maCondFormList;
94 :
95 : ScAddress maPos;
96 : ScDocument* mpDoc;
97 :
98 : formula::RefEdit* mpLastEdit;
99 :
100 : DECL_LINK( EdRangeModifyHdl, Edit* );
101 : protected:
102 :
103 : virtual void RefInputDone( sal_Bool bForced = false );
104 :
105 :
106 : public:
107 : SC_DLLPUBLIC ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat,
108 : const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
109 : virtual ~ScCondFormatDlg();
110 :
111 : SC_DLLPUBLIC ScConditionalFormat* GetConditionalFormat() const;
112 :
113 : virtual void SetReference(const ScRange&, ScDocument*);
114 : virtual sal_Bool IsRefInputMode() const;
115 : virtual void SetActive();
116 : virtual sal_Bool IsTableLocked() const;
117 :
118 : void InvalidateRefData();
119 :
120 : DECL_LINK( RangeGetFocusHdl, formula::RefEdit* );
121 : DECL_LINK( RangeLoseFocusHdl, void* );
122 : };
123 :
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|