diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-07-27 19:12:45 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-07-28 08:13:40 +0200 |
commit | f5dd4faef6c6ee23bb33a0662087e1892db78b3d (patch) | |
tree | 32848118bd734bfd0d812abb159cf0c38aa953df /sfx2/source/dialog/dinfdlg.cxx | |
parent | 0c45d90cfb1cc60218fbce3743df442b1f1d3f70 (diff) |
SfxMedium::GetItemSet never returns nullptr
Change-Id: Ibfc98a49022aa09ebf5315e5d3328308c1e51d66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154997
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2/source/dialog/dinfdlg.cxx')
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 800f912b2ac9..24c4f509559f 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -775,9 +775,7 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) { if (!pShell) break; - SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet(); - if (!pMedSet) - break; + SfxItemSet& rMedSet = pShell->GetMedium()->GetItemSet(); std::shared_ptr<const SfxFilter> pFilter = pShell->GetMedium()->GetFilter(); if (!pFilter) break; @@ -789,11 +787,11 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) VclAbstractDialogFactory * pFact = VclAbstractDialogFactory::Create(); m_xPasswordDialog = pFact->CreatePasswordToOpenModifyDialog(GetFrameWeld(), maxPwdLen, false); m_xPasswordDialog->AllowEmpty(); // needed to remove password - m_xPasswordDialog->StartExecuteAsync([this, pFilter, pMedSet, pShell](sal_Int32 nResult) + m_xPasswordDialog->StartExecuteAsync([this, pFilter, &rMedSet, pShell](sal_Int32 nResult) { if (nResult == RET_OK) { - sfx2::SetPassword(pFilter, pMedSet, m_xPasswordDialog->GetPasswordToOpen(), + sfx2::SetPassword(pFilter, &rMedSet, m_xPasswordDialog->GetPasswordToOpen(), m_xPasswordDialog->GetPasswordToOpen(), true); tools::JsonWriter payloadJson; payloadJson.put("password", m_xPasswordDialog->GetPasswordToOpen()); @@ -805,7 +803,7 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) m_xPasswordDialog->disposeOnce(); }); } else { - sfx2::RequestPassword(pFilter, OUString(), pMedSet, GetFrameWeld()->GetXWindow()); + sfx2::RequestPassword(pFilter, OUString(), &rMedSet, GetFrameWeld()->GetXWindow()); pShell->SetModified(); } } @@ -855,10 +853,7 @@ void SfxDocumentPage::ImplCheckPasswordState() { if (!pShell) break; - SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet(); - if (!pMedSet) - break; - const SfxUnoAnyItem* pEncryptionDataItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pMedSet, SID_ENCRYPTIONDATA, false); + const SfxUnoAnyItem* pEncryptionDataItem = pShell->GetMedium()->GetItemSet().GetItem(SID_ENCRYPTIONDATA, false); uno::Sequence< beans::NamedValue > aEncryptionData; if (pEncryptionDataItem) pEncryptionDataItem->GetValue() >>= aEncryptionData; |