LibreOffice Module sc (master)  1
condformatdlg.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_SC_SOURCE_UI_INC_CONDFORMATDLG_HXX
11 #define INCLUDED_SC_SOURCE_UI_INC_CONDFORMATDLG_HXX
12 
13 #include <rangelst.hxx>
14 #include "condformatdlgitem.hxx"
15 #include "condformatdlgentry.hxx"
16 
17 #include "anyrefdg.hxx"
18 
19 #include <memory>
20 
21 #define DLG_RET_ADD 8
22 #define DLG_RET_EDIT 16
23 
24 class ScDocument;
26 class ScViewData;
27 
28 class ScCondFormatDlg;
29 
31 {
32 private:
33  std::unique_ptr<weld::ScrolledWindow> mxScrollWindow;
34  std::unique_ptr<weld::Container> mxGrid;
35 
36  typedef std::vector<std::unique_ptr<ScCondFrmtEntry>> EntryContainer;
37  EntryContainer maEntries;
38 
39  bool mbFrozen;
40  bool mbNewEntry;
41 
46 
47 public:
49  std::unique_ptr<weld::ScrolledWindow> xWindow,
50  std::unique_ptr<weld::Container> xGrid);
51  weld::Container* GetContainer() { return mxGrid.get(); }
53 
54  void init(ScDocument& rDoc, const ScConditionalFormat* pFormat,
55  const ScRangeList& rRanges, const ScAddress& rPos,
57 
58  void SetRange(const ScRangeList& rRange);
59 
60  std::unique_ptr<ScConditionalFormat> GetConditionalFormat() const;
62  void Freeze() { mbFrozen = true; }
63  void Thaw() { mbFrozen = false; }
64  void RecalcAll();
65 
66  DECL_LINK( AddBtnHdl, weld::Button&, void );
67  DECL_LINK( RemoveBtnHdl, weld::Button&, void );
68  DECL_LINK( UpBtnHdl, weld::Button&, void );
69  DECL_LINK( DownBtnHdl, weld::Button&, void );
70  DECL_LINK( EntrySelectHdl, ScCondFrmtEntry&, void );
71 
72  DECL_LINK( TypeListHdl, weld::ComboBox&, void );
73  DECL_LINK( AfterTypeListHdl, void*, void );
74  DECL_LINK( ColFormatTypeHdl, weld::ComboBox&, void );
75  DECL_LINK( AfterColFormatTypeHdl, void*, void );
76 };
77 
79 {
80 private:
81  sal_Int32 mnKey;
82 
85 
86  std::shared_ptr<ScCondFormatDlgItem> mpDlgItem;
87 
88  OUString msBaseTitle;
89 
91  std::unique_ptr<weld::Button> mxBtnOk;
92  std::unique_ptr<weld::Button> mxBtnAdd;
93  std::unique_ptr<weld::Button> mxBtnRemove;
94  std::unique_ptr<weld::Button> mxBtnUp;
95  std::unique_ptr<weld::Button> mxBtnDown;
96  std::unique_ptr<weld::Button> mxBtnCancel;
97  std::unique_ptr<weld::Label> mxFtRange;
98  std::unique_ptr<formula::RefEdit> mxEdRange;
99  std::unique_ptr<formula::RefButton> mxRbRange;
100  std::unique_ptr<ScCondFormatList> mxCondFormList;
101 
102  void updateTitle();
103  DECL_LINK( EdRangeModifyHdl, formula::RefEdit&, void );
104 protected:
105 
106  virtual void RefInputDone( bool bForced = false ) override;
107  void OkPressed();
108  void CancelPressed();
109 
110 public:
112  ScViewData* pViewData, const ScCondFormatDlgItem* pDlgItem);
113  virtual ~ScCondFormatDlg() override;
114 
115  std::unique_ptr<ScConditionalFormat> GetConditionalFormat() const;
116 
117  virtual void SetReference(const ScRange&, ScDocument&) override;
118  virtual bool IsRefInputMode() const override;
119  virtual void SetActive() override;
120  virtual bool IsTableLocked() const override;
121  virtual void Close() override;
122 
123  void InvalidateRefData();
124  void OnSelectionChange(size_t nIndex, size_t nSize, bool bSelected = true);
125 
126  DECL_LINK( BtnPressedHdl, weld::Button&, void );
127  DECL_LINK( RangeGetFocusHdl, formula::RefEdit&, void );
128 };
129 
130 #endif
131 
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Button > mxBtnDown
ScRangeList maRanges
virtual ~ScCondFormatDlg() override
virtual void Close() override
void OnSelectionChange(size_t nIndex, size_t nSize, bool bSelected=true)
std::unique_ptr< formula::RefEdit > mxEdRange
virtual bool IsTableLocked() const override
std::unique_ptr< weld::ScrolledWindow > mxScrollWindow
EntryContainer maEntries
virtual void SetReference(const ScRange &, ScDocument &) override
virtual void SetActive() override
void SetRange(const ScRangeList &rRange)
std::unique_ptr< ScConditionalFormat > GetConditionalFormat() const
weld::Container * GetContainer()
std::unique_ptr< weld::Button > mxBtnOk
std::unique_ptr< ScConditionalFormat > GetConditionalFormat() const
virtual void RefInputDone(bool bForced=false) override
DECL_LINK(AddBtnHdl, weld::Button &, void)
std::unique_ptr< weld::Button > mxBtnRemove
ScCondFormatDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pWindow, ScViewData *pViewData, const ScCondFormatDlgItem *pDlgItem)
std::unique_ptr< weld::Container > mxGrid
std::unique_ptr< weld::Button > mxBtnUp
std::unique_ptr< weld::Button > mxBtnCancel
formula::RefEdit * mpLastEdit
ScViewData * mpViewData
DECL_LINK(EdRangeModifyHdl, formula::RefEdit &, void)
std::unique_ptr< ScCondFormatList > mxCondFormList
std::unique_ptr< formula::RefButton > mxRbRange
OUString msBaseTitle
std::unique_ptr< weld::Label > mxFtRange
std::unique_ptr< weld::Button > mxBtnAdd
weld::Window * GetFrameWeld()
virtual bool IsRefInputMode() const override
std::vector< std::unique_ptr< ScCondFrmtEntry > > EntryContainer
ScDocument * mpDoc
std::shared_ptr< ScCondFormatDlgItem > mpDlgItem
ScCondFormatList(ScCondFormatDlg *pParent, std::unique_ptr< weld::ScrolledWindow > xWindow, std::unique_ptr< weld::Container > xGrid)
ScCondFormatDlg * mpDialogParent
void init(ScDocument &rDoc, const ScConditionalFormat *pFormat, const ScRangeList &rRanges, const ScAddress &rPos, condformat::dialog::ScCondFormatDialogType eType)