[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Dec 18 09:28:12 UTC 2018
include/sfx2/filedlghelper.hxx | 6 +++---
sfx2/source/appl/appopen.cxx | 6 +++---
sfx2/source/dialog/filedlghelper.cxx | 18 +++++++++---------
sfx2/source/dialog/filedlgimpl.hxx | 2 +-
sfx2/source/doc/guisaveas.cxx | 11 +++++------
5 files changed, 21 insertions(+), 22 deletions(-)
New commits:
commit 574678cf92d50abf456ebbb56b9ea6cc5ca5ecf6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 18 08:25:52 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 18 10:27:47 2018 +0100
use unique_ptr in FileOpenDialog_Impl
Change-Id: I530d26a489a130c9fdfa105b3891d21cbfeb3379
Reviewed-on: https://gerrit.libreoffice.org/65305
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx
index 2a2374a0b728..2e2104eeb7fc 100644
--- a/include/sfx2/filedlghelper.hxx
+++ b/include/sfx2/filedlghelper.hxx
@@ -230,10 +230,10 @@ public:
DECL_LINK( ExecuteSystemFilePicker, void*, void );
ErrCode Execute( std::vector<OUString>& rpURLList,
- SfxItemSet *& rpSet,
+ std::unique_ptr<SfxItemSet>& rpSet,
OUString& rFilter,
const OUString& rDirPath );
- ErrCode Execute( SfxItemSet *& rpSet,
+ ErrCode Execute( std::unique_ptr<SfxItemSet>& rpSet,
OUString& rFilter );
};
@@ -247,7 +247,7 @@ ErrCode FileOpenDialog_Impl( weld::Window* pParent,
FileDialogFlags nFlags,
std::vector<OUString>& rpURLList,
OUString& rFilter,
- SfxItemSet *& rpSet,
+ std::unique_ptr<SfxItemSet>& rpSet,
const OUString* pPath,
sal_Int16 nDialog,
const OUString& rStandardDir,
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index c54b3e58580b..a4ff9c8fe23f 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -594,7 +594,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
// get FileName from dialog
std::vector<OUString> aURLList;
OUString aFilter;
- SfxItemSet* pSet = nullptr;
+ std::unique_ptr<SfxItemSet> pSet;
OUString aPath;
const SfxStringItem* pFolderNameItem = rReq.GetArg<SfxStringItem>(SID_PATH);
if ( pFolderNameItem )
@@ -648,12 +648,12 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
return;
}
- rReq.SetArgs( *static_cast<SfxAllItemSet*>(pSet) );
+ rReq.SetArgs( *static_cast<SfxAllItemSet*>(pSet.get()) );
if ( !aFilter.isEmpty() )
rReq.AppendItem( SfxStringItem( SID_FILTER_NAME, aFilter ) );
rReq.AppendItem( SfxStringItem( SID_TARGETNAME, "_default" ) );
rReq.AppendItem( SfxStringItem( SID_REFERER, "private:user" ) );
- delete pSet;
+ pSet.reset();
if(!aURLList.empty())
{
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index c6133a2bf243..016e4ecdbd70 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1387,7 +1387,7 @@ void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterfac
}
ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
- SfxItemSet *& rpSet,
+ std::unique_ptr<SfxItemSet>& rpSet,
OUString& rFilter )
{
// rFilter is a pure output parameter, it shouldn't be used for anything else
@@ -1403,15 +1403,15 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
// check password checkbox if the document had password before
if( mbHasPassword )
{
- const SfxBoolItem* pPassItem = SfxItemSet::GetItem<SfxBoolItem>(rpSet, SID_PASSWORDINTERACTION, false);
+ const SfxBoolItem* pPassItem = SfxItemSet::GetItem<SfxBoolItem>(rpSet.get(), SID_PASSWORDINTERACTION, false);
mbPwdCheckBoxState = ( pPassItem != nullptr && pPassItem->GetValue() );
// in case the document has password to modify, the dialog should be shown
- const SfxUnoAnyItem* pPassToModifyItem = SfxItemSet::GetItem<SfxUnoAnyItem>(rpSet, SID_MODIFYPASSWORDINFO, false);
+ const SfxUnoAnyItem* pPassToModifyItem = SfxItemSet::GetItem<SfxUnoAnyItem>(rpSet.get(), SID_MODIFYPASSWORDINFO, false);
mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue().hasValue() );
}
- const SfxBoolItem* pSelectItem = SfxItemSet::GetItem<SfxBoolItem>(rpSet, SID_SELECTION, false);
+ const SfxBoolItem* pSelectItem = SfxItemSet::GetItem<SfxBoolItem>(rpSet.get(), SID_SELECTION, false);
if ( pSelectItem )
mbSelection = pSelectItem->GetValue();
else
@@ -1442,7 +1442,7 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
{
// create an itemset if there is no
if( !rpSet )
- rpSet = new SfxAllItemSet( SfxGetpApp()->GetPool() );
+ rpSet.reset(new SfxAllItemSet( SfxGetpApp()->GetPool() ));
// the item should remain only if it was set by the dialog
rpSet->ClearItem( SID_SELECTION );
@@ -1518,7 +1518,7 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
{
// ask for a password
OUString aDocName(rpURLList[0]);
- ErrCode errCode = RequestPassword(pCurrentFilter, aDocName, rpSet, GetFrameInterface());
+ ErrCode errCode = RequestPassword(pCurrentFilter, aDocName, rpSet.get(), GetFrameInterface());
if (errCode != ERRCODE_NONE)
return errCode;
}
@@ -2367,7 +2367,7 @@ IMPL_LINK_NOARG(FileDialogHelper, ExecuteSystemFilePicker, void*, void)
// rDirPath has to be a directory
ErrCode FileDialogHelper::Execute( std::vector<OUString>& rpURLList,
- SfxItemSet *& rpSet,
+ std::unique_ptr<SfxItemSet>& rpSet,
OUString& rFilter,
const OUString& rDirPath )
{
@@ -2381,7 +2381,7 @@ ErrCode FileDialogHelper::Execute()
return mpImpl->execute();
}
-ErrCode FileDialogHelper::Execute( SfxItemSet *& rpSet,
+ErrCode FileDialogHelper::Execute( std::unique_ptr<SfxItemSet>& rpSet,
OUString& rFilter )
{
ErrCode nRet;
@@ -2630,7 +2630,7 @@ ErrCode FileOpenDialog_Impl( weld::Window* pParent,
FileDialogFlags nFlags,
std::vector<OUString>& rpURLList,
OUString& rFilter,
- SfxItemSet *& rpSet,
+ std::unique_ptr<SfxItemSet>& rpSet,
const OUString* pPath,
sal_Int16 nDialog,
const OUString& rStandardDir,
diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx
index 23830ddcad84..57f73d5c79e3 100644
--- a/sfx2/source/dialog/filedlgimpl.hxx
+++ b/sfx2/source/dialog/filedlgimpl.hxx
@@ -177,7 +177,7 @@ namespace sfx2
virtual ~FileDialogHelper_Impl() override;
ErrCode execute( std::vector<OUString>& rpURLList,
- SfxItemSet *& rpSet,
+ std::unique_ptr<SfxItemSet>& rpSet,
OUString& rFilter );
ErrCode execute();
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 0e78de6ff18e..ff34b7dcebea 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -961,18 +961,17 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode,
// generate SidSet from MediaDescriptor and provide it into FileDialog
// than merge changed SidSet back
- SfxAllItemSet aDialogParams( SfxGetpApp()->GetPool() );
- SfxItemSet* pDialogParams = &aDialogParams;
+ std::unique_ptr<SfxItemSet> pDialogParams(new SfxAllItemSet( SfxGetpApp()->GetPool() ));
TransformParameters( nSlotID,
GetMediaDescr().getAsConstPropertyValueList(),
- aDialogParams );
+ static_cast<SfxAllItemSet&>(*pDialogParams) );
const SfxPoolItem* pItem = nullptr;
- if ( bPreselectPassword && aDialogParams.GetItemState( SID_ENCRYPTIONDATA, true, &pItem ) != SfxItemState::SET )
+ if ( bPreselectPassword && pDialogParams->GetItemState( SID_ENCRYPTIONDATA, true, &pItem ) != SfxItemState::SET )
{
// the file dialog preselects the password checkbox if the provided mediadescriptor has encryption data entry
// after dialog execution the password interaction flag will be either removed or not
- aDialogParams.Put( SfxBoolItem( SID_PASSWORDINTERACTION, true ) );
+ pDialogParams->Put( SfxBoolItem( SID_PASSWORDINTERACTION, true ) );
}
// aFilterName is a pure output parameter, pDialogParams is an in/out parameter
@@ -986,7 +985,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode,
// the following two arguments can not be converted in MediaDescriptor,
// so they should be removed from the ItemSet after retrieving
- const SfxBoolItem* pRecommendReadOnly = SfxItemSet::GetItem<SfxBoolItem>(pDialogParams, SID_RECOMMENDREADONLY, false);
+ const SfxBoolItem* pRecommendReadOnly = SfxItemSet::GetItem<SfxBoolItem>(pDialogParams.get(), SID_RECOMMENDREADONLY, false);
m_bRecommendReadOnly = ( pRecommendReadOnly && pRecommendReadOnly->GetValue() );
pDialogParams->ClearItem( SID_RECOMMENDREADONLY );
More information about the Libreoffice-commits
mailing list