diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-10-16 12:06:21 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-10-16 12:12:28 +0200 |
commit | adeefc6295b1cf411b47b9b4213c16effea9d832 (patch) | |
tree | 04eb6620ab4bc1ed72b7c187994c13be30726f52 /sfx2/source/doc | |
parent | 20248b82be361279f2b4814280b0371658ca27c0 (diff) |
sfx items: Kill the unreadable & misplaced SFX_ITEMSET_ARG too.
Change-Id: I1e0f96dce2b9cf9da32f4f577cf76e1d8824d37a
Diffstat (limited to 'sfx2/source/doc')
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 74 | ||||
-rw-r--r-- | sfx2/source/doc/guisaveas.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objcont.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 28 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 56 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 34 |
8 files changed, 105 insertions, 109 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 746eed2b960f..cdd9a8abbade 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -418,7 +418,7 @@ Reference < XContent > SfxMedium::GetContent() const Reference < ::com::sun::star::ucb::XContent > xContent; Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; - SFX_ITEMSET_ARG(pImp->m_pSet, pItem, SfxUnoAnyItem, SID_CONTENT); + const SfxUnoAnyItem* pItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pImp->m_pSet, SID_CONTENT, false); if ( pItem ) pItem->GetValue() >>= xContent; @@ -712,12 +712,12 @@ bool SfxMedium::IsStorage() bool SfxMedium::IsPreview_Impl() { bool bPreview = false; - SFX_ITEMSET_ARG(GetItemSet(), pPreview, SfxBoolItem, SID_PREVIEW); + const SfxBoolItem* pPreview = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_PREVIEW, false); if ( pPreview ) bPreview = pPreview->GetValue(); else { - SFX_ITEMSET_ARG(GetItemSet(), pFlags, SfxStringItem, SID_OPTIONS); + const SfxStringItem* pFlags = SfxItemSet::GetItem<SfxStringItem>(GetItemSet(), SID_OPTIONS, false); if ( pFlags ) { OUString aFileFlags = pFlags->GetValue(); @@ -961,7 +961,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI ) if ( !bResult ) { // no read-write access is necessary on loading if the document is explicitly opened as copy - SFX_ITEMSET_ARG(GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE); + const SfxBoolItem* pTemplateItem = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_TEMPLATE, false); bResult = ( bLoading && pTemplateItem && pTemplateItem->GetValue() ); } @@ -1036,7 +1036,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI ) { // the error should be set in case it is storing process // or the document has been opened for editing explicitly - SFX_ITEMSET_ARG(pImp->m_pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY); + const SfxBoolItem* pReadOnlyItem = SfxItemSet::GetItem<SfxBoolItem>(pImp->m_pSet, SID_DOC_READONLY, false); if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) ) SetError( ERRCODE_IO_ACCESSDENIED, OUString( OSL_LOG_PREFIX ) ); @@ -1073,7 +1073,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI ) if ( !bResult ) { // no read-write access is necessary on loading if the document is explicitly opened as copy - SFX_ITEMSET_ARG(GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE); + const SfxBoolItem* pTemplateItem = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_TEMPLATE, false); bResult = ( bLoading && pTemplateItem && pTemplateItem->GetValue() ); } @@ -1270,7 +1270,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI ) { // the error should be set in case it is storing process // or the document has been opened for editing explicitly - SFX_ITEMSET_ARG(pImp->m_pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY); + const SfxBoolItem* pReadOnlyItem = SfxItemSet::GetItem<SfxBoolItem>(pImp->m_pSet, SID_DOC_READONLY, false); if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) ) SetError( ERRCODE_IO_ACCESSDENIED, OUString( OSL_LOG_PREFIX ) ); @@ -1309,7 +1309,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo ) if ( GetError() ) return pImp->xStorage; - SFX_ITEMSET_ARG(GetItemSet(), pRepairItem, SfxBoolItem, SID_REPAIRPACKAGE); + const SfxBoolItem* pRepairItem = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_REPAIRPACKAGE, false); if ( pRepairItem && pRepairItem->GetValue() ) { // the storage should be created for repairing mode @@ -1319,7 +1319,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo ) Reference< ::com::sun::star::ucb::XProgressHandler > xProgressHandler; Reference< ::com::sun::star::task::XStatusIndicator > xStatusIndicator; - SFX_ITEMSET_ARG(GetItemSet(), pxProgressItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL); + const SfxUnoAnyItem* pxProgressItem = SfxItemSet::GetItem<SfxUnoAnyItem>(GetItemSet(), SID_PROGRESS_STATUSBAR_CONTROL, false); if( pxProgressItem && ( pxProgressItem->GetValue() >>= xStatusIndicator ) ) xProgressHandler = Reference< ::com::sun::star::ucb::XProgressHandler >( new utl::ProgressHandlerWrap( xStatusIndicator ) ); @@ -1385,7 +1385,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo ) GetVersionList(); } - SFX_ITEMSET_ARG(pImp->m_pSet, pVersion, SfxInt16Item, SID_VERSION); + const SfxInt16Item* pVersion = SfxItemSet::GetItem<SfxInt16Item>(pImp->m_pSet, SID_VERSION, false); bool bResetStorage = false; if ( pVersion && pVersion->GetValue() ) @@ -1690,8 +1690,8 @@ bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, if( ::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext(), aTempCont ) ) { bool bTransactStarted = false; - SFX_ITEMSET_ARG(GetItemSet(), pOverWrite, SfxBoolItem, SID_OVERWRITE); - SFX_ITEMSET_ARG(GetItemSet(), pRename, SfxBoolItem, SID_RENAME); + const SfxBoolItem* pOverWrite = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_OVERWRITE, false); + const SfxBoolItem* pRename = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_RENAME, false); bool bRename = pRename && pRename->GetValue(); bool bOverWrite = pOverWrite ? pOverWrite->GetValue() : !bRename; @@ -1776,14 +1776,14 @@ bool SfxMedium::TryDirectTransfer( const OUString& aURL, SfxItemSet& aTargetSet // if the document had no password it should be stored without password // if the document had password it should be stored with the same password // otherwise the stream copying can not be done - SFX_ITEMSET_ARG(&aTargetSet, pNewPassItem, SfxStringItem, SID_PASSWORD); - SFX_ITEMSET_ARG(GetItemSet(), pOldPassItem, SfxStringItem, SID_PASSWORD); + const SfxStringItem* pNewPassItem = aTargetSet.GetItem<SfxStringItem>(SID_PASSWORD, false); + const SfxStringItem* pOldPassItem = SfxItemSet::GetItem<SfxStringItem>(GetItemSet(), SID_PASSWORD, false); if ( ( !pNewPassItem && !pOldPassItem ) || ( pNewPassItem && pOldPassItem && pNewPassItem->GetValue() == pOldPassItem->GetValue() ) ) { // the filter must be the same - SFX_ITEMSET_ARG(&aTargetSet, pNewFilterItem, SfxStringItem, SID_FILTER_NAME); - SFX_ITEMSET_ARG(GetItemSet(), pOldFilterItem, SfxStringItem, SID_FILTER_NAME); + const SfxStringItem* pNewFilterItem = aTargetSet.GetItem<SfxStringItem>(SID_FILTER_NAME, false); + const SfxStringItem* pOldFilterItem = SfxItemSet::GetItem<SfxStringItem>(GetItemSet(), SID_FILTER_NAME, false); if ( pNewFilterItem && pOldFilterItem && pNewFilterItem->GetValue() == pOldFilterItem->GetValue() ) { // get the input stream and copy it @@ -1808,8 +1808,8 @@ bool SfxMedium::TryDirectTransfer( const OUString& aURL, SfxItemSet& aTargetSet InsertCommandArgument aInsertArg; aInsertArg.Data = xInStream; - SFX_ITEMSET_ARG(&aTargetSet, pRename, SfxBoolItem, SID_RENAME); - SFX_ITEMSET_ARG(&aTargetSet, pOverWrite, SfxBoolItem, SID_OVERWRITE); + const SfxBoolItem* pRename = aTargetSet.GetItem<SfxBoolItem>(SID_RENAME, false); + const SfxBoolItem* pOverWrite = aTargetSet.GetItem<SfxBoolItem>(SID_OVERWRITE, false); if ( (pOverWrite && !pOverWrite->GetValue()) // argument says: never overwrite || (pRename && pRename->GetValue()) ) // argument says: rename file aInsertArg.ReplaceExisting = false; @@ -1862,7 +1862,7 @@ void SfxMedium::Transfer_Impl() if (pImp->m_aLogicName.startsWith("private:stream")) { // TODO/LATER: support storing to SID_STREAM - SFX_ITEMSET_ARG(pImp->m_pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM); + const SfxUnoAnyItem* pOutStreamItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pImp->m_pSet, SID_OUTPUTSTREAM, false); if( pOutStreamItem && ( pOutStreamItem->GetValue() >>= rOutStream ) ) { if ( pImp->xStorage.is() ) @@ -1926,7 +1926,7 @@ void SfxMedium::Transfer_Impl() return; } - SFX_ITEMSET_ARG(GetItemSet(), pSegmentSize, SfxInt32Item, SID_SEGMENTSIZE); + const SfxInt32Item* pSegmentSize = SfxItemSet::GetItem<SfxInt32Item>(GetItemSet(), SID_SEGMENTSIZE, false); if ( pSegmentSize ) { // this file must be stored into a disk spanned package @@ -2059,8 +2059,8 @@ void SfxMedium::Transfer_Impl() (void)::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xEnv, comphelper::getProcessComponentContext(), aSourceContent ); // check for external parameters that may customize the handling of NameClash situations - SFX_ITEMSET_ARG(GetItemSet(), pRename, SfxBoolItem, SID_RENAME); - SFX_ITEMSET_ARG(GetItemSet(), pOverWrite, SfxBoolItem, SID_OVERWRITE); + const SfxBoolItem* pRename = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_RENAME, false); + const SfxBoolItem* pOverWrite = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_OVERWRITE, false); sal_Int32 nNameClash; if ( pOverWrite && !pOverWrite->GetValue() ) // argument says: never overwrite @@ -2081,9 +2081,9 @@ void SfxMedium::Transfer_Impl() if ( IsInCheckIn( ) ) { eOperation = ::ucbhelper::InsertOperation_CHECKIN; - SFX_ITEMSET_ARG(GetItemSet(), pMajor, SfxBoolItem, SID_DOCINFO_MAJOR); + const SfxBoolItem* pMajor = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_DOCINFO_MAJOR, false); bMajor = pMajor && pMajor->GetValue( ); - SFX_ITEMSET_ARG(GetItemSet(), pComments, SfxStringItem, SID_DOCINFO_COMMENTS); + const SfxStringItem* pComments = SfxItemSet::GetItem<SfxStringItem>(GetItemSet(), SID_DOCINFO_COMMENTS, false); if ( pComments ) sComment = pComments->GetValue( ); } @@ -2302,7 +2302,7 @@ void SfxMedium::GetLockingStream_Impl() if ( GetURLObject().GetProtocol() == INetProtocol::File && !pImp->m_xLockingStream.is() ) { - SFX_ITEMSET_ARG(pImp->m_pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM); + const SfxUnoAnyItem* pWriteStreamItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pImp->m_pSet, SID_STREAM, false); if ( pWriteStreamItem ) pWriteStreamItem->GetValue() >>= pImp->m_xLockingStream; @@ -2344,8 +2344,8 @@ void SfxMedium::GetMedium_Impl() Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(); //TODO/MBA: need support for SID_STREAM - SFX_ITEMSET_ARG(pImp->m_pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM); - SFX_ITEMSET_ARG(pImp->m_pSet, pInStreamItem, SfxUnoAnyItem, SID_INPUTSTREAM); + const SfxUnoAnyItem* pWriteStreamItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pImp->m_pSet, SID_STREAM, false); + const SfxUnoAnyItem* pInStreamItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pImp->m_pSet, SID_INPUTSTREAM, false); if ( pWriteStreamItem ) { pWriteStreamItem->GetValue() >>= pImp->xStream; @@ -2524,7 +2524,7 @@ void SfxMedium::Init_Impl() // TODO/LATER: handle lifetime of storages pImp->bDisposeStorage = false; - SFX_ITEMSET_ARG(pImp->m_pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE); + const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pImp->m_pSet, SID_DOC_SALVAGE, false); if ( pSalvageItem && pSalvageItem->GetValue().isEmpty() ) { pSalvageItem = NULL; @@ -2567,7 +2567,7 @@ void SfxMedium::Init_Impl() // in case output stream is by mistake here // clear the reference - SFX_ITEMSET_ARG(pImp->m_pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM); + const SfxUnoAnyItem* pOutStreamItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pImp->m_pSet, SID_OUTPUTSTREAM, false); if( pOutStreamItem && ( !( pOutStreamItem->GetValue() >>= rOutStream ) || !pImp->m_aLogicName.startsWith("private:stream")) ) @@ -2579,7 +2579,7 @@ void SfxMedium::Init_Impl() if (!pImp->m_aLogicName.isEmpty()) { // if the logic name is set it should be set in MediaDescriptor as well - SFX_ITEMSET_ARG(pImp->m_pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME); + const SfxStringItem* pFileNameItem = SfxItemSet::GetItem<SfxStringItem>(pImp->m_pSet, SID_FILE_NAME, false); if ( !pFileNameItem ) { // let the ItemSet be created if necessary @@ -2630,7 +2630,7 @@ SfxMedium::GetInteractionHandler( bool bGetAlways ) if ( pImp->m_pSet ) { ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > xHandler; - SFX_ITEMSET_ARG(pImp->m_pSet, pHandler, SfxUnoAnyItem, SID_INTERACTIONHANDLER); + const SfxUnoAnyItem* pHandler = SfxItemSet::GetItem<SfxUnoAnyItem>(pImp->m_pSet, SID_INTERACTIONHANDLER, false); if ( pHandler && (pHandler->GetValue() >>= xHandler) && xHandler.is() ) return xHandler; } @@ -2999,7 +2999,7 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) : pImp->m_pFilter = pImp->m_pCustomFilter.get(); } - SFX_ITEMSET_ARG(pImp->m_pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE); + const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pImp->m_pSet, SID_DOC_SALVAGE, false); if( pSalvageItem ) { // QUESTION: there is some treatment of Salvage in Init_Impl; align! @@ -3008,7 +3008,7 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) : // if an URL is provided in SalvageItem that means that the FileName refers to a temporary file // that must be copied here - SFX_ITEMSET_ARG(pImp->m_pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME); + const SfxStringItem* pFileNameItem = SfxItemSet::GetItem<SfxStringItem>(pImp->m_pSet, SID_FILE_NAME, false); if (!pFileNameItem) throw uno::RuntimeException(); OUString aNewTempFileURL = SfxMedium::CreateTempCopyWithExt( pFileNameItem->GetValue() ); if ( !aNewTempFileURL.isEmpty() ) @@ -3026,11 +3026,11 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) : } bool readOnly = false; - SFX_ITEMSET_ARG(pImp->m_pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY); + const SfxBoolItem* pReadOnlyItem = SfxItemSet::GetItem<SfxBoolItem>(pImp->m_pSet, SID_DOC_READONLY, false); if ( pReadOnlyItem && pReadOnlyItem->GetValue() ) readOnly = true; - SFX_ITEMSET_ARG(pImp->m_pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME); + const SfxStringItem* pFileNameItem = SfxItemSet::GetItem<SfxStringItem>(pImp->m_pSet, SID_FILE_NAME, false); if (!pFileNameItem) throw uno::RuntimeException(); pImp->m_aLogicName = pFileNameItem->GetValue(); pImp->m_nStorOpenMode = readOnly ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE; @@ -3341,7 +3341,7 @@ bool SfxMedium::IsReadOnly() const // c) the API can force the readonly state! if (!bReadOnly) { - SFX_ITEMSET_ARG(GetItemSet(), pItem, SfxBoolItem, SID_DOC_READONLY); + const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_DOC_READONLY, false); if (pItem) bReadOnly = pItem->GetValue(); } @@ -3743,7 +3743,7 @@ OUString SfxMedium::SwitchDocumentToTempFile() // remove the readonly state bool bWasReadonly = false; pImp->m_nStorOpenMode = SFX_STREAM_READWRITE; - SFX_ITEMSET_ARG(pImp->m_pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY); + const SfxBoolItem* pReadOnlyItem = SfxItemSet::GetItem<SfxBoolItem>(pImp->m_pSet, SID_DOC_READONLY, false); if ( pReadOnlyItem && pReadOnlyItem->GetValue() ) bWasReadonly = true; GetItemSet()->ClearItem( SID_DOC_READONLY ); diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 4c70d0c2f031..87acdbf39a73 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1043,7 +1043,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, // the following two arguments can not be converted in MediaDescriptor, // so they should be removed from the ItemSet after retrieving - SFX_ITEMSET_ARG(pDialogParams, pRecommendReadOnly, SfxBoolItem, SID_RECOMMENDREADONLY); + const SfxBoolItem* pRecommendReadOnly = SfxItemSet::GetItem<SfxBoolItem>(pDialogParams, SID_RECOMMENDREADONLY, false); m_bRecommendReadOnly = ( pRecommendReadOnly && pRecommendReadOnly->GetValue() ); pDialogParams->ClearItem( SID_RECOMMENDREADONLY ); diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 0af7fe7e89c1..ce7c9279fe1d 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -396,7 +396,7 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) if ( !pFile->GetFilter() || !pFile->GetFilter()->IsOwnFormat() ) return; - SFX_ITEMSET_ARG(pFile->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE); + const SfxUInt16Item* pUpdateDocItem = SfxItemSet::GetItem<SfxUInt16Item>(pFile->GetItemSet(), SID_UPDATEDOCMODE, false); sal_Int16 bCanUpdateFromTemplate = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE; // created from template? diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 66a4ce5f0bbc..5a1b04c15fcc 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -835,7 +835,7 @@ OUString SfxObjectShell::GetTitle if ( pMed ) { - SFX_ITEMSET_ARG(pMed->GetItemSet(), pNameItem, SfxStringItem, SID_DOCINFO_TITLE); + const SfxStringItem* pNameItem = SfxItemSet::GetItem<SfxStringItem>(pMed->GetItemSet(), SID_DOCINFO_TITLE, false); if ( pNameItem ) aTitle = pNameItem->GetValue(); } @@ -862,7 +862,7 @@ OUString SfxObjectShell::GetTitle // If a specific title was given at open: // important for URLs: use INetProtocol::File for which the set title is not // considered. (See below, analysis of aTitleMap_Impl) - SFX_ITEMSET_ARG(pMed->GetItemSet(), pNameItem, SfxStringItem, SID_DOCINFO_TITLE); + const SfxStringItem* pNameItem = SfxItemSet::GetItem<SfxStringItem>(pMed->GetItemSet(), SID_DOCINFO_TITLE, false); if ( pNameItem ) return X( pNameItem->GetValue() ); } @@ -1024,7 +1024,7 @@ void SfxObjectShell::PostActivateEvent_Impl( SfxViewFrame* pFrame ) SfxApplication* pSfxApp = SfxGetpApp(); if ( !pSfxApp->IsDowning() && !IsLoading() && pFrame && !pFrame->GetFrame().IsClosing_Impl() ) { - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN); + const SfxBoolItem* pHiddenItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_HIDDEN, false); if ( !pHiddenItem || !pHiddenItem->GetValue() ) { sal_uInt16 nId = pImp->nEventId; @@ -1162,7 +1162,7 @@ void SfxObjectShell::InitOwnModel_Impl() { if ( !pImp->bModelInitialized ) { - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE); + const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_DOC_SALVAGE, false); if ( pSalvageItem ) { pImp->aTempName = pMedium->GetPhysicalName(); @@ -1197,7 +1197,7 @@ void SfxObjectShell::InitOwnModel_Impl() void SfxObjectShell::FinishedLoading( SfxLoadedFlags nFlags ) { bool bSetModifiedTRUE = false; - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE); + const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_DOC_SALVAGE, false); if( ( nFlags & SfxLoadedFlags::MAINDOCUMENT ) && !(pImp->nLoadedFlags & SfxLoadedFlags::MAINDOCUMENT ) && !(pImp->nFlagsInProgress & SfxLoadedFlags::MAINDOCUMENT )) { @@ -1258,7 +1258,7 @@ void SfxObjectShell::FinishedLoading( SfxLoadedFlags nFlags ) if ( (pImp->nLoadedFlags & SfxLoadedFlags::MAINDOCUMENT ) && (pImp->nLoadedFlags & SfxLoadedFlags::IMAGES ) ) { - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE); + const SfxBoolItem* pTemplateItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_TEMPLATE, false); bool bTemplate = pTemplateItem && pTemplateItem->GetValue(); // closing the streams on loading should be under control of SFX! @@ -1296,7 +1296,7 @@ void SfxObjectShell::TemplateDisconnectionAfterLoad() if ( pTmpMedium ) { OUString aName( pTmpMedium->GetName() ); - SFX_ITEMSET_ARG(pTmpMedium->GetItemSet(), pTemplNamItem, SfxStringItem, SID_TEMPLATE_NAME); + const SfxStringItem* pTemplNamItem = SfxItemSet::GetItem<SfxStringItem>(pTmpMedium->GetItemSet(), SID_TEMPLATE_NAME, false); OUString aTemplateName; if ( pTemplNamItem ) aTemplateName = pTemplNamItem->GetValue(); @@ -1342,7 +1342,7 @@ void SfxObjectShell::TemplateDisconnectionAfterLoad() assert(pMedium != 0); if( ok ) { - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE); + const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_DOC_SALVAGE, false); bool bSalvage = pSalvageItem != nullptr; if ( !bSalvage ) @@ -1685,7 +1685,7 @@ bool SfxObjectShell::IsPreview() const return false; bool bPreview = false; - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pFlags, SfxStringItem, SID_OPTIONS); + const SfxStringItem* pFlags = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_OPTIONS, false); if ( pFlags ) { // Distributed values among individual items @@ -1697,7 +1697,7 @@ bool SfxObjectShell::IsPreview() const if ( !bPreview ) { - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pItem, SfxBoolItem, SID_PREVIEW); + const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_PREVIEW, false); if ( pItem ) bPreview = pItem->GetValue(); } @@ -1750,7 +1750,7 @@ vcl::Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) { vcl::Window* pWindow = 0; SfxItemSet* pSet = pLoadingMedium ? pLoadingMedium->GetItemSet() : GetMedium()->GetItemSet(); - SFX_ITEMSET_ARG(pSet, pUnoItem, SfxUnoFrameItem, SID_FILLFRAME); + const SfxUnoFrameItem* pUnoItem = SfxItemSet::GetItem<SfxUnoFrameItem>(pSet, SID_FILLFRAME, false); if ( pUnoItem ) { uno::Reference < frame::XFrame > xFrame( pUnoItem->GetFrame() ); @@ -1760,7 +1760,7 @@ vcl::Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) if ( !pWindow ) { SfxFrame* pFrame = 0; - SFX_ITEMSET_ARG(pSet, pFrameItem, SfxFrameItem, SID_DOCFRAME); + const SfxFrameItem* pFrameItem = SfxItemSet::GetItem<SfxFrameItem>(pSet, SID_DOCFRAME, false); if( pFrameItem && pFrameItem->GetFrame() ) // get target frame from ItemSet pFrame = pFrameItem->GetFrame(); @@ -1783,7 +1783,7 @@ vcl::Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) if ( pWindow ) { // this frame may be invisible, show it if it is allowed - SFX_ITEMSET_ARG(pSet, pHiddenItem, SfxBoolItem, SID_HIDDEN); + const SfxBoolItem* pHiddenItem = SfxItemSet::GetItem<SfxBoolItem>(pSet, SID_HIDDEN, false); if ( !pHiddenItem || !pHiddenItem->GetValue() ) { pWindow->Show(); @@ -1861,7 +1861,7 @@ sal_Int16 SfxObjectShell_Impl::getCurrentMacroExecMode() const OSL_PRECOND( pMedium, "SfxObjectShell_Impl::getCurrentMacroExecMode: no medium!" ); if ( pMedium ) { - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pMacroModeItem, SfxUInt16Item, SID_MACROEXECMODE); + const SfxUInt16Item* pMacroModeItem = SfxItemSet::GetItem<SfxUInt16Item>(pMedium->GetItemSet(), SID_MACROEXECMODE, false); if ( pMacroModeItem ) nImposedExecMode = pMacroModeItem->GetValue(); } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 27fc3156ebc2..1e7164aa0d19 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -277,14 +277,14 @@ bool SfxObjectShell::APISaveAs_Impl if ( GetMedium() ) { OUString aFilterName; - SFX_ITEMSET_ARG(aParams, pFilterNameItem, SfxStringItem, SID_FILTER_NAME); + const SfxStringItem* pFilterNameItem = SfxItemSet::GetItem<SfxStringItem>(aParams, SID_FILTER_NAME, false); if( pFilterNameItem ) { aFilterName = pFilterNameItem->GetValue(); } else { - SFX_ITEMSET_ARG(aParams, pContentTypeItem, SfxStringItem, SID_CONTENTTYPE); + const SfxStringItem* pContentTypeItem = SfxItemSet::GetItem<SfxStringItem>(aParams, SID_CONTENTTYPE, false); if ( pContentTypeItem ) { const SfxFilter* pFilter = SfxFilterMatcher( OUString::createFromAscii(GetFactory().GetShortName()) ).GetFilter4Mime( pContentTypeItem->GetValue(), SfxFilterFlags::EXPORT ); @@ -310,7 +310,7 @@ bool SfxObjectShell::APISaveAs_Impl SfxObjectShellRef xLock( this ); // ??? // use the title that is provided in the media descriptor - SFX_ITEMSET_ARG(aParams, pDocTitleItem, SfxStringItem, SID_DOCINFO_TITLE); + const SfxStringItem* pDocTitleItem = SfxItemSet::GetItem<SfxStringItem>(aParams, SID_DOCINFO_TITLE, false); if ( pDocTitleItem ) getDocProperties()->setTitle( pDocTitleItem->GetValue() ); @@ -503,7 +503,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) ScopedVclPtr<SfxDocumentInfoDialog> pDlg(CreateDocumentInfoDialog(0, aSet)); if ( RET_OK == pDlg->Execute() ) { - SFX_ITEMSET_ARG(pDlg->GetOutputItemSet(), pDocInfoItem, SfxDocumentInfoItem, SID_DOCINFO); + const SfxDocumentInfoItem* pDocInfoItem = SfxItemSet::GetItem<SfxDocumentInfoItem>(pDlg->GetOutputItemSet(), SID_DOCINFO, false); if ( pDocInfoItem ) { // user has done some changes to DocumentInfo @@ -565,7 +565,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( nId == SID_SAVEASDOC || nId == SID_SAVEASREMOTE ) { // in case of plugin mode the SaveAs operation means SaveTo - SFX_ITEMSET_ARG(GetMedium()->GetItemSet(), pViewOnlyItem, SfxBoolItem, SID_VIEWONLY); + const SfxBoolItem* pViewOnlyItem = SfxItemSet::GetItem<SfxBoolItem>(GetMedium()->GetItemSet(), SID_VIEWONLY, false); if ( pViewOnlyItem && pViewOnlyItem->GetValue() ) rReq.AppendItem( SfxBoolItem( SID_SAVETO, true ) ); } @@ -636,8 +636,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) bool bPreselectPassword = false; - SFX_ITEMSET_ARG(GetMedium()->GetItemSet(), pOldEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA); - SFX_ITEMSET_ARG(GetMedium()->GetItemSet(), pOldPasswordItem, SfxStringItem, SID_PASSWORD); + const SfxUnoAnyItem* pOldEncryptionDataItem = SfxItemSet::GetItem<SfxUnoAnyItem>(GetMedium()->GetItemSet(), SID_ENCRYPTIONDATA, false); + const SfxStringItem* pOldPasswordItem = SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_PASSWORD, false); if ( pOldEncryptionDataItem || pOldPasswordItem ) bPreselectPassword = true; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 8998ace450a8..5e39ce7ab79b 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -188,7 +188,7 @@ bool GetEncryptionData_Impl( const SfxItemSet* pSet, uno::Sequence< beans::Named bool bResult = false; if ( pSet ) { - SFX_ITEMSET_ARG(pSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA); + const SfxUnoAnyItem* pEncryptionDataItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pSet, SID_ENCRYPTIONDATA, false); if ( pEncryptionDataItem ) { pEncryptionDataItem->GetValue() >>= o_rEncryptionData; @@ -196,7 +196,7 @@ bool GetEncryptionData_Impl( const SfxItemSet* pSet, uno::Sequence< beans::Named } else { - SFX_ITEMSET_ARG(pSet, pPasswordItem, SfxStringItem, SID_PASSWORD); + const SfxStringItem* pPasswordItem = SfxItemSet::GetItem<SfxStringItem>(pSet, SID_PASSWORD, false); if ( pPasswordItem ) { OUString aPassword = pPasswordItem->GetValue(); @@ -639,15 +639,15 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) SfxItemSet* pSet = pMedium->GetItemSet(); if( !pImp->nEventId ) { - SFX_ITEMSET_ARG(pSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE); + const SfxBoolItem* pTemplateItem = SfxItemSet::GetItem<SfxBoolItem>(pSet, SID_TEMPLATE, false); SetActivateEvent_Impl( ( pTemplateItem && pTemplateItem->GetValue() ) ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); } - SFX_ITEMSET_ARG(pSet, pBaseItem, SfxStringItem, SID_BASEURL); + const SfxStringItem* pBaseItem = SfxItemSet::GetItem<SfxStringItem>(pSet, SID_BASEURL, false); OUString aBaseURL; - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE); + const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_DOC_SALVAGE, false); if( pBaseItem ) aBaseURL = pBaseItem->GetValue(); else @@ -694,7 +694,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) try { bool bWarnMediaTypeFallback = false; - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pRepairPackageItem, SfxBoolItem, SID_REPAIRPACKAGE); + const SfxBoolItem* pRepairPackageItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_REPAIRPACKAGE, false); // treat the package as broken if the mediatype was retrieved as a fallback uno::Reference< beans::XPropertySet > xStorProps( xStorage, uno::UNO_QUERY_THROW ); @@ -729,7 +729,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) if ( bOk ) { // the document loaded from template has no name - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE); + const SfxBoolItem* pTemplateItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_TEMPLATE, false); if ( !pTemplateItem || !pTemplateItem->GetValue() ) bHasName = true; } @@ -849,9 +849,9 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) if ( SfxObjectCreateMode::EMBEDDED != eCreateMode ) { - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pAsTempItem, SfxBoolItem, SID_TEMPLATE); - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pPreviewItem, SfxBoolItem, SID_PREVIEW); - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN); + const SfxBoolItem* pAsTempItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_TEMPLATE, false); + const SfxBoolItem* pPreviewItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_PREVIEW, false); + const SfxBoolItem* pHiddenItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_HIDDEN, false); if( bOk && !pMedium->GetOrigURL().isEmpty() && !( pAsTempItem && pAsTempItem->GetValue() ) && !( pPreviewItem && pPreviewItem->GetValue() ) @@ -861,7 +861,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) } } - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pDdeReconnectItem, SfxBoolItem, SID_DDE_RECONNECT_ONLOAD); + const SfxBoolItem* pDdeReconnectItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_DDE_RECONNECT_ONLOAD, false); bool bReconnectDde = true; // by default, we try to auto-connect DDE connections. if (pDdeReconnectItem) @@ -884,8 +884,8 @@ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDo { sal_uInt32 nError = ERRCODE_NONE; SfxItemSet* pSet = pMedium->GetItemSet(); - SFX_ITEMSET_ARG(pSet, pOptions, SfxStringItem, SID_FILE_FILTEROPTIONS); - SFX_ITEMSET_ARG(pSet, pData, SfxUnoAnyItem, SID_FILTER_DATA); + const SfxStringItem* pOptions = SfxItemSet::GetItem<SfxStringItem>(pSet, SID_FILE_FILTEROPTIONS, false); + const SfxUnoAnyItem* pData = SfxItemSet::GetItem<SfxUnoAnyItem>(pSet, SID_FILTER_DATA, false); if ( !pData && !pOptions ) { com::sun::star::uno::Reference< XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); @@ -942,11 +942,11 @@ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDo aNewParams, NULL ); - SFX_ITEMSET_ARG(&aNewParams, pFilterOptions, SfxStringItem, SID_FILE_FILTEROPTIONS); + const SfxStringItem* pFilterOptions = aNewParams.GetItem<SfxStringItem>(SID_FILE_FILTEROPTIONS, false); if ( pFilterOptions ) pSet->Put( *pFilterOptions ); - SFX_ITEMSET_ARG(&aNewParams, pFilterData, SfxUnoAnyItem, SID_FILTER_DATA); + const SfxUnoAnyItem* pFilterData = aNewParams.GetItem<SfxUnoAnyItem>(SID_FILTER_DATA, false); if ( pFilterData ) pSet->Put( *pFilterData ); } @@ -1191,7 +1191,7 @@ bool SfxObjectShell::SaveTo_Impl SfxItemSet *pMedSet = rMedium.GetItemSet(); if( pMedSet ) { - SFX_ITEMSET_ARG(pMedSet, pSaveToItem, SfxBoolItem, SID_SAVETO); + const SfxBoolItem* pSaveToItem = SfxItemSet::GetItem<SfxBoolItem>(pMedSet, SID_SAVETO, false); bCopyTo = GetCreateMode() == SfxObjectCreateMode::EMBEDDED || (pSaveToItem && pSaveToItem->GetValue()); } @@ -1415,9 +1415,7 @@ bool SfxObjectShell::SaveTo_Impl pFilter = rMedium.GetFilter(); - const SfxStringItem *pVersionItem = ( !rMedium.IsInCheckIn( ) && pSet ) - ? static_cast<const SfxStringItem*>( SfxRequest::GetItem( pSet, SID_DOCINFO_COMMENTS, false, checkSfxPoolItem< SfxStringItem > ) ) - : NULL; + const SfxStringItem *pVersionItem = !rMedium.IsInCheckIn()? SfxItemSet::GetItem<SfxStringItem>(pSet, SID_DOCINFO_COMMENTS, false): nullptr; OUString aTmpVersionURL; if ( bOk ) @@ -1505,9 +1503,7 @@ bool SfxObjectShell::SaveTo_Impl if ( bOk && pVersionItem && !rMedium.IsInCheckIn() ) { // store a version also - const SfxStringItem *pAuthorItem = pSet - ? static_cast<const SfxStringItem*>( SfxRequest::GetItem( pSet, SID_DOCINFO_AUTHOR, false, checkSfxPoolItem< SfxStringItem > ) ) - : NULL; + const SfxStringItem *pAuthorItem = SfxItemSet::GetItem<SfxStringItem>(pSet, SID_DOCINFO_AUTHOR, false); // version comment util::RevisionTag aInfo; @@ -2526,7 +2522,7 @@ bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) // an interaction handler here can acquire only in case of GUI Saving // and should be removed after the saving is done com::sun::star::uno::Reference< XInteractionHandler > xInteract; - SFX_ITEMSET_ARG(pArgs, pxInteractionItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER); + const SfxUnoAnyItem* pxInteractionItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pArgs, SID_INTERACTIONHANDLER, false); if ( pxInteractionItem && ( pxInteractionItem->GetValue() >>= xInteract ) && xInteract.is() ) pMediumTmp->GetItemSet()->Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, makeAny( xInteract ) ) ); @@ -2583,10 +2579,10 @@ bool SfxObjectShell::Save_Impl( const SfxItemSet* pSet ) pImp->bIsSaving = true; bool bSaved = false; - SFX_ITEMSET_ARG(GetMedium()->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE); + const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_DOC_SALVAGE, false); if ( pSalvageItem ) { - SFX_ITEMSET_ARG(GetMedium()->GetItemSet(), pFilterItem, SfxStringItem, SID_FILTER_NAME); + const SfxStringItem* pFilterItem = SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_FILTER_NAME, false); OUString aFilterName; const SfxFilter *pFilter = NULL; if ( pFilterItem ) @@ -2595,7 +2591,7 @@ bool SfxObjectShell::Save_Impl( const SfxItemSet* pSet ) SfxMedium *pMed = new SfxMedium( pSalvageItem->GetValue(), STREAM_READWRITE | StreamMode::SHARE_DENYWRITE | StreamMode::TRUNC, pFilter ); - SFX_ITEMSET_ARG(GetMedium()->GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD); + const SfxStringItem* pPasswordItem = SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_PASSWORD, false); if ( pPasswordItem ) pMed->GetItemSet()->Put( *pPasswordItem ); @@ -2651,7 +2647,7 @@ bool SfxObjectShell::CommonSaveAs_Impl DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "Illegal URL!" ); DBG_ASSERT( aParams->Count() != 0, "Incorrect Parameter"); - SFX_ITEMSET_ARG(aParams, pSaveToItem, SfxBoolItem, SID_SAVETO); + const SfxBoolItem* pSaveToItem = SfxItemSet::GetItem<SfxBoolItem>(aParams, SID_SAVETO, false); bool bSaveTo = pSaveToItem && pSaveToItem->GetValue(); const SfxFilter* pFilter = GetFactory().GetFilterContainer()->GetFilter4FilterName( aFilterName ); @@ -2663,7 +2659,7 @@ bool SfxObjectShell::CommonSaveAs_Impl return false; } - SFX_ITEMSET_ARG(aParams, pCopyStreamItem, SfxBoolItem, SID_COPY_STREAM_IF_POSSIBLE); + const SfxBoolItem* pCopyStreamItem = SfxItemSet::GetItem<SfxBoolItem>(aParams, SID_COPY_STREAM_IF_POSSIBLE, false); if ( bSaveTo && pCopyStreamItem && pCopyStreamItem->GetValue() && !IsModified() ) { if ( pMedium->TryDirectTransfer( aURL.GetMainURL( INetURLObject::NO_DECODE ), *aParams ) ) @@ -2821,7 +2817,7 @@ bool SfxObjectShell::PreDoSaveAs_Impl } // check if a "SaveTo" is wanted, no "SaveAs" - SFX_ITEMSET_ARG(pParams, pSaveToItem, SfxBoolItem, SID_SAVETO); + const SfxBoolItem* pSaveToItem = SfxItemSet::GetItem<SfxBoolItem>(pParams, SID_SAVETO, false); bool bCopyTo = GetCreateMode() == SfxObjectCreateMode::EMBEDDED || (pSaveToItem && pSaveToItem->GetValue()); // distinguish between "Save" and "SaveAs" @@ -3047,7 +3043,7 @@ bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium ) if ( xStorage.is() ) { // Password - SFX_ITEMSET_ARG(rMedium.GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD); + const SfxStringItem* pPasswdItem = SfxItemSet::GetItem<SfxStringItem>(rMedium.GetItemSet(), SID_PASSWORD, false); if ( pPasswdItem || ERRCODE_IO_ABORT != CheckPasswd_Impl( this, SfxGetpApp()->GetPool(), pMedium ) ) { uno::Sequence< beans::NamedValue > aEncryptionData; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 1a8c6c750dee..e5207d06accf 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -1105,8 +1105,8 @@ Reference<lang::XComponent> SfxObjectShell::CreateAndLoadComponent( const SfxIte { uno::Sequence < beans::PropertyValue > aProps; TransformItems( SID_OPENDOC, rSet, aProps ); - SFX_ITEMSET_ARG(&rSet, pFileNameItem, SfxStringItem, SID_FILE_NAME); - SFX_ITEMSET_ARG(&rSet, pTargetItem, SfxStringItem, SID_TARGETNAME); + const SfxStringItem* pFileNameItem = rSet.GetItem<SfxStringItem>(SID_FILE_NAME, false); + const SfxStringItem* pTargetItem = rSet.GetItem<SfxStringItem>(SID_TARGETNAME, false); OUString aURL; OUString aTarget("_blank"); if ( pFileNameItem ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index a0d2d7d6ff44..ed11d795dcdf 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -940,12 +940,12 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const OUString& aSet.ClearItem( SID_FILLFRAME ); pMedium->GetItemSet()->Put( aSet ); - SFX_ITEMSET_ARG(&aSet, pItem, SfxStringItem, SID_FILTER_NAME); + const SfxStringItem* pItem = aSet.GetItem<SfxStringItem>(SID_FILTER_NAME, false); if ( pItem ) pMedium->SetFilter( pObjectShell->GetFactory().GetFilterContainer()->GetFilter4FilterName( pItem->GetValue() ) ); - SFX_ITEMSET_ARG(&aSet, pTitleItem, SfxStringItem, SID_DOCINFO_TITLE); + const SfxStringItem* pTitleItem = aSet.GetItem<SfxStringItem>(SID_DOCINFO_TITLE, false); if ( pTitleItem ) { SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjectShell ); @@ -1669,7 +1669,7 @@ void SAL_CALL SfxBaseModel::storeAsURL( const OUString& rURL loadCmisProperties( ); #if OSL_DEBUG_LEVEL > 0 - SFX_ITEMSET_ARG(m_pData->m_pObjectShell->GetMedium()->GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD); + const SfxStringItem* pPasswdItem = SfxItemSet::GetItem<SfxStringItem>(m_pData->m_pObjectShell->GetMedium()->GetItemSet(), SID_PASSWORD, false); OSL_ENSURE( !pPasswdItem, "There should be no Password property in the document MediaDescriptor!" ); #endif } @@ -1799,7 +1799,7 @@ void setUpdatePickList( SfxMedium* pMedium ) return; bool bHidden = false; - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN); + const SfxBoolItem* pHidItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_HIDDEN, false); if (pHidItem) bHidden = pHidItem->GetValue(); @@ -1843,7 +1843,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA } OUString aFilterName; - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pFilterNameItem, SfxStringItem, SID_FILTER_NAME); + const SfxStringItem* pFilterNameItem = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_FILTER_NAME, false); if( pFilterNameItem ) aFilterName = pFilterNameItem->GetValue(); if( !m_pData->m_pObjectShell->GetFactory().GetFilterContainer()->GetFilter4FilterName( aFilterName ) ) @@ -1853,7 +1853,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA throw frame::IllegalArgumentIOException(); } - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE); + const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_DOC_SALVAGE, false); bool bSalvage = pSalvageItem != nullptr; // load document @@ -1868,7 +1868,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA if ( nError == ERRCODE_IO_BROKENPACKAGE && xHandler.is() ) { OUString aDocName = pMedium->GetURLObject().getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pRepairItem, SfxBoolItem, SID_REPAIRPACKAGE); + const SfxBoolItem* pRepairItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_REPAIRPACKAGE, false); if ( !pRepairItem || !pRepairItem->GetValue() ) { RequestPackageReparation aRequest( aDocName ); @@ -1907,7 +1907,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA if( bSalvage ) { // file recovery: restore original filter - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pFilterItem, SfxStringItem, SID_FILTER_NAME); + const SfxStringItem* pFilterItem = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_FILTER_NAME, false); SfxFilterMatcher& rMatcher = SfxGetpApp()->GetFilterMatcher(); const SfxFilter* pSetFilter = rMatcher.GetFilter4FilterName( pFilterItem->GetValue() ); pMedium->SetFilter( pSetFilter ); @@ -1917,7 +1917,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA // TODO/LATER: may be the mode should be retrieved from outside and the preused filter should not be set if ( m_pData->m_pObjectShell->GetCreateMode() == SfxObjectCreateMode::EMBEDDED ) { - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pFilterItem, SfxStringItem, SID_FILTER_NAME); + const SfxStringItem* pFilterItem = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_FILTER_NAME, false); if ( pFilterItem ) m_pData->m_aPreusedFilterName = pFilterItem->GetValue(); } @@ -1932,7 +1932,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA setUpdatePickList(pMedium); #if OSL_DEBUG_LEVEL > 0 - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD); + const SfxStringItem* pPasswdItem = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_PASSWORD, false); OSL_ENSURE( !pPasswdItem, "There should be no Password property in the document MediaDescriptor!" ); #endif } @@ -2680,7 +2680,7 @@ SfxMedium* SfxBaseModel::handleLoadError( sal_uInt32 nError, SfxMedium* pMedium } bool bSilent = false; - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pSilentItem, SfxBoolItem, SID_SILENT); + const SfxBoolItem* pSilentItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_SILENT, false); if( pSilentItem ) bSilent = pSilentItem->GetValue(); @@ -3019,7 +3019,7 @@ void SfxBaseModel::impl_store( const OUString& sURL TransformParameters( SID_SAVEASDOC, seqArguments, *aParams ); - SFX_ITEMSET_ARG(aParams, pCopyStreamItem, SfxBoolItem, SID_COPY_STREAM_IF_POSSIBLE); + const SfxBoolItem* pCopyStreamItem = SfxItemSet::GetItem<SfxBoolItem>(aParams, SID_COPY_STREAM_IF_POSSIBLE, false); if ( pCopyStreamItem && pCopyStreamItem->GetValue() && !bSaveTo ) { @@ -3032,7 +3032,7 @@ void SfxBaseModel::impl_store( const OUString& sURL sal_uInt32 nModifyPasswordHash = 0; Sequence< beans::PropertyValue > aModifyPasswordInfo; - SFX_ITEMSET_ARG(aParams, pModifyPasswordInfoItem, SfxUnoAnyItem, SID_MODIFYPASSWORDINFO); + const SfxUnoAnyItem* pModifyPasswordInfoItem = SfxItemSet::GetItem<SfxUnoAnyItem>(aParams, SID_MODIFYPASSWORDINFO, false); if ( pModifyPasswordInfoItem ) { // it contains either a simple hash or a set of PropertyValues @@ -3073,7 +3073,7 @@ void SfxBaseModel::impl_store( const OUString& sURL } Reference < task::XInteractionHandler > xHandler; - SFX_ITEMSET_ARG(aParams, pItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER); + const SfxUnoAnyItem* pItem = SfxItemSet::GetItem<SfxUnoAnyItem>(aParams, SID_INTERACTIONHANDLER, false); if ( pItem ) pItem->GetValue() >>= xHandler; @@ -3739,7 +3739,7 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const Reference< embed::XStorage >& // allow to use an interactionhandler (if there is one) pMedium->UseInteractionHandler( true ); - SFX_ITEMSET_ARG(&aSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE); + const SfxBoolItem* pTemplateItem = aSet.GetItem<SfxBoolItem>(SID_TEMPLATE, false); bool bTemplate = pTemplateItem && pTemplateItem->GetValue(); m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = false; @@ -3773,7 +3773,7 @@ void SAL_CALL SfxBaseModel::storeToStorage( const Reference< embed::XStorage >& TransformParameters( SID_SAVEASDOC, aMediaDescriptor, aSet ); // TODO/LATER: may be a special URL "private:storage" should be used - SFX_ITEMSET_ARG(&aSet, pItem, SfxStringItem, SID_FILTER_NAME); + const SfxStringItem* pItem = aSet.GetItem<SfxStringItem>(SID_FILTER_NAME, false); sal_Int32 nVersion = SOFFICE_FILEFORMAT_CURRENT; if( pItem ) { @@ -3998,7 +3998,7 @@ OUString SAL_CALL SfxBaseModel::getTitle() catch (const ucb::CommandAbortedException &) { } - SFX_ITEMSET_ARG(pMedium->GetItemSet(), pRepairedDocItem, SfxBoolItem, SID_REPAIRPACKAGE); + const SfxBoolItem* pRepairedDocItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_REPAIRPACKAGE, false); if ( pRepairedDocItem && pRepairedDocItem->GetValue() ) aResult += SfxResId(STR_REPAIREDDOCUMENT).toString(); } |