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"
26 #include "anyrefdg.hxx"
29 #define DLG_RET_EDIT 16
32 class ScConditionalFormat
;
34 class ScConditionalFormat
;
35 struct ScDataBarFormatData
;
36 class ScCondFrmtEntry
;
38 namespace condformat
{
42 enum ScCondFormatDialogType
56 class ScCondFormatDlg
;
58 class ScCondFormatList
: public Control
61 typedef std::vector
<VclPtr
<ScCondFrmtEntry
>> EntryContainer
;
62 EntryContainer maEntries
;
65 VclPtr
<ScrollBar
> mpScrollBar
;
70 VclPtr
<ScCondFormatDlg
> mpDialogParent
;
72 void DoScroll(long nDiff
);
75 ScCondFormatList(vcl::Window
* pParent
, WinBits nStyle
);
76 virtual ~ScCondFormatList();
77 virtual void dispose() SAL_OVERRIDE
;
79 void init(ScDocument
* pDoc
, ScCondFormatDlg
* pDialogParent
, const ScConditionalFormat
* pFormat
,
80 const ScRangeList
& rRanges
, const ScAddress
& rPos
,
81 condformat::dialog::ScCondFormatDialogType eType
);
83 virtual Size
GetOptimalSize() const SAL_OVERRIDE
;
84 virtual void Resize() SAL_OVERRIDE
;
86 ScConditionalFormat
* GetConditionalFormat() const;
89 DECL_LINK( AddBtnHdl
, void* );
90 DECL_LINK( RemoveBtnHdl
, void* );
91 DECL_LINK( ScrollHdl
, void* );
92 DECL_LINK( EntrySelectHdl
, ScCondFrmtEntry
* );
94 DECL_LINK( TypeListHdl
, ListBox
*);
95 DECL_LINK( AfterTypeListHdl
, ListBox
*);
96 DECL_LINK( ColFormatTypeHdl
, ListBox
*);
99 class ScCondFormatDlg
: public ScAnyRefDlg
102 VclPtr
<PushButton
> mpBtnOk
;
103 VclPtr
<PushButton
> mpBtnAdd
;
104 VclPtr
<PushButton
> mpBtnRemove
;
105 VclPtr
<PushButton
> mpBtnCancel
;
106 VclPtr
<FixedText
> mpFtRange
;
107 VclPtr
<formula::RefEdit
> mpEdRange
;
108 VclPtr
<formula::RefButton
> mpRbRange
;
110 VclPtr
<ScCondFormatList
> mpCondFormList
;
115 ScViewData
* mpViewData
;
117 VclPtr
<formula::RefEdit
> mpLastEdit
;
119 DECL_LINK( EdRangeModifyHdl
, Edit
* );
122 virtual void RefInputDone( bool bForced
= false ) SAL_OVERRIDE
;
124 void CancelPressed();
127 SC_DLLPUBLIC
ScCondFormatDlg(SfxBindings
* pB
, SfxChildWindow
* pCW
, vcl::Window
* pWindow
,
128 ScViewData
* pViewData
, const ScConditionalFormat
* pFormat
,
129 const ScRangeList
& rRange
, const ScAddress
& rPos
,
130 condformat::dialog::ScCondFormatDialogType eType
, bool bManaged
);
131 virtual ~ScCondFormatDlg();
132 virtual void dispose() SAL_OVERRIDE
;
134 SC_DLLPUBLIC ScConditionalFormat
* GetConditionalFormat() const;
136 static OUString
GenerateXmlString(sal_uInt32 nIndex
, sal_uInt8 nType
, bool bManaged
);
137 static bool ParseXmlString(const OUString
& sXMLString
, sal_uInt32
& nIndex
,
138 sal_uInt8
& nType
, bool& bManaged
);
139 virtual void SetReference(const ScRange
&, ScDocument
*) SAL_OVERRIDE
;
140 virtual bool IsRefInputMode() const SAL_OVERRIDE
;
141 virtual void SetActive() SAL_OVERRIDE
;
142 virtual bool IsTableLocked() const SAL_OVERRIDE
;
143 virtual bool Close() SAL_OVERRIDE
;
145 void InvalidateRefData();
147 DECL_LINK( BtnPressedHdl
, Button
* );
148 DECL_LINK( RangeGetFocusHdl
, formula::RefEdit
* );
149 DECL_STATIC_LINK( ScCondFormatDlg
, RangeLoseFocusHdl
, void* );
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */