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 /sw | |
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 'sw')
-rw-r--r-- | sw/qa/core/filters-test.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/docnode/section.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ascii/parasc.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ascii/wrtasc.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/html/htmlform.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 19 | ||||
-rw-r--r-- | sw/source/filter/xml/swxml.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/xml/wrtxml.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/ascfldlg.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/dialog/uiregionsw.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/app/apphdl.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh.cxx | 24 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/app/docshini.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 3 |
22 files changed, 67 insertions, 105 deletions
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index f4723b0e94cd..ffc24cbda4b8 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -99,7 +99,7 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL, if (rUserData == FILTER_TEXT_DLG) { - pSrcMed->GetItemSet()->Put( + pSrcMed->GetItemSet().Put( SfxStringItem(SID_FILE_FILTEROPTIONS, "UTF8,LF,Liberation Mono,en-US")); } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index bce8f371f9ee..12d9e281c2f0 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1199,7 +1199,7 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSe if( xDocSh->GetMedium() && rSection.GetLinkFilePassword().isEmpty() ) { - if( const SfxStringItem* pItem = xDocSh->GetMedium()->GetItemSet()-> + if( const SfxStringItem* pItem = xDocSh->GetMedium()->GetItemSet(). GetItemIfSet( SID_PASSWORD, false ) ) rSection.SetLinkFilePassword( pItem->GetValue() ); } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 831cffd5ac1d..54dd3df5d695 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1095,7 +1095,7 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL, new SfxMedium(xReadStorage, sBaseURL ) : new SfxMedium(sFileName, StreamMode::READ )); if( !sBaseURL.isEmpty() ) - pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) ); + pMed->GetItemSet().Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) ); SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() ); ErrCode nErr = aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE); @@ -1122,9 +1122,9 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL, pMed.reset(new SfxMedium(sFileName, StreamMode::READ, pFilter, nullptr)); } if(!sFilterOptions.isEmpty()) - pMed->GetItemSet()->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sFilterOptions ) ); + pMed->GetItemSet().Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sFilterOptions ) ); if(!sBaseURL.isEmpty()) - pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) ); + pMed->GetItemSet().Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) ); } // this sourcecode is not responsible for the lifetime of the shell, SfxObjectShellLock should not be used @@ -1135,10 +1135,10 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL, return; SwReaderPtr pRdr; - SfxItemSet* pSet = pMed->GetItemSet(); - pSet->Put(SfxBoolItem(FN_API_CALL, true)); + SfxItemSet& rSet = pMed->GetItemSet(); + rSet.Put(SfxBoolItem(FN_API_CALL, true)); if(!sPassword.isEmpty()) - pSet->Put(SfxStringItem(SID_PASSWORD, sPassword)); + rSet.Put(SfxStringItem(SID_PASSWORD, sPassword)); Reader *pRead = pDocSh->StartConvertFrom( *pMed, pRdr, nullptr, pUnoCursor); if( !pRead ) return; diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index b29251bcbd8b..1fff4268d8d1 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -95,8 +95,8 @@ ErrCode AsciiReader::Read( SwDoc& rDoc, const OUString&, SwPaM &rPam, const OUSt OUString optionsString; aParser.GetUsedAsciiOptions().WriteUserData(optionsString); - if(m_pMedium != nullptr && m_pMedium->GetItemSet() != nullptr) - m_pMedium->GetItemSet()->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, optionsString)); + if(m_pMedium != nullptr) + m_pMedium->GetItemSet().Put(SfxStringItem(SID_FILE_FILTEROPTIONS, optionsString)); } // after Read reset the options m_aOption.ResetASCIIOpts(); diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx index 59097fa9aa86..327e317a8c9d 100644 --- a/sw/source/filter/ascii/wrtasc.cxx +++ b/sw/source/filter/ascii/wrtasc.cxx @@ -211,17 +211,13 @@ ErrCode SwASCWriter::WriteStream() void SwASCWriter::SetupFilterOptions(SfxMedium& rMedium) { - const SfxItemSet* pSet = rMedium.GetItemSet(); - if( nullptr != pSet ) + if( const SfxStringItem* pItem = rMedium.GetItemSet().GetItemIfSet( SID_FILE_FILTEROPTIONS ) ) { - if( const SfxStringItem* pItem = pSet->GetItemIfSet( SID_FILE_FILTEROPTIONS ) ) - { - SwAsciiOptions aOpt; - OUString sItemOpt; - sItemOpt = pItem->GetValue(); - aOpt.ReadUserData(sItemOpt); - SetAsciiOptions(aOpt); - } + SwAsciiOptions aOpt; + OUString sItemOpt; + sItemOpt = pItem->GetValue(); + aOpt.ReadUserData(sItemOpt); + SetAsciiOptions(aOpt); } } diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index ddb37c6f9341..f5685a4dbf63 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -643,7 +643,7 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha if ( pDocSh->GetMedium() ) { // if there is no hidden property in the MediaDescriptor it should be removed after loading - const SfxBoolItem* pHiddenItem = SfxItemSet::GetItem<SfxBoolItem>(pDocSh->GetMedium()->GetItemSet(), SID_HIDDEN, false); + const SfxBoolItem* pHiddenItem = pDocSh->GetMedium()->GetItemSet().GetItem(SID_HIDDEN, false); m_bRemoveHidden = ( pHiddenItem == nullptr || !pHiddenItem->GetValue() ); } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 7c4532bf7015..c8fd6c55bf2e 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -531,7 +531,7 @@ SwHTMLParser::~SwHTMLParser() // the temporary view frame is hidden, so the hidden flag might need to be removed if ( m_bRemoveHidden && m_xDoc.is() && m_xDoc->GetDocShell() && m_xDoc->GetDocShell()->GetMedium() ) - m_xDoc->GetDocShell()->GetMedium()->GetItemSet()->ClearItem( SID_HIDDEN ); + m_xDoc->GetDocShell()->GetMedium()->GetItemSet().ClearItem( SID_HIDDEN ); } } @@ -5596,11 +5596,7 @@ void HTMLReader::SetupFilterOptions() if (!m_pMedium) return; - const SfxItemSet* pItemSet = m_pMedium->GetItemSet(); - if (!pItemSet) - return; - - auto pItem = pItemSet->GetItem<SfxStringItem>(SID_FILE_FILTEROPTIONS); + auto pItem = m_pMedium->GetItemSet().GetItem(SID_FILE_FILTEROPTIONS); if (!pItem) return; diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 1c9d68a15fd5..d4d7fea41260 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -185,12 +185,8 @@ std::unique_ptr<SwHTMLNumRuleInfo> SwHTMLWriter::ReleaseNextNumInfo() void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium) { - const SfxItemSet* pSet = rMedium.GetItemSet(); - if (pSet == nullptr) - return; - uno::Sequence<beans::PropertyValue> aArgs = rMedium.GetArgs(); - if (const SfxStringItem* pItem = pSet->GetItemIfSet( SID_FILE_FILTEROPTIONS )) + if (const SfxStringItem* pItem = rMedium.GetItemSet().GetItemIfSet( SID_FILE_FILTEROPTIONS )) { const OUString sFilterOptions = pItem->GetValue(); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index ba9425ec3c2b..8395ab8938a3 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -117,13 +117,9 @@ OUString SwBasicEscherEx::GetBasePath() const SfxMedium * pMedium = mrWrt.GetWriter().GetMedia(); if (pMedium) { - const SfxItemSet* pPItemSet = pMedium->GetItemSet(); - if( pPItemSet ) - { - const SfxStringItem* pPItem = pPItemSet->GetItem( SID_FILE_NAME ); - if ( pPItem ) - sDocUrl = pPItem->GetValue(); - } + const SfxStringItem* pPItem = pMedium->GetItemSet().GetItem( SID_FILE_NAME ); + if ( pPItem ) + sDocUrl = pPItem->GetValue(); } return sDocUrl.copy(0, sDocUrl.lastIndexOf('/') + 1); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index e22351e477df..09855b37f0c1 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3492,7 +3492,7 @@ bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec if ( mpMedium ) { - const SfxUnoAnyItem* pEncryptionDataItem = SfxItemSet::GetItem<SfxUnoAnyItem>(mpMedium->GetItemSet(), SID_ENCRYPTIONDATA, false); + const SfxUnoAnyItem* pEncryptionDataItem = mpMedium->GetItemSet().GetItem(SID_ENCRYPTIONDATA, false); if ( pEncryptionDataItem && ( pEncryptionDataItem->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) ) { OSL_ENSURE( false, "Unexpected EncryptionData!" ); @@ -3502,7 +3502,7 @@ bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec if ( !aEncryptionData.hasElements() ) { // try to generate the encryption data based on password - const SfxStringItem* pPasswordItem = SfxItemSet::GetItem<SfxStringItem>(mpMedium->GetItemSet(), SID_PASSWORD, false); + const SfxStringItem* pPasswordItem = mpMedium->GetItemSet().GetItem(SID_PASSWORD, false); if ( pPasswordItem && !pPasswordItem->GetValue().isEmpty() && pPasswordItem->GetValue().getLength() <= 15 ) { // Generate random number with a seed of time as salt. @@ -3521,12 +3521,12 @@ bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec rCodec.InitKey( aPassword, pDocId ); aEncryptionData = rCodec.GetEncryptionData(); - mpMedium->GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::Any( aEncryptionData ) ) ); + mpMedium->GetItemSet().Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::Any( aEncryptionData ) ) ); } } if ( aEncryptionData.hasElements() ) - mpMedium->GetItemSet()->ClearItem( SID_PASSWORD ); + mpMedium->GetItemSet().ClearItem( SID_PASSWORD ); } // nonempty encryption data means here that the codec was successfully initialized @@ -3790,7 +3790,7 @@ ErrCode SwWW8Writer::WriteStorage() if (mpMedium) { // Check for specific encryption requests - const SfxUnoAnyItem* pEncryptionDataItem = SfxItemSet::GetItem<SfxUnoAnyItem>(mpMedium->GetItemSet(), SID_ENCRYPTIONDATA, false); + const SfxUnoAnyItem* pEncryptionDataItem = mpMedium->GetItemSet().GetItem(SID_ENCRYPTIONDATA, false); if (pEncryptionDataItem && (pEncryptionDataItem->GetValue() >>= aEncryptionData)) { ::comphelper::SequenceAsHashMap aHashData(aEncryptionData); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index e2d6b35e7345..a16da71ce055 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -5603,10 +5603,7 @@ namespace { OUString aPassw; - const SfxItemSet* pSet = rMedium.GetItemSet(); - const SfxStringItem *pPasswordItem; - - if(pSet && (pPasswordItem = pSet->GetItemIfSet(SID_PASSWORD))) + if (const SfxStringItem* pPasswordItem = rMedium.GetItemSet().GetItemIfSet(SID_PASSWORD)) aPassw = pPasswordItem->GetValue(); else { @@ -5637,7 +5634,7 @@ namespace uno::Sequence< beans::NamedValue > InitXorWord95Codec( ::msfilter::MSCodec_XorWord95& rCodec, SfxMedium& rMedium, WW8Fib const * pWwFib ) { uno::Sequence< beans::NamedValue > aEncryptionData; - const SfxUnoAnyItem* pEncryptionData = SfxItemSet::GetItem<SfxUnoAnyItem>(rMedium.GetItemSet(), SID_ENCRYPTIONDATA, false); + const SfxUnoAnyItem* pEncryptionData = rMedium.GetItemSet().GetItem(SID_ENCRYPTIONDATA, false); if ( pEncryptionData && ( pEncryptionData->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) ) aEncryptionData.realloc( 0 ); @@ -5690,7 +5687,7 @@ namespace uno::Sequence< beans::NamedValue > Init97Codec(msfilter::MSCodec97& rCodec, sal_uInt8 const pDocId[16], SfxMedium& rMedium) { uno::Sequence< beans::NamedValue > aEncryptionData; - const SfxUnoAnyItem* pEncryptionData = SfxItemSet::GetItem<SfxUnoAnyItem>(rMedium.GetItemSet(), SID_ENCRYPTIONDATA, false); + const SfxUnoAnyItem* pEncryptionData = rMedium.GetItemSet().GetItem(SID_ENCRYPTIONDATA, false); if ( pEncryptionData && ( pEncryptionData->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) ) aEncryptionData.realloc( 0 ); @@ -5872,8 +5869,8 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) m_pDataStream = pDecryptData; } - pMedium->GetItemSet()->ClearItem( SID_PASSWORD ); - pMedium->GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::Any( aEncryptionData ) ) ); + pMedium->GetItemSet().ClearItem( SID_PASSWORD ); + pMedium->GetItemSet().Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::Any( aEncryptionData ) ) ); } } break; @@ -5936,8 +5933,8 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) m_pDataStream = pDecryptData; } - pMedium->GetItemSet()->ClearItem( SID_PASSWORD ); - pMedium->GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::Any( aEncryptionData ) ) ); + pMedium->GetItemSet().ClearItem( SID_PASSWORD ); + pMedium->GetItemSet().Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::Any( aEncryptionData ) ) ); } } break; @@ -6483,7 +6480,7 @@ ErrCode WW8Reader::DecryptDRMPackage() // Set the media descriptor data uno::Sequence<beans::NamedValue> aEncryptionData = xPackageEncryption->createEncryptionData(""); - m_pMedium->GetItemSet()->Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, uno::Any(aEncryptionData))); + m_pMedium->GetItemSet().Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, uno::Any(aEncryptionData))); } catch (const std::exception&) { diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index d6496e779299..4664748292e6 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -617,15 +617,11 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con if (pDocSh->GetMedium()) { - SfxItemSet* pSet = pDocSh->GetMedium()->GetItemSet(); - if (pSet) + const SfxUnoAnyItem* pItem = + pDocSh->GetMedium()->GetItemSet().GetItem(SID_PROGRESS_STATUSBAR_CONTROL); + if (pItem) { - const SfxUnoAnyItem* pItem = - pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL); - if (pItem) - { - pItem->GetValue() >>= xStatusIndicator; - } + pItem->GetValue() >>= xStatusIndicator; } } @@ -720,10 +716,10 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con OUString StreamPath; if( SfxObjectCreateMode::EMBEDDED == rDoc.GetDocShell()->GetCreateMode() ) { - if ( pMedDescrMedium && pMedDescrMedium->GetItemSet() ) + if (pMedDescrMedium) { const SfxStringItem* pDocHierarchItem = - pMedDescrMedium->GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME); + pMedDescrMedium->GetItemSet().GetItem(SID_DOC_HIERARCHICALNAME); if ( pDocHierarchItem ) StreamPath = pDocHierarchItem->GetValue(); } diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 1ff2b3520282..a5b0560c1c5a 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -467,7 +467,7 @@ ErrCode SwXMLWriter::WriteStorage() ErrCode SwXMLWriter::WriteMedium( SfxMedium& aTargetMedium ) { - return Write_(aTargetMedium.GetItemSet()); + return Write_(&aTargetMedium.GetItemSet()); } ErrCode SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed, diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index 2dab8cda2397..d800233e2856 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -82,8 +82,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( weld::Window* pParent, SwDocShell& rDocSh, const SfxStringItem* pItem; OUString sAsciiOptions; if( rDocSh.GetMedium() != nullptr && - rDocSh.GetMedium()->GetItemSet() != nullptr && - (pItem = rDocSh.GetMedium()->GetItemSet()->GetItemIfSet( SID_FILE_FILTEROPTIONS ))) + (pItem = rDocSh.GetMedium()->GetItemSet().GetItemIfSet( SID_FILE_FILTEROPTIONS ))) { sAsciiOptions = pItem->GetValue(); } diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 96c5b7f8f708..14145a1ed35f 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -1308,7 +1308,7 @@ IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, v { sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE ); sFilterName = pMedium->GetFilter()->GetFilterName(); - if ( const SfxStringItem* pItem = pMedium->GetItemSet()->GetItemIfSet( SID_PASSWORD, false ) ) + if ( const SfxStringItem* pItem = pMedium->GetItemSet().GetItemIfSet( SID_PASSWORD, false ) ) sPassword = pItem->GetValue(); ::lcl_ReadSections(*pMedium, *m_xSubRegionED); } @@ -1770,7 +1770,7 @@ IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFil { m_sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE ); m_sFilterName = pMedium->GetFilter()->GetFilterName(); - if ( const SfxStringItem* pItem = pMedium->GetItemSet()->GetItemIfSet( SID_PASSWORD, false ) ) + if ( const SfxStringItem* pItem = pMedium->GetItemSet().GetItemIfSet( SID_PASSWORD, false ) ) m_sFilePasswd = pItem->GetValue(); m_xFileNameED->set_text( INetURLObject::decode( m_sFileName, INetURLObject::DecodeMechanism::Unambiguous ) ); diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 5e38ee835078..9d8dfadbdef6 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -880,7 +880,7 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) // update fixed fields if (pDocSh->GetMedium()) { - const SfxBoolItem* pTemplateItem = SfxItemSet::GetItem<SfxBoolItem>(pDocSh->GetMedium()->GetItemSet(), SID_TEMPLATE, false); + const SfxBoolItem* pTemplateItem = pDocSh->GetMedium()->GetItemSet().GetItem(SID_TEMPLATE, false); if (pTemplateItem && pTemplateItem->GetValue()) { // assume that not calling via SwEditShell::SetFixFields @@ -894,7 +894,7 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) // Update all FIX-Date/Time fields if( pWrtSh ) { - const SfxUInt16Item* pUpdateDocItem = SfxItemSet::GetItem<SfxUInt16Item>(pDocSh->GetMedium()->GetItemSet(), SID_UPDATEDOCMODE, false); + const SfxUInt16Item* pUpdateDocItem = pDocSh->GetMedium()->GetItemSet().GetItem(SID_UPDATEDOCMODE, false); bool bUpdateFields = true; if( pUpdateDocItem && pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE) bUpdateFields = false; diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 22c9a18c45ae..c3160e0ead9f 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -139,10 +139,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReaderPtr& rpRdr, SwPaM* pPaM ) { bool bAPICall = false; - const SfxBoolItem* pApiItem; - const SfxItemSet* pMedSet = rMedium.GetItemSet(); - if( pMedSet && - (pApiItem = pMedSet->GetItemIfSet( FN_API_CALL )) ) + if( const SfxBoolItem* pApiItem = rMedium.GetItemSet().GetItemIfSet( FN_API_CALL ) ) bAPICall = pApiItem->GetValue(); std::shared_ptr<const SfxFilter> pFlt = rMedium.GetFilter(); @@ -177,7 +174,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReaderPtr& rpRdr, return nullptr; // #i30171# set the UpdateDocMode at the SwDocShell - const SfxUInt16Item* pUpdateDocItem = SfxItemSet::GetItem<SfxUInt16Item>(rMedium.GetItemSet(), SID_UPDATEDOCMODE, false); + const SfxUInt16Item* pUpdateDocItem = rMedium.GetItemSet().GetItem(SID_UPDATEDOCMODE, false); m_nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE; if (!pFlt->GetDefaultTemplate().isEmpty()) @@ -187,10 +184,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReaderPtr& rpRdr, pFlt->GetUserData() == FILTER_TEXT_DLG ) { SwAsciiOptions aOpt; - const SfxItemSet* pSet = rMedium.GetItemSet(); - const SfxStringItem* pItem; - if( pSet && - (pItem = pSet->GetItemIfSet( SID_FILE_FILTEROPTIONS )) ) + if( const SfxStringItem* pItem = rMedium.GetItemSet().GetItemIfSet( SID_FILE_FILTEROPTIONS ) ) aOpt.ReadUserData( pItem->GetValue() ); pRead->GetReaderOpt().SetASCIIOpts( aOpt ); @@ -425,7 +419,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) { // Don't save data source in case a temporary is being saved for preview in MM wizard if (const SfxBoolItem* pNoEmbDS - = SfxItemSet::GetItem(rMedium.GetItemSet(), SID_NO_EMBEDDED_DS, false)) + = rMedium.GetItemSet().GetItem(SID_NO_EMBEDDED_DS, false)) bSaveDS = !pNoEmbDS->GetValue(); } if (bSaveDS) @@ -462,7 +456,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) if (!bCopyTo) { if (const SfxBoolItem* pSaveToItem - = SfxItemSet::GetItem(rMedium.GetItemSet(), SID_SAVETO, false)) + = rMedium.GetItemSet().GetItem(SID_SAVETO, false)) bCopyTo = pSaveToItem->GetValue(); } @@ -745,12 +739,8 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) { SwAsciiOptions aOpt; OUString sItemOpt; - const SfxItemSet* pSet = rMedium.GetItemSet(); - if( nullptr != pSet ) - { - if( const SfxStringItem* pItem = pSet->GetItemIfSet( SID_FILE_FILTEROPTIONS ) ) - sItemOpt = pItem->GetValue(); - } + if( const SfxStringItem* pItem = rMedium.GetItemSet().GetItemIfSet( SID_FILE_FILTEROPTIONS ) ) + sItemOpt = pItem->GetValue(); if(!sItemOpt.isEmpty()) aOpt.ReadUserData( sItemOpt ); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 0a8e4e6c7900..5bf5b65c3af3 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1733,7 +1733,7 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh, if( pMed && pMed->GetURLObject() == aTmpObj ) { const SfxPoolItem* pItem; - if( ( SfxItemState::SET == pMed->GetItemSet()->GetItemState( + if( ( SfxItemState::SET == pMed->GetItemSet().GetItemState( SID_VERSION, false, &pItem ) ) ? (nVersion == static_cast<const SfxInt16Item*>(pItem)->GetValue()) : !nVersion ) @@ -1773,10 +1773,10 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh, } if( nVersion ) - xMed->GetItemSet()->Put( SfxInt16Item( SID_VERSION, nVersion )); + xMed->GetItemSet().Put( SfxInt16Item( SID_VERSION, nVersion )); if( !rPasswd.isEmpty() ) - xMed->GetItemSet()->Put( SfxStringItem( SID_PASSWORD, rPasswd )); + xMed->GetItemSet().Put( SfxStringItem( SID_PASSWORD, rPasswd )); if( !pSfxFlt ) aMatcher.DetectFilter( *xMed, pSfxFlt ); diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index 7407de9ef6f5..0323fe332a43 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -493,7 +493,7 @@ bool SwDocShell::Load( SfxMedium& rMedium ) m_xBasePool = new SwDocStyleSheetPool( *m_xDoc, SfxObjectCreateMode::ORGANIZER == GetCreateMode() ); if(GetCreateMode() != SfxObjectCreateMode::ORGANIZER) { - const SfxUInt16Item* pUpdateDocItem = SfxItemSet::GetItem<SfxUInt16Item>(rMedium.GetItemSet(), SID_UPDATEDOCMODE, false); + const SfxUInt16Item* pUpdateDocItem = rMedium.GetItemSet().GetItem(SID_UPDATEDOCMODE, false); m_nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE; } diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 5a536cc9ef58..f16fadeaa395 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -820,15 +820,12 @@ static bool lcl_SaveDoc( SfxMedium* pDstMed = new SfxMedium( url, StreamMode::STD_READWRITE ); pDstMed->SetFilter( pStoreToFilter ); - if( pDstMed->GetItemSet() ) - { - if( pStoreToFilterOptions ) - pDstMed->GetItemSet()->Put( SfxStringItem(SID_FILE_FILTEROPTIONS, - *pStoreToFilterOptions)); - if( pSaveToFilterData->hasElements() ) - pDstMed->GetItemSet()->Put( SfxUnoAnyItem(SID_FILTER_DATA, - uno::Any(*pSaveToFilterData))); - } + if( pStoreToFilterOptions ) + pDstMed->GetItemSet().Put( SfxStringItem(SID_FILE_FILTEROPTIONS, + *pStoreToFilterOptions)); + if( pSaveToFilterData->hasElements() ) + pDstMed->GetItemSet().Put( SfxUnoAnyItem(SID_FILTER_DATA, + uno::Any(*pSaveToFilterData))); // convert fields to text if we are exporting to PDF. // this prevents a second merge while updating the fields diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 5e59d75ba043..d1f18b7b08b9 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -549,7 +549,7 @@ IMPL_LINK_NOARG(SwView, AttrChangedNotify, LinkParamNone*, void) m_aTimer.Start(); const SfxBoolItem *pItem = - GetObjectShell()->GetMedium()->GetItemSet()-> + GetObjectShell()->GetMedium()->GetItemSet(). GetItemIfSet( SID_HIDDEN, false ); if ( !pItem || !pItem->GetValue() ) { diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 603ce43210a0..8af40e5e2447 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3055,8 +3055,7 @@ void SAL_CALL SwXTextDocument::render( // prevent crash described in #i108805 SwDocShell *pRenderDocShell = pDoc->GetDocShell(); - SfxItemSet *pSet = pRenderDocShell->GetMedium()->GetItemSet(); - pSet->Put( SfxBoolItem( SID_HIDDEN, false ) ); + pRenderDocShell->GetMedium()->GetItemSet().Put( SfxBoolItem( SID_HIDDEN, false ) ); } } |