summaryrefslogtreecommitdiff
path: root/sd/source
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 /sd/source
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 'sd/source')
-rw-r--r--sd/source/filter/grf/sdgrffilter.cxx10
-rw-r--r--sd/source/filter/html/sdhtmlfilter.cxx4
-rw-r--r--sd/source/filter/ppt/pptin.cxx12
-rw-r--r--sd/source/filter/sdfilter.cxx2
-rw-r--r--sd/source/filter/sdpptwrp.cxx8
-rw-r--r--sd/source/filter/xml/sdxmlwrp.cxx32
-rw-r--r--sd/source/ui/app/sdmod1.cxx8
-rw-r--r--sd/source/ui/docshell/docshel4.cxx83
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.cxx2
-rw-r--r--sd/source/ui/view/ToolBarManager.cxx2
10 files changed, 61 insertions, 102 deletions
diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx
index 4866b269f776..d296a624b78a 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -251,9 +251,9 @@ bool SdGRFFilter::Export()
if ( pPage )
{
uno::Reference< lang::XComponent > xSource( pPage->getUnoPage(), uno::UNO_QUERY );
- SfxItemSet* pSet = mrMedium.GetItemSet();
- if ( pSet && xSource.is() )
+ if (xSource.is())
{
+ SfxItemSet& rSet = mrMedium.GetItemSet();
const OUString aTypeName( mrMedium.GetFilter()->GetTypeName() );
GraphicFilter &rGraphicFilter = GraphicFilter::GetGraphicFilter();
const sal_uInt16 nFilter = rGraphicFilter.GetExportFormatNumberForTypeName( aTypeName );
@@ -262,7 +262,7 @@ bool SdGRFFilter::Export()
uno::Reference< task::XInteractionHandler > xInteractionHandler;
beans::PropertyValues aArgs;
- TransformItems( SID_SAVEASDOC, *pSet, aArgs );
+ TransformItems( SID_SAVEASDOC, rSet, aArgs );
static constexpr OUStringLiteral sFilterName( u"FilterName" );
OUString sShortName( rGraphicFilter.GetExportFormatShortName( nFilter ) );
@@ -296,8 +296,8 @@ bool SdGRFFilter::Export()
}
// take selection if needed
- if( ( SfxItemState::SET == pSet->GetItemState( SID_SELECTION ) )
- && pSet->Get( SID_SELECTION ).GetValue()
+ if( ( SfxItemState::SET == rSet.GetItemState( SID_SELECTION ) )
+ && rSet.Get( SID_SELECTION ).GetValue()
&& pDrawViewShell )
{
uno::Reference< view::XSelectionSupplier > xSelectionSupplier(
diff --git a/sd/source/filter/html/sdhtmlfilter.cxx b/sd/source/filter/html/sdhtmlfilter.cxx
index f7a3bc10f2aa..a86b1ad29051 100644
--- a/sd/source/filter/html/sdhtmlfilter.cxx
+++ b/sd/source/filter/html/sdhtmlfilter.cxx
@@ -36,11 +36,9 @@ bool SdHTMLFilter::Export()
mrMedium.Close();
mrMedium.Commit();
- SfxItemSet* pSet = mrMedium.GetItemSet();
-
css::uno::Sequence<css::beans::PropertyValue> aParams;
- if (const SfxUnoAnyItem* pItem = pSet->GetItemIfSet(SID_FILTER_DATA, false))
+ if (const SfxUnoAnyItem* pItem = mrMedium.GetItemSet().GetItemIfSet(SID_FILTER_DATA, false))
pItem->GetValue() >>= aParams;
HtmlExport aExport(mrMedium.GetName(), aParams, &mrDocument, &mrDocShell);
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 3eaebfd1892b..464c934ab780 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1256,18 +1256,10 @@ bool ImplSdPPTImport::Import()
switch ( m_aUserEditAtom.eLastViewType )
{
case PptViewTypeEnum::Outline:
- {
- SfxItemSet* pSet = mrMed.GetItemSet();
- if ( pSet )
- pSet->Put( SfxUInt16Item( SID_VIEW_ID, 3 ) );
- }
+ mrMed.GetItemSet().Put( SfxUInt16Item( SID_VIEW_ID, 3 ) );
break;
case PptViewTypeEnum::SlideSorter:
- {
- SfxItemSet* pSet = mrMed.GetItemSet();
- if ( pSet )
- pSet->Put( SfxUInt16Item( SID_VIEW_ID, 2 ) );
- }
+ mrMed.GetItemSet().Put( SfxUInt16Item( SID_VIEW_ID, 2 ) );
break;
case PptViewTypeEnum::TitleMaster:
nSelectedPage = 1;
diff --git a/sd/source/filter/sdfilter.cxx b/sd/source/filter/sdfilter.cxx
index e1ee1393226e..ec95da771ced 100644
--- a/sd/source/filter/sdfilter.cxx
+++ b/sd/source/filter/sdfilter.cxx
@@ -54,7 +54,7 @@ void SdFilter::CreateStatusIndicator()
{
// The status indicator must be retrieved from the provided medium arguments
const SfxUnoAnyItem* pStatusBarItem =
- mrMedium.GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL);
+ mrMedium.GetItemSet().GetItem(SID_PROGRESS_STATUSBAR_CONTROL);
if ( pStatusBarItem )
pStatusBarItem->GetValue() >>= mxStatusIndicator;
diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx
index da2032816393..64a1fa1f1934 100644
--- a/sd/source/filter/sdpptwrp.cxx
+++ b/sd/source/filter/sdpptwrp.cxx
@@ -132,7 +132,7 @@ static tools::SvRef<SotStorage> lcl_DRMDecrypt(const SfxMedium& rMedium, const t
// Set the media descriptor data
Sequence<NamedValue> aEncryptionData = xPackageEncryption->createEncryptionData("");
- rMedium.GetItemSet()->Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, Any(aEncryptionData)));
+ rMedium.GetItemSet().Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, Any(aEncryptionData)));
}
catch (const std::exception&)
{
@@ -216,7 +216,7 @@ bool SdPPTFilter::Export()
Sequence< NamedValue > aEncryptionData;
Reference< css::packages::XPackageEncryption > xPackageEncryption;
- const SfxUnoAnyItem* pEncryptionDataItem = SfxItemSet::GetItem<SfxUnoAnyItem>(mrMedium.GetItemSet(), SID_ENCRYPTIONDATA, false);
+ const SfxUnoAnyItem* pEncryptionDataItem = mrMedium.GetItemSet().GetItem(SID_ENCRYPTIONDATA, false);
std::shared_ptr<SvStream> pMediaStrm;
if (pEncryptionDataItem && (pEncryptionDataItem->GetValue() >>= aEncryptionData))
{
@@ -239,7 +239,7 @@ bool SdPPTFilter::Export()
pOutputStrm = pMediaStrm.get();
// Temp removal of EncryptionData to avoid password protection triggering
- mrMedium.GetItemSet()->ClearItem(SID_ENCRYPTIONDATA);
+ mrMedium.GetItemSet().ClearItem(SID_ENCRYPTIONDATA);
}
}
}
@@ -309,7 +309,7 @@ bool SdPPTFilter::Export()
xEncryptedRootStrg->Commit();
// Restore encryption data
- mrMedium.GetItemSet()->Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, Any(aEncryptionData)));
+ mrMedium.GetItemSet().Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, Any(aEncryptionData)));
}
}
}
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index 099f56ee9e22..6dba0df7b4db 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -504,14 +504,10 @@ bool SdXMLFilter::Import( ErrCode& nError )
// try to get an XStatusIndicator from the Medium
{
- SfxItemSet* pSet = mrMedium.GetItemSet();
- if(pSet)
+ const SfxUnoAnyItem* pItem = mrMedium.GetItemSet().GetItem(SID_PROGRESS_STATUSBAR_CONTROL);
+ if (pItem)
{
- const SfxUnoAnyItem* pItem = pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL);
- if (pItem)
- {
- pItem->GetValue() >>= mxStatusIndicator;
- }
+ pItem->GetValue() >>= mxStatusIndicator;
}
if(mxStatusIndicator.is())
@@ -561,13 +557,10 @@ bool SdXMLFilter::Import( ErrCode& nError )
if( ERRCODE_NONE == nRet && SfxObjectCreateMode::EMBEDDED == mrDocShell.GetCreateMode() )
{
OUString aName;
- if ( mrMedium.GetItemSet() )
- {
- const SfxStringItem* pDocHierarchItem =
- mrMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME);
- if ( pDocHierarchItem )
- aName = pDocHierarchItem->GetValue();
- }
+ const SfxStringItem* pDocHierarchItem =
+ mrMedium.GetItemSet().GetItem(SID_DOC_HIERARCHICALNAME);
+ if ( pDocHierarchItem )
+ aName = pDocHierarchItem->GetValue();
else
aName = "dummyObjectName" ;
@@ -797,13 +790,10 @@ bool SdXMLFilter::Export()
if( SfxObjectCreateMode::EMBEDDED == mrDocShell.GetCreateMode() )
{
OUString aName;
- if ( mrMedium.GetItemSet() )
- {
- const SfxStringItem* pDocHierarchItem =
- mrMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME);
- if ( pDocHierarchItem )
- aName = pDocHierarchItem->GetValue();
- }
+ const SfxStringItem* pDocHierarchItem =
+ mrMedium.GetItemSet().GetItem(SID_DOC_HIERARCHICALNAME);
+ if ( pDocHierarchItem )
+ aName = pDocHierarchItem->GetValue();
if( !aName.isEmpty() )
{
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 881d5aa1eefd..0a4f7d5e587b 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -431,8 +431,8 @@ SfxFrame* SdModule::CreateFromTemplate(const OUString& rTemplatePath, const Refe
}
else if( pDocShell )
{
- if (pDocShell->GetMedium() && pDocShell->GetMedium()->GetItemSet())
- pDocShell->GetMedium()->GetItemSet()->Put(SfxBoolItem(SID_REPLACEABLE, bReplaceable));
+ if (pDocShell->GetMedium())
+ pDocShell->GetMedium()->GetItemSet().Put(SfxBoolItem(SID_REPLACEABLE, bReplaceable));
SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, i_rFrame );
OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" );
pFrame = pViewFrame ? &pViewFrame->GetFrame() : nullptr;
@@ -520,8 +520,8 @@ SfxFrame* SdModule::CreateEmptyDocument( const Reference< XFrame >& i_rFrame )
pDoc->CreateFirstPages();
pDoc->StopWorkStartupDelay();
}
- if (pNewDocSh->GetMedium() && pNewDocSh->GetMedium()->GetItemSet())
- pNewDocSh->GetMedium()->GetItemSet()->Put(SfxBoolItem(SID_REPLACEABLE, true));
+ if (pNewDocSh->GetMedium())
+ pNewDocSh->GetMedium()->GetItemSet().Put(SfxBoolItem(SID_REPLACEABLE, true));
SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame );
OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" );
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index aeee4709208a..c240399053b9 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -277,21 +277,18 @@ bool DrawDocShell::Load( SfxMedium& rMedium )
bool bStartPresentation = false;
ErrCode nError = ERRCODE_NONE;
- SfxItemSet* pSet = rMedium.GetItemSet();
+ SfxItemSet& rSet = rMedium.GetItemSet();
- if( pSet )
+ if( ( SfxItemState::SET == rSet.GetItemState(SID_PREVIEW ) ) && rSet.Get( SID_PREVIEW ).GetValue() )
{
- if( ( SfxItemState::SET == pSet->GetItemState(SID_PREVIEW ) ) && pSet->Get( SID_PREVIEW ).GetValue() )
- {
- mpDoc->SetStarDrawPreviewMode( true );
- }
+ mpDoc->SetStarDrawPreviewMode( true );
+ }
- if( SfxItemState::SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&&
- pSet->Get( SID_DOC_STARTPRESENTATION ).GetValue() )
- {
- bStartPresentation = true;
- mpDoc->SetStartWithPresentation( true );
- }
+ if( SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)&&
+ rSet.Get( SID_DOC_STARTPRESENTATION ).GetValue() )
+ {
+ bStartPresentation = true;
+ mpDoc->SetStartWithPresentation( true );
}
bRet = SfxObjectShell::Load( rMedium );
@@ -340,9 +337,7 @@ bool DrawDocShell::Load( SfxMedium& rMedium )
// tell SFX to change viewshell when in preview mode
if( IsPreview() || bStartPresentation )
{
- SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
- if( pMediumSet )
- pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) );
+ GetMedium()->GetItemSet().Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) );
}
return bRet;
@@ -368,10 +363,7 @@ bool DrawDocShell::LoadFrom( SfxMedium& rMedium )
// tell SFX to change viewshell when in preview mode
if( IsPreview() )
{
- SfxItemSet *pSet = GetMedium()->GetItemSet();
-
- if( pSet )
- pSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) );
+ GetMedium()->GetItemSet().Put( SfxUInt16Item( SID_VIEW_ID, 5 ) );
}
return bRet;
@@ -428,21 +420,16 @@ bool DrawDocShell::ImportFrom(SfxMedium &rMedium,
const bool bRet = SfxObjectShell::ImportFrom(rMedium, xInsertPosition);
- SfxItemSet* pSet = rMedium.GetItemSet();
- if( pSet )
+ SfxItemSet& rSet = rMedium.GetItemSet();
+ if( SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)&&
+ rSet.Get( SID_DOC_STARTPRESENTATION ).GetValue() )
{
- if( SfxItemState::SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&&
- pSet->Get( SID_DOC_STARTPRESENTATION ).GetValue() )
- {
- mpDoc->SetStartWithPresentation( true );
+ mpDoc->SetStartWithPresentation( true );
- // tell SFX to change viewshell when in preview mode
- if( IsPreview() )
- {
- SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
- if( pMediumSet )
- pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, 1 ) );
- }
+ // tell SFX to change viewshell when in preview mode
+ if( IsPreview() )
+ {
+ GetMedium()->GetItemSet().Put( SfxUInt16Item( SID_VIEW_ID, 1 ) );
}
}
@@ -460,20 +447,17 @@ bool DrawDocShell::ConvertFrom( SfxMedium& rMedium )
SetWaitCursor( true );
- SfxItemSet* pSet = rMedium.GetItemSet();
- if( pSet )
+ SfxItemSet& rSet = rMedium.GetItemSet();
+ if( ( SfxItemState::SET == rSet.GetItemState(SID_PREVIEW ) ) && rSet.Get( SID_PREVIEW ).GetValue() )
{
- if( ( SfxItemState::SET == pSet->GetItemState(SID_PREVIEW ) ) && pSet->Get( SID_PREVIEW ).GetValue() )
- {
- mpDoc->SetStarDrawPreviewMode( true );
- }
+ mpDoc->SetStarDrawPreviewMode( true );
+ }
- if( SfxItemState::SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&&
- pSet->Get( SID_DOC_STARTPRESENTATION ).GetValue() )
- {
- bStartPresentation = true;
- mpDoc->SetStartWithPresentation( true );
- }
+ if( SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)&&
+ rSet.Get( SID_DOC_STARTPRESENTATION ).GetValue() )
+ {
+ bStartPresentation = true;
+ mpDoc->SetStartWithPresentation( true );
}
if( aFilterName == pFilterPowerPoint97
@@ -526,19 +510,14 @@ bool DrawDocShell::ConvertFrom( SfxMedium& rMedium )
// tell SFX to change viewshell when in preview mode
if( IsPreview() )
{
- SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
-
- if( pMediumSet )
- pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) );
+ GetMedium()->GetItemSet().Put( SfxUInt16Item( SID_VIEW_ID, 5 ) );
}
SetWaitCursor( false );
// tell SFX to change viewshell when in preview mode
if( IsPreview() || bStartPresentation )
{
- SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
- if( pMediumSet )
- pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) );
+ GetMedium()->GetItemSet().Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) );
}
return bRet;
@@ -893,7 +872,7 @@ bool DrawDocShell::SaveAsOwnFormat( SfxMedium& rMedium )
OUString aLayoutName;
- SfxStringItem const * pLayoutItem = rMedium.GetItemSet()->GetItemIfSet(SID_TEMPLATE_NAME, false);
+ SfxStringItem const * pLayoutItem = rMedium.GetItemSet().GetItemIfSet(SID_TEMPLATE_NAME, false);
if( pLayoutItem )
{
aLayoutName = pLayoutItem->GetValue();
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 692b3d73ef64..42ed20634499 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -2439,7 +2439,7 @@ void SlideshowImpl::setActiveXToolbarsVisible( bool bVisible )
if ( !(!maPresSettings.mbFullScreen && mpDocSh && mpDocSh->GetMedium()) )
return;
- const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(mpDocSh->GetMedium()->GetItemSet(), SID_VIEWONLY, false);
+ const SfxBoolItem* pItem = mpDocSh->GetMedium()->GetItemSet().GetItem(SID_VIEWONLY, false);
if ( !(pItem && pItem->GetValue()) )
return;
diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx
index 0db84b25a3b4..b3ea6ee8ded2 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -873,7 +873,7 @@ bool ToolBarManager::Implementation::CheckPlugInMode (std::u16string_view rsName
if (pMedium == nullptr)
break;
- const SfxBoolItem* pViewOnlyItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_VIEWONLY, false);
+ const SfxBoolItem* pViewOnlyItem = pMedium->GetItemSet().GetItem(SID_VIEWONLY, false);
if (pViewOnlyItem == nullptr)
break;