1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_SC_SOURCE_UI_INC_CONDFORMATDLG_HXX
11 #define INCLUDED_SC_SOURCE_UI_INC_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"
24 #include "viewdata.hxx"
25 #include "condformatdlgitem.hxx"
27 #include "anyrefdg.hxx"
32 #define DLG_RET_EDIT 16
35 class ScConditionalFormat
;
37 class ScConditionalFormat
;
38 struct ScDataBarFormatData
;
39 class ScCondFrmtEntry
;
41 class ScCondFormatDlg
;
43 class ScCondFormatList
: public Control
46 typedef std::vector
<VclPtr
<ScCondFrmtEntry
>> EntryContainer
;
47 EntryContainer maEntries
;
50 VclPtr
<ScrollBar
> mpScrollBar
;
55 VclPtr
<ScCondFormatDlg
> mpDialogParent
;
57 void DoScroll(long nDiff
);
60 ScCondFormatList(vcl::Window
* pParent
, WinBits nStyle
);
61 virtual ~ScCondFormatList();
62 virtual void dispose() override
;
64 void init(ScDocument
* pDoc
, ScCondFormatDlg
* pDialogParent
, const ScConditionalFormat
* pFormat
,
65 const ScRangeList
& rRanges
, const ScAddress
& rPos
,
66 condformat::dialog::ScCondFormatDialogType eType
);
68 virtual Size
GetOptimalSize() const override
;
69 virtual void Resize() override
;
71 ScConditionalFormat
* GetConditionalFormat() const;
74 DECL_LINK_TYPED( AddBtnHdl
, Button
*, void );
75 DECL_LINK_TYPED( RemoveBtnHdl
, Button
*, void );
76 DECL_LINK_TYPED( ScrollHdl
, ScrollBar
*, void );
77 DECL_LINK_TYPED( EntrySelectHdl
, ScCondFrmtEntry
&, void );
79 DECL_LINK_TYPED( TypeListHdl
, ListBox
&, void );
80 DECL_LINK_TYPED( AfterTypeListHdl
, void*, void );
81 DECL_LINK_TYPED( ColFormatTypeHdl
, ListBox
&, void );
84 class ScCondFormatDlg
: public ScAnyRefDlg
87 VclPtr
<PushButton
> mpBtnOk
;
88 VclPtr
<PushButton
> mpBtnAdd
;
89 VclPtr
<PushButton
> mpBtnRemove
;
90 VclPtr
<PushButton
> mpBtnCancel
;
91 VclPtr
<FixedText
> mpFtRange
;
92 VclPtr
<formula::RefEdit
> mpEdRange
;
93 VclPtr
<formula::RefButton
> mpRbRange
;
95 VclPtr
<ScCondFormatList
> mpCondFormList
;
99 ScViewData
* mpViewData
;
101 VclPtr
<formula::RefEdit
> mpLastEdit
;
103 std::shared_ptr
<ScCondFormatDlgItem
> mpDlgItem
;
105 OUString msBaseTitle
;
108 DECL_LINK_TYPED( EdRangeModifyHdl
, Edit
&, void );
111 virtual void RefInputDone( bool bForced
= false ) override
;
113 void CancelPressed();
116 SC_DLLPUBLIC
ScCondFormatDlg(SfxBindings
* pB
, SfxChildWindow
* pCW
, vcl::Window
* pWindow
,
117 ScViewData
* pViewData
, const ScCondFormatDlgItem
* pDlgItem
);
118 virtual ~ScCondFormatDlg();
119 virtual void dispose() override
;
121 SC_DLLPUBLIC ScConditionalFormat
* GetConditionalFormat() const;
123 virtual void SetReference(const ScRange
&, ScDocument
*) override
;
124 virtual bool IsRefInputMode() const override
;
125 virtual void SetActive() override
;
126 virtual bool IsTableLocked() const override
;
127 virtual bool Close() override
;
129 void InvalidateRefData();
131 DECL_LINK_TYPED( BtnPressedHdl
, Button
*, void );
132 DECL_LINK_TYPED( RangeGetFocusHdl
, Control
&, void );
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */