diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-02 09:07:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-02 08:56:31 +0000 |
commit | 4547cc9428649af54480d4471154bd44c8480f5c (patch) | |
tree | b5cdc2c7ef0017504cd8d85149b2bfe7bf3b2942 /sfx2 | |
parent | 31a503a0a10aea0489ac2ebe5abd745f37e6402b (diff) |
no need to allocate TargetsTable separately
Change-Id: Ifc16a5c7137776c8375d83afb031999023a7424a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148083
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/autoredactdialog.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/autoredactdialog.cxx | 32 |
2 files changed, 17 insertions, 17 deletions
diff --git a/sfx2/inc/autoredactdialog.hxx b/sfx2/inc/autoredactdialog.hxx index 540494c932ea..52a03cfd8a8f 100644 --- a/sfx2/inc/autoredactdialog.hxx +++ b/sfx2/inc/autoredactdialog.hxx @@ -102,7 +102,7 @@ class SfxAutoRedactDialog final : public SfxDialogController bool m_bIsValidState; bool m_bTargetsCopied; - std::unique_ptr<TargetsTable> m_xTargetsBox; + TargetsTable m_aTargetsBox; std::unique_ptr<weld::Button> m_xLoadBtn; std::unique_ptr<weld::Button> m_xSaveBtn; std::unique_ptr<weld::Button> m_xAddBtn; diff --git a/sfx2/source/doc/autoredactdialog.cxx b/sfx2/source/doc/autoredactdialog.cxx index 4831ac46d74f..6e438a90bd1b 100644 --- a/sfx2/source/doc/autoredactdialog.cxx +++ b/sfx2/source/doc/autoredactdialog.cxx @@ -196,7 +196,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, Save, weld::Button&, void) IMPL_LINK_NOARG(SfxAutoRedactDialog, AddHdl, weld::Button&, void) { // Open the Add Target dialog, create a new target and insert into the targets vector and the listbox - SfxAddTargetDialog aAddTargetDialog(getDialog(), m_xTargetsBox->GetNameProposal()); + SfxAddTargetDialog aAddTargetDialog(getDialog(), m_aTargetsBox.GetNameProposal()); bool bIncomplete; do @@ -216,7 +216,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, AddHdl, weld::Button&, void) SfxResId(STR_REDACTION_FIELDS_REQUIRED))); xBox->run(); } - else if (m_xTargetsBox->GetTargetByName(aAddTargetDialog.getName())) + else if (m_aTargetsBox.GetTargetByName(aAddTargetDialog.getName())) { bIncomplete = true; std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog( @@ -233,10 +233,10 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, AddHdl, weld::Button&, void) aAddTargetDialog.isCaseSensitive(), aAddTargetDialog.isWholeWords(), 0 }); // Only the visual/display part - m_xTargetsBox->InsertTarget(redactiontarget); + m_aTargetsBox.InsertTarget(redactiontarget); // Actually add to the targets vector - if (m_xTargetsBox->GetTargetByName(redactiontarget->sName)) + if (m_aTargetsBox.GetTargetByName(redactiontarget->sName)) m_aTableTargets.emplace_back(redactiontarget, redactiontarget->sName); else { @@ -250,14 +250,14 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, AddHdl, weld::Button&, void) IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, weld::Button&, void) { - sal_Int32 nSelectedRow = m_xTargetsBox->get_selected_index(); + sal_Int32 nSelectedRow = m_aTargetsBox.get_selected_index(); // No selection, nothing to edit if (nSelectedRow < 0) return; // Only one entry should be selected for editing - if (m_xTargetsBox->get_selected_rows().size() > 1) + if (m_aTargetsBox.get_selected_rows().size() > 1) { //Warn the user about multiple selections std::unique_ptr<weld::MessageDialog> xBox( @@ -268,7 +268,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, weld::Button&, void) } // Get the redaction target to be edited - RedactionTarget* pTarget = weld::fromId<RedactionTarget*>(m_xTargetsBox->get_id(nSelectedRow)); + RedactionTarget* pTarget = weld::fromId<RedactionTarget*>(m_aTargetsBox.get_id(nSelectedRow)); // Construct and run the edit target dialog SfxAddTargetDialog aEditTargetDialog(getDialog(), pTarget->sName, pTarget->sType, @@ -294,7 +294,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, weld::Button&, void) xBox->run(); } else if (aEditTargetDialog.getName() != pTarget->sName - && m_xTargetsBox->GetTargetByName(aEditTargetDialog.getName())) + && m_aTargetsBox.GetTargetByName(aEditTargetDialog.getName())) { bIncomplete = true; std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog( @@ -313,7 +313,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, weld::Button&, void) pTarget->bWholeWords = aEditTargetDialog.isWholeWords(); // And sync the targets box row with the actual target data - m_xTargetsBox->setRowData(nSelectedRow, pTarget); + m_aTargetsBox.setRowData(nSelectedRow, pTarget); } IMPL_LINK_NOARG(SfxAutoRedactDialog, DoubleClickEditHdl, weld::TreeView&, bool) { @@ -323,7 +323,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, DoubleClickEditHdl, weld::TreeView&, bool) } IMPL_LINK_NOARG(SfxAutoRedactDialog, DeleteHdl, weld::Button&, void) { - std::vector<int> aSelectedRows = m_xTargetsBox->get_selected_rows(); + std::vector<int> aSelectedRows = m_aTargetsBox.get_selected_rows(); //No selection, so nothing to delete if (aSelectedRows.empty()) @@ -345,7 +345,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, DeleteHdl, weld::Button&, void) for (const auto& i : aSelectedRows) { m_aTableTargets.erase(m_aTableTargets.begin() + (i - delta)); - m_xTargetsBox->remove(i - delta++); + m_aTargetsBox.remove(i - delta++); } } @@ -497,11 +497,11 @@ void SfxAutoRedactDialog::StartFileDialog(StartFileDialogType nType, const OUStr void SfxAutoRedactDialog::addTarget(std::unique_ptr<RedactionTarget> pTarget) { // Only the visual/display part - m_xTargetsBox->InsertTarget(pTarget.get()); + m_aTargetsBox.InsertTarget(pTarget.get()); // Actually add to the targets vector auto name = pTarget->sName; - if (m_xTargetsBox->GetTargetByName(name)) + if (m_aTargetsBox.GetTargetByName(name)) m_aTableTargets.emplace_back(std::move(pTarget), name); else { @@ -515,7 +515,7 @@ void SfxAutoRedactDialog::addTarget(std::unique_ptr<RedactionTarget> pTarget) void SfxAutoRedactDialog::clearTargets() { // Clear the targets box - m_xTargetsBox->clear(); + m_aTargetsBox.clear(); // Clear the targets vector m_aTableTargets.clear(); @@ -525,7 +525,7 @@ SfxAutoRedactDialog::SfxAutoRedactDialog(weld::Window* pParent) : SfxDialogController(pParent, "sfx/ui/autoredactdialog.ui", "AutoRedactDialog") , m_bIsValidState(true) , m_bTargetsCopied(false) - , m_xTargetsBox(new TargetsTable(m_xBuilder->weld_tree_view("targets"))) + , m_aTargetsBox(m_xBuilder->weld_tree_view("targets")) , m_xLoadBtn(m_xBuilder->weld_button("btnLoadTargets")) , m_xSaveBtn(m_xBuilder->weld_button("btnSaveTargets")) , m_xAddBtn(m_xBuilder->weld_button("add")) @@ -578,7 +578,7 @@ SfxAutoRedactDialog::SfxAutoRedactDialog(weld::Window* pParent) m_xAddBtn->connect_clicked(LINK(this, SfxAutoRedactDialog, AddHdl)); m_xEditBtn->connect_clicked(LINK(this, SfxAutoRedactDialog, EditHdl)); m_xDeleteBtn->connect_clicked(LINK(this, SfxAutoRedactDialog, DeleteHdl)); - m_xTargetsBox->connect_row_activated(LINK(this, SfxAutoRedactDialog, DoubleClickEditHdl)); + m_aTargetsBox.connect_row_activated(LINK(this, SfxAutoRedactDialog, DoubleClickEditHdl)); } SfxAutoRedactDialog::~SfxAutoRedactDialog() |