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 "sc.hrc"
30 :
31 : #include <vcl/dialog.hxx>
32 : #include <svtools/svtabbx.hxx>
33 : #include <vcl/button.hxx>
34 : #include <vcl/fixed.hxx>
35 : #include <svtools/headbar.hxx>
36 :
37 : #include "conditio.hxx"
38 : #include "document.hxx"
39 :
40 : #include <map>
41 :
42 : class ScDocument;
43 :
44 0 : class ScCondFormatManagerWindow : public SvTabListBox
45 : {
46 : private:
47 : void Init();
48 : String createEntryString(const ScConditionalFormat& rFormat);
49 :
50 : HeaderBar maHeaderBar;
51 : ScDocument* mpDoc;
52 : ScConditionalFormatList* mpFormatList;
53 : std::map<SvTreeListEntry*, sal_Int32> maMapLBoxEntryToCondIndex;
54 :
55 : DECL_LINK( HeaderEndDragHdl, void* );
56 :
57 : public:
58 : ScCondFormatManagerWindow( Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList );
59 :
60 : void DeleteSelection();
61 : ScConditionalFormat* GetSelection();
62 : void Update();
63 : };
64 :
65 0 : class ScCondFormatManagerCtrl : Control
66 : {
67 : public:
68 : ScCondFormatManagerCtrl(Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList);
69 :
70 : ScConditionalFormat* GetSelection();
71 : void DeleteSelection();
72 : void Update();
73 0 : ScCondFormatManagerWindow &GetListControl() { return maWdManager; }
74 :
75 : private:
76 : ScCondFormatManagerWindow maWdManager;
77 : };
78 :
79 : class ScCondFormatManagerDlg : public ModalDialog
80 : {
81 : public:
82 : ScCondFormatManagerDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScAddress& rPos);
83 : ~ScCondFormatManagerDlg();
84 :
85 : ScConditionalFormatList* GetConditionalFormatList();
86 :
87 : bool CondFormatsChanged();
88 :
89 : virtual bool IsInRefMode() const;
90 :
91 : private:
92 : PushButton maBtnAdd;
93 : PushButton maBtnRemove;
94 : PushButton maBtnEdit;
95 :
96 : OKButton maBtnOk;
97 : CancelButton maBtnCancel;
98 :
99 : FixedLine maFlLine;
100 :
101 : ScConditionalFormatList* mpFormatList;
102 :
103 : ScCondFormatManagerCtrl maCtrlManager;
104 :
105 : ScDocument* mpDoc;
106 : ScAddress maPos;
107 :
108 : DECL_LINK(RemoveBtnHdl, void*);
109 : DECL_LINK(EditBtnHdl, void*);
110 : DECL_LINK(AddBtnHdl, void*);
111 :
112 : bool mbModified;
113 : };
114 :
115 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|