Prepare for removal of non-const operator[] from Sequence in connectivity

Change-Id: If92f9af5e248f4b066359fe043adf221102e8561
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124353
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2021-10-28 21:15:12 +03:00
parent 5661f257f9
commit 089dbfda13
20 changed files with 78 additions and 105 deletions

View File

@@ -120,10 +120,10 @@ namespace connectivity
{ {
Reference< XJavaVM > xVM = JavaVirtualMachine::create(_rxContext); Reference< XJavaVM > xVM = JavaVirtualMachine::create(_rxContext);
Sequence<sal_Int8> processID(16); Sequence<sal_Int8> processID(17); // 16 + 1
rtl_getGlobalProcessId( reinterpret_cast<sal_uInt8*>(processID.getArray()) ); auto pprocessID = processID.getArray();
processID.realloc(17); rtl_getGlobalProcessId( reinterpret_cast<sal_uInt8*>(pprocessID) );
processID[16] = 0; pprocessID[16] = 0; // RETURN_VIRTUALMACHINE
Any uaJVM = xVM->getJavaVM( processID ); Any uaJVM = xVM->getJavaVM( processID );
sal_Int64 nTemp; sal_Int64 nTemp;

View File

@@ -122,7 +122,7 @@ css::uno::Sequence< OUString > SAL_CALL OConnectionWrapper::getSupportedServiceN
{ {
sal_Int32 nLen = aSupported.getLength(); sal_Int32 nLen = aSupported.getLength();
aSupported.realloc( nLen + 1 ); aSupported.realloc( nLen + 1 );
aSupported[ nLen ] = sConnectionService; aSupported.getArray()[ nLen ] = sConnectionService;
} }
// outta here // outta here

View File

@@ -279,9 +279,7 @@ static Reference< XConnection > getConnection_allowException(
Reference<XInitialization> xIni(xDataSource, UNO_QUERY); Reference<XInitialization> xIni(xDataSource, UNO_QUERY);
if (xIni.is()) if (xIni.is())
{ {
Sequence< Any > aArgs(1); Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", makeAny(_rxParent) )) };
NamedValue aParam( "ParentWindow", makeAny(_rxParent) );
aArgs[0] <<= aParam;
xIni->initialize(aArgs); xIni->initialize(aArgs);
} }
@@ -319,9 +317,7 @@ static Reference< XConnection > getConnection_allowException(
if (xIni.is()) if (xIni.is())
{ {
Sequence< Any > aArgs(1); Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", makeAny(Reference<XWindow>()) )) };
NamedValue aParam( "ParentWindow", makeAny(Reference<XWindow>()) );
aArgs[0] <<= aParam;
xIni->initialize(aArgs); xIni->initialize(aArgs);
} }

View File

@@ -158,7 +158,7 @@ namespace dbtools::param
aProperties = m_xDelegatorPSI->getProperties(); aProperties = m_xDelegatorPSI->getProperties();
sal_Int32 nProperties( aProperties.getLength() ); sal_Int32 nProperties( aProperties.getLength() );
aProperties.realloc( nProperties + 1 ); aProperties.realloc( nProperties + 1 );
aProperties[ nProperties ] = Property( aProperties.getArray()[ nProperties ] = Property(
"Value", "Value",
PROPERTY_ID_VALUE, PROPERTY_ID_VALUE,
::cppu::UnoType< Any >::get(), ::cppu::UnoType< Any >::get(),

View File

@@ -295,8 +295,7 @@ Reference< XInterface > OPoolCollection::createWithProvider(const Reference< XMu
const OUString& _rPath) const OUString& _rPath)
{ {
OSL_ASSERT(_rxConfProvider.is()); OSL_ASSERT(_rxConfProvider.is());
Sequence< Any > args(1); Sequence< Any > args{ Any(NamedValue( "nodepath", makeAny(_rPath))) };
args[0] <<= NamedValue( "nodepath", makeAny(_rPath));
Reference< XInterface > xInterface( Reference< XInterface > xInterface(
_rxConfProvider->createInstanceWithArguments( _rxConfProvider->createInstanceWithArguments(
"com.sun.star.configuration.ConfigurationAccess", "com.sun.star.configuration.ConfigurationAccess",

View File

@@ -104,18 +104,17 @@ Reference< XSpreadsheetDocument> const & OCalcConnection::acquireDoc()
return m_xDoc; return m_xDoc;
} }
// open read-only as long as updating isn't implemented // open read-only as long as updating isn't implemented
Sequence<PropertyValue> aArgs(2); Sequence<PropertyValue> aArgs(m_sPassword.isEmpty() ? 2 : 3);
aArgs[0].Name = "Hidden"; auto pArgs = aArgs.getArray();
aArgs[0].Value <<= true; pArgs[0].Name = "Hidden";
aArgs[1].Name = "ReadOnly"; pArgs[0].Value <<= true;
aArgs[1].Value <<= true; pArgs[1].Name = "ReadOnly";
pArgs[1].Value <<= true;
if ( !m_sPassword.isEmpty() ) if ( !m_sPassword.isEmpty() )
{ {
const sal_Int32 nPos = aArgs.getLength(); pArgs[2].Name = "Password";
aArgs.realloc(nPos+1); pArgs[2].Value <<= m_sPassword;
aArgs[nPos].Name = "Password";
aArgs[nPos].Value <<= m_sPassword;
} }
Reference< XDesktop2 > xDesktop = Desktop::create( getDriver()->getComponentContext() ); Reference< XDesktop2 > xDesktop = Desktop::create( getDriver()->getComponentContext() );

View File

@@ -2332,10 +2332,10 @@ namespace
{ {
Content aContent(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext()); Content aContent(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
Sequence< PropertyValue > aProps( 1 ); Sequence< PropertyValue > aProps{ { "Title",
aProps[0].Name = "Title"; -1, // n/a
aProps[0].Handle = -1; // n/a Any(sNewName),
aProps[0].Value <<= sNewName; css::beans::PropertyState_DIRECT_VALUE } };
Sequence< Any > aValues; Sequence< Any > aValues;
aContent.executeCommand( "setPropertyValues",makeAny(aProps) ) >>= aValues; aContent.executeCommand( "setPropertyValues",makeAny(aProps) ) >>= aValues;
if(aValues.hasElements() && aValues[0].hasValue()) if(aValues.hasElements() && aValues[0].hasValue())

View File

@@ -32,6 +32,7 @@
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData2.hpp> #include <com/sun/star/sdbc/XDatabaseMetaData2.hpp>
#include <comphelper/propertyvalue.hxx>
#include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/exc_hlp.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <sal/log.hxx> #include <sal/log.hxx>
@@ -315,13 +316,12 @@ namespace connectivity::hsqldb
xProvider.set( GraphicProvider::create(m_xContext) ); xProvider.set( GraphicProvider::create(m_xContext) );
// ask the provider to obtain a graphic // ask the provider to obtain a graphic
Sequence< PropertyValue > aMediaProperties( 1 ); Sequence< PropertyValue > aMediaProperties{ comphelper::makePropertyValue(
aMediaProperties[0].Name = "URL"; "URL", OUString(
aMediaProperties[0].Value <<= OUString( // load the graphic from the global graphic repository
// load the graphic from the global graphic repository "private:graphicrepository/"
"private:graphicrepository/" // the relative path within the images.zip
// the relative path within the images.zip LINKED_TEXT_TABLE_IMAGE_RESOURCE)) };
LINKED_TEXT_TABLE_IMAGE_RESOURCE);
xGraphic = xProvider->queryGraphic( aMediaProperties ); xGraphic = xProvider->queryGraphic( aMediaProperties );
OSL_ENSURE( xGraphic.is(), "OHsqlConnection::impl_getTextTableIcon_nothrow: the provider did not give us a graphic object!" ); OSL_ENSURE( xGraphic.is(), "OHsqlConnection::impl_getTextTableIcon_nothrow: the provider did not give us a graphic object!" );
} }

View File

@@ -26,6 +26,8 @@
#include <string.h> #include <string.h>
#include <algorithm>
using namespace ::com::sun::star::container; using namespace ::com::sun::star::container;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::embed; using namespace ::com::sun::star::embed;
@@ -229,7 +231,7 @@ jint read_from_storage_stream_into_buffer( JNIEnv * env, jstring name, jstring k
if (nBytesRead <= 0) if (nBytesRead <= 0)
return -1; return -1;
env->SetByteArrayRegion(buffer,off,nBytesRead,reinterpret_cast<jbyte*>(&aData[0])); env->SetByteArrayRegion(buffer,off,nBytesRead,reinterpret_cast<const jbyte*>(&aData[0]));
return nBytesRead; return nBytesRead;
} }
@@ -299,10 +301,8 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nativ
} }
Sequence< sal_Int32 > ch(4); Sequence< sal_Int32 > ch(4);
for(sal_Int32 i = 0;i < 4; ++i) std::transform(aData.begin(), aData.end(), ch.getArray(),
{ [](auto c) { return static_cast<unsigned char>(c); });
ch[i] = static_cast<unsigned char>(aData[i]);
}
if ((ch[0] | ch[1] | ch[2] | ch[3]) < 0) if ((ch[0] | ch[1] | ch[2] | ch[3]) < 0)
{ {

View File

@@ -277,7 +277,7 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
} }
OSL_ENSURE(nLen >= nBytesRead,"Buffer is too small!"); OSL_ENSURE(nLen >= nBytesRead,"Buffer is too small!");
OSL_ENSURE(aData.getLength() >= nBytesRead,"Buffer is too small!"); OSL_ENSURE(aData.getLength() >= nBytesRead,"Buffer is too small!");
env->SetByteArrayRegion(buffer, 0, nBytesRead, reinterpret_cast<jbyte*>(&aData[0])); env->SetByteArrayRegion(buffer, 0, nBytesRead, reinterpret_cast<const jbyte*>(&aData[0]));
#ifdef HSQLDB_DBG #ifdef HSQLDB_DBG
aDataLog.write( &aData[0], nBytesRead ); aDataLog.write( &aData[0], nBytesRead );
#endif #endif

View File

@@ -168,11 +168,12 @@ namespace connectivity::mozab
sal_Int32 index=static_cast<sal_Int32>(product); sal_Int32 index=static_cast<sal_Int32>(product);
ProductStruct &rProduct = m_ProductProfileList[index]; ProductStruct &rProduct = m_ProductProfileList[index];
list.realloc(static_cast<sal_Int32>(rProduct.mProfileList.size())); list.realloc(static_cast<sal_Int32>(rProduct.mProfileList.size()));
auto listRange = list.getArray();
sal_Int32 i=0; sal_Int32 i=0;
for(const auto& rEntry : rProduct.mProfileList) for(const auto& rEntry : rProduct.mProfileList)
{ {
const ProfileStruct& rProfile = rEntry.second; const ProfileStruct& rProfile = rEntry.second;
list[i] = rProfile.getProfileName(); listRange[i] = rProfile.getProfileName();
i++; i++;
} }

View File

@@ -460,9 +460,8 @@ OUString OConnection::transFormPreparedStatement(const OUString& _sSQL)
{ {
try try
{ {
Sequence<Any> aArgs(1);
Reference<XConnection> xCon = this; Reference<XConnection> xCon = this;
aArgs[0] <<= NamedValue("ActiveConnection", makeAny(xCon)); Sequence<Any> aArgs{ Any(NamedValue("ActiveConnection", makeAny(xCon))) };
m_xParameterSubstitution.set( m_xParameterSubstitution.set(
m_xDriver->getFactory()->createInstanceWithArguments( m_xDriver->getFactory()->createInstanceWithArguments(

View File

@@ -41,8 +41,6 @@ static void lcl_setRows_throw(const Reference<XResultSet>& _xResultSet, sal_Int3
const std::vector<std::vector<Any>>& _rRows) const std::vector<std::vector<Any>>& _rRows)
{ {
Reference<XInitialization> xIni(_xResultSet, UNO_QUERY); Reference<XInitialization> xIni(_xResultSet, UNO_QUERY);
Sequence<Any> aArgs(2);
aArgs[0] <<= _nType;
Sequence<Sequence<Any>> aRows(_rRows.size()); Sequence<Sequence<Any>> aRows(_rRows.size());
@@ -55,7 +53,7 @@ static void lcl_setRows_throw(const Reference<XResultSet>& _xResultSet, sal_Int3
} }
++pRowsIter; ++pRowsIter;
} }
aArgs[1] <<= aRows; Sequence<Any> aArgs{ Any(_nType), Any(aRows) };
xIni->initialize(aArgs); xIni->initialize(aArgs);
} }

View File

@@ -70,9 +70,7 @@ Reference< XConnection > Driver::connect(
if( ! acceptsURL( url ) ) // XDriver spec tells me to do so ... if( ! acceptsURL( url ) ) // XDriver spec tells me to do so ...
return Reference< XConnection > (); return Reference< XConnection > ();
Sequence< Any > seq ( 2 ); Sequence< Any > seq{ Any(url), Any(info) };
seq[0] <<= url;
seq[1] <<= info;
return Reference< XConnection> ( return Reference< XConnection> (
m_smgr->createInstanceWithArgumentsAndContext( m_smgr->createInstanceWithArgumentsAndContext(
"org.openoffice.comp.connectivity.pq.Connection.noext", "org.openoffice.comp.connectivity.pq.Connection.noext",

View File

@@ -89,9 +89,10 @@ static cppu::IPropertyArrayHelper * createPropertyArrayHelper(
PropertyDef const *props, int count , sal_Int16 attr ) PropertyDef const *props, int count , sal_Int16 attr )
{ {
Sequence< Property > seq( count ); Sequence< Property > seq( count );
auto seqRange = asNonConstRange(seq);
for( int i = 0 ; i < count ; i ++ ) for( int i = 0 ; i < count ; i ++ )
{ {
seq[i] = Property( props[i].name, i, props[i].type, attr ); seqRange[i] = Property( props[i].name, i, props[i].type, attr );
} }
return new cppu::OPropertyArrayHelper( seq, true ); return new cppu::OPropertyArrayHelper( seq, true );
} }
@@ -100,9 +101,10 @@ static cppu::IPropertyArrayHelper * createPropertyArrayHelper(
PropertyDefEx const *props, int count ) PropertyDefEx const *props, int count )
{ {
Sequence< Property > seq( count ); Sequence< Property > seq( count );
auto seqRange = asNonConstRange(seq);
for( int i = 0 ; i < count ; i ++ ) for( int i = 0 ; i < count ; i ++ )
{ {
seq[i] = Property( props[i].name, i, props[i].type, props[i].attribute ); seqRange[i] = Property( props[i].name, i, props[i].type, props[i].attribute );
} }
return new cppu::OPropertyArrayHelper( seq, true ); return new cppu::OPropertyArrayHelper( seq, true );
} }
@@ -184,8 +186,7 @@ Statics & getStatics()
// Table props set // Table props set
ImplementationStatics &ist = statics.refl.table; ImplementationStatics &ist = statics.refl.table;
ist.implName = "org.openoffice.comp.pq.sdbcx.Table"; ist.implName = "org.openoffice.comp.pq.sdbcx.Table";
ist.serviceNames = Sequence< OUString > ( 1 ); ist.serviceNames = { "com.sun.star.sdbcx.Table" };
ist.serviceNames[0] = "com.sun.star.sdbcx.Table";
PropertyDef tableDef[] = PropertyDef tableDef[] =
{ {
PropertyDef( statics.CATALOG_NAME , tString ), PropertyDef( statics.CATALOG_NAME , tString ),
@@ -214,8 +215,7 @@ Statics & getStatics()
// Column props set // Column props set
statics.refl.column.implName = "org.openoffice.comp.pq.sdbcx.Column"; statics.refl.column.implName = "org.openoffice.comp.pq.sdbcx.Column";
statics.refl.column.serviceNames = Sequence< OUString > ( 1 ); statics.refl.column.serviceNames = { "com.sun.star.sdbcx.Column" };
statics.refl.column.serviceNames[0] = "com.sun.star.sdbcx.Column";
PropertyDefEx columnDef[] = PropertyDefEx columnDef[] =
{ {
PropertyDefEx( statics.CATALOG_NAME , tString, READONLY ), PropertyDefEx( statics.CATALOG_NAME , tString, READONLY ),
@@ -237,9 +237,7 @@ Statics & getStatics()
statics.refl.columnDescriptor.implName = statics.refl.columnDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.ColumnDescriptor"; "org.openoffice.comp.pq.sdbcx.ColumnDescriptor";
statics.refl.columnDescriptor.serviceNames = Sequence< OUString > ( 1 ); statics.refl.columnDescriptor.serviceNames = { "com.sun.star.sdbcx.ColumnDescriptor" };
statics.refl.columnDescriptor.serviceNames[0] =
"com.sun.star.sdbcx.ColumnDescriptor";
PropertyDef columnDescDef[] = PropertyDef columnDescDef[] =
{ {
PropertyDef( statics.CATALOG_NAME , tString ), PropertyDef( statics.CATALOG_NAME , tString ),
@@ -262,8 +260,7 @@ Statics & getStatics()
// Key properties // Key properties
statics.refl.key.implName = "org.openoffice.comp.pq.sdbcx.Key"; statics.refl.key.implName = "org.openoffice.comp.pq.sdbcx.Key";
statics.refl.key.serviceNames = Sequence< OUString > ( 1 ); statics.refl.key.serviceNames = { "com.sun.star.sdbcx.Key" };
statics.refl.key.serviceNames[0] = "com.sun.star.sdbcx.Key";
PropertyDef keyDef[] = PropertyDef keyDef[] =
{ {
PropertyDef( statics.DELETE_RULE, tInt ), PropertyDef( statics.DELETE_RULE, tInt ),
@@ -281,9 +278,7 @@ Statics & getStatics()
// Key properties // Key properties
statics.refl.keyDescriptor.implName = statics.refl.keyDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.KeyDescriptor"; "org.openoffice.comp.pq.sdbcx.KeyDescriptor";
statics.refl.keyDescriptor.serviceNames = Sequence< OUString > ( 1 ); statics.refl.keyDescriptor.serviceNames = { "com.sun.star.sdbcx.KeyDescriptor" };
statics.refl.keyDescriptor.serviceNames[0] =
"com.sun.star.sdbcx.KeyDescriptor";
PropertyDef keyDescDef[] = PropertyDef keyDescDef[] =
{ {
PropertyDef( statics.DELETE_RULE, tInt ), PropertyDef( statics.DELETE_RULE, tInt ),
@@ -298,8 +293,7 @@ Statics & getStatics()
// KeyColumn props set // KeyColumn props set
statics.refl.keycolumn.implName = "org.openoffice.comp.pq.sdbcx.KeyColumn"; statics.refl.keycolumn.implName = "org.openoffice.comp.pq.sdbcx.KeyColumn";
statics.refl.keycolumn.serviceNames = Sequence< OUString > ( 1 ); statics.refl.keycolumn.serviceNames = { "com.sun.star.sdbcx.KeyColumn" };
statics.refl.keycolumn.serviceNames[0] = "com.sun.star.sdbcx.KeyColumn";
PropertyDef keycolumnDef[] = PropertyDef keycolumnDef[] =
{ {
PropertyDef( statics.CATALOG_NAME , tString ), PropertyDef( statics.CATALOG_NAME , tString ),
@@ -322,9 +316,8 @@ Statics & getStatics()
// KeyColumn props set // KeyColumn props set
statics.refl.keycolumnDescriptor.implName = statics.refl.keycolumnDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.KeyColumnDescriptor"; "org.openoffice.comp.pq.sdbcx.KeyColumnDescriptor";
statics.refl.keycolumnDescriptor.serviceNames = Sequence< OUString > ( 1 ); statics.refl.keycolumnDescriptor.serviceNames =
statics.refl.keycolumnDescriptor.serviceNames[0] = { "com.sun.star.sdbcx.KeyColumnDescriptor" };
"com.sun.star.sdbcx.KeyColumnDescriptor";
PropertyDef keycolumnDescDef[] = PropertyDef keycolumnDescDef[] =
{ {
PropertyDef( statics.NAME , tString ), PropertyDef( statics.NAME , tString ),
@@ -335,8 +328,7 @@ Statics & getStatics()
// view props set // view props set
statics.refl.view.implName = "org.openoffice.comp.pq.sdbcx.View"; statics.refl.view.implName = "org.openoffice.comp.pq.sdbcx.View";
statics.refl.view.serviceNames = Sequence< OUString > ( 1 ); statics.refl.view.serviceNames = { "com.sun.star.sdbcx.View" };
statics.refl.view.serviceNames[0] = "com.sun.star.sdbcx.View";
PropertyDef viewDef[] = PropertyDef viewDef[] =
{ {
PropertyDef( statics.CATALOG_NAME , tString ), PropertyDef( statics.CATALOG_NAME , tString ),
@@ -350,14 +342,12 @@ Statics & getStatics()
// view props set // view props set
statics.refl.viewDescriptor.implName = "org.openoffice.comp.pq.sdbcx.ViewDescriptor"; statics.refl.viewDescriptor.implName = "org.openoffice.comp.pq.sdbcx.ViewDescriptor";
statics.refl.viewDescriptor.serviceNames = Sequence< OUString > ( 1 ); statics.refl.viewDescriptor.serviceNames = { "com.sun.star.sdbcx.ViewDescriptor" };
statics.refl.viewDescriptor.serviceNames[0] = "com.sun.star.sdbcx.ViewDescriptor";
statics.refl.viewDescriptor.pProps = createPropertyArrayHelper( statics.refl.viewDescriptor.pProps = createPropertyArrayHelper(
viewDef, SAL_N_ELEMENTS(viewDef), 0 ); // reuse view, as it is identical viewDef, SAL_N_ELEMENTS(viewDef), 0 ); // reuse view, as it is identical
// user props set // user props set
statics.refl.user.implName = "org.openoffice.comp.pq.sdbcx.User"; statics.refl.user.implName = "org.openoffice.comp.pq.sdbcx.User";
statics.refl.user.serviceNames = Sequence< OUString > ( 1 ); statics.refl.user.serviceNames = { "com.sun.star.sdbcx.User" };
statics.refl.user.serviceNames[0] = "com.sun.star.sdbcx.User";
PropertyDef userDefRO[] = PropertyDef userDefRO[] =
{ {
PropertyDef( statics.NAME , tString ) PropertyDef( statics.NAME , tString )
@@ -368,9 +358,7 @@ Statics & getStatics()
// user props set // user props set
statics.refl.userDescriptor.implName = statics.refl.userDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.UserDescriptor"; "org.openoffice.comp.pq.sdbcx.UserDescriptor";
statics.refl.userDescriptor.serviceNames = Sequence< OUString > ( 1 ); statics.refl.userDescriptor.serviceNames = { "com.sun.star.sdbcx.UserDescriptor" };
statics.refl.userDescriptor.serviceNames[0] =
"com.sun.star.sdbcx.UserDescriptor";
PropertyDef userDefWR[] = PropertyDef userDefWR[] =
{ {
PropertyDef( statics.NAME , tString ), PropertyDef( statics.NAME , tString ),
@@ -381,8 +369,7 @@ Statics & getStatics()
// index props set // index props set
statics.refl.index.implName = "org.openoffice.comp.pq.sdbcx.Index"; statics.refl.index.implName = "org.openoffice.comp.pq.sdbcx.Index";
statics.refl.index.serviceNames = Sequence< OUString > ( 1 ); statics.refl.index.serviceNames = { "com.sun.star.sdbcx.Index" };
statics.refl.index.serviceNames[0] = "com.sun.star.sdbcx.Index";
PropertyDef indexDef[] = PropertyDef indexDef[] =
{ {
PropertyDef( statics.CATALOG , tString ), PropertyDef( statics.CATALOG , tString ),
@@ -398,16 +385,13 @@ Statics & getStatics()
// index props set // index props set
statics.refl.indexDescriptor.implName = statics.refl.indexDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.IndexDescriptor"; "org.openoffice.comp.pq.sdbcx.IndexDescriptor";
statics.refl.indexDescriptor.serviceNames = Sequence< OUString > ( 1 ); statics.refl.indexDescriptor.serviceNames = { "com.sun.star.sdbcx.IndexDescriptor" };
statics.refl.indexDescriptor.serviceNames[0] =
"com.sun.star.sdbcx.IndexDescriptor";
statics.refl.indexDescriptor.pProps = createPropertyArrayHelper( statics.refl.indexDescriptor.pProps = createPropertyArrayHelper(
indexDef, SAL_N_ELEMENTS(indexDef), 0 ); indexDef, SAL_N_ELEMENTS(indexDef), 0 );
// indexColumn props set // indexColumn props set
statics.refl.indexColumn.implName = "org.openoffice.comp.pq.sdbcx.IndexColumn"; statics.refl.indexColumn.implName = "org.openoffice.comp.pq.sdbcx.IndexColumn";
statics.refl.indexColumn.serviceNames = Sequence< OUString > ( 1 ); statics.refl.indexColumn.serviceNames = { "com.sun.star.sdbcx.IndexColumn" };
statics.refl.indexColumn.serviceNames[0] = "com.sun.star.sdbcx.IndexColumn";
PropertyDef indexColumnDef[] = PropertyDef indexColumnDef[] =
{ {
PropertyDef( statics.CATALOG_NAME , tString ), PropertyDef( statics.CATALOG_NAME , tString ),
@@ -430,9 +414,8 @@ Statics & getStatics()
// indexColumn props set // indexColumn props set
statics.refl.indexColumnDescriptor.implName = statics.refl.indexColumnDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.IndexColumnDescriptor"; "org.openoffice.comp.pq.sdbcx.IndexColumnDescriptor";
statics.refl.indexColumnDescriptor.serviceNames = Sequence< OUString > ( 1 ); statics.refl.indexColumnDescriptor.serviceNames =
statics.refl.indexColumnDescriptor.serviceNames[0] = { "com.sun.star.sdbcx.IndexColumnDescriptor" };
"com.sun.star.sdbcx.IndexColumnDescriptor";
PropertyDef indexColumnDescDef[] = PropertyDef indexColumnDescDef[] =
{ {
PropertyDef( statics.IS_ASCENDING, tBool ), PropertyDef( statics.IS_ASCENDING, tBool ),
@@ -443,8 +426,7 @@ Statics & getStatics()
// resultset // resultset
statics.refl.resultSet.implName = "org.openoffice.comp.pq.ResultSet"; statics.refl.resultSet.implName = "org.openoffice.comp.pq.ResultSet";
statics.refl.resultSet.serviceNames = Sequence< OUString > ( 1 ); statics.refl.resultSet.serviceNames = { "com.sun.star.sdbc.ResultSet" };
statics.refl.resultSet.serviceNames[0] = "com.sun.star.sdbc.ResultSet";
statics.refl.resultSet.types = UpdateableResultSet::getStaticTypes( false /* updateable */ ); statics.refl.resultSet.types = UpdateableResultSet::getStaticTypes( false /* updateable */ );
PropertyDef resultSet[] = PropertyDef resultSet[] =
{ {
@@ -461,8 +443,7 @@ Statics & getStatics()
// updateableResultset // updateableResultset
statics.refl.updateableResultSet.implName = "org.openoffice.comp.pq.UpdateableResultSet"; statics.refl.updateableResultSet.implName = "org.openoffice.comp.pq.UpdateableResultSet";
statics.refl.updateableResultSet.serviceNames = Sequence< OUString > ( 1 ); statics.refl.updateableResultSet.serviceNames = { "com.sun.star.sdbc.ResultSet" };
statics.refl.updateableResultSet.serviceNames[0] = "com.sun.star.sdbc.ResultSet";
statics.refl.updateableResultSet.types = UpdateableResultSet::getStaticTypes( true /* updateable */ ); statics.refl.updateableResultSet.types = UpdateableResultSet::getStaticTypes( true /* updateable */ );
statics.refl.updateableResultSet.pProps = createPropertyArrayHelper( statics.refl.updateableResultSet.pProps = createPropertyArrayHelper(
resultSet, SAL_N_ELEMENTS(resultSet), 0 ); resultSet, SAL_N_ELEMENTS(resultSet), 0 );

View File

@@ -918,11 +918,12 @@ Sequence< OUString > convertMappedIntArray2StringArray(
const Int2StringMap &map, const Sequence< sal_Int32 > &intArray ) const Int2StringMap &map, const Sequence< sal_Int32 > &intArray )
{ {
Sequence< OUString > ret( intArray.getLength() ); Sequence< OUString > ret( intArray.getLength() );
auto retRange = asNonConstRange(ret);
for( int i = 0; i < intArray.getLength() ; i ++ ) for( int i = 0; i < intArray.getLength() ; i ++ )
{ {
Int2StringMap::const_iterator ii = map.find( intArray[i] ); Int2StringMap::const_iterator ii = map.find( intArray[i] );
if( ii != map.end() ) if( ii != map.end() )
ret[i] = ii->second; retRange[i] = ii->second;
} }
return ret; return ret;
} }

View File

@@ -163,10 +163,11 @@ Any Container::getByName( const OUString& aName )
Sequence< OUString > Container::getElementNames( ) Sequence< OUString > Container::getElementNames( )
{ {
Sequence< OUString > ret( m_values.size() ); Sequence< OUString > ret( m_values.size() );
auto retRange = asNonConstRange(ret);
for( const auto& [rName, rIndex] : m_name2index ) for( const auto& [rName, rIndex] : m_name2index )
{ {
// give element names in index order ! // give element names in index order !
ret[rIndex] = rName; retRange[rIndex] = rName;
} }
return ret; return ret;
} }

View File

@@ -153,9 +153,10 @@ void Indexes::refresh()
std::vector< sal_Int32 > seq = parseIntArray( row->getString( C_COLUMNS ) ); std::vector< sal_Int32 > seq = parseIntArray( row->getString( C_COLUMNS ) );
Sequence< OUString > columnNames(seq.size()); Sequence< OUString > columnNames(seq.size());
auto columnNamesRange = asNonConstRange(columnNames);
for( size_t columns = 0 ; columns < seq.size() ; columns ++ ) for( size_t columns = 0 ; columns < seq.size() ; columns ++ )
{ {
columnNames[columns] = column2NameMap[ seq[columns] ]; columnNamesRange[columns] = column2NameMap[ seq[columns] ];
} }
pIndex->setPropertyValue_NoBroadcast_public( pIndex->setPropertyValue_NoBroadcast_public(

View File

@@ -97,18 +97,17 @@ uno::Reference<text::XTextDocument> const& OWriterConnection::acquireDoc()
return m_xDoc; return m_xDoc;
} }
// open read-only as long as updating isn't implemented // open read-only as long as updating isn't implemented
uno::Sequence<beans::PropertyValue> aArgs(2); uno::Sequence<beans::PropertyValue> aArgs(m_sPassword.isEmpty() ? 2 : 3);
aArgs[0].Name = "Hidden"; auto pArgs = aArgs.getArray();
aArgs[0].Value <<= true; pArgs[0].Name = "Hidden";
aArgs[1].Name = "ReadOnly"; pArgs[0].Value <<= true;
aArgs[1].Value <<= true; pArgs[1].Name = "ReadOnly";
pArgs[1].Value <<= true;
if (!m_sPassword.isEmpty()) if (!m_sPassword.isEmpty())
{ {
const sal_Int32 nPos = aArgs.getLength(); pArgs[2].Name = "Password";
aArgs.realloc(nPos + 1); pArgs[2].Value <<= m_sPassword;
aArgs[nPos].Name = "Password";
aArgs[nPos].Value <<= m_sPassword;
} }
uno::Reference<frame::XDesktop2> xDesktop uno::Reference<frame::XDesktop2> xDesktop

View File

@@ -186,8 +186,8 @@ Any SAL_CALL ODriverEnumeration::nextElement( )
css::configuration::theDefaultProvider::get( _rContext ) ); css::configuration::theDefaultProvider::get( _rContext ) );
// one argument for creating the node access: the path to the configuration node // one argument for creating the node access: the path to the configuration node
Sequence< Any > aCreationArgs(1); Sequence< Any > aCreationArgs{ Any(NamedValue(
aCreationArgs[0] <<= NamedValue( "nodepath", makeAny( OUString("org.openoffice.Office.DataAccess/DriverManager") ) ); "nodepath", makeAny( OUString("org.openoffice.Office.DataAccess/DriverManager") ) )) };
// create the node access // create the node access
Reference< XNameAccess > xDriverManagerNode( Reference< XNameAccess > xDriverManagerNode(