weld ScPivotLayoutDialog
Change-Id: I821ee682bf5b65774a609227811365b94ae2063e
Reviewed-on: https://gerrit.libreoffice.org/71547
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 5fce152..50b8118 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -247,15 +247,6 @@
<glade-widget-class title="Glossary Tree List" name="swuilo-SwGlTreeListBox"
generic-name="Glossary Tree List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Pivot Table List" name="sclo-ScPivotLayoutTreeList"
generic-name="Pivot Table List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Pivot Table Label List" name="sclo-ScPivotLayoutTreeListLabel"
generic-name="Pivot Table Label List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Pivot Table Data List" name="sclo-ScPivotLayoutTreeListData"
generic-name="Pivot Table Data List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Sidebar Dial Control" name="svxlo-SidebarDialControl"
generic-name="Sidebar Dial Control" parent="GtkSpinner"
icon-name="widget-gtk-spinner"/>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index ed3d69d..4bc3e08 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -78,6 +78,7 @@ class VCL_DLLPUBLIC Widget
protected:
Link<Widget&, void> m_aFocusInHdl;
Link<Widget&, void> m_aFocusOutHdl;
Link<Widget&, bool> m_aMnemonicActivateHdl;
Link<const Size&, void> m_aSizeAllocateHdl;
Link<const KeyEvent&, bool> m_aKeyPressHdl;
Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
@@ -161,6 +162,15 @@ public:
m_aFocusOutHdl = rLink;
}
// rLink is called when the mnemonic for the Widget is called.
// If rLink returns true the Widget will not automatically gain
// focus as normally occurs
virtual void connect_mnemonic_activate(const Link<Widget&, bool>& rLink)
{
assert(!m_aMnemonicActivateHdl.IsSet() || !rLink.IsSet());
m_aMnemonicActivateHdl = rLink;
}
virtual void connect_size_allocate(const Link<const Size&, void>& rLink)
{
assert(!m_aSizeAllocateHdl.IsSet() || !rLink.IsSet());
@@ -655,6 +665,7 @@ public:
virtual std::vector<int> get_selected_rows() const = 0;
virtual void set_font_color(int pos, const Color& rColor) const = 0;
virtual void scroll_to_row(int pos) = 0;
virtual int get_cursor_index() const = 0;
virtual void set_cursor(int pos) = 0;
//by text
@@ -801,6 +812,11 @@ public:
OUString const& get_saved_value() const { return m_sSavedValue; }
bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
// for dnd
virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult) = 0;
// for dragging and dropping between TreeViews, return the active source
virtual TreeView* get_drag_source() const = 0;
using Widget::set_sensitive;
};
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index c109e80..e2223af 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1577,6 +1577,7 @@ public:
virtual bool IsChart() const { return false; }
void SetHelpHdl(const Link<vcl::Window&, bool>& rLink);
void SetMnemonicActivateHdl(const Link<vcl::Window&, bool>& rLink);
};
}
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 7b2c458..cb6ba69 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -472,12 +472,12 @@ public:
const SfxItemSet& rArgSet,
sal_uInt16 nSourceTab) = 0;
virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Window* pParent,
virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Widget* pParent,
const ScDPLabelDataVector& rLabelVec,
const ScDPLabelData& rLabelData,
const ScPivotFuncData& rFuncData ) = 0;
virtual VclPtr<AbstractScDPSubtotalDlg> CreateScDPSubtotalDlg(weld::Window* pParent,
virtual VclPtr<AbstractScDPSubtotalDlg> CreateScDPSubtotalDlg(weld::Widget* pParent,
ScDPObject& rDPObj,
const ScDPLabelData& rLabelData,
const ScPivotFuncData& rFuncData,
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 717e9d8..0579355 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -884,7 +884,7 @@ VclPtr<AbstractScPivotFilterDlg> ScAbstractDialogFactory_Impl::CreateScPivotFilt
return VclPtr<AbstractScPivotFilterDlg_Impl>::Create(std::make_unique<ScPivotFilterDlg>(pParent, rArgSet, nSourceTab));
}
VclPtr<AbstractScDPFunctionDlg> ScAbstractDialogFactory_Impl::CreateScDPFunctionDlg(weld::Window* pParent,
VclPtr<AbstractScDPFunctionDlg> ScAbstractDialogFactory_Impl::CreateScDPFunctionDlg(weld::Widget* pParent,
const ScDPLabelDataVector& rLabelVec,
const ScDPLabelData& rLabelData,
const ScPivotFuncData& rFuncData)
@@ -892,7 +892,7 @@ VclPtr<AbstractScDPFunctionDlg> ScAbstractDialogFactory_Impl::CreateScDPFunction
return VclPtr<AbstractScDPFunctionDlg_Impl>::Create(std::make_unique<ScDPFunctionDlg>(pParent, rLabelVec, rLabelData, rFuncData));
}
VclPtr<AbstractScDPSubtotalDlg> ScAbstractDialogFactory_Impl::CreateScDPSubtotalDlg(weld::Window* pParent,
VclPtr<AbstractScDPSubtotalDlg> ScAbstractDialogFactory_Impl::CreateScDPSubtotalDlg(weld::Widget* pParent,
ScDPObject& rDPObj,
const ScDPLabelData& rLabelData,
const ScPivotFuncData& rFuncData,
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 0648660..14d6b53 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -658,12 +658,12 @@ public:
virtual VclPtr<AbstractScPivotFilterDlg> CreateScPivotFilterDlg(weld::Window* pParent, const SfxItemSet& rArgSet,
sal_uInt16 nSourceTab) override;
virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Window* pParent,
virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Widget* pParent,
const ScDPLabelDataVector& rLabelVec,
const ScDPLabelData& rLabelData,
const ScPivotFuncData& rFuncData ) override;
virtual VclPtr<AbstractScDPSubtotalDlg> CreateScDPSubtotalDlg(weld::Window* pParent,
virtual VclPtr<AbstractScDPSubtotalDlg> CreateScDPSubtotalDlg(weld::Widget* pParent,
ScDPObject& rDPObj,
const ScDPLabelData& rLabelData,
const ScPivotFuncData& rFuncData,
diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 9199d80..070c75c 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -68,96 +68,97 @@ ScRange lclGetRangeForNamedRange(OUString const & aName, const ScDocument* pDocu
}
ScPivotLayoutDialog::ScPivotLayoutDialog(
SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, vcl::Window* pParent,
ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bNewPivotTable) :
ScAnyRefDlg (pSfxBindings, pChildWindow, pParent, "PivotTableLayout", "modules/scalc/ui/pivottablelayoutdialog.ui"),
maPivotTableObject (*pPivotTableObject),
mpPreviouslyFocusedListBox(nullptr),
mpViewData (pViewData),
mpDocument (pViewData->GetDocument()),
mbNewPivotTable (bNewPivotTable),
mpActiveEdit (nullptr),
maAddressDetails (mpDocument->GetAddressConvention(), 0, 0),
mbDialogLostFocus (false)
SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, weld::Window* pParent,
ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bNewPivotTable)
: ScAnyRefDlgController(pSfxBindings, pChildWindow, pParent, "modules/scalc/ui/pivottablelayoutdialog.ui", "PivotTableLayout")
, maPivotTableObject(*pPivotTableObject)
, mpPreviouslyFocusedListBox(nullptr)
, mpViewData(pViewData)
, mpDocument(pViewData->GetDocument())
, mbNewPivotTable(bNewPivotTable)
, maAddressDetails(mpDocument->GetAddressConvention(), 0, 0)
, mbDialogLostFocus(false)
, mpActiveEdit(nullptr)
, mxListBoxField(new ScPivotLayoutTreeListLabel(m_xBuilder->weld_tree_view("listbox-fields")))
, mxListBoxPage(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-page")))
, mxListBoxColumn(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-column")))
, mxListBoxRow(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-row")))
, mxListBoxData(new ScPivotLayoutTreeListData(m_xBuilder->weld_tree_view("listbox-data")))
, mxCheckIgnoreEmptyRows(m_xBuilder->weld_check_button("check-ignore-empty-rows"))
, mxCheckTotalColumns(m_xBuilder->weld_check_button("check-total-columns"))
, mxCheckAddFilter(m_xBuilder->weld_check_button("check-add-filter"))
, mxCheckIdentifyCategories(m_xBuilder->weld_check_button("check-identify-categories"))
, mxCheckTotalRows(m_xBuilder->weld_check_button("check-total-rows"))
, mxCheckDrillToDetail(m_xBuilder->weld_check_button("check-drill-to-details"))
, mxSourceRadioNamedRange(m_xBuilder->weld_radio_button("source-radio-named-range"))
, mxSourceRadioSelection(m_xBuilder->weld_radio_button("source-radio-selection"))
, mxSourceListBox(m_xBuilder->weld_combo_box("source-list"))
, mxSourceEdit(new formula::WeldRefEdit(m_xBuilder->weld_entry("source-edit")))
, mxSourceButton(new formula::WeldRefButton(m_xBuilder->weld_button("source-button")))
, mxDestinationRadioNewSheet(m_xBuilder->weld_radio_button("destination-radio-new-sheet"))
, mxDestinationRadioNamedRange(m_xBuilder->weld_radio_button("destination-radio-named-range"))
, mxDestinationRadioSelection(m_xBuilder->weld_radio_button("destination-radio-selection"))
, mxDestinationListBox(m_xBuilder->weld_combo_box("destination-list"))
, mxDestinationEdit(new formula::WeldRefEdit(m_xBuilder->weld_entry("destination-edit")))
, mxDestinationButton(new formula::WeldRefButton(m_xBuilder->weld_button("destination-button")))
, mxBtnOK(m_xBuilder->weld_button("ok"))
, mxBtnCancel(m_xBuilder->weld_button("cancel"))
, mxSourceFrame(m_xBuilder->weld_frame("frame2"))
, mxSourceLabel(mxSourceFrame->weld_label_widget())
, mxDestFrame(m_xBuilder->weld_frame("frame1"))
, mxDestLabel(mxDestFrame->weld_label_widget())
, mxOptions(m_xBuilder->weld_expander("options"))
, mxMore(m_xBuilder->weld_expander("more"))
{
get(mpListBoxField, "listbox-fields");
get(mpListBoxPage, "listbox-page");
get(mpListBoxColumn, "listbox-column");
get(mpListBoxRow, "listbox-row");
get(mpListBoxData, "listbox-data");
get(mpCheckIgnoreEmptyRows, "check-ignore-empty-rows");
get(mpCheckTotalColumns, "check-total-columns");
get(mpCheckAddFilter, "check-add-filter");
get(mpCheckIdentifyCategories, "check-identify-categories");
get(mpCheckTotalRows, "check-total-rows");
get(mpCheckDrillToDetail, "check-drill-to-details");
get(mpBtnOK, "ok");
get(mpBtnCancel, "cancel");
get(mpSourceRadioNamedRange, "source-radio-named-range");
get(mpSourceRadioSelection, "source-radio-selection");
get(mpSourceListBox, "source-list");
get(mpSourceEdit, "source-edit");
get(mpSourceButton, "source-button");
get(mpDestinationRadioNewSheet, "destination-radio-new-sheet");
get(mpDestinationRadioNamedRange, "destination-radio-named-range");
get(mpDestinationRadioSelection, "destination-radio-selection");
get(mpDestinationListBox, "destination-list");
get(mpDestinationEdit, "destination-edit");
get(mpDestinationButton, "destination-button");
// Source UI
Link<RadioButton&,void> aLink2 = LINK(this, ScPivotLayoutDialog, ToggleSource);
mpSourceRadioNamedRange->SetToggleHdl(aLink2);
mpSourceRadioSelection->SetToggleHdl(aLink2);
Link<weld::ToggleButton&,void> aLink2 = LINK(this, ScPivotLayoutDialog, ToggleSource);
mxSourceRadioNamedRange->connect_toggled(aLink2);
mxSourceRadioSelection->connect_toggled(aLink2);
mpSourceEdit->SetReferences(this, mpSourceRadioSelection);
mpSourceButton->SetReferences(this, mpSourceEdit);
mxSourceEdit->SetReferences(this, mxSourceLabel.get());
mxSourceButton->SetReferences(this, mxSourceEdit.get());
Link<Control&,void> aLink = LINK(this, ScPivotLayoutDialog, GetFocusHandler);
mpSourceEdit->SetGetFocusHdl(aLink);
mpSourceButton->SetGetFocusHdl(aLink);
Link<formula::WeldRefEdit&,void> aEditLink = LINK(this, ScPivotLayoutDialog, GetEditFocusHandler);
mxDestinationEdit->SetGetFocusHdl(aEditLink);
mxSourceEdit->SetGetFocusHdl(aEditLink);
aLink = LINK(this, ScPivotLayoutDialog, LoseFocusHandler);
mpSourceEdit->SetLoseFocusHdl(aLink);
mpSourceButton->SetLoseFocusHdl(aLink);
aEditLink = LINK(this, ScPivotLayoutDialog, LoseEditFocusHandler);
mxDestinationEdit->SetLoseFocusHdl(aEditLink);
mxSourceEdit->SetLoseFocusHdl(aEditLink);
mpSourceEdit->SetModifyHdl(LINK(this, ScPivotLayoutDialog, SourceEditModified));
mpSourceListBox->SetSelectHdl(LINK(this, ScPivotLayoutDialog, SourceListSelected));
mxSourceEdit->SetModifyHdl(LINK(this, ScPivotLayoutDialog, SourceEditModified));
mxSourceListBox->connect_changed(LINK(this, ScPivotLayoutDialog, SourceListSelected));
// Destination UI
aLink2 = LINK(this, ScPivotLayoutDialog, ToggleDestination);
mpDestinationRadioNewSheet->SetToggleHdl(aLink2);
mpDestinationRadioNamedRange->SetToggleHdl(aLink2);
mpDestinationRadioSelection->SetToggleHdl(aLink2);
mxDestinationRadioNewSheet->connect_toggled(aLink2);
mxDestinationRadioNamedRange->connect_toggled(aLink2);
mxDestinationRadioSelection->connect_toggled(aLink2);
mpDestinationEdit->SetReferences(this, mpDestinationRadioNewSheet);
mpDestinationButton->SetReferences(this, mpDestinationEdit);
mxDestinationEdit->SetReferences(this, mxDestLabel.get());
mxDestinationButton->SetReferences(this, mxDestinationEdit.get());
aLink = LINK(this, ScPivotLayoutDialog, GetFocusHandler);
mpDestinationEdit->SetGetFocusHdl(aLink);
mpDestinationButton->SetGetFocusHdl(aLink);
Link<formula::WeldRefButton&,void> aButtonLink = LINK(this, ScPivotLayoutDialog, GetButtonFocusHandler);
mxSourceButton->SetGetFocusHdl(aButtonLink);
mxDestinationButton->SetGetFocusHdl(aButtonLink);
aLink = LINK(this, ScPivotLayoutDialog, LoseFocusHandler);
mpDestinationEdit->SetLoseFocusHdl(aLink);
mpDestinationButton->SetLoseFocusHdl(aLink);
aButtonLink = LINK(this, ScPivotLayoutDialog, LoseButtonFocusHandler);
mxSourceButton->SetLoseFocusHdl(aButtonLink);
mxDestinationButton->SetLoseFocusHdl(aButtonLink);
// Buttons
mpBtnCancel->SetClickHdl(LINK(this, ScPivotLayoutDialog, CancelClicked));
mpBtnOK->SetClickHdl(LINK(this, ScPivotLayoutDialog, OKClicked));
mxBtnCancel->connect_clicked(LINK(this, ScPivotLayoutDialog, CancelClicked));
mxBtnOK->connect_clicked(LINK(this, ScPivotLayoutDialog, OKClicked));
// Initialize Data
maPivotTableObject.FillOldParam(maPivotParameters);
maPivotTableObject.FillLabelData(maPivotParameters);
mpListBoxField->Setup (this);
mpListBoxPage->Setup (this, ScPivotLayoutTreeList::PAGE_LIST);
mpListBoxColumn->Setup(this, ScPivotLayoutTreeList::COLUMN_LIST);
mpListBoxRow->Setup (this, ScPivotLayoutTreeList::ROW_LIST);
mpListBoxData->Setup (this);
mxListBoxField->Setup (this);
mxListBoxPage->Setup (this, ScPivotLayoutTreeList::PAGE_LIST);
mxListBoxColumn->Setup(this, ScPivotLayoutTreeList::COLUMN_LIST);
mxListBoxRow->Setup (this, ScPivotLayoutTreeList::ROW_LIST);
mxListBoxData->Setup (this);
FillValuesToListBoxes();
@@ -165,19 +166,19 @@ ScPivotLayoutDialog::ScPivotLayoutDialog(
const ScDPSaveData* pSaveData = maPivotTableObject.GetSaveData();
if (pSaveData == nullptr)
{
mpCheckAddFilter->Check(false);
mpCheckDrillToDetail->Check(false);
mxCheckAddFilter->set_active(false);
mxCheckDrillToDetail->set_active(false);
}
else
{
mpCheckAddFilter->Check(pSaveData->GetFilterButton());
mpCheckDrillToDetail->Check(pSaveData->GetDrillDown());
mxCheckAddFilter->set_active(pSaveData->GetFilterButton());
mxCheckDrillToDetail->set_active(pSaveData->GetDrillDown());
}
mpCheckIgnoreEmptyRows->Check(maPivotParameters.bIgnoreEmptyRows);
mpCheckIdentifyCategories->Check(maPivotParameters.bDetectCategories);
mpCheckTotalColumns->Check(maPivotParameters.bMakeTotalCol);
mpCheckTotalRows->Check(maPivotParameters.bMakeTotalRow);
mxCheckIgnoreEmptyRows->set_active(maPivotParameters.bIgnoreEmptyRows);
mxCheckIdentifyCategories->set_active(maPivotParameters.bDetectCategories);
mxCheckTotalColumns->set_active(maPivotParameters.bMakeTotalCol);
mxCheckTotalRows->set_active(maPivotParameters.bMakeTotalRow);
SetupSource();
SetupDestination();
@@ -185,43 +186,11 @@ ScPivotLayoutDialog::ScPivotLayoutDialog(
ScPivotLayoutDialog::~ScPivotLayoutDialog()
{
disposeOnce();
}
void ScPivotLayoutDialog::dispose()
{
mpPreviouslyFocusedListBox.clear();
mpListBoxField.clear();
mpListBoxPage.clear();
mpListBoxColumn.clear();
mpListBoxRow.clear();
mpListBoxData.clear();
mpCheckIgnoreEmptyRows.clear();
mpCheckTotalColumns.clear();
mpCheckAddFilter.clear();
mpCheckIdentifyCategories.clear();
mpCheckTotalRows.clear();
mpCheckDrillToDetail.clear();
mpSourceRadioNamedRange.clear();
mpSourceRadioSelection.clear();
mpSourceListBox.clear();
mpSourceEdit.clear();
mpSourceButton.clear();
mpDestinationRadioNewSheet.clear();
mpDestinationRadioNamedRange.clear();
mpDestinationRadioSelection.clear();
mpDestinationListBox.clear();
mpDestinationEdit.clear();
mpDestinationButton.clear();
mpBtnOK.clear();
mpBtnCancel.clear();
mpActiveEdit.clear();
ScAnyRefDlg::dispose();
}
void ScPivotLayoutDialog::SetupSource()
{
mpSourceListBox->Clear();
mxSourceListBox->clear();
ScRange aSourceRange;
OUString sSourceNamedRangeName;
@@ -234,21 +203,21 @@ void ScPivotLayoutDialog::SetupSource()
if(!aSourceRange.IsValid())
{
// Source is probably a DB Range
mpSourceRadioNamedRange->Disable();
mpSourceRadioSelection->Disable();
mxSourceRadioNamedRange->set_sensitive(false);
mxSourceRadioSelection->set_sensitive(false);
ToggleSource();
return;
}
else
{
OUString aSourceRangeName = aSourceRange.Format(ScRefFlags::RANGE_ABS_3D, mpDocument, maAddressDetails);
mpSourceEdit->SetText(aSourceRangeName);
mxSourceEdit->SetText(aSourceRangeName);
}
}
else
{
mpSourceRadioNamedRange->Disable();
mpSourceRadioSelection->Disable();
mxSourceRadioNamedRange->set_sensitive(false);
mxSourceRadioSelection->set_sensitive(false);
ToggleSource();
return;
}
@@ -264,7 +233,7 @@ void ScPivotLayoutDialog::SetupSource()
{
if (!aIterator.WasDBName())
{
mpSourceListBox->InsertEntry(aEachName);
mxSourceListBox->append_text(aEachName);
if (aEachRange == aSourceRange)
{
sSourceNamedRangeName = aEachName;
@@ -275,25 +244,25 @@ void ScPivotLayoutDialog::SetupSource()
if (bIsNamedRange)
{
mpSourceListBox->SelectEntry(sSourceNamedRangeName);
mpSourceRadioNamedRange->Check();
mxSourceListBox->set_active_text(sSourceNamedRangeName);
mxSourceRadioNamedRange->set_active(true);
}
else
{
mpSourceListBox->SelectEntryPos(0);
mpSourceRadioSelection->Check();
mxSourceListBox->set_active(0);
mxSourceRadioSelection->set_active(true);
}
// If entries - select first entry, otherwise disable the radio button.
if (mpSourceListBox->GetEntryCount() <= 0)
mpSourceRadioNamedRange->Disable();
if (mxSourceListBox->get_count() <= 0)
mxSourceRadioNamedRange->set_sensitive(false);
ToggleSource();
}
void ScPivotLayoutDialog::SetupDestination()
{
mpDestinationListBox->Clear();
mxDestinationListBox->clear();
// Fill up named ranges
ScAreaNameIterator aIterator(mpDocument);
@@ -304,20 +273,20 @@ void ScPivotLayoutDialog::SetupDestination()
{
if (!aIterator.WasDBName())
{
mpDestinationListBox->InsertEntry(aName);
mxDestinationListBox->append_text(aName);
}
}
// If entries - select first entry, otherwise disable the radio button.
if (mpDestinationListBox->GetEntryCount() > 0)
mpDestinationListBox->SelectEntryPos(0);
if (mxDestinationListBox->get_count() > 0)
mxDestinationListBox->set_active(0);
else
mpDestinationRadioNamedRange->Disable();
mxDestinationRadioNamedRange->set_sensitive(false);
//
if (mbNewPivotTable)
{
mpDestinationRadioNewSheet->Check();
mxDestinationRadioNewSheet->set_active(true);
}
else
{
@@ -325,8 +294,8 @@ void ScPivotLayoutDialog::SetupDestination()
{
ScAddress aAddress(maPivotParameters.nCol, maPivotParameters.nRow, maPivotParameters.nTab);
OUString aAddressString = aAddress.Format(ScRefFlags::ADDR_ABS_3D, mpDocument, maAddressDetails);
mpDestinationEdit->SetText(aAddressString);
mpDestinationRadioSelection->Check();
mxDestinationEdit->SetText(aAddressString);
mxDestinationRadioSelection->set_active(true);
}
}
@@ -335,11 +304,11 @@ void ScPivotLayoutDialog::SetupDestination()
void ScPivotLayoutDialog::FillValuesToListBoxes()
{
mpListBoxField->FillLabelFields(maPivotParameters.maLabelArray);
mpListBoxData->FillDataField(maPivotParameters.maDataFields);
mpListBoxColumn->FillFields(maPivotParameters.maColFields);
mpListBoxRow->FillFields(maPivotParameters.maRowFields);
mpListBoxPage->FillFields(maPivotParameters.maPageFields);
mxListBoxField->FillLabelFields(maPivotParameters.maLabelArray);
mxListBoxData->FillDataField(maPivotParameters.maDataFields);
mxListBoxColumn->FillFields(maPivotParameters.maColFields);
mxListBoxRow->FillFields(maPivotParameters.maRowFields);
mxListBoxPage->FillFields(maPivotParameters.maPageFields);
}
void ScPivotLayoutDialog::SetActive()
@@ -350,13 +319,13 @@ void ScPivotLayoutDialog::SetActive()
if(mpActiveEdit != nullptr)
{
mpActiveEdit->GrabFocus();
if (mpActiveEdit == mpSourceEdit)
if (mpActiveEdit == mxSourceEdit.get())
UpdateSourceRange();
}
}
else
{
GrabFocus();
m_xDialog->grab_focus();
}
RefInputDone();
@@ -375,13 +344,13 @@ void ScPivotLayoutDialog::SetReference(const ScRange& rReferenceRange, ScDocumen
OUString aReferenceString = rReferenceRange.Format(ScRefFlags::RANGE_ABS_3D, pDocument, maAddressDetails);
if (mpActiveEdit == mpSourceEdit)
if (mpActiveEdit == mxSourceEdit.get())
{
mpSourceEdit->SetRefString(aReferenceString);
mxSourceEdit->SetRefString(aReferenceString);
}
else if (mpActiveEdit == mpDestinationEdit)
else if (mpActiveEdit == mxDestinationEdit.get())
{
mpDestinationEdit->SetRefString(aReferenceString);
mxDestinationEdit->SetRefString(aReferenceString);
}
}
@@ -401,17 +370,17 @@ void ScPivotLayoutDialog::ItemInserted(const ScItemValue* pItemValue, ScPivotLay
case ScPivotLayoutTreeList::COLUMN_LIST:
case ScPivotLayoutTreeList::PAGE_LIST:
{
mpListBoxRow->RemoveEntryForItem(pItemValue);
mpListBoxColumn->RemoveEntryForItem(pItemValue);
mpListBoxPage->RemoveEntryForItem(pItemValue);
mxListBoxRow->RemoveEntryForItem(pItemValue);
mxListBoxColumn->RemoveEntryForItem(pItemValue);
mxListBoxPage->RemoveEntryForItem(pItemValue);
}
break;
case ScPivotLayoutTreeList::LABEL_LIST:
{
mpListBoxRow->RemoveEntryForItem(pItemValue);
mpListBoxColumn->RemoveEntryForItem(pItemValue);
mpListBoxPage->RemoveEntryForItem(pItemValue);
mpListBoxData->RemoveEntryForItem(pItemValue);
mxListBoxRow->RemoveEntryForItem(pItemValue);
mxListBoxColumn->RemoveEntryForItem(pItemValue);
mxListBoxPage->RemoveEntryForItem(pItemValue);
mxListBoxData->RemoveEntryForItem(pItemValue);
}
break;
default:
@@ -426,23 +395,23 @@ void ScPivotLayoutDialog::UpdateSourceRange()
ScSheetSourceDesc aSourceSheet = *maPivotTableObject.GetSheetDesc();
if (mpSourceRadioNamedRange->IsChecked())
if (mxSourceRadioNamedRange->get_active())
{
OUString aEntryString = mpSourceListBox->GetSelectedEntry();
OUString aEntryString = mxSourceListBox->get_active_text();
ScRange aSourceRange = lclGetRangeForNamedRange(aEntryString, mpDocument);
if (!aSourceRange.IsValid() || aSourceSheet.GetSourceRange() == aSourceRange)
return;
aSourceSheet.SetRangeName(aEntryString);
}
else if (mpSourceRadioSelection->IsChecked())
else if (mxSourceRadioSelection->get_active())
{
OUString aSourceString = mpSourceEdit->GetText();
OUString aSourceString = mxSourceEdit->GetText();
ScRange aSourceRange;
ScRefFlags nResult = aSourceRange.Parse(aSourceString, mpDocument, maAddressDetails);
bool bIsValid = (nResult & ScRefFlags::VALID) == ScRefFlags::VALID; // aSourceString is valid
mpSourceEdit->SetRefValid(true);
mxSourceEdit->SetRefValid(true);
if (bIsValid)
{
@@ -460,7 +429,7 @@ void ScPivotLayoutDialog::UpdateSourceRange()
if (!aSourceRange.IsValid())
{
mpSourceEdit->SetRefValid(false);
mxSourceEdit->SetRefValid(false);
return;
}
@@ -470,7 +439,7 @@ void ScPivotLayoutDialog::UpdateSourceRange()
aSourceSheet.SetSourceRange(aSourceRange);
if (aSourceSheet.CheckSourceRange() != nullptr)
{
mpSourceEdit->SetRefValid(false);
mxSourceEdit->SetRefValid(false);
return;
}
}
@@ -542,32 +511,32 @@ void ScPivotLayoutDialog::ApplyChanges()
void ScPivotLayoutDialog::ApplySaveData(ScDPSaveData& rSaveData)
{
rSaveData.SetIgnoreEmptyRows(mpCheckIgnoreEmptyRows->IsChecked());
rSaveData.SetRepeatIfEmpty(mpCheckIdentifyCategories->IsChecked());
rSaveData.SetColumnGrand(mpCheckTotalColumns->IsChecked());
rSaveData.SetRowGrand(mpCheckTotalRows->IsChecked());
rSaveData.SetFilterButton(mpCheckAddFilter->IsChecked());
rSaveData.SetDrillDown(mpCheckDrillToDetail->IsChecked());
rSaveData.SetIgnoreEmptyRows(mxCheckIgnoreEmptyRows->get_active());
rSaveData.SetRepeatIfEmpty(mxCheckIdentifyCategories->get_active());
rSaveData.SetColumnGrand(mxCheckTotalColumns->get_active());
rSaveData.SetRowGrand(mxCheckTotalRows->get_active());
rSaveData.SetFilterButton(mxCheckAddFilter->get_active());
rSaveData.SetDrillDown(mxCheckDrillToDetail->get_active());
Reference<XDimensionsSupplier> xSource = maPivotTableObject.GetSource();
ScPivotFieldVector aPageFieldVector;
mpListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector);
mxListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector);
ScDPObject::ConvertOrientation(rSaveData, aPageFieldVector, DataPilotFieldOrientation_PAGE,
xSource, maPivotParameters.maLabelArray);
ScPivotFieldVector aColFieldVector;
mpListBoxColumn->PushEntriesToPivotFieldVector(aColFieldVector);
mxListBoxColumn->PushEntriesToPivotFieldVector(aColFieldVector);
ScDPObject::ConvertOrientation(rSaveData, aColFieldVector, DataPilotFieldOrientation_COLUMN,
xSource, maPivotParameters.maLabelArray);
ScPivotFieldVector aRowFieldVector;
mpListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector);
mxListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector);
ScDPObject::ConvertOrientation(rSaveData, aRowFieldVector, DataPilotFieldOrientation_ROW,
xSource, maPivotParameters.maLabelArray);
ScPivotFieldVector aDataFieldVector;
mpListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector);
mxListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector);
ScDPObject::ConvertOrientation(rSaveData, aDataFieldVector, DataPilotFieldOrientation_DATA,
xSource, maPivotParameters.maLabelArray,
&aColFieldVector, &aRowFieldVector, &aPageFieldVector);
@@ -611,17 +580,17 @@ bool ScPivotLayoutDialog::GetDestination(ScRange& aDestinationRange, bool& bToNe
{
bToNewSheet = false;
if (mpDestinationRadioNamedRange->IsChecked())
if (mxDestinationRadioNamedRange->get_active())
{
OUString aName = mpDestinationListBox->GetSelectedEntry();
OUString aName = mxDestinationListBox->get_active_text();
aDestinationRange = lclGetRangeForNamedRange(aName, mpDocument);
if (!aDestinationRange.IsValid())
return false;
}
else if (mpDestinationRadioSelection->IsChecked())
else if (mxDestinationRadioSelection->get_active())
{
ScAddress aAddress;
aAddress.Parse(mpDestinationEdit->GetText(), mpDocument, maAddressDetails);
aAddress.Parse(mxDestinationEdit->GetText(), mpDocument, maAddressDetails);
aDestinationRange = ScRange(aAddress);
}
else
@@ -634,12 +603,12 @@ bool ScPivotLayoutDialog::GetDestination(ScRange& aDestinationRange, bool& bToNe
ScItemValue* ScPivotLayoutDialog::GetItem(SCCOL nColumn)
{
return mpListBoxField->GetItem(nColumn);
return mxListBoxField->GetItem(nColumn);
}
bool ScPivotLayoutDialog::IsDataElement(SCCOL nColumn)
{
return mpListBoxField->IsDataElement(nColumn);
return mxListBoxField->IsDataElement(nColumn);
}
ScDPLabelData& ScPivotLayoutDialog::GetLabelData(SCCOL nColumn)
@@ -649,99 +618,91 @@ ScDPLabelData& ScPivotLayoutDialog::GetLabelData(SCCOL nColumn)
void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
{
return mpListBoxData->PushDataFieldNames(rDataFieldNames);
mxListBoxData->PushDataFieldNames(rDataFieldNames);
}
bool ScPivotLayoutDialog::Close()
void ScPivotLayoutDialog::Close()
{
return DoClose( ScPivotLayoutWrapper::GetChildWindowId() );
DoClose( ScPivotLayoutWrapper::GetChildWindowId() );
}
IMPL_LINK_NOARG( ScPivotLayoutDialog, OKClicked, Button*, void )
IMPL_LINK_NOARG( ScPivotLayoutDialog, OKClicked, weld::Button&, void )
{
ApplyChanges();
Close();
m_xDialog->response(RET_OK);
}
IMPL_LINK_NOARG( ScPivotLayoutDialog, CancelClicked, Button*, void )
IMPL_LINK_NOARG( ScPivotLayoutDialog, CancelClicked, weld::Button&, void )
{
Close();
m_xDialog->response(RET_CANCEL);
}
IMPL_LINK(ScPivotLayoutDialog, GetFocusHandler, Control&, rCtrl, void)
IMPL_LINK(ScPivotLayoutDialog, GetEditFocusHandler, formula::WeldRefEdit&, rCtrl, void)
{
mpActiveEdit = &rCtrl;
mpActiveEdit->SelectAll();
}
IMPL_LINK(ScPivotLayoutDialog, GetButtonFocusHandler, formula::WeldRefButton&, rCtrl, void)
{
mpActiveEdit = nullptr;
if (&rCtrl == static_cast<Control*>(mpSourceEdit) ||
&rCtrl == static_cast<Control*>(mpSourceButton))
{
mpActiveEdit = mpSourceEdit;
}
else if (&rCtrl == static_cast<Control*>(mpDestinationEdit) ||
&rCtrl == static_cast<Control*>(mpDestinationButton))
{
mpActiveEdit = mpDestinationEdit;
}
if (&rCtrl == mxSourceButton.get())
mpActiveEdit = mxSourceEdit.get();
else if (&rCtrl == mxDestinationButton.get())
mpActiveEdit = mxDestinationEdit.get();
if (mpActiveEdit)
mpActiveEdit->SetSelection(Selection(0, SELECTION_MAX));
mpActiveEdit->SelectAll();
}
IMPL_LINK_NOARG(ScPivotLayoutDialog, LoseFocusHandler, Control&, void)
IMPL_LINK_NOARG(ScPivotLayoutDialog, LoseEditFocusHandler, formula::WeldRefEdit&, void)
{
mbDialogLostFocus = !IsActive();
mbDialogLostFocus = !m_xDialog->has_toplevel_focus();
}
IMPL_LINK_NOARG(ScPivotLayoutDialog, SourceListSelected, ListBox&, void)
IMPL_LINK_NOARG(ScPivotLayoutDialog, LoseButtonFocusHandler, formula::WeldRefButton&, void)
{
mbDialogLostFocus = !m_xDialog->has_toplevel_focus();
}
IMPL_LINK_NOARG(ScPivotLayoutDialog, SourceListSelected, weld::ComboBox&, void)
{
UpdateSourceRange();
}
IMPL_LINK_NOARG(ScPivotLayoutDialog, SourceEditModified, Edit&, void)
IMPL_LINK_NOARG(ScPivotLayoutDialog, SourceEditModified, formula::WeldRefEdit&, void)
{
UpdateSourceRange();
}
IMPL_LINK_NOARG(ScPivotLayoutDialog, ToggleSource, RadioButton&, void)
IMPL_LINK_NOARG(ScPivotLayoutDialog, ToggleSource, weld::ToggleButton&, void)
{
ToggleSource();
}
void ScPivotLayoutDialog::ToggleSource()
{
bool bNamedRange = mpSourceRadioNamedRange->IsChecked();
bool bSelection = mpSourceRadioSelection->IsChecked();
mpSourceListBox->Enable(bNamedRange);
mpSourceButton->Enable(bSelection);
mpSourceEdit->Enable(bSelection);
bool bNamedRange = mxSourceRadioNamedRange->get_active();
bool bSelection = mxSourceRadioSelection->get_active();
mxSourceListBox->set_sensitive(bNamedRange);
mxSourceButton->GetWidget()->set_sensitive(bSelection);
mxSourceEdit->GetWidget()->set_sensitive(bSelection);
UpdateSourceRange();
}
IMPL_LINK_NOARG(ScPivotLayoutDialog, ToggleDestination, RadioButton&, void)
IMPL_LINK_NOARG(ScPivotLayoutDialog, ToggleDestination, weld::ToggleButton&, void)
{
ToggleDestination();
}
void ScPivotLayoutDialog::ToggleDestination()
{
bool bNamedRange = mpDestinationRadioNamedRange->IsChecked();
bool bSelection = mpDestinationRadioSelection->IsChecked();
mpDestinationListBox->Enable(bNamedRange);
mpDestinationButton->Enable(bSelection);
mpDestinationEdit->Enable(bSelection);
}
ScPivotLayoutTreeListBase* ScPivotLayoutDialog::FindListBoxFor(const SvTreeListEntry *pEntry)
{
if (mpListBoxPage->HasEntry(pEntry))
return mpListBoxPage.get();
if (mpListBoxColumn->HasEntry(pEntry))
return mpListBoxColumn.get();
if (mpListBoxRow->HasEntry(pEntry))
return mpListBoxRow.get();
if (mpListBoxData->HasEntry(pEntry))
return mpListBoxData.get();
return nullptr;
bool bNamedRange = mxDestinationRadioNamedRange->get_active();
bool bSelection = mxDestinationRadioSelection->get_active();
mxDestinationListBox->set_sensitive(bNamedRange);
mxDestinationButton->GetWidget()->set_sensitive(bSelection);
mxDestinationEdit->GetWidget()->set_sensitive(bSelection);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index 03ea8a98..1900464 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -19,17 +19,16 @@
#include <pivot.hxx>
#include <scabstdlg.hxx>
VCL_BUILDER_FACTORY_ARGS(ScPivotLayoutTreeList,
WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN)
ScPivotLayoutTreeList::ScPivotLayoutTreeList(vcl::Window* pParent, WinBits nBits) :
ScPivotLayoutTreeListBase(pParent, nBits)
ScPivotLayoutTreeList::ScPivotLayoutTreeList(std::unique_ptr<weld::TreeView> xControl)
: ScPivotLayoutTreeListBase(std::move(xControl))
{
SetForceMakeVisible(true);
mxControl->connect_key_press(LINK(this, ScPivotLayoutTreeList, KeyInputHdl));
mxControl->connect_row_activated(LINK(this, ScPivotLayoutTreeList, DoubleClickHdl));
}
ScPivotLayoutTreeList::~ScPivotLayoutTreeList()
{}
{
}
void ScPivotLayoutTreeList::Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListType eType)
{
@@ -37,17 +36,17 @@ void ScPivotLayoutTreeList::Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListT
meType = eType;
}
bool ScPivotLayoutTreeList::DoubleClickHdl()
IMPL_LINK_NOARG(ScPivotLayoutTreeList, DoubleClickHdl, weld::TreeView&, void)
{
SvTreeListEntry* pEntry = GetCurEntry();
if (!pEntry)
return false;
int nEntry = mxControl->get_cursor_index();
if (nEntry == -1)
return;
ScItemValue* pCurrentItemValue = static_cast<ScItemValue*>(pEntry->GetUserData());
ScItemValue* pCurrentItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(nEntry).toInt64());
ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
if (mpParent->IsDataElement(rCurrentFunctionData.mnCol))
return false;
return;
SCCOL nCurrentColumn = rCurrentFunctionData.mnCol;
ScDPLabelData& rCurrentLabelData = mpParent->GetLabelData(nCurrentColumn);
@@ -58,20 +57,18 @@ bool ScPivotLayoutTreeList::DoubleClickHdl()
mpParent->PushDataFieldNames(aDataFieldNames);
ScopedVclPtr<AbstractScDPSubtotalDlg> pDialog(
pFactory->CreateScDPSubtotalDlg(GetFrameWeld(), mpParent->maPivotTableObject, rCurrentLabelData, rCurrentFunctionData, aDataFieldNames));
pFactory->CreateScDPSubtotalDlg(mxControl.get(), mpParent->maPivotTableObject, rCurrentLabelData, rCurrentFunctionData, aDataFieldNames));
if (pDialog->Execute() == RET_OK)
{
pDialog->FillLabelData(rCurrentLabelData);
rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask();
}
return true;
}
void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector)
{
Clear();
mxControl->clear();
maItemValues.clear();
for (ScPivotField& rField : rFieldVector)
@@ -79,13 +76,14 @@ void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector)
OUString aLabel = mpParent->GetItem( rField.nCol )->maName;
ScItemValue* pItemValue = new ScItemValue( aLabel, rField.nCol, rField.nFuncMask );
maItemValues.push_back(std::unique_ptr<ScItemValue>(pItemValue));
InsertEntry(pItemValue->maName, nullptr, false, TREELIST_APPEND, pItemValue);
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
mxControl->append(sId, pItemValue->maName);
}
}
void ScPivotLayoutTreeList::InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget)
void ScPivotLayoutTreeList::InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget)
{
ScItemValue* pItemValue = static_cast<ScItemValue*>(pSource->GetUserData());
ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(rSource.get_selected_id().toInt64());
ScItemValue* pOriginalItemValue = pItemValue->mpOriginalItemValue;
// Don't allow to add "Data" element to page fields
@@ -94,31 +92,32 @@ void ScPivotLayoutTreeList::InsertEntryForSourceTarget(SvTreeListEntry* pSource,
mpParent->ItemInserted(pOriginalItemValue, meType);
sal_uLong nPosition = (pTarget == nullptr) ? TREELIST_APPEND : GetModel()->GetAbsPos(pTarget) + 1;
InsertEntryForItem(pOriginalItemValue, nPosition);
InsertEntryForItem(pOriginalItemValue, nTarget);
}
void ScPivotLayoutTreeList::InsertEntryForItem(const ScItemValue* pItemValue, sal_uLong nPosition)
void ScPivotLayoutTreeList::InsertEntryForItem(const ScItemValue* pItemValue, int nPosition)
{
ScItemValue *pListItemValue = new ScItemValue(pItemValue);
maItemValues.push_back(std::unique_ptr<ScItemValue>(pListItemValue));
OUString rName = pListItemValue->maName;
InsertEntry(rName, nullptr, false, nPosition, pListItemValue);
OUString sName = pListItemValue->maName;
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pListItemValue)));
mxControl->insert(nullptr, nPosition, &sName, &sId, nullptr, nullptr, nullptr, false, nullptr);
}
void ScPivotLayoutTreeList::KeyInput(const KeyEvent& rKeyEvent)
IMPL_LINK(ScPivotLayoutTreeList, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
{
vcl::KeyCode aCode = rKeyEvent.GetKeyCode();
sal_uInt16 nCode = aCode.GetCode();
if (nCode == KEY_DELETE)
{
const SvTreeListEntry* pEntry = GetCurEntry();
if (pEntry)
GetModel()->Remove(pEntry);
return;
const int nEntry = mxControl->get_cursor_index();
if (nEntry != -1)
mxControl->remove(nEntry);
return true;
}
SvTreeListBox::KeyInput(rKeyEvent);
return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index f9fdea9..1ca50da 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -14,24 +14,19 @@
#include <vcl/treelistentry.hxx>
ScPivotLayoutTreeListBase::ScPivotLayoutTreeListBase(vcl::Window* pParent, WinBits nBits, SvPivotTreeListType eType)
: SvTreeListBox(pParent, nBits)
ScPivotLayoutTreeListBase::ScPivotLayoutTreeListBase(std::unique_ptr<weld::TreeView> xControl, SvPivotTreeListType eType)
: mxControl(std::move(xControl))
, maDropTargetHelper(*this)
, meType(eType)
, mpParent(nullptr)
{
SetHighlightRange();
SetDragDropMode(DragDropMode::CTRL_MOVE | DragDropMode::APP_MOVE | DragDropMode::APP_DROP);
mxControl->connect_focus_in(LINK(this, ScPivotLayoutTreeListBase, GetFocusHdl));
mxControl->connect_mnemonic_activate(LINK(this, ScPivotLayoutTreeListBase, MnemonicActivateHdl));
mxControl->connect_focus_out(LINK(this, ScPivotLayoutTreeListBase, LoseFocusHdl));
}
ScPivotLayoutTreeListBase::~ScPivotLayoutTreeListBase()
{
disposeOnce();
}
void ScPivotLayoutTreeListBase::dispose()
{
mpParent.clear();
SvTreeListBox::dispose();
}
void ScPivotLayoutTreeListBase::Setup(ScPivotLayoutDialog* pParent)
@@ -39,50 +34,58 @@ void ScPivotLayoutTreeListBase::Setup(ScPivotLayoutDialog* pParent)
mpParent = pParent;
}
DragDropMode ScPivotLayoutTreeListBase::NotifyStartDrag(TransferDataContainer& /*aTransferDataContainer*/,
SvTreeListEntry* /*pEntry*/ )
ScPivotLayoutTreeDropTarget::ScPivotLayoutTreeDropTarget(ScPivotLayoutTreeListBase& rTreeView)
: DropTargetHelper(rTreeView.get_widget().get_drop_target())
, m_rTreeView(rTreeView)
{
return GetDragDropMode();
}
void ScPivotLayoutTreeListBase::DragFinished(sal_Int8 /*nDropAction*/)
{}
bool ScPivotLayoutTreeListBase::NotifyAcceptDrop(SvTreeListEntry* /*pEntry*/)
sal_Int8 ScPivotLayoutTreeDropTarget::AcceptDrop(const AcceptDropEvent& rEvt)
{
return true;
// to enable the autoscroll when we're close to the edges
weld::TreeView& rWidget = m_rTreeView.get_widget();
rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr);
return DND_ACTION_MOVE;
}
TriState ScPivotLayoutTreeListBase::NotifyMoving(SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
SvTreeListEntry*& /*rpNewParent*/, sal_uLong& /*rNewChildPos*/)
sal_Int8 ScPivotLayoutTreeDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
InsertEntryForSourceTarget(pSource, pTarget);
return TRISTATE_FALSE;
weld::TreeView& rWidget = m_rTreeView.get_widget();
weld::TreeView* pSource = rWidget.get_drag_source();
if (!pSource)
return DND_ACTION_NONE;
std::unique_ptr<weld::TreeIter> xTarget(rWidget.make_iterator());
int nTargetPos = -1;
if (rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get()))
nTargetPos = rWidget.get_iter_index_in_parent(*xTarget);
m_rTreeView.InsertEntryForSourceTarget(*pSource, nTargetPos);
return DND_ACTION_MOVE;
}
TriState ScPivotLayoutTreeListBase::NotifyCopying(SvTreeListEntry* /*pTarget*/, SvTreeListEntry* /*pSource*/,
SvTreeListEntry*& /*rpNewParent*/, sal_uLong& /*rNewChildPos*/)
bool ScPivotLayoutTreeListBase::HasEntry(const weld::TreeIter& rEntry)
{
return TRISTATE_FALSE;
}
std::unique_ptr<weld::TreeIter> xEntry(mxControl->make_iterator());
if (!mxControl->get_iter_first(*xEntry))
return false;
bool ScPivotLayoutTreeListBase::HasEntry(const SvTreeListEntry* pEntry)
{
SvTreeListEntry* pEachEntry;
for (pEachEntry = First(); pEachEntry != nullptr; pEachEntry = Next(pEachEntry))
do
{
if(pEachEntry == pEntry)
if (mxControl->iter_compare(*xEntry, rEntry))
return true;
}
} while (mxControl->iter_next(*xEntry));
return false;
}
void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector& rVector)
{
SvTreeListEntry* pEachEntry;
for (pEachEntry = First(); pEachEntry != nullptr; pEachEntry = Next(pEachEntry))
std::unique_ptr<weld::TreeIter> xEachEntry(mxControl->make_iterator());
if (!mxControl->get_iter_first(*xEachEntry))
return;
do
{
ScItemValue* pItemValue = static_cast<ScItemValue*>(pEachEntry->GetUserData());
ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xEachEntry).toInt64());
ScPivotFuncData& rFunctionData = pItemValue->maFunctionData;
ScPivotField aField;
@@ -92,46 +95,44 @@ void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector
aField.mnDupCount = rFunctionData.mnDupCount;
aField.maFieldRef = rFunctionData.maFieldRef;
rVector.push_back(aField);
}
} while (mxControl->iter_next(*xEachEntry));
}
void ScPivotLayoutTreeListBase::InsertEntryForSourceTarget(SvTreeListEntry* /*pSource*/, SvTreeListEntry* /*pTarget*/)
{}
void ScPivotLayoutTreeListBase::InsertEntryForSourceTarget(weld::TreeView& /*pSource*/, int /*nTarget*/)
{
}
void ScPivotLayoutTreeListBase::RemoveEntryForItem(const ScItemValue* pItemValue)
{
SvTreeListEntry* pEachEntry;
for (pEachEntry = First(); pEachEntry != nullptr; pEachEntry = Next(pEachEntry))
{
ScItemValue* pEachItemValue = static_cast<ScItemValue*>(pEachEntry->GetUserData());
if (pEachItemValue == pItemValue)
{
GetModel()->Remove(pEachEntry);
return;
}
}
}
void ScPivotLayoutTreeListBase::GetFocus()
{
SvTreeListBox::GetFocus();
if (!mpParent || !mpParent->mpPreviouslyFocusedListBox)
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
int nPos = mxControl->find_id(sId);
if (nPos == -1)
return;
if (GetGetFocusFlags() & GetFocusFlags::Mnemonic)
{
SvTreeListEntry* pEntry = mpParent->mpPreviouslyFocusedListBox->GetCurEntry();
if (pEntry)
InsertEntryForSourceTarget(pEntry, nullptr);
mpParent->mpPreviouslyFocusedListBox->GrabFocus();
}
mxControl->remove(nPos);
}
void ScPivotLayoutTreeListBase::LoseFocus()
IMPL_LINK_NOARG(ScPivotLayoutTreeListBase, GetFocusHdl, weld::Widget&, void)
{
SvTreeListBox::LoseFocus();
if (mpParent)
mpParent->mpPreviouslyFocusedListBox = this;
if (!mpParent)
return;
mpParent->mpPreviouslyFocusedListBox = this;
}
IMPL_LINK_NOARG(ScPivotLayoutTreeListBase, MnemonicActivateHdl, weld::Widget&, bool)
{
if (!mpParent || !mpParent->mpPreviouslyFocusedListBox)
return false;
weld::TreeView& rSource = mpParent->mpPreviouslyFocusedListBox->get_widget();
int nEntry = rSource.get_cursor_index();
if (nEntry != -1)
InsertEntryForSourceTarget(rSource, -1);
return true;
}
IMPL_LINK_NOARG(ScPivotLayoutTreeListBase, LoseFocusHdl, weld::Widget&, void)
{
if (!mpParent)
return;
mpParent->mpPreviouslyFocusedListBox = nullptr;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index 1fd8aad..0c5b8d8 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -21,9 +21,6 @@
#include <globstr.hrc>
#include <scresid.hxx>
VCL_BUILDER_FACTORY_ARGS(ScPivotLayoutTreeListData,
WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN)
namespace
{
@@ -66,18 +63,23 @@ OUString lclCreateDataItemName(const PivotFunc nFunctionMask, const OUString& rN
} // anonymous namespace
ScPivotLayoutTreeListData::ScPivotLayoutTreeListData(vcl::Window* pParent, WinBits nBits) :
ScPivotLayoutTreeListBase(pParent, nBits, DATA_LIST)
ScPivotLayoutTreeListData::ScPivotLayoutTreeListData(std::unique_ptr<weld::TreeView> xControl)
: ScPivotLayoutTreeListBase(std::move(xControl))
{
SetForceMakeVisible(true);
mxControl->connect_key_press(LINK(this, ScPivotLayoutTreeListData, KeyInputHdl));
mxControl->connect_row_activated(LINK(this, ScPivotLayoutTreeListData, DoubleClickHdl));
}
ScPivotLayoutTreeListData::~ScPivotLayoutTreeListData()
{}
bool ScPivotLayoutTreeListData::DoubleClickHdl()
IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, void)
{
ScItemValue* pCurrentItemValue = static_cast<ScItemValue*>(GetCurEntry()->GetUserData());
int nEntry = mxControl->get_cursor_index();
if (nEntry == -1)
return;
ScItemValue* pCurrentItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(nEntry).toInt64());
ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
SCCOL nCurrentColumn = rCurrentFunctionData.mnCol;
@@ -86,7 +88,7 @@ bool ScPivotLayoutTreeListData::DoubleClickHdl()
ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create();
ScopedVclPtr<AbstractScDPFunctionDlg> pDialog(
pFactory->CreateScDPFunctionDlg(GetFrameWeld(), mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData));
pFactory->CreateScDPFunctionDlg(mxControl.get(), mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData));
if (pDialog->Execute() == RET_OK)
{
@@ -104,15 +106,13 @@ bool ScPivotLayoutTreeListData::DoubleClickHdl()
rDFData.maName,
rCurrentFunctionData.mnDupCount);
SetEntryText(GetCurEntry(), sDataItemName);
mxControl->set_text(nEntry, sDataItemName);
}
return true;
}
void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields)
{
Clear();
mxControl->clear();
maDataItemValues.clear();
for (ScPivotField& rField : rDataFields)
@@ -139,16 +139,20 @@ void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields)
pItemValue->maFunctionData.mnDupCount);
maDataItemValues.push_back(std::unique_ptr<ScItemValue>(pItemValue));
InsertEntry(sDataItemName, nullptr, false, TREELIST_APPEND, pItemValue);
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
mxControl->append(sId, sDataItemName);
}
}
void ScPivotLayoutTreeListData::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
{
SvTreeListEntry* pLoopEntry;
for (pLoopEntry = First(); pLoopEntry != nullptr; pLoopEntry = Next(pLoopEntry))
std::unique_ptr<weld::TreeIter> xLoopEntry(mxControl->make_iterator());
if (!mxControl->get_iter_first(*xLoopEntry))
return;
do
{
ScItemValue* pEachItemValue = static_cast<ScItemValue*>(pLoopEntry->GetUserData());
ScItemValue* pEachItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xLoopEntry).toInt64());
SCCOL nColumn = pEachItemValue->maFunctionData.mnCol;
ScDPLabelData& rLabelData = mpParent->GetLabelData(nColumn);
@@ -166,31 +170,30 @@ void ScPivotLayoutTreeListData::PushDataFieldNames(std::vector<ScDPName>& rDataF
}
rDataFieldNames.emplace_back(rLabelData.maName, sLayoutName, rLabelData.mnDupCount);
}
} while (mxControl->iter_next(*xLoopEntry));
}
void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget)
void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget)
{
ScItemValue* pItemValue = static_cast<ScItemValue*>(pSource->GetUserData());
ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(rSource.get_selected_id().toInt64());
if (mpParent->IsDataElement(pItemValue->maFunctionData.mnCol))
return;
if (HasEntry(pSource))
if (&rSource == mxControl.get())
{
OUString rText = GetEntryText(pSource);
GetModel()->Remove(pSource);
sal_uLong nPosition = (pTarget == nullptr) ? TREELIST_APPEND : GetModel()->GetAbsPos(pTarget) + 1;
InsertEntry(rText, nullptr, false, nPosition, pItemValue);
OUString sText = mxControl->get_selected_text();
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
mxControl->remove_id(sId);
mxControl->insert(nullptr, nTarget, &sText, &sId, nullptr, nullptr, nullptr, false, nullptr);
}
else
{
sal_uLong nPosition = (pTarget == nullptr) ? TREELIST_APPEND : GetModel()->GetAbsPos(pTarget) + 1;
InsertEntryForItem(pItemValue->mpOriginalItemValue, nPosition);
InsertEntryForItem(pItemValue->mpOriginalItemValue, nTarget);
}
}
void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition)
void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, int nPosition)
{
ScItemValue* pDataItemValue = new ScItemValue(pItemValue);
pDataItemValue->mpOriginalItemValue = pItemValue;
@@ -211,7 +214,8 @@ void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, sal_
pDataItemValue->maName,
rFunctionData.mnDupCount);
InsertEntry(sDataName, nullptr, false, nPosition, pDataItemValue);
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDataItemValue)));
mxControl->insert(nullptr, nPosition, &sDataName, &sId, nullptr, nullptr, nullptr, false, nullptr);
}
void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValue)
@@ -223,10 +227,12 @@ void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValu
rInputFunctionData.mnDupCount = 0;
sal_uInt8 nMaxDuplicateCount = 0;
SvTreeListEntry* pEachEntry;
for (pEachEntry = First(); pEachEntry != nullptr; pEachEntry = Next(pEachEntry))
std::unique_ptr<weld::TreeIter> xEachEntry(mxControl->make_iterator());
if (!mxControl->get_iter_first(*xEachEntry))
return;
do
{
ScItemValue* pItemValue = static_cast<ScItemValue*>(pEachEntry->GetUserData());
ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xEachEntry).toInt64());
if (pItemValue == pInputItemValue)
continue;
@@ -239,7 +245,7 @@ void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValu
if(rFunctionData.mnDupCount > nMaxDuplicateCount)
nMaxDuplicateCount = rFunctionData.mnDupCount;
}
}
} while (mxControl->iter_next(*xEachEntry));
if(bFoundDuplicate)
{
@@ -247,20 +253,20 @@ void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValu
}
}
void ScPivotLayoutTreeListData::KeyInput(const KeyEvent& rKeyEvent)
IMPL_LINK(ScPivotLayoutTreeListData, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
{
vcl::KeyCode aCode = rKeyEvent.GetKeyCode();
sal_uInt16 nCode = aCode.GetCode();
if (nCode == KEY_DELETE)
{
const SvTreeListEntry* pEntry = GetCurEntry();
if (pEntry)
GetModel()->Remove(pEntry);
return;
int nEntry = mxControl->get_cursor_index();
if (nEntry != -1)
mxControl->remove(nEntry);
return true;
}
SvTreeListBox::KeyInput(rKeyEvent);
return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
index 82cfc0e..d09afc5 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
@@ -18,14 +18,11 @@
#include <vcl/treelistentry.hxx>
#include <pivot.hxx>
VCL_BUILDER_FACTORY_ARGS(ScPivotLayoutTreeListLabel,
WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN);
ScPivotLayoutTreeListLabel::ScPivotLayoutTreeListLabel(vcl::Window* pParent, WinBits nBits)
: ScPivotLayoutTreeListBase(pParent, nBits, LABEL_LIST)
ScPivotLayoutTreeListLabel::ScPivotLayoutTreeListLabel(std::unique_ptr<weld::TreeView> xControl)
: ScPivotLayoutTreeListBase(std::move(xControl), LABEL_LIST)
, maDataItem(0)
{
SetForceMakeVisible(true);
mxControl->connect_key_press(LINK(this, ScPivotLayoutTreeListLabel, KeyInputHdl));
}
ScPivotLayoutTreeListLabel::~ScPivotLayoutTreeListLabel()
@@ -33,7 +30,7 @@ ScPivotLayoutTreeListLabel::~ScPivotLayoutTreeListLabel()
void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVector)
{
Clear();
mxControl->clear();
maItemValues.clear();
for (std::unique_ptr<ScDPLabelData> const & pLabelData : rLabelVector)
@@ -47,17 +44,16 @@ void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect
if (pLabelData->mnOriginalDim < 0 && !pLabelData->mbDataLayout)
{
SvTreeListEntry* pEntry = InsertEntry(pLabelData->maName);
pEntry->SetUserData(pValue);
mxControl->append(OUString::number(reinterpret_cast<sal_Int64>(pValue)), pLabelData->maName);
}
}
}
void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* /*pTarget*/)
void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(weld::TreeView& rSource, int /*nTarget*/)
{
ScPivotLayoutTreeListBase *pSourceTree = mpParent->FindListBoxFor(pSource);
if (pSourceTree)
pSourceTree->RemoveSelection();
if (&rSource == mxControl.get())
return;
rSource.remove(rSource.get_selected_index());
}
bool ScPivotLayoutTreeListLabel::IsDataElement(SCCOL nColumn)
@@ -72,20 +68,20 @@ ScItemValue* ScPivotLayoutTreeListLabel::GetItem(SCCOL nColumn)
return maItemValues[nColumn].get();
}
void ScPivotLayoutTreeListLabel::KeyInput(const KeyEvent& rKeyEvent)
IMPL_LINK(ScPivotLayoutTreeListLabel, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
{
vcl::KeyCode aCode = rKeyEvent.GetKeyCode();
sal_uInt16 nCode = aCode.GetCode();
if (nCode == KEY_DELETE)
{
const SvTreeListEntry* pEntry = GetCurEntry();
if (pEntry)
GetModel()->Remove(pEntry);
return;
int nEntry = mxControl->get_cursor_index();
if (nEntry != -1)
mxControl->remove(nEntry);
return true;
}
SvTreeListBox::KeyInput(rKeyEvent);
return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 7d93d84..a082dbfd 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -234,7 +234,7 @@ namespace
}
ScDPFunctionDlg::ScDPFunctionDlg(
weld::Window* pParent, const ScDPLabelDataVector& rLabelVec,
weld::Widget* pParent, const ScDPLabelDataVector& rLabelVec,
const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData)
: GenericDialogController(pParent, "modules/scalc/ui/datafielddialog.ui", "DataFieldDialog")
, mxLbFunc(new ScDPFunctionListBox(m_xBuilder->weld_tree_view("functions")))
@@ -443,7 +443,7 @@ IMPL_LINK_NOARG(ScDPFunctionDlg, DblClickHdl, weld::TreeView&, void)
m_xDialog->response(RET_OK);
}
ScDPSubtotalDlg::ScDPSubtotalDlg(weld::Window* pParent, ScDPObject& rDPObj,
ScDPSubtotalDlg::ScDPSubtotalDlg(weld::Widget* pParent, ScDPObject& rDPObj,
const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData,
const ScDPNameVec& rDataFields, bool bEnableLayout)
: GenericDialogController(pParent, "modules/scalc/ui/pivotfielddialog.ui", "PivotFieldDialog")
diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx
index 7d24443..55a476b 100644
--- a/sc/source/ui/inc/PivotLayoutDialog.hxx
+++ b/sc/source/ui/inc/PivotLayoutDialog.hxx
@@ -33,12 +33,12 @@ public:
~ScItemValue();
};
class ScPivotLayoutDialog : public ScAnyRefDlg
class ScPivotLayoutDialog : public ScAnyRefDlgController
{
public:
ScDPObject maPivotTableObject;
VclPtr<ScPivotLayoutTreeListBase> mpPreviouslyFocusedListBox;
ScPivotLayoutTreeListBase* mpPreviouslyFocusedListBox;
private:
ScViewData* mpViewData;
@@ -46,52 +46,62 @@ private:
bool const mbNewPivotTable;
VclPtr<ScPivotLayoutTreeListLabel> mpListBoxField;
VclPtr<ScPivotLayoutTreeList> mpListBoxPage;
VclPtr<ScPivotLayoutTreeList> mpListBoxColumn;
VclPtr<ScPivotLayoutTreeList> mpListBoxRow;
VclPtr<ScPivotLayoutTreeListData> mpListBoxData;
VclPtr<CheckBox> mpCheckIgnoreEmptyRows;
VclPtr<CheckBox> mpCheckTotalColumns;
VclPtr<CheckBox> mpCheckAddFilter;
VclPtr<CheckBox> mpCheckIdentifyCategories;
VclPtr<CheckBox> mpCheckTotalRows;
VclPtr<CheckBox> mpCheckDrillToDetail;
VclPtr<RadioButton> mpSourceRadioNamedRange;
VclPtr<RadioButton> mpSourceRadioSelection;
VclPtr<ListBox> mpSourceListBox;
VclPtr<formula::RefEdit> mpSourceEdit;
VclPtr<formula::RefButton> mpSourceButton;
VclPtr<RadioButton> mpDestinationRadioNewSheet;
VclPtr<RadioButton> mpDestinationRadioNamedRange;
VclPtr<RadioButton> mpDestinationRadioSelection;
VclPtr<ListBox> mpDestinationListBox;
VclPtr<formula::RefEdit> mpDestinationEdit;
VclPtr<formula::RefButton> mpDestinationButton;
VclPtr<PushButton> mpBtnOK;
VclPtr<CancelButton> mpBtnCancel;
VclPtr<formula::RefEdit> mpActiveEdit;
ScAddress::Details const maAddressDetails;
bool mbDialogLostFocus;
DECL_LINK(CancelClicked, Button*, void);
DECL_LINK(OKClicked, Button*, void);
DECL_LINK(GetFocusHandler, Control&, void);
DECL_LINK(LoseFocusHandler, Control&, void);
DECL_LINK(ToggleSource, RadioButton&, void);
DECL_LINK(ToggleDestination, RadioButton&, void);
DECL_LINK(SourceListSelected, ListBox&, void);
DECL_LINK(SourceEditModified, Edit&, void);
formula::WeldRefEdit* mpActiveEdit;
std::unique_ptr<ScPivotLayoutTreeListLabel> mxListBoxField;
std::unique_ptr<ScPivotLayoutTreeList> mxListBoxPage;
std::unique_ptr<ScPivotLayoutTreeList> mxListBoxColumn;
std::unique_ptr<ScPivotLayoutTreeList> mxListBoxRow;
std::unique_ptr<ScPivotLayoutTreeListData> mxListBoxData;
std::unique_ptr<weld::CheckButton> mxCheckIgnoreEmptyRows;
std::unique_ptr<weld::CheckButton> mxCheckTotalColumns;
std::unique_ptr<weld::CheckButton> mxCheckAddFilter;
std::unique_ptr<weld::CheckButton> mxCheckIdentifyCategories;
std::unique_ptr<weld::CheckButton> mxCheckTotalRows;
std::unique_ptr<weld::CheckButton> mxCheckDrillToDetail;
std::unique_ptr<weld::RadioButton> mxSourceRadioNamedRange;
std::unique_ptr<weld::RadioButton> mxSourceRadioSelection;
std::unique_ptr<weld::ComboBox> mxSourceListBox;
std::unique_ptr<formula::WeldRefEdit> mxSourceEdit;
std::unique_ptr<formula::WeldRefButton> mxSourceButton;
std::unique_ptr<weld::RadioButton> mxDestinationRadioNewSheet;
std::unique_ptr<weld::RadioButton> mxDestinationRadioNamedRange;
std::unique_ptr<weld::RadioButton> mxDestinationRadioSelection;
std::unique_ptr<weld::ComboBox> mxDestinationListBox;
std::unique_ptr<formula::WeldRefEdit> mxDestinationEdit;
std::unique_ptr<formula::WeldRefButton> mxDestinationButton;
std::unique_ptr<weld::Button> mxBtnOK;
std::unique_ptr<weld::Button> mxBtnCancel;
std::unique_ptr<weld::Frame> mxSourceFrame;
std::unique_ptr<weld::Label> mxSourceLabel;
std::unique_ptr<weld::Frame> mxDestFrame;
std::unique_ptr<weld::Label> mxDestLabel;
std::unique_ptr<weld::Expander> mxOptions;
std::unique_ptr<weld::Expander> mxMore;
DECL_LINK(CancelClicked, weld::Button&, void);
DECL_LINK(OKClicked, weld::Button&, void);
DECL_LINK(GetEditFocusHandler, formula::WeldRefEdit&, void);
DECL_LINK(GetButtonFocusHandler, formula::WeldRefButton&, void);
DECL_LINK(LoseEditFocusHandler, formula::WeldRefEdit&, void);
DECL_LINK(LoseButtonFocusHandler, formula::WeldRefButton&, void);
DECL_LINK(ToggleSource, weld::ToggleButton&, void);
DECL_LINK(ToggleDestination, weld::ToggleButton&, void);
DECL_LINK(SourceListSelected, weld::ComboBox&, void);
DECL_LINK(SourceEditModified, formula::WeldRefEdit&, void);
void ToggleSource();
void ToggleDestination();
virtual bool Close() override;
virtual void Close() override;
ScPivotParam maPivotParameters;
@@ -104,10 +114,9 @@ private:
bool GetDestination(ScRange& aDestinationRange, bool& bToNewSheet);
public:
ScPivotLayoutDialog(SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, vcl::Window* pParent,
ScPivotLayoutDialog(SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, weld::Window* pParent,
ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bCreateNewPivotTable);
virtual ~ScPivotLayoutDialog() override;
virtual void dispose() override;
virtual void SetReference(const ScRange& rReferenceRange, ScDocument* pDocument) override;
virtual void SetActive() override;
@@ -127,8 +136,6 @@ public:
ScDPLabelData& GetLabelData(SCCOL nColumn);
ScDPLabelDataVector& GetLabelDataVector() { return maPivotParameters.maLabelArray;}
void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames);
ScPivotLayoutTreeListBase* FindListBoxFor(const SvTreeListEntry *pEntry);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/PivotLayoutTreeList.hxx b/sc/source/ui/inc/PivotLayoutTreeList.hxx
index 8af3cd1..02120e7 100644
--- a/sc/source/ui/inc/PivotLayoutTreeList.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeList.hxx
@@ -12,6 +12,7 @@
#define INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTTREELIST_HXX
#include <memory>
#include <tools/solar.h>
#include "PivotLayoutTreeListBase.hxx"
class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase
@@ -19,19 +20,19 @@ class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase
private:
std::vector<std::unique_ptr<ScItemValue> > maItemValues;
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
DECL_LINK(DoubleClickHdl, weld::TreeView&, void);
public:
ScPivotLayoutTreeList(vcl::Window* pParent, WinBits nBits);
ScPivotLayoutTreeList(std::unique_ptr<weld::TreeView> xControl);
virtual ~ScPivotLayoutTreeList() override;
virtual bool DoubleClickHdl() override;
void Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListType eType);
void FillFields(ScPivotFieldVector& rFieldVector);
virtual void InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget) override;
protected:
virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) override;
void InsertEntryForItem(const ScItemValue* pItemValue, sal_uLong nPosition);
virtual void KeyInput(const KeyEvent& rKeyEvent) override;
void InsertEntryForItem(const ScItemValue* pItemValue, int nPosition);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
index fb5d9a0..4796fdc 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
@@ -11,14 +11,27 @@
#ifndef INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTTREELISTBASE_HXX
#define INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTTREELISTBASE_HXX
#include <vcl/treelistbox.hxx>
#include <vcl/transfer.hxx>
#include <vcl/weld.hxx>
#include <pivot.hxx>
class ScPivotLayoutDialog;
class ScPivotLayoutTreeListBase;
class ScItemValue;
class ScPivotLayoutTreeListBase : public SvTreeListBox
class ScPivotLayoutTreeDropTarget : public DropTargetHelper
{
private:
ScPivotLayoutTreeListBase& m_rTreeView;
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
public:
ScPivotLayoutTreeDropTarget(ScPivotLayoutTreeListBase& rTreeView);
};
class ScPivotLayoutTreeListBase
{
public:
enum SvPivotTreeListType
@@ -32,36 +45,29 @@ public:
};
protected:
std::unique_ptr<weld::TreeView> mxControl;
ScPivotLayoutTreeDropTarget maDropTargetHelper;
SvPivotTreeListType meType;
VclPtr<ScPivotLayoutDialog> mpParent;
ScPivotLayoutDialog* mpParent;
DECL_LINK(GetFocusHdl, weld::Widget&, void);
DECL_LINK(MnemonicActivateHdl, weld::Widget&, bool);
DECL_LINK(LoseFocusHdl, weld::Widget&, void);
public:
void Setup(ScPivotLayoutDialog* pParent);
ScPivotLayoutTreeListBase(vcl::Window* pParent, WinBits nBits, SvPivotTreeListType eType = UNDEFINED);
virtual ~ScPivotLayoutTreeListBase() override;
virtual void dispose() override;
virtual bool NotifyAcceptDrop(SvTreeListEntry* pEntry) override;
virtual TriState NotifyMoving(SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos) override;
virtual TriState NotifyCopying(SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos) override;
virtual DragDropMode NotifyStartDrag(TransferDataContainer& aTransferDataContainer,
SvTreeListEntry* pEntry) override;
virtual void DragFinished(sal_Int8 nDropAction) override;
virtual void GetFocus() override;
virtual void LoseFocus() override;
ScPivotLayoutTreeListBase(std::unique_ptr<weld::TreeView> xControl, SvPivotTreeListType eType = UNDEFINED);
weld::TreeView& get_widget() { return *mxControl; }
virtual ~ScPivotLayoutTreeListBase();
void PushEntriesToPivotFieldVector(ScPivotFieldVector& rVector);
void RemoveEntryForItem(const ScItemValue* pItemValue);
bool HasEntry(const SvTreeListEntry* pEntry);
bool HasEntry(const weld::TreeIter& rEntry);
protected:
virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget);
virtual void InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/PivotLayoutTreeListData.hxx b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
index 0f2847c..c9f9dce4 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListData.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
@@ -12,27 +12,29 @@
#define INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTTREELISTDATA_HXX
#include "PivotLayoutTreeListBase.hxx"
#include <tools/solar.h>
#include <vector>
#include <memory>
class ScPivotLayoutTreeListData final : public ScPivotLayoutTreeListBase
{
private:
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
DECL_LINK(DoubleClickHdl, weld::TreeView&, void);
public:
ScPivotLayoutTreeListData(vcl::Window* pParent, WinBits nBits);
ScPivotLayoutTreeListData(std::unique_ptr<weld::TreeView> xControl);
virtual ~ScPivotLayoutTreeListData() override;
virtual bool DoubleClickHdl() override;
void FillDataField(ScPivotFieldVector& rDataFields);
void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames);
virtual void InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget) override;
private:
virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) override;
void InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition);
void InsertEntryForItem(ScItemValue* pItemValue, int nPosition);
void AdjustDuplicateCount(ScItemValue* pInputItemValue);
virtual void KeyInput(const KeyEvent& rKeyEvent) override;
std::vector<std::unique_ptr<ScItemValue> > maDataItemValues;
};
diff --git a/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx b/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
index 9934dac..ac2ccc0 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
@@ -21,16 +21,14 @@ private:
std::vector<std::unique_ptr<ScItemValue> > maItemValues;
SCCOL maDataItem;
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
public:
ScPivotLayoutTreeListLabel(vcl::Window* pParent, WinBits nBits);
ScPivotLayoutTreeListLabel(std::unique_ptr<weld::TreeView> xControl);
virtual ~ScPivotLayoutTreeListLabel() override;
void FillLabelFields(ScDPLabelDataVector& rLabelVector);
ScItemValue* GetItem(SCCOL nColumn);
bool IsDataElement(SCCOL nColumn);
protected:
virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) override;
virtual void KeyInput(const KeyEvent& rKeyEvent) override;
virtual void InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx
index 2193043..19b1d49 100644
--- a/sc/source/ui/inc/pvfundlg.hxx
+++ b/sc/source/ui/inc/pvfundlg.hxx
@@ -54,7 +54,7 @@ class ScDPFunctionDlg : public weld::GenericDialogController
{
typedef std::unordered_map< OUString, OUString > NameMapType;
public:
explicit ScDPFunctionDlg(weld::Window* pParent, const ScDPLabelDataVector& rLabelVec,
explicit ScDPFunctionDlg(weld::Widget* pParent, const ScDPLabelDataVector& rLabelVec,
const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
virtual ~ScDPFunctionDlg() override;
PivotFunc GetFuncMask() const;
@@ -92,7 +92,7 @@ private:
class ScDPSubtotalDlg : public weld::GenericDialogController
{
public:
explicit ScDPSubtotalDlg(weld::Window* pParent, ScDPObject& rDPObj,
explicit ScDPSubtotalDlg(weld::Widget* pParent, ScDPObject& rDPObj,
const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData,
const ScDPNameVec& rDataFields, bool bEnableLayout);
virtual ~ScDPSubtotalDlg() override;
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index fd4e479..8a389b5 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -33,11 +33,11 @@
#include <validate.hxx>
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
SFX_IMPL_MODELESSDIALOG_WITHID(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScFilterDlgWrapper, SID_FILTER )
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER )
@@ -131,7 +131,7 @@ IMPL_CONTROLLER_CHILD_CTOR( ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
IMPL_CONTROLLER_CHILD_CTOR( ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
IMPL_CHILD_CTOR( ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
IMPL_CONTROLLER_CHILD_CTOR( ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
IMPL_CONTROLLER_CHILD_CTOR( ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 9c7691a..a5a04d9 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -140,25 +140,8 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
if(pCW)
pCW->SetHideNotDelete(true);
ScDocument* pDoc = GetViewData().GetDocument();
switch( nSlotId )
{
case SID_OPENDLG_PIVOTTABLE:
{
// all settings must be in pDialogDPObject
if( pDialogDPObject )
{
// Check for an existing datapilot output.
ScViewData& rViewData = GetViewData();
rViewData.SetRefTabNo( rViewData.GetTabNo() );
ScDPObject* pObj = pDoc->GetDPAtCursor(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo());
pResult = VclPtr<ScPivotLayoutDialog>::Create(pB, pCW, pParent, &rViewData, pDialogDPObject.get(), pObj == nullptr);
}
}
break;
case SID_OPENDLG_FUNCTION:
{
// dialog checks, what is in the cell
@@ -477,6 +460,21 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
xResult.reset(new ScXMLSourceDlg(pB, pCW, pParent, pDoc));
break;
}
case SID_OPENDLG_PIVOTTABLE:
{
// all settings must be in pDialogDPObject
if( pDialogDPObject )
{
// Check for an existing datapilot output.
ScViewData& rViewData = GetViewData();
rViewData.SetRefTabNo( rViewData.GetTabNo() );
ScDPObject* pObj = pDoc->GetDPAtCursor(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo());
xResult.reset(new ScPivotLayoutDialog(pB, pCW, pParent, &rViewData, pDialogDPObject.get(), pObj == nullptr));
}
break;
}
}
if (xResult)
diff --git a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
index cf96bea..1380840 100644
--- a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
+++ b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
@@ -1,13 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkTreeStore" id="liststore1">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkTreeStore" id="liststore2">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkTreeStore" id="liststore3">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkTreeStore" id="liststore4">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkTreeStore" id="liststore5">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="PivotTableLayout">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="pivottablelayoutdialog|PivotTableLayout">Pivot Table Layout</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -22,6 +66,7 @@
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
@@ -81,6 +126,7 @@
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="spacing">6</property>
@@ -104,12 +150,12 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">4</property>
<property name="label" translatable="yes" context="pivottablelayoutdialog|label3">Column Fields:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">listbox-column</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -121,15 +167,40 @@
</packing>
</child>
<child>
<object class="sclo-ScPivotLayoutTreeList" id="listbox-column">
<object class="GtkScrolledWindow">
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Pivot Table List-selection"/>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="listbox-column">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="reorderable">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore3</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Pivot Table List-selection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<child>
<object class="GtkCellRendererText" id="cellrenderertext3"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
@@ -156,12 +227,12 @@
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">4</property>
<property name="label" translatable="yes" context="pivottablelayoutdialog|label5">Data Fields:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">listbox-data</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -173,15 +244,40 @@
</packing>
</child>
<child>
<object class="sclo-ScPivotLayoutTreeListData" id="listbox-data">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="width_request">240</property>
<property name="height_request">120</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Pivot Table Data List-selection"/>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="listbox-data">
<property name="visible">True</property>
<property name="reorderable">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore4</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Pivot Table Data List-selection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn4">
<child>
<object class="GtkCellRendererText" id="cellrenderertext4"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
@@ -208,12 +304,12 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">4</property>
<property name="label" translatable="yes" context="pivottablelayoutdialog|label4">Row Fields:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">listbox-row</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -225,14 +321,38 @@
</packing>
</child>
<child>
<object class="sclo-ScPivotLayoutTreeList" id="listbox-row">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="width_request">180</property>
<property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Pivot Table List-selection4"/>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="listbox-row">
<property name="visible">True</property>
<property name="reorderable">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="model">liststore5</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Pivot Table List-selection4"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn5">
<child>
<object class="GtkCellRendererText" id="cellrenderertext5"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
@@ -259,12 +379,12 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">4</property>
<property name="label" translatable="yes" context="pivottablelayoutdialog|label2">Page Fields:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">listbox-page</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -276,15 +396,40 @@
</packing>
</child>
<child>
<object class="sclo-ScPivotLayoutTreeList" id="listbox-page">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="width_request">200</property>
<property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Pivot Table List-selection5"/>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="listbox-page">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="reorderable">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore1</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Pivot Table List-selection5"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
@@ -305,7 +450,7 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
@@ -321,11 +466,11 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">4</property>
<property name="label" translatable="yes" context="pivottablelayoutdialog|label1">Available Fields:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">listbox-fields</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -337,15 +482,40 @@
</packing>
</child>
<child>
<object class="sclo-ScPivotLayoutTreeListLabel" id="listbox-fields">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="width_request">180</property>
<property name="height_request">150</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Pivot Table Label List-selection"/>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="listbox-fields">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="reorderable">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore2</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Pivot Table Label List-selection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
@@ -363,7 +533,7 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
@@ -402,8 +572,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
@@ -418,8 +588,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
@@ -434,8 +604,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
@@ -450,8 +620,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
@@ -466,8 +636,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
@@ -482,8 +652,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
@@ -555,8 +725,8 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">destination-radio-named-range</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -581,7 +751,7 @@
</packing>
</child>
<child>
<object class="foruilo-RefEdit" id="destination-edit">
<object class="GtkEntry" id="destination-edit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
@@ -592,7 +762,7 @@
</packing>
</child>
<child>
<object class="foruilo-RefButton" id="destination-button">
<object class="GtkButton" id="destination-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -603,7 +773,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="destination-list">
<object class="GtkComboBoxText" id="destination-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@@ -622,7 +792,7 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">destination-radio-selection</property>
<property name="group">destination-radio-new-sheet</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -679,8 +849,8 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">source-radio-named-range</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -688,7 +858,7 @@
</packing>
</child>
<child>
<object class="foruilo-RefEdit" id="source-edit">
<object class="GtkEntry" id="source-edit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
@@ -699,7 +869,7 @@
</packing>
</child>
<child>
<object class="foruilo-RefButton" id="source-button">
<object class="GtkButton" id="source-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -726,7 +896,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="source-list">
<object class="GtkComboBoxText" id="source-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@@ -777,7 +947,7 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 2b76b9c..5dc2067 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -475,6 +475,8 @@ void SfxModelessDialogController::EndDialog()
{
m_xImpl->bClosing = true;
SfxDialogController::EndDialog();
if (!m_xImpl)
return;
m_xImpl->bClosing = false;
}
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index bf4fc82..2ae3397 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -471,9 +471,6 @@ custom_widgets = [
'ScCsvTableBox',
'ScDataTableView',
'ScDoubleField',
'ScPivotLayoutTreeList',
'ScPivotLayoutTreeListData',
'ScPivotLayoutTreeListLabel',
'SdPageObjsTLB',
'SearchBox',
'SearchResultsBox',
diff --git a/solenv/sanitizers/ui/modules/scalc.false b/solenv/sanitizers/ui/modules/scalc.false
index 1b76ef5..a49d5f2 100644
--- a/solenv/sanitizers/ui/modules/scalc.false
+++ b/solenv/sanitizers/ui/modules/scalc.false
@@ -29,6 +29,8 @@ sc/uiconfig/scalc/ui/movingaveragedialog.ui://GtkButton[@id='output-range-button
sc/uiconfig/scalc/ui/multipleoperationsdialog.ui://GtkButton[@id='formulasref'] button-no-label
sc/uiconfig/scalc/ui/multipleoperationsdialog.ui://GtkButton[@id='rowref'] button-no-label
sc/uiconfig/scalc/ui/multipleoperationsdialog.ui://GtkButton[@id='colref'] button-no-label
sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui://GtkButton[@id='destination-button'] button-no-label
sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui://GtkButton[@id='source-button'] button-no-label
sc/uiconfig/scalc/ui/printareasdialog.ui://GtkButton[@id='rbprintarea'] button-no-label
sc/uiconfig/scalc/ui/printareasdialog.ui://GtkButton[@id='rbrepeatrow'] button-no-label
sc/uiconfig/scalc/ui/printareasdialog.ui://GtkButton[@id='rbrepeatcol'] button-no-label
diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr
index 37dbd67..4c56bf4 100644
--- a/solenv/sanitizers/ui/modules/scalc.suppr
+++ b/solenv/sanitizers/ui/modules/scalc.suppr
@@ -148,8 +148,8 @@ sc/uiconfig/scalc/ui/pivotfilterdialog.ui://GtkComboBoxText[@id='val3'] missing-
sc/uiconfig/scalc/ui/pivotfilterdialog.ui://GtkLabel[@id='dbarealabel'] orphan-label
sc/uiconfig/scalc/ui/pivotfilterdialog.ui://GtkLabel[@id='dbarea'] orphan-label
sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui://GtkLabel[@id='label6'] orphan-label
sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui://foruilo-RefEdit[@id='destination-edit'] no-labelled-by
sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui://foruilo-RefEdit[@id='source-edit'] no-labelled-by
sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui://GtkEntry[@id='destination-edit'] no-labelled-by
sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui://GtkEntry[@id='source-edit'] no-labelled-by
sc/uiconfig/scalc/ui/printareasdialog.ui://GtkEntry[@id='edprintarea'] no-labelled-by
sc/uiconfig/scalc/ui/printareasdialog.ui://GtkEntry[@id='edrepeatrow'] no-labelled-by
sc/uiconfig/scalc/ui/printareasdialog.ui://GtkEntry[@id='edrepeatcol'] no-labelled-by
diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx
index 2ccb886..7db5912 100644
--- a/sw/source/ui/fldui/fldfunc.cxx
+++ b/sw/source/ui/fldui/fldfunc.cxx
@@ -70,7 +70,8 @@ SwFieldFuncPage::SwFieldFuncPage(TabPageParent pParent, const SfxItemSet *const
{
FillFieldSelect(*m_xSelectionLB);
FillFieldSelect(*m_xFormatLB);
m_xListItemsLB->set_size_request(m_xListItemED->get_preferred_size().Width(), -1);
m_xListItemsLB->set_size_request(m_xListItemED->get_preferred_size().Width(),
m_xListItemsLB->get_height_rows(5));
auto nWidth = m_xTypeLB->get_approximate_digit_width() * FIELD_COLUMN_WIDTH / 8;
auto nHeight = m_xTypeLB->get_height_rows(20);
diff --git a/vcl/inc/treeglue.hxx b/vcl/inc/treeglue.hxx
index a314c70..15b95c0 100644
--- a/vcl/inc/treeglue.hxx
+++ b/vcl/inc/treeglue.hxx
@@ -7,6 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <vcl/svimpbox.hxx>
#include <vcl/svtabbx.hxx>
//the default NotifyStartDrag is weird to me, and defaults to enabling all
@@ -31,6 +32,8 @@ public:
class LclTabListBox : public SvTabListBox
{
Link<SvTreeListBox*, void> m_aModelChangedHdl;
Link<SvTreeListBox*, void> m_aStartDragHdl;
Link<SvTreeListBox*, void> m_aEndDragHdl;
public:
LclTabListBox(vcl::Window* pParent, WinBits nWinStyle)
@@ -39,12 +42,26 @@ public:
}
void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; }
void SetStartDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aStartDragHdl = rLink; }
void SetEndDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aEndDragHdl = rLink; }
virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override
{
return GetDragDropMode();
}
virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override
{
m_aStartDragHdl.Call(this);
SvTabListBox::StartDrag(nAction, rPosPixel);
}
virtual void DragFinished(sal_Int8 nDropAction) override
{
m_aEndDragHdl.Call(this);
SvTabListBox::DragFinished(nDropAction);
}
virtual void ModelHasCleared() override
{
SvTabListBox::ModelHasCleared();
@@ -74,6 +91,29 @@ public:
SvTabListBox::ModelHasRemoved(pEntry);
m_aModelChangedHdl.Call(this);
}
virtual SvTreeListEntry* GetDropTarget(const Point& rPos) override
{
pTargetEntry = pImpl->GetEntry(rPos);
// scroll
if (rPos.Y() < 12)
{
ImplShowTargetEmphasis(pTargetEntry, false);
ScrollOutputArea(+1);
}
else
{
Size aSize(pImpl->GetOutputSize());
if (rPos.Y() > aSize.Height() - 12)
{
ImplShowTargetEmphasis(pTargetEntry, false);
ScrollOutputArea(-1);
}
}
return pTargetEntry;
}
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 74882ef..8e0e53b 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -244,6 +244,7 @@ public:
int mnChildEventListenersIteratingCount;
std::set<Link<VclWindowEvent&,void>> maChildEventListenersDeleted;
Link<vcl::Window&, bool> maHelpRequestHdl;
Link<vcl::Window&, bool> maMnemonicActivateHdl;
// The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
css::uno::WeakReference< css::rendering::XCanvas > mxCanvas;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 6babd54..72011c1 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -245,6 +245,7 @@ protected:
private:
DECL_LINK(EventListener, VclWindowEvent&, void);
DECL_LINK(KeyEventListener, VclWindowEvent&, bool);
DECL_LINK(MnemonicActivateHdl, vcl::Window&, bool);
const bool m_bTakeOwnership;
bool m_bEventListener;
@@ -508,6 +509,12 @@ public:
weld::Widget::connect_focus_in(rLink);
}
virtual void connect_mnemonic_activate(const Link<Widget&, bool>& rLink) override
{
m_xWidget->SetMnemonicActivateHdl(LINK(this, SalInstanceWidget, MnemonicActivateHdl));
weld::Widget::connect_mnemonic_activate(rLink);
}
virtual void connect_focus_out(const Link<Widget&, void>& rLink) override
{
ensure_event_listener();
@@ -599,6 +606,8 @@ public:
virtual ~SalInstanceWidget() override
{
if (m_aMnemonicActivateHdl.IsSet())
m_xWidget->SetMnemonicActivateHdl(Link<vcl::Window&,bool>());
if (m_bKeyEventListener)
Application::RemoveKeyListener(LINK(this, SalInstanceWidget, KeyEventListener));
if (m_bEventListener)
@@ -704,6 +713,11 @@ IMPL_LINK(SalInstanceWidget, KeyEventListener, VclWindowEvent&, rEvent, bool)
return HandleKeyEventListener(rEvent);
}
IMPL_LINK_NOARG(SalInstanceWidget, MnemonicActivateHdl, vcl::Window&, bool)
{
return m_aMnemonicActivateHdl.Call(*this);
}
namespace
{
Image createImage(const OUString& rImage)
@@ -2431,6 +2445,10 @@ namespace
}
}
class SalInstanceTreeView;
static SalInstanceTreeView* g_DragSource;
class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::TreeView
{
private:
@@ -2450,6 +2468,8 @@ private:
DECL_LINK(HeaderBarClickedHdl, HeaderBar*, void);
DECL_LINK(ToggleHdl, SvLBoxButtonData*, void);
DECL_LINK(ModelChangedHdl, SvTreeListBox*, void);
DECL_LINK(StartDragHdl, SvTreeListBox*, void);
DECL_STATIC_LINK(SalInstanceTreeView, FinishDragHdl, SvTreeListBox*, void);
DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void);
DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
@@ -2486,6 +2506,8 @@ public:
else
{
static_cast<LclTabListBox&>(*m_xTreeView).SetModelChangedHdl(LINK(this, SalInstanceTreeView, ModelChangedHdl));
static_cast<LclTabListBox&>(*m_xTreeView).SetStartDragHdl(LINK(this, SalInstanceTreeView, StartDragHdl));
static_cast<LclTabListBox&>(*m_xTreeView).SetEndDragHdl(LINK(this, SalInstanceTreeView, FinishDragHdl));
}
m_aCheckButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
m_aRadioButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
@@ -2706,6 +2728,14 @@ public:
enable_notify_events();
}
virtual int get_cursor_index() const override
{
SvTreeListEntry* pEntry = m_xTreeView->GetCurEntry();
if (!pEntry)
return -1;
return SvTreeList::GetRelPos(pEntry);
}
virtual void set_cursor(int pos) override
{
if (pos == -1)
@@ -3425,6 +3455,24 @@ public:
return *m_xTreeView;
}
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter* pResult) override
{
SvTreeListEntry* pTarget = m_xTreeView->GetDropTarget(rPos);
if (pTarget && pResult)
{
SalInstanceTreeIter& rSalIter = static_cast<SalInstanceTreeIter&>(*pResult);
rSalIter.iter = pTarget;
}
return pTarget != nullptr;
}
virtual TreeView* get_drag_source() const override
{
return g_DragSource;
}
virtual ~SalInstanceTreeView() override
{
LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
@@ -3438,6 +3486,8 @@ public:
}
else
{
static_cast<LclTabListBox&>(*m_xTreeView).SetEndDragHdl(Link<SvTreeListBox*, void>());
static_cast<LclTabListBox&>(*m_xTreeView).SetStartDragHdl(Link<SvTreeListBox*, void>());
static_cast<LclTabListBox&>(*m_xTreeView).SetModelChangedHdl(Link<SvTreeListBox*, void>());
}
m_xTreeView->SetPopupMenuHdl(Link<const CommandEvent&, bool>());
@@ -3506,6 +3556,16 @@ IMPL_LINK_NOARG(SalInstanceTreeView, ModelChangedHdl, SvTreeListBox*, void)
signal_model_changed();
}
IMPL_LINK_NOARG(SalInstanceTreeView, StartDragHdl, SvTreeListBox*, void)
{
g_DragSource = this;
}
IMPL_STATIC_LINK_NOARG(SalInstanceTreeView, FinishDragHdl, SvTreeListBox*, void)
{
g_DragSource = nullptr;
}
IMPL_LINK(SalInstanceTreeView, ToggleHdl, SvLBoxButtonData*, pData, void)
{
SvTreeListEntry* pEntry = pData->GetActEntry();
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index d6e7391..4394513 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -506,10 +506,21 @@ vcl::Window* ImplFindAccelWindow( vcl::Window* pParent, sal_uInt16& rIndex, sal_
namespace vcl {
void Window::SetMnemonicActivateHdl(const Link<vcl::Window&, bool>& rLink)
{
if (mpWindowImpl) // may be called after dispose
{
mpWindowImpl->maMnemonicActivateHdl = rLink;
}
}
void Window::ImplControlFocus( GetFocusFlags nFlags )
{
if ( nFlags & GetFocusFlags::Mnemonic )
{
if (mpWindowImpl->maMnemonicActivateHdl.Call(*this))
return;
if ( GetType() == WindowType::RADIOBUTTON )
{
if ( !static_cast<RadioButton*>(this)->IsChecked() )
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 1893335..5850616 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1269,6 +1269,18 @@ protected:
m_aFocusInHdl.Call(*this);
}
static gboolean signalMnemonicActivate(GtkWidget*, gboolean, gpointer widget)
{
GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
SolarMutexGuard aGuard;
return pThis->signal_mnemonic_activate();
}
bool signal_mnemonic_activate()
{
return m_aMnemonicActivateHdl.Call(*this);
}
static gboolean signalFocusOut(GtkWidget*, GdkEvent*, gpointer widget)
{
GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
@@ -1304,6 +1316,7 @@ private:
bool m_bFrozen;
sal_uInt16 m_nLastMouseButton;
gulong m_nFocusInSignalId;
gulong m_nMnemonicActivateSignalId;
gulong m_nFocusOutSignalId;
gulong m_nKeyPressSignalId;
gulong m_nKeyReleaseSignalId;
@@ -1484,6 +1497,7 @@ public:
, m_bFrozen(false)
, m_nLastMouseButton(0)
, m_nFocusInSignalId(0)
, m_nMnemonicActivateSignalId(0)
, m_nFocusOutSignalId(0)
, m_nKeyPressSignalId(0)
, m_nKeyReleaseSignalId(0)
@@ -1865,6 +1879,12 @@ public:
weld::Widget::connect_focus_in(rLink);
}
virtual void connect_mnemonic_activate(const Link<Widget&, bool>& rLink) override
{
m_nMnemonicActivateSignalId = g_signal_connect(m_pWidget, "mnemonic-activate", G_CALLBACK(signalMnemonicActivate), this);
weld::Widget::connect_mnemonic_activate(rLink);
}
virtual void connect_focus_out(const Link<Widget&, void>& rLink) override
{
m_nFocusOutSignalId = g_signal_connect(m_pWidget, "focus-out-event", G_CALLBACK(signalFocusOut), this);
@@ -1971,6 +1991,8 @@ public:
g_signal_handler_disconnect(m_pWidget, m_nButtonReleaseSignalId);
if (m_nFocusInSignalId)
g_signal_handler_disconnect(m_pWidget, m_nFocusInSignalId);
if (m_nMnemonicActivateSignalId)
g_signal_handler_disconnect(m_pWidget, m_nMnemonicActivateSignalId);
if (m_nFocusOutSignalId)
g_signal_handler_disconnect(m_pWidget, m_nFocusOutSignalId);
if (m_nSizeAllocateSignalId)
@@ -1983,6 +2005,8 @@ public:
{
if (m_nFocusInSignalId)
g_signal_handler_block(m_pWidget, m_nFocusInSignalId);
if (m_nMnemonicActivateSignalId)
g_signal_handler_block(m_pWidget, m_nMnemonicActivateSignalId);
if (m_nFocusOutSignalId)
g_signal_handler_block(m_pWidget, m_nFocusOutSignalId);
if (m_nSizeAllocateSignalId)
@@ -1995,6 +2019,8 @@ public:
g_signal_handler_unblock(m_pWidget, m_nSizeAllocateSignalId);
if (m_nFocusOutSignalId)
g_signal_handler_unblock(m_pWidget, m_nFocusOutSignalId);
if (m_nMnemonicActivateSignalId)
g_signal_handler_unblock(m_pWidget, m_nMnemonicActivateSignalId);
if (m_nFocusInSignalId)
g_signal_handler_unblock(m_pWidget, m_nFocusInSignalId);
}
@@ -5854,6 +5880,10 @@ struct GtkInstanceTreeIter : public weld::TreeIter
GtkTreeIter iter;
};
class GtkInstanceTreeView;
static GtkInstanceTreeView* g_DragSource;
class GtkInstanceTreeView : public GtkInstanceContainer, public virtual weld::TreeView
{
private:
@@ -5882,7 +5912,9 @@ private:
gulong m_nVAdjustmentChangedSignalId;
gulong m_nRowDeletedSignalId;
gulong m_nRowInsertedSignalId;
gulong m_nPopupMenu;
gulong m_nPopupMenuSignalId;
gulong m_nDragBeginSignalId;
gulong m_nDragEndSignalId;
DECL_LINK(async_signal_changed, void*, void);
@@ -6168,6 +6200,17 @@ private:
return default_sort_func(pModel, a, b, m_xSorter.get());
}
static void signalDragBegin(GtkWidget*, GdkDragContext*, gpointer widget)
{
GtkInstanceTreeView* pThis = static_cast<GtkInstanceTreeView*>(widget);
g_DragSource = pThis;
}
static void signalDragEnd(GtkWidget*, GdkDragContext*, gpointer)
{
g_DragSource = nullptr;
}
public:
GtkInstanceTreeView(GtkTreeView* pTreeView, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
: GtkInstanceContainer(GTK_CONTAINER(pTreeView), pBuilder, bTakeOwnership)
@@ -6181,7 +6224,9 @@ public:
, m_nRowActivatedSignalId(g_signal_connect(pTreeView, "row-activated", G_CALLBACK(signalRowActivated), this))
, m_nTestExpandRowSignalId(g_signal_connect(pTreeView, "test-expand-row", G_CALLBACK(signalTestExpandRow), this))
, m_nVAdjustmentChangedSignalId(0)
, m_nPopupMenu(g_signal_connect(pTreeView, "popup-menu", G_CALLBACK(signalPopupMenu), this))
, m_nPopupMenuSignalId(g_signal_connect(pTreeView, "popup-menu", G_CALLBACK(signalPopupMenu), this))
, m_nDragBeginSignalId(g_signal_connect(pTreeView, "drag-begin", G_CALLBACK(signalDragBegin), this))
, m_nDragEndSignalId(g_signal_connect(pTreeView, "drag-end", G_CALLBACK(signalDragEnd), this))
{
m_pColumns = gtk_tree_view_get_columns(m_pTreeView);
int nIndex(0);
@@ -6962,6 +7007,23 @@ public:
return path != nullptr;
}
virtual int get_cursor_index() const override
{
int nRet = -1;
GtkTreePath* path;
gtk_tree_view_get_cursor(m_pTreeView, &path, nullptr);
if (path)
{
gint depth;
gint* indices = gtk_tree_path_get_indices_with_depth(path, &depth);
nRet = indices[depth-1];
gtk_tree_path_free(path);
}
return nRet;
}
virtual void set_cursor(const weld::TreeIter& rIter) override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
@@ -7309,9 +7371,100 @@ public:
weld::TreeView::connect_popup_menu(rLink);
}
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter* pResult) override
{
// to keep it simple we'll default to always drop before the current row
// except for the special edge cases
GtkTreeViewDropPosition pos = GTK_TREE_VIEW_DROP_BEFORE;
// unhighlight current highlighted row
gtk_tree_view_set_drag_dest_row(m_pTreeView, nullptr, pos);
GtkTreePath *path = nullptr;
GtkTreeViewDropPosition gtkpos = GTK_TREE_VIEW_DROP_BEFORE;
bool ret = gtk_tree_view_get_dest_row_at_pos(m_pTreeView, rPos.X(), rPos.Y(),
&path, >kpos);
// find the last entry in the model for comparison
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
int nChildren = gtk_tree_model_iter_n_children(pModel, nullptr);
GtkTreePath *lastpath;
if (nChildren)
lastpath = gtk_tree_path_new_from_indices(nChildren - 1, -1);
else
lastpath = gtk_tree_path_new_from_indices(0, -1);
if (!ret)
{
// empty space, draw an indicator at the last entry
assert(!path);
path = gtk_tree_path_copy(lastpath);
pos = GTK_TREE_VIEW_DROP_AFTER;
}
else if (gtk_tree_path_compare(path, lastpath) == 0)
{
// if we're on the last entry, see if gtk thinks
// the drop should be before or after it, and if
// its after, treat it like a drop into empty
// space, i.e. append it
if (gtkpos == GTK_TREE_VIEW_DROP_AFTER ||
gtkpos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
{
ret = false;
pos = gtkpos;
}
}
if (ret && pResult)
{
GtkInstanceTreeIter& rGtkIter = static_cast<GtkInstanceTreeIter&>(*pResult);
gtk_tree_model_get_iter(pModel, &rGtkIter.iter, path);
}
// highlight the row
gtk_tree_view_set_drag_dest_row(m_pTreeView, path, pos);
assert(path);
gtk_tree_path_free(path);
gtk_tree_path_free(lastpath);
// auto scroll if we're close to the edges
GtkAdjustment* pVAdjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(m_pTreeView));
double fStep = gtk_adjustment_get_step_increment(pVAdjustment);
if (rPos.Y() < fStep)
{
double fValue = gtk_adjustment_get_value(pVAdjustment) - fStep;
if (fValue < 0)
fValue = 0.0;
gtk_adjustment_set_value(pVAdjustment, fValue);
}
else
{
GdkRectangle aRect;
gtk_tree_view_get_visible_rect(m_pTreeView, &aRect);
if (rPos.Y() > aRect.height - fStep)
{
double fValue = gtk_adjustment_get_value(pVAdjustment) + fStep;
double fMax = gtk_adjustment_get_upper(pVAdjustment);
if (fValue > fMax)
fValue = fMax;
gtk_adjustment_set_value(pVAdjustment, fValue);
}
}
return ret;
}
virtual TreeView* get_drag_source() const override
{
return g_DragSource;
}
virtual ~GtkInstanceTreeView() override
{
g_signal_handler_disconnect(m_pTreeView, m_nPopupMenu);
g_signal_handler_disconnect(m_pTreeView, m_nDragEndSignalId);
g_signal_handler_disconnect(m_pTreeView, m_nDragBeginSignalId);
g_signal_handler_disconnect(m_pTreeView, m_nPopupMenuSignalId);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
g_signal_handler_disconnect(pModel, m_nRowDeletedSignalId);
g_signal_handler_disconnect(pModel, m_nRowInsertedSignalId);