Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License or as specified alternatively below. You may obtain a copy of
8 : * the License at http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * Major Contributor(s):
16 : * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
17 : *
18 : * All Rights Reserved.
19 : *
20 : * For minor contributions see the git repository.
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : * instead of those above.
27 : */
28 :
29 : #include <vcl/button.hxx>
30 : #include <vcl/dialog.hxx>
31 : #include <vcl/lstbox.hxx>
32 : #include <vcl/scrbar.hxx>
33 : #include <vcl/fixed.hxx>
34 : #include <vcl/edit.hxx>
35 : #include <svx/fntctrl.hxx>
36 : #include <svtools/ctrlbox.hxx>
37 :
38 : #include "rangelst.hxx"
39 : #include "condformathelper.hxx"
40 :
41 : #include <boost/ptr_container/ptr_vector.hpp>
42 : #include <boost/scoped_ptr.hpp>
43 : #include "anyrefdg.hxx"
44 :
45 : class ScDocument;
46 : class ScConditionalFormat;
47 : class ScFormatEntry;
48 : class ScConditionalFormat;
49 : struct ScDataBarFormatData;
50 : class ScCondFrmtEntry;
51 :
52 : namespace condformat {
53 :
54 : namespace dialog {
55 :
56 : enum ScCondFormatDialogType
57 : {
58 : NONE,
59 : CONDITION,
60 : COLORSCALE,
61 : DATABAR
62 : };
63 :
64 : }
65 :
66 : }
67 :
68 0 : class ScCondFormatList : public Control
69 : {
70 : private:
71 : typedef boost::ptr_vector<ScCondFrmtEntry> EntryContainer;
72 : EntryContainer maEntries;
73 :
74 : bool mbHasScrollBar;
75 : boost::scoped_ptr<ScrollBar> mpScrollBar;
76 :
77 : ScDocument* mpDoc;
78 : ScAddress maPos;
79 : ScRangeList maRanges;
80 :
81 : void DoScroll(long nDiff);
82 :
83 : public:
84 : ScCondFormatList( Window* pParent, const ResId& rResId, ScDocument* pDoc, const ScConditionalFormat* pFormat,
85 : const ScRangeList& rRanges, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
86 :
87 : ScConditionalFormat* GetConditionalFormat() const;
88 : void RecalcAll();
89 :
90 : DECL_LINK( AddBtnHdl, void* );
91 : DECL_LINK( RemoveBtnHdl, void* );
92 : DECL_LINK( ScrollHdl, void* );
93 : DECL_LINK( EntrySelectHdl, ScCondFrmtEntry* );
94 :
95 : DECL_LINK( TypeListHdl, ListBox*);
96 : DECL_LINK( ColFormatTypeHdl, ListBox*);
97 : };
98 :
99 : class ScCondFormatDlg : public ScAnyRefModalDlg
100 : {
101 : private:
102 : PushButton maBtnAdd;
103 : PushButton maBtnRemove;
104 : OKButton maBtnOk;
105 : CancelButton maBtnCancel;
106 : FixedText maFtRange;
107 : formula::RefEdit maEdRange;
108 : formula::RefButton maRbRange;
109 :
110 : ScCondFormatList maCondFormList;
111 :
112 : ScAddress maPos;
113 : ScDocument* mpDoc;
114 :
115 : formula::RefEdit* mpLastEdit;
116 :
117 : DECL_LINK( EdRangeModifyHdl, Edit* );
118 : protected:
119 :
120 : virtual void RefInputDone( sal_Bool bForced = false );
121 :
122 :
123 : public:
124 : SC_DLLPUBLIC ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat,
125 : const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
126 : virtual ~ScCondFormatDlg();
127 :
128 : SC_DLLPUBLIC ScConditionalFormat* GetConditionalFormat() const;
129 :
130 : virtual void SetReference(const ScRange&, ScDocument*);
131 : virtual sal_Bool IsRefInputMode() const;
132 : virtual void SetActive();
133 : virtual sal_Bool IsTableLocked() const;
134 :
135 : void InvalidateRefData();
136 :
137 : DECL_LINK( RangeGetFocusHdl, formula::RefEdit* );
138 : DECL_LINK( RangeLoseFocusHdl, void* );
139 : };
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|