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.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2021-10-29 09:43:43 +03:00
parent f662ba9536
commit b3bf75786f
6 changed files with 37 additions and 38 deletions

View file

@ -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]);
}
}
}

View file

@ -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;

View file

@ -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 )
{

View file

@ -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;
}

View file

@ -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

View file

@ -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;