fpicker/source/aqua/ControlHelper.mm | 13 +++++++------ fpicker/source/aqua/SalAquaFilePicker.mm | 3 ++- fpicker/source/office/OfficeFilePicker.cxx | 13 ++++--------- fpicker/source/office/RemoteFilesDialog.cxx | 6 ++++-- fpicker/source/office/contentenumeration.cxx | 26 ++++++++++++-------------- fpicker/source/office/iodlg.cxx | 14 ++++++++------ 6 files changed, 37 insertions(+), 38 deletions(-)
New commits: commit b3bf75786f6cfd3feae735ae705e87f48d8059ed Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Oct 29 09:43:43 2021 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sat Oct 30 10:32:07 2021 +0200 Prepare for removal of non-const operator[] from Sequence in fpicker Change-Id: I918b785082b89833839fc0a7eeb7cb36a91f897a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124369 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/fpicker/source/aqua/ControlHelper.mm b/fpicker/source/aqua/ControlHelper.mm index 1feb6d9458a2..88f0b655cb58 100644 --- a/fpicker/source/aqua/ControlHelper.mm +++ b/fpicker/source/aqua/ControlHelper.mm @@ -66,12 +66,13 @@ uno::Any HandleGetListValue(const NSControl* pControl, const sal_Int16 nControlA int nItems = [rMenu numberOfItems]; if (nItems > 0) { aItemList.realloc(nItems); - } - for (int i = 0; i < nItems; i++) { - NSString* sCFItem = [pButton itemTitleAtIndex:i]; - if (nil != sCFItem) { - aItemList[i] = [sCFItem OUString]; - SAL_INFO("fpicker.aqua","Return value[" << (i - 1) << "]: " << aItemList[i - 1]); + OUString* pItemList = aItemList.getArray(); + for (int i = 0; i < nItems; i++) { + NSString* sCFItem = [pButton itemTitleAtIndex:i]; + if (nil != sCFItem) { + pItemList[i] = [sCFItem OUString]; + SAL_INFO("fpicker.aqua","Return value[" << (i - 1) << "]: " << aItemList[i - 1]); + } } } diff --git a/fpicker/source/aqua/SalAquaFilePicker.mm b/fpicker/source/aqua/SalAquaFilePicker.mm index fa2ec600c2ec..01e6f80e92b5 100644 --- a/fpicker/source/aqua/SalAquaFilePicker.mm +++ b/fpicker/source/aqua/SalAquaFilePicker.mm @@ -250,6 +250,7 @@ uno::Sequence<OUString> SAL_CALL SalAquaFilePicker::getSelectedFiles() SAL_INFO("fpicker.aqua", "# of items: " << nFiles); uno::Sequence< OUString > aSelectedFiles(nFiles); + OUString* pSelectedFiles = aSelectedFiles.getArray(); for(NSUInteger nIndex = 0; nIndex < nFiles; nIndex += 1) { @@ -279,7 +280,7 @@ uno::Sequence<OUString> SAL_CALL SalAquaFilePicker::getSelectedFiles() OUString sFileOrDirURL = [url OUString]; - aSelectedFiles[nIndex] = sFileOrDirURL; + pSelectedFiles[nIndex] = sFileOrDirURL; } return aSelectedFiles; diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 3386979e4714..49a00f429fb2 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -773,12 +773,7 @@ Sequence< sal_Int16 > SAL_CALL SvtFilePicker::getSupportedImageFormats() { checkAlive(); - SolarMutexGuard aGuard; - Sequence< sal_Int16 > aFormats( 1 ); - - aFormats[0] = FilePreviewImageFormats::BITMAP; - - return aFormats; + return { FilePreviewImageFormats::BITMAP }; } sal_Int32 SAL_CALL SvtFilePicker::getTargetColorDepth() @@ -953,19 +948,19 @@ void SAL_CALL SvtFilePicker::initialize( const Sequence< Any >& _rArguments ) { // compatibility: one argument, type sal_Int16 , specifies the service type int index = 0; - + auto pArguments = aArguments.getArray(); if (_rArguments[0] >>= m_nServiceType) { // skip the first entry if it was the ServiceType, because it's not needed in OCommonPicker::initialize and it's not a NamedValue NamedValue emptyNamedValue; - aArguments[0] <<= emptyNamedValue; + pArguments[0] <<= emptyNamedValue; index = 1; } for ( int i = index; i < _rArguments.getLength(); i++) { NamedValue namedValue; - aArguments[i] = _rArguments[i]; + pArguments[i] = _rArguments[i]; if (aArguments[i] >>= namedValue ) { diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 2e7ac67ead37..b7efa8071116 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -146,13 +146,15 @@ RemoteFilesDialog::~RemoteFilesDialog() if( m_bIsUpdated ) { Sequence< OUString > placesUrlsList( m_aServices.size() ); + auto placesUrlsListRange = asNonConstRange(placesUrlsList); Sequence< OUString > placesNamesList( m_aServices.size() ); + auto placesNamesListRange = asNonConstRange(placesNamesList); int i = 0; for (auto const& service : m_aServices) { - placesUrlsList[i] = service->GetUrl(); - placesNamesList[i] = service->GetName(); + placesUrlsListRange[i] = service->GetUrl(); + placesNamesListRange[i] = service->GetName(); ++i; } diff --git a/fpicker/source/office/contentenumeration.cxx b/fpicker/source/office/contentenumeration.cxx index b167fef3d190..737808e10b62 100644 --- a/fpicker/source/office/contentenumeration.cxx +++ b/fpicker/source/office/contentenumeration.cxx @@ -139,20 +139,18 @@ namespace svt { Reference< XResultSet > xResultSet; - Sequence< OUString > aProps(12); - - aProps[0] = "Title"; - aProps[1] = "Size"; - aProps[2] = "DateModified"; - aProps[3] = "DateCreated"; - aProps[4] = "IsFolder"; - aProps[5] = "TargetURL"; - aProps[6] = "IsHidden"; - aProps[7] = "IsVolume"; - aProps[8] = "IsRemote"; - aProps[9] = "IsRemoveable"; - aProps[10] = "IsFloppy"; - aProps[11] = "IsCompactDisc"; + Sequence< OUString > aProps{ "Title", + "Size", + "DateModified", + "DateCreated", + "IsFolder", + "TargetURL", + "IsHidden", + "IsVolume", + "IsRemote", + "IsRemoveable", + "IsFloppy", + "IsCompactDisc" }; Reference< XCommandEnvironment > xEnvironment; try diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 6d863e1d2f3f..880a24a2c15c 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -481,13 +481,15 @@ SvtFileDialog::~SvtFileDialog() const std::vector<PlacePtr> aPlaces = m_xImpl->m_xPlaces->GetPlaces(); Sequence< OUString > placesUrlsList(m_xImpl->m_xPlaces->GetNbEditablePlaces()); + auto placesUrlsListRange = asNonConstRange(placesUrlsList); Sequence< OUString > placesNamesList(m_xImpl->m_xPlaces->GetNbEditablePlaces()); + auto placesNamesListRange = asNonConstRange(placesNamesList); int i(0); for (auto const& place : aPlaces) { if(place->IsEditable()) { - placesUrlsList[i] = place->GetUrl(); - placesNamesList[i] = place->GetName(); + placesUrlsListRange[i] = place->GetUrl(); + placesNamesListRange[i] = place->GetName(); ++i; } } @@ -1388,12 +1390,12 @@ void SvtFileDialog::displayIOException( const OUString& _rURL, IOErrorCode _eCod // build an own exception which tells "access denied" InteractiveAugmentedIOException aException; - aException.Arguments.realloc( 2 ); - aException.Arguments[ 0 ] <<= sDisplayPath; - aException.Arguments[ 1 ] <<= PropertyValue( + aException.Arguments = + { css::uno::Any(sDisplayPath), + css::uno::Any(PropertyValue( "Uri", -1, aException.Arguments[ 0 ], PropertyState_DIRECT_VALUE - ); + )) }; // (formerly, it was sufficient to put the URL first parameter. Nowadays, // the services expects the URL in a PropertyValue named "Uri" ...) aException.Code = _eCode;