20#undef SC_DLLIMPLEMENTATION
23#include <document.hxx>
37#include <osl/diagnose.h>
41 : GenericDialogController(pParent,
"modules/scalc/ui/pivotfilterdialog.ui",
"PivotFilterDialog")
43 , aStrEmpty(
ScResId(SCSTR_FILTER_EMPTY))
44 , aStrNotEmpty(
ScResId(SCSTR_FILTER_NOTEMPTY))
45 , aStrColumn(
ScResId(SCSTR_COLUMN_LETTER))
46 , nWhichQuery(rArgSet.GetPool()->
GetWhich(SID_QUERY))
47 , theQueryData(static_cast<const
ScQueryItem&>(rArgSet.
Get(nWhichQuery)).GetQueryData())
51 , m_xLbField1(m_xBuilder->weld_combo_box(
"field1"))
52 , m_xLbCond1(m_xBuilder->weld_combo_box(
"cond1"))
53 , m_xEdVal1(m_xBuilder->weld_combo_box(
"val1"))
54 , m_xLbConnect1(m_xBuilder->weld_combo_box(
"connect1"))
55 , m_xLbField2(m_xBuilder->weld_combo_box(
"field2"))
56 , m_xLbCond2(m_xBuilder->weld_combo_box(
"cond2"))
57 , m_xEdVal2(m_xBuilder->weld_combo_box(
"val2"))
58 , m_xLbConnect2(m_xBuilder->weld_combo_box(
"connect2"))
59 , m_xLbField3(m_xBuilder->weld_combo_box(
"field3"))
60 , m_xLbCond3(m_xBuilder->weld_combo_box(
"cond3"))
61 , m_xEdVal3(m_xBuilder->weld_combo_box(
"val3"))
62 , m_xBtnCase(m_xBuilder->weld_check_button(
"case"))
63 , m_xBtnRegExp(m_xBuilder->weld_check_button(
"regexp"))
64 , m_xBtnUnique(m_xBuilder->weld_check_button(
"unique"))
65 , m_xFtDbArea(m_xBuilder->weld_label(
"dbarea"))
123 rStart.
Col(), rStart.
Row(),
126 theDbName = pDBData->
GetName();
129 OUString sLabel =
" (" + theDbName +
")";
152 sal_uInt16 nCondPos =
static_cast<sal_uInt16
>(rEntry.
eOp);
232 for (
col=nFirstCol;
col<=nMaxCol;
col++ )
235 if ( aFieldName.isEmpty() )
247 if ( !(
pDoc && nList>0 && nList<=3) )
258 if (
pDoc && nFieldSelPos )
272 nColumn, nFirstRow, nLastRow, nTab, bCaseSens, *
m_pEntryLists[nColumn]);
276 for (
const auto& rEntry : *pColl)
286 if ( nList>0 && nList<=3 )
350 static_cast<SCCOL>(nField) - 1) :
static_cast<SCCOL>(0);
383 if (&rLb == m_xLbConnect1.get())
385 if ( !m_xLbField2->get_sensitive() )
387 m_xLbField2->set_sensitive(
true);
388 m_xLbCond2->set_sensitive(
true);
389 m_xEdVal2->set_sensitive(
true);
392 else if (&rLb == m_xLbConnect2.get())
394 if ( !m_xLbField3->get_sensitive() )
396 m_xLbField3->set_sensitive(
true);
397 m_xLbCond3->set_sensitive(
true);
398 m_xEdVal3->set_sensitive(
true);
401 else if (&rLb == m_xLbField1.get())
403 if ( m_xLbField1->get_active() == 0 )
405 m_xLbConnect1->set_active(-1);
406 m_xLbConnect2->set_active(-1);
407 m_xLbField2->set_active( 0 );
408 m_xLbField3->set_active( 0 );
409 m_xLbCond2->set_active( 0 );
410 m_xLbCond3->set_active( 0 );
415 m_xLbConnect1->set_sensitive(
false);
416 m_xLbConnect2->set_sensitive(
false);
417 m_xLbField2->set_sensitive(
false);
418 m_xLbField3->set_sensitive(
false);
419 m_xLbCond2->set_sensitive(
false);
420 m_xLbCond3->set_sensitive(
false);
421 m_xEdVal2->set_sensitive(
false);
422 m_xEdVal3->set_sensitive(
false);
426 UpdateValueList( 1 );
427 if ( !m_xLbConnect1->get_sensitive() )
429 m_xLbConnect1->set_sensitive(
true);
433 else if (&rLb == m_xLbField2.get())
435 if ( m_xLbField2->get_active() == 0 )
437 m_xLbConnect2->set_active(-1);
438 m_xLbField3->set_active( 0 );
439 m_xLbCond3->set_active( 0 );
443 m_xLbConnect2->set_sensitive(
false);
444 m_xLbField3->set_sensitive(
false);
445 m_xLbCond3->set_sensitive(
false);
446 m_xEdVal3->set_sensitive(
false);
450 UpdateValueList( 2 );
451 if (!m_xLbConnect2->get_sensitive())
453 m_xLbConnect2->set_sensitive(
true);
457 else if (&rLb == m_xLbField3.get())
459 if (m_xLbField3->get_active() == 0)
470 if (&rBox != m_xBtnCase.get())
473 for (
auto&
a : m_pEntryLists)
476 OUString aCurVal1 = m_xEdVal1->get_active_text();
477 OUString aCurVal2 = m_xEdVal2->get_active_text();
478 OUString aCurVal3 = m_xEdVal3->get_active_text();
479 UpdateValueList( 1 );
480 UpdateValueList( 2 );
481 UpdateValueList( 3 );
482 m_xEdVal1->set_entry_text(aCurVal1);
483 m_xEdVal2->set_entry_text(aCurVal2);
484 m_xEdVal3->set_entry_text(aCurVal3);
489 OUString aStrVal = rEd.get_active_text();
492 if ( &rEd == m_xEdVal2.get() ) pLb = m_xLbCond2.get();
493 else if ( &rEd == m_xEdVal3.get() ) pLb = m_xLbCond3.get();
498 if ( aStrEmpty == aStrVal || aStrNotEmpty == aStrVal )
void ScColToAlpha(OUStringBuffer &rBuf, SCCOL nCol)
append alpha representation of column to buffer
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
const ScDBData * GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
const OUString & GetName() const
SC_DLLPUBLIC void GetFilterEntriesArea(SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bCaseSens, ScFilterEntries &rFilterEntries)
Entries for Filter dialog.
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
static SC_DLLPUBLIC OUString ReplaceOrAppend(const OUString &rString, std::u16string_view rPlaceholder, const OUString &rReplacement)
Replaces the first occurrence of rPlaceholder in rString with rReplacement, or if rPlaceholder is not...
std::array< std::unique_ptr< ScFilterEntries >, MAXCOLCOUNT > m_pEntryLists
std::unique_ptr< weld::CheckButton > m_xBtnCase
const OUString aStrColumn
std::unique_ptr< weld::ComboBox > m_xLbField3
std::unique_ptr< weld::ComboBox > m_xLbCond3
std::unique_ptr< ScQueryItem > pOutItem
std::unique_ptr< weld::CheckButton > m_xBtnUnique
std::unique_ptr< weld::ComboBox > m_xEdVal2
std::unique_ptr< weld::ComboBox > m_xLbField1
void Init(const SfxItemSet &rArgSet)
virtual ~ScPivotFilterDlg() override
sal_uInt16 GetFieldSelPos(SCCOL nField)
const sal_uInt16 nWhichQuery
void ClearValueList(sal_uInt16 nList)
const ScQueryItem & GetOutputItem()
std::unique_ptr< weld::ComboBox > m_xEdVal3
std::unique_ptr< weld::ComboBox > m_xLbField2
weld::ComboBox * aCondLbArr[3]
weld::ComboBox * aValueEdArr[3]
std::unique_ptr< weld::Label > m_xFtDbArea
std::unique_ptr< weld::ComboBox > m_xLbCond1
void UpdateValueList(sal_uInt16 nList)
const ScQueryParam theQueryData
std::unique_ptr< weld::ComboBox > m_xLbCond2
std::unique_ptr< weld::ComboBox > m_xEdVal1
std::unique_ptr< weld::CheckButton > m_xBtnRegExp
std::unique_ptr< weld::ComboBox > m_xLbConnect1
ScPivotFilterDlg(weld::Window *pParent, const SfxItemSet &rArgSet, SCTAB nSourceTab)
std::unique_ptr< weld::ComboBox > m_xLbConnect2
const OUString aStrNotEmpty
weld::ComboBox * aFieldLbArr[3]
ScViewData * GetViewData() const
ScDocument & GetDocument() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SharedString intern(const OUString &rStr)
const OUString & getString() const
virtual OUString get_active_text() const=0
virtual void set_entry_text(const OUString &rStr)=0
virtual void set_active(int pos)=0
void append_text(const OUString &rStr)
virtual int get_active() const=0
void set_active_text(const OUString &rStr)
void connect_changed(const Link< ComboBox &, void > &rLink)
std::shared_ptr< weld::Dialog > m_xDialog
constexpr OUStringLiteral STR_DB_LOCAL_NONAME
#define LINK(Instance, Class, Member)
RttiCompleteObjectLocator col
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
IMPL_LINK(ScPivotFilterDlg, LbSelectHdl, weld::ComboBox &, rLb, void)
OUString ScResId(TranslateId aId)
svl::SharedString maString
Each instance of this struct represents a single filtering criteria.
bool IsQueryByNonEmpty() const
const Item & GetQueryItem() const
void SetQueryByNonEmpty()
bool IsQueryByEmpty() const
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
utl::SearchParam::SearchType eSearchType