sw/inc/cmdid.h | 1 - sw/source/ui/chrdlg/chardlg.cxx | 11 +++++------ sw/source/ui/dialog/macassgn.cxx | 8 ++++---- sw/source/uibase/inc/chrdlg.hxx | 5 +++-- sw/source/uibase/inc/macassgn.hxx | 5 +++-- 5 files changed, 15 insertions(+), 15 deletions(-)
New commits: commit ff81f9aff4f67cedf4cb85de9ce763cb7259795e Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Feb 27 20:30:07 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Feb 28 09:29:20 2022 +0100 unwrap data structure in SwCharURLPage we want to work with SvxMacroTableDtor and we are unnecessarily wrapping it in SvxMacroItem. Just use SvxMacroTableDtor directly. And remove FN_INET_FIELD_MACRO which is now unused. Change-Id: I83c0c7b0ecd02b996ddad1a03a0fc0dec6c38c10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130654 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index eb16c528b541..53a0f49c3e54 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -797,7 +797,6 @@ class SwUINumRuleItem; #define FN_PARAM_GRF_REALSIZE TypedWhichId<SvxSizeItem>(FN_PARAM+70) #define FN_PARAM_GRF_DIALOG (FN_PARAM+71) -#define FN_INET_FIELD_MACRO (FN_PARAM+77) /* Id for URL-Field-Macros*/ #define FN_PARAM_PRINTER TypedWhichId<SwPtrItem>(FN_PARAM+78) /* Printer */ #define FN_PARAM_STDFONTS TypedWhichId<SwPtrItem>(FN_PARAM+79) /* ConfigItem Standardfonts */ diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index edd12254dd8b..d4d748fc4dab 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -190,7 +190,6 @@ SwCharURLPage::SwCharURLPage(weld::Container* pPage, weld::DialogController* pCo SwCharURLPage::~SwCharURLPage() { - pINetItem.reset(); } void SwCharURLPage::Reset(const SfxItemSet* rSet) @@ -225,10 +224,10 @@ void SwCharURLPage::Reset(const SfxItemSet* rSet) m_xVisitedLB->save_value(); m_xNotVisitedLB->save_value(); m_xTargetFrameLB->save_value(); - pINetItem.reset( new SvxMacroItem(FN_INET_FIELD_MACRO) ); + m_oINetMacroTable.emplace(); if( pINetFormat->GetMacroTable() ) - pINetItem->SetMacroTable(*pINetFormat->GetMacroTable()); + m_oINetMacroTable = *pINetFormat->GetMacroTable(); } if (SfxItemState::SET == rSet->GetItemState(FN_PARAM_SELECTION, false, &pItem)) { @@ -265,8 +264,8 @@ bool SwCharURLPage::FillItemSet(SfxItemSet* rSet) nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, SwGetPoolIdFromName::ChrFmt); aINetFormat.SetINetFormatAndId( sEntry, nId ); - if (pINetItem && !pINetItem->GetMacroTable().empty()) - aINetFormat.SetMacroTable(&pINetItem->GetMacroTable()); + if (m_oINetMacroTable && !m_oINetMacroTable->empty()) + aINetFormat.SetMacroTable(&*m_oINetMacroTable); if (m_xVisitedLB->get_value_changed_from_saved()) bModified = true; @@ -304,7 +303,7 @@ IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl, weld::Button&, void) IMPL_LINK_NOARG(SwCharURLPage, EventHdl, weld::Button&, void) { bModified |= SwMacroAssignDlg::INetFormatDlg(GetFrameWeld(), - ::GetActiveView()->GetWrtShell(), pINetItem); + ::GetActiveView()->GetWrtShell(), m_oINetMacroTable); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx index 1b4de3da4acb..4e68c8ab8e8e 100644 --- a/sw/source/ui/dialog/macassgn.cxx +++ b/sw/source/ui/dialog/macassgn.cxx @@ -101,15 +101,15 @@ SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType ) } bool SwMacroAssignDlg::INetFormatDlg(weld::Window* pParent, SwWrtShell& rSh, - std::unique_ptr<SvxMacroItem>& rpINetItem ) + std::optional<SvxMacroTableDtor>& rpINetItem ) { bool bRet = false; SfxItemSetFixed<RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG> aSet( rSh.GetAttrPool() ); SvxMacroItem aItem( RES_FRMMACRO ); if( !rpINetItem ) - rpINetItem.reset(new SvxMacroItem( RES_FRMMACRO )); + rpINetItem.emplace(); else - aItem.SetMacroTable( rpINetItem->GetMacroTable() ); + aItem.SetMacroTable( *rpINetItem ); aSet.Put( aItem ); aSet.Put( AddEvents( MACASSGN_INETFMT ) ); @@ -123,7 +123,7 @@ bool SwMacroAssignDlg::INetFormatDlg(weld::Window* pParent, SwWrtShell& rSh, const SfxPoolItem* pItem; if( SfxItemState::SET == pOutSet->GetItemState( RES_FRMMACRO, false, &pItem )) { - rpINetItem->SetMacroTable( static_cast<const SvxMacroItem*>(pItem)->GetMacroTable() ); + *rpINetItem = static_cast<const SvxMacroItem*>(pItem)->GetMacroTable(); bRet = true; } } diff --git a/sw/source/uibase/inc/chrdlg.hxx b/sw/source/uibase/inc/chrdlg.hxx index 8527f15e2693..687d16e0cfd9 100644 --- a/sw/source/uibase/inc/chrdlg.hxx +++ b/sw/source/uibase/inc/chrdlg.hxx @@ -21,9 +21,10 @@ #include <sfx2/tabdlg.hxx> #include "chrdlgmodes.hxx" +#include <svl/macitem.hxx> +#include <optional> class SwView; -class SvxMacroItem; class SwCharDlg final : public SfxTabDialogController { @@ -41,7 +42,7 @@ public: class SwCharURLPage final : public SfxTabPage { - std::unique_ptr<SvxMacroItem> pINetItem; + std::optional<SvxMacroTableDtor> m_oINetMacroTable; bool bModified; std::unique_ptr<weld::Entry> m_xURLED; diff --git a/sw/source/uibase/inc/macassgn.hxx b/sw/source/uibase/inc/macassgn.hxx index afc6fe56c568..4311e91075bd 100644 --- a/sw/source/uibase/inc/macassgn.hxx +++ b/sw/source/uibase/inc/macassgn.hxx @@ -21,9 +21,10 @@ #include <sfx2/evntconf.hxx> #include <vcl/weld.hxx> +#include <svl/macitem.hxx> +#include <optional> class SwWrtShell; -class SvxMacroItem; enum DlgEventType { @@ -40,7 +41,7 @@ class SwMacroAssignDlg public: static SfxEventNamesItem AddEvents(DlgEventType eType); static bool INetFormatDlg(weld::Window* pParent, SwWrtShell& rSh, - std::unique_ptr<SvxMacroItem>& rpINetItem); + std::optional<SvxMacroTableDtor>& rpINetItem); }; #endif