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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_FILTDLG_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_FILTDLG_HXX
23 #include <vcl/combobox.hxx>
24 #include <vcl/lstbox.hxx>
25 #include <vcl/layout.hxx>
26 #include <vcl/morebtn.hxx>
27 #include <svtools/stdctrl.hxx>
29 #include "address.hxx"
30 #include "anyrefdg.hxx"
31 #include "queryparam.hxx"
32 #include "typedstrdata.hxx"
37 #include <boost/ptr_container/ptr_map.hpp>
38 #include <boost/noncopyable.hpp>
39 #include <boost/scoped_ptr.hpp>
41 class ScFilterOptionsMgr
;
46 class ScFilterDlg
: public ScAnyRefDlg
48 struct EntryList
: boost::noncopyable
50 std::vector
<ScTypedStrData
> maList
;
54 typedef boost::ptr_map
<SCCOL
,EntryList
> EntryListsMap
;
56 ScFilterDlg( SfxBindings
* pB
, SfxChildWindow
* pCW
, vcl::Window
* pParent
,
57 const SfxItemSet
& rArgSet
);
58 virtual ~ScFilterDlg();
59 virtual void dispose() SAL_OVERRIDE
;
61 virtual void SetReference( const ScRange
& rRef
, ScDocument
* pDoc
) SAL_OVERRIDE
;
63 virtual bool IsRefInputMode() const SAL_OVERRIDE
;
64 virtual void SetActive() SAL_OVERRIDE
;
66 virtual bool Close() SAL_OVERRIDE
;
68 size_t GetSliderPos();
69 void RefreshEditRow( size_t nOffset
);
72 VclPtr
<ListBox
> pLbConnect1
;
73 VclPtr
<ListBox
> pLbField1
;
74 VclPtr
<ListBox
> pLbCond1
;
75 VclPtr
<ComboBox
> pEdVal1
;
77 VclPtr
<ListBox
> pLbConnect2
;
78 VclPtr
<ListBox
> pLbField2
;
79 VclPtr
<ListBox
> pLbCond2
;
80 VclPtr
<ComboBox
> pEdVal2
;
82 VclPtr
<ListBox
> pLbConnect3
;
83 VclPtr
<ListBox
> pLbField3
;
84 VclPtr
<ListBox
> pLbCond3
;
85 VclPtr
<ComboBox
> pEdVal3
;
87 VclPtr
<ListBox
> pLbConnect4
;
88 VclPtr
<ListBox
> pLbField4
;
89 VclPtr
<ListBox
> pLbCond4
;
90 VclPtr
<ComboBox
> pEdVal4
;
92 VclPtr
<ScrollBar
> pScrollBar
;
93 VclPtr
<VclExpander
> pExpander
;
95 VclPtr
<OKButton
> pBtnOk
;
96 VclPtr
<CancelButton
> pBtnCancel
;
98 VclPtr
<CheckBox
> pBtnCase
;
99 VclPtr
<CheckBox
> pBtnRegExp
;
100 VclPtr
<CheckBox
> pBtnHeader
;
101 VclPtr
<CheckBox
> pBtnUnique
;
102 VclPtr
<CheckBox
> pBtnCopyResult
;
103 VclPtr
<ListBox
> pLbCopyArea
;
104 VclPtr
<formula::RefEdit
> pEdCopyArea
;
105 VclPtr
<formula::RefButton
> pRbCopyArea
;
106 VclPtr
<CheckBox
> pBtnDestPers
;
107 VclPtr
<FixedText
> pFtDbAreaLabel
;
108 VclPtr
<FixedText
> pFtDbArea
;
109 const OUString aStrUndefined
;
110 const OUString aStrNone
;
112 const OUString aStrEmpty
;
113 const OUString aStrNotEmpty
;
114 const OUString aStrColumn
;
116 ScFilterOptionsMgr
* pOptionsMgr
;
118 const sal_uInt16 nWhichQuery
;
119 ScQueryParam theQueryData
;
120 ScQueryItem
* pOutItem
;
121 ScViewData
* pViewData
;
125 std::vector
<VclPtr
<ComboBox
>> maValueEdArr
;
126 std::vector
<VclPtr
<ListBox
>> maFieldLbArr
;
127 std::vector
<VclPtr
<ListBox
>> maCondLbArr
;
128 std::vector
<VclPtr
<ListBox
>> maConnLbArr
;
130 std::deque
<bool> maHasDates
;
131 std::deque
<bool> maRefreshExceptQuery
;
134 EntryListsMap maEntryLists
;
136 // Hack: RefInput control
140 void Init ( const SfxItemSet
& rArgSet
);
141 void FillFieldLists ();
142 void FillAreaList ();
143 void UpdateValueList ( size_t nList
);
144 void UpdateHdrInValueList( size_t nList
);
145 void ClearValueList ( size_t nList
);
146 size_t GetFieldSelPos ( SCCOL nField
);
147 ScQueryItem
* GetOutputItem ();
150 DECL_LINK( LbSelectHdl
, ListBox
* );
151 DECL_LINK( ValModifyHdl
, ComboBox
* );
152 DECL_LINK( CheckBoxHdl
, CheckBox
* );
153 DECL_LINK( EndDlgHdl
, Button
* );
154 DECL_LINK( ScrollHdl
, void* );
155 DECL_LINK( MoreExpandedHdl
, void* );
157 // Hack: RefInput control
158 DECL_LINK_TYPED( TimeOutHdl
, Timer
*, void );
161 class ScSpecialFilterDlg
: public ScAnyRefDlg
164 ScSpecialFilterDlg( SfxBindings
* pB
, SfxChildWindow
* pCW
, vcl::Window
* pParent
,
165 const SfxItemSet
& rArgSet
);
166 virtual ~ScSpecialFilterDlg();
167 virtual void dispose() SAL_OVERRIDE
;
169 virtual void SetReference( const ScRange
& rRef
, ScDocument
* pDoc
) SAL_OVERRIDE
;
171 virtual bool IsRefInputMode() const SAL_OVERRIDE
;
172 virtual void SetActive() SAL_OVERRIDE
;
174 virtual bool Close() SAL_OVERRIDE
;
177 VclPtr
<ListBox
> pLbFilterArea
;
178 VclPtr
<formula::RefEdit
> pEdFilterArea
;
179 VclPtr
<formula::RefButton
> pRbFilterArea
;
181 VclPtr
<VclExpander
> pExpander
;
182 VclPtr
<CheckBox
> pBtnCase
;
183 VclPtr
<CheckBox
> pBtnRegExp
;
184 VclPtr
<CheckBox
> pBtnHeader
;
185 VclPtr
<CheckBox
> pBtnUnique
;
186 VclPtr
<CheckBox
> pBtnCopyResult
;
187 VclPtr
<ListBox
> pLbCopyArea
;
188 VclPtr
<formula::RefEdit
> pEdCopyArea
;
189 VclPtr
<formula::RefButton
> pRbCopyArea
;
190 VclPtr
<CheckBox
> pBtnDestPers
;
191 VclPtr
<FixedText
> pFtDbAreaLabel
;
192 VclPtr
<FixedText
> pFtDbArea
;
193 const OUString aStrUndefined
;
194 const OUString aStrNoName
;
196 VclPtr
<OKButton
> pBtnOk
;
197 VclPtr
<CancelButton
> pBtnCancel
;
199 ScFilterOptionsMgr
* pOptionsMgr
;
201 const sal_uInt16 nWhichQuery
;
202 const ScQueryParam theQueryData
;
203 ScQueryItem
* pOutItem
;
204 ScViewData
* pViewData
;
207 VclPtr
<formula::RefEdit
> pRefInputEdit
;
210 // Hack: RefInput control
214 void Init( const SfxItemSet
& rArgSet
);
215 ScQueryItem
* GetOutputItem( const ScQueryParam
& rParam
,
216 const ScRange
& rSource
);
219 DECL_LINK( FilterAreaSelHdl
, ListBox
* );
220 DECL_LINK( FilterAreaModHdl
, formula::RefEdit
* );
221 DECL_LINK( EndDlgHdl
, Button
* );
222 DECL_LINK( ScrollHdl
, ScrollBar
* );
224 // Hack: RefInput control
225 DECL_LINK_TYPED( TimeOutHdl
, Idle
*, void );
228 #endif // INCLUDED_SC_SOURCE_UI_INC_FILTDLG_HXX
230 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */