summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-07-27 19:12:45 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-07-28 08:13:40 +0200
commitf5dd4faef6c6ee23bb33a0662087e1892db78b3d (patch)
tree32848118bd734bfd0d812abb159cf0c38aa953df /sw/source/uibase
parent0c45d90cfb1cc60218fbce3743df442b1f1d3f70 (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/source/uibase')
-rw-r--r--sw/source/uibase/app/apphdl.cxx4
-rw-r--r--sw/source/uibase/app/docsh.cxx24
-rw-r--r--sw/source/uibase/app/docsh2.cxx6
-rw-r--r--sw/source/uibase/app/docshini.cxx2
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx15
-rw-r--r--sw/source/uibase/uiview/view.cxx2
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx3
7 files changed, 21 insertions, 35 deletions
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 ) );
}
}