Drop uses of css::uno::Sequence::getConstArray in cppuhelper .. cui
where it was obsoleted by commits2484de6728(Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) andfb3c04bd19(Drop non-const Sequence::operator[] in internal code 2021-11-05). Change-Id: Ia2b60af973183bbe79656e67b5e37d7efa39a308 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166817 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -255,16 +255,11 @@ Sequence< Type > SAL_CALL ImplInhHelper_getTypes(
|
||||
class_data * cd, Sequence< Type > const & rAddTypes )
|
||||
{
|
||||
sal_Int32 nImplTypes = cd->m_nTypes;
|
||||
sal_Int32 nAddTypes = rAddTypes.getLength();
|
||||
Sequence< Type > types( nImplTypes + nAddTypes );
|
||||
Sequence<Type> types(nImplTypes + rAddTypes.getLength());
|
||||
Type * pTypes = types.getArray();
|
||||
fillTypes( pTypes, cd );
|
||||
// append base types
|
||||
Type const * pAddTypes = rAddTypes.getConstArray();
|
||||
while (nAddTypes--)
|
||||
{
|
||||
pTypes[ nImplTypes + nAddTypes ] = pAddTypes[ nAddTypes ];
|
||||
}
|
||||
std::copy(rAddTypes.begin(), rAddTypes.end(), pTypes + nImplTypes);
|
||||
return types;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,10 +44,8 @@ sal_Bool component_writeInfoHelper(
|
||||
Reference< XRegistryKey > xNewKey(
|
||||
static_cast< XRegistryKey * >( pRegistryKey )->createKey( sKey ) );
|
||||
|
||||
Sequence< OUString > seq = entries[i].getSupportedServiceNames();
|
||||
const OUString *pArray = seq.getConstArray();
|
||||
for ( sal_Int32 nPos = 0 ; nPos < seq.getLength(); nPos ++ )
|
||||
xNewKey->createKey( pArray[nPos] );
|
||||
for (auto& serviceName : entries[i].getSupportedServiceNames())
|
||||
xNewKey->createKey(serviceName);
|
||||
}
|
||||
bRet = true;
|
||||
}
|
||||
|
||||
@@ -149,9 +149,6 @@ void Data::initProperties(
|
||||
css::uno::Reference<
|
||||
css::reflection::XInterfaceMemberTypeDescription > > members(
|
||||
ifc->getMembers());
|
||||
OUString const * absentBegin = absentOptional.getConstArray();
|
||||
OUString const * absentEnd =
|
||||
absentBegin + absentOptional.getLength();
|
||||
for (const auto & m : members) {
|
||||
if (m->getTypeClass()
|
||||
== css::uno::TypeClass_INTERFACE_ATTRIBUTE)
|
||||
@@ -250,8 +247,8 @@ void Data::initProperties(
|
||||
css::uno::Type(
|
||||
t->getTypeClass(), t->getName()),
|
||||
attrAttribs),
|
||||
(std::find(absentBegin, absentEnd, name)
|
||||
== absentEnd))).
|
||||
(std::find(absentOptional.begin(), absentOptional.end(), name)
|
||||
== absentOptional.end()))).
|
||||
second)
|
||||
{
|
||||
throw css::uno::RuntimeException(
|
||||
|
||||
@@ -926,7 +926,6 @@ void OPropertySetHelper::firePropertiesChangeEvent(
|
||||
std::unique_ptr<sal_Int32[]> pHandles(new sal_Int32[nLen]);
|
||||
IPropertyArrayHelper & rPH = getInfoHelper();
|
||||
rPH.fillHandles( pHandles.get(), rPropertyNames );
|
||||
const OUString* pNames = rPropertyNames.getConstArray();
|
||||
|
||||
// get the count of matching properties
|
||||
sal_Int32 nFireLen = 0;
|
||||
@@ -948,7 +947,7 @@ void OPropertySetHelper::firePropertiesChangeEvent(
|
||||
if( pHandles[i] != -1 )
|
||||
{
|
||||
pChanges[nFirePos].Source = xSource;
|
||||
pChanges[nFirePos].PropertyName = pNames[i];
|
||||
pChanges[nFirePos].PropertyName = rPropertyNames[i];
|
||||
pChanges[nFirePos].PropertyHandle = pHandles[i];
|
||||
getFastPropertyValue( pChanges[nFirePos].OldValue, pHandles[i] );
|
||||
pChanges[nFirePos].NewValue = pChanges[nFirePos].OldValue;
|
||||
@@ -979,11 +978,10 @@ static int compare_Property_Impl( const void *arg1, const void *arg2 )
|
||||
void OPropertyArrayHelper::init( sal_Bool bSorted )
|
||||
{
|
||||
sal_Int32 i, nElements = aInfos.getLength();
|
||||
const Property* pProperties = aInfos.getConstArray();
|
||||
|
||||
for( i = 1; i < nElements; i++ )
|
||||
{
|
||||
if( pProperties[i-1].Name > pProperties[i].Name )
|
||||
if (aInfos[i - 1].Name > aInfos[i].Name)
|
||||
{
|
||||
if (bSorted) {
|
||||
OSL_FAIL( "Property array is not sorted" );
|
||||
@@ -991,12 +989,11 @@ void OPropertyArrayHelper::init( sal_Bool bSorted )
|
||||
// not sorted
|
||||
qsort( aInfos.getArray(), nElements, sizeof( Property ),
|
||||
compare_Property_Impl );
|
||||
pProperties = aInfos.getConstArray();
|
||||
break;
|
||||
}
|
||||
}
|
||||
for( i = 0; i < nElements; i++ )
|
||||
if( pProperties[i].Handle != i )
|
||||
if (aInfos[i].Handle != i)
|
||||
return;
|
||||
// The handle is the index
|
||||
bRightOrdered = true;
|
||||
@@ -1037,7 +1034,6 @@ sal_Bool OPropertyArrayHelper::fillPropertyMembersByHandle
|
||||
sal_Int32 nHandle
|
||||
)
|
||||
{
|
||||
const Property* pProperties = aInfos.getConstArray();
|
||||
sal_Int32 nElements = aInfos.getLength();
|
||||
|
||||
if( bRightOrdered )
|
||||
@@ -1045,20 +1041,20 @@ sal_Bool OPropertyArrayHelper::fillPropertyMembersByHandle
|
||||
if( nHandle < 0 || nHandle >= nElements )
|
||||
return false;
|
||||
if( pPropName )
|
||||
*pPropName = pProperties[ nHandle ].Name;
|
||||
*pPropName = aInfos[nHandle].Name;
|
||||
if( pAttributes )
|
||||
*pAttributes = pProperties[ nHandle ].Attributes;
|
||||
*pAttributes = aInfos[nHandle].Attributes;
|
||||
return true;
|
||||
}
|
||||
// normally the array is sorted
|
||||
for( sal_Int32 i = 0; i < nElements; i++ )
|
||||
{
|
||||
if( pProperties[i].Handle == nHandle )
|
||||
if (aInfos[i].Handle == nHandle)
|
||||
{
|
||||
if( pPropName )
|
||||
*pPropName = pProperties[ i ].Name;
|
||||
*pPropName = aInfos[i].Name;
|
||||
if( pAttributes )
|
||||
*pAttributes = pProperties[ i ].Attributes;
|
||||
*pAttributes = aInfos[i].Attributes;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1108,10 +1104,9 @@ sal_Int32 OPropertyArrayHelper::getHandleByName( const OUString & rPropName )
|
||||
sal_Int32 OPropertyArrayHelper::fillHandles( sal_Int32 * pHandles, const Sequence< OUString > & rPropNames )
|
||||
{
|
||||
sal_Int32 nHitCount = 0;
|
||||
const OUString * pReqProps = rPropNames.getConstArray();
|
||||
sal_Int32 nReqLen = rPropNames.getLength();
|
||||
const Property * pCur = aInfos.getConstArray();
|
||||
const Property * pEnd = pCur + aInfos.getLength();
|
||||
const Property * pCur = aInfos.begin();
|
||||
const Property * pEnd = aInfos.end();
|
||||
|
||||
for( sal_Int32 i = 0; i < nReqLen; i++ )
|
||||
{
|
||||
@@ -1129,11 +1124,11 @@ sal_Int32 OPropertyArrayHelper::fillHandles( sal_Int32 * pHandles, const Sequenc
|
||||
if( (nReqLen - i) * nLog >= pEnd - pCur )
|
||||
{
|
||||
// linear search is better
|
||||
while( pCur < pEnd && pReqProps[i] > pCur->Name )
|
||||
while (pCur < pEnd && rPropNames[i] > pCur->Name)
|
||||
{
|
||||
pCur++;
|
||||
}
|
||||
if( pCur < pEnd && pReqProps[i] == pCur->Name )
|
||||
if (pCur < pEnd && rPropNames[i] == pCur->Name)
|
||||
{
|
||||
pHandles[i] = pCur->Handle;
|
||||
nHitCount++;
|
||||
@@ -1152,7 +1147,7 @@ sal_Int32 OPropertyArrayHelper::fillHandles( sal_Int32 * pHandles, const Sequenc
|
||||
{
|
||||
pMid = (pEnd - pCur) / 2 + pCur;
|
||||
|
||||
nCompVal = pReqProps[i].compareTo( pMid->Name );
|
||||
nCompVal = rPropNames[i].compareTo(pMid->Name);
|
||||
|
||||
if( nCompVal > 0 )
|
||||
pCur = pMid + 1;
|
||||
|
||||
+10
-20
@@ -75,9 +75,6 @@ static typelib_TypeDescription * createCTD(
|
||||
const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes();
|
||||
const Sequence< OUString > & rMemberNames = xType->getMemberNames();
|
||||
|
||||
const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray();
|
||||
const OUString * pMemberNames = rMemberNames.getConstArray();
|
||||
|
||||
sal_Int32 nMembers = rMemberTypes.getLength();
|
||||
OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" );
|
||||
|
||||
@@ -90,14 +87,14 @@ static typelib_TypeDescription * createCTD(
|
||||
for ( nPos = nMembers; nPos--; )
|
||||
{
|
||||
typelib_CompoundMember_Init & rInit = pMemberInits[nPos];
|
||||
rInit.eTypeClass = static_cast<typelib_TypeClass>(pMemberTypes[nPos]->getTypeClass());
|
||||
rInit.eTypeClass = static_cast<typelib_TypeClass>(rMemberTypes[nPos]->getTypeClass());
|
||||
|
||||
OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
|
||||
OUString aMemberTypeName(rMemberTypes[nPos]->getName());
|
||||
rInit.pTypeName = aMemberTypeName.pData;
|
||||
rtl_uString_acquire( rInit.pTypeName );
|
||||
|
||||
// string is held by rMemberNames
|
||||
rInit.pMemberName = pMemberNames[nPos].pData;
|
||||
rInit.pMemberName = rMemberNames[nPos].pData;
|
||||
}
|
||||
|
||||
typelib_typedescription_new(
|
||||
@@ -134,9 +131,6 @@ static typelib_TypeDescription * createCTD(
|
||||
const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes();
|
||||
const Sequence< OUString > & rMemberNames = xType->getMemberNames();
|
||||
|
||||
const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray();
|
||||
const OUString * pMemberNames = rMemberNames.getConstArray();
|
||||
|
||||
sal_Int32 nMembers = rMemberTypes.getLength();
|
||||
OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" );
|
||||
|
||||
@@ -163,14 +157,14 @@ static typelib_TypeDescription * createCTD(
|
||||
{
|
||||
typelib_StructMember_Init & rInit = pMemberInits[nPos];
|
||||
rInit.aBase.eTypeClass
|
||||
= static_cast<typelib_TypeClass>(pMemberTypes[nPos]->getTypeClass());
|
||||
= static_cast<typelib_TypeClass>(rMemberTypes[nPos]->getTypeClass());
|
||||
|
||||
OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
|
||||
OUString aMemberTypeName(rMemberTypes[nPos]->getName());
|
||||
rInit.aBase.pTypeName = aMemberTypeName.pData;
|
||||
rtl_uString_acquire( rInit.aBase.pTypeName );
|
||||
|
||||
// string is held by rMemberNames
|
||||
rInit.aBase.pMemberName = pMemberNames[nPos].pData;
|
||||
rInit.aBase.pMemberName = rMemberNames[nPos].pData;
|
||||
|
||||
rInit.bParameterizedType = templateMemberTypes.hasElements()
|
||||
&& (templateMemberTypes[nPos]->getTypeClass()
|
||||
@@ -242,7 +236,6 @@ static typelib_TypeDescription * createCTD(
|
||||
|
||||
// init all params
|
||||
const Sequence<Reference< XMethodParameter > > & rParams = xMethod->getParameters();
|
||||
const Reference< XMethodParameter > * pParams = rParams.getConstArray();
|
||||
sal_Int32 nParams = rParams.getLength();
|
||||
|
||||
typelib_Parameter_Init * pParamInit = static_cast<typelib_Parameter_Init *>(alloca(
|
||||
@@ -251,7 +244,7 @@ static typelib_TypeDescription * createCTD(
|
||||
sal_Int32 nPos;
|
||||
for ( nPos = nParams; nPos--; )
|
||||
{
|
||||
const Reference< XMethodParameter > & xParam = pParams[nPos];
|
||||
const Reference<XMethodParameter>& xParam = rParams[nPos];
|
||||
const Reference< XTypeDescription > & xType = xParam->getType();
|
||||
typelib_Parameter_Init & rInit = pParamInit[xParam->getPosition()];
|
||||
|
||||
@@ -268,14 +261,13 @@ static typelib_TypeDescription * createCTD(
|
||||
|
||||
// init all exception strings
|
||||
const Sequence<Reference< XTypeDescription > > & rExceptions = xMethod->getExceptions();
|
||||
const Reference< XTypeDescription > * pExceptions = rExceptions.getConstArray();
|
||||
sal_Int32 nExceptions = rExceptions.getLength();
|
||||
rtl_uString ** ppExceptionNames = static_cast<rtl_uString **>(alloca(
|
||||
sizeof(rtl_uString *) * nExceptions ));
|
||||
|
||||
for ( nPos = nExceptions; nPos--; )
|
||||
{
|
||||
OUString aExceptionTypeName( pExceptions[nPos]->getName() );
|
||||
OUString aExceptionTypeName(rExceptions[nPos]->getName());
|
||||
ppExceptionNames[nPos] = aExceptionTypeName.pData;
|
||||
rtl_uString_acquire( ppExceptionNames[nPos] );
|
||||
}
|
||||
@@ -337,18 +329,16 @@ static typelib_TypeDescription * createCTD(
|
||||
typelib_TypeDescriptionReference ** ppMemberRefs = static_cast<typelib_TypeDescriptionReference **>(alloca(
|
||||
sizeof(typelib_TypeDescriptionReference *) * nMembers ));
|
||||
|
||||
const Reference< XInterfaceMemberTypeDescription > * pMembers = rMembers.getConstArray();
|
||||
|
||||
OUString aTypeName( xType->getName() );
|
||||
|
||||
sal_Int32 nPos;
|
||||
for ( nPos = nMembers; nPos--; )
|
||||
{
|
||||
OUString aMemberTypeName( pMembers[nPos]->getName() );
|
||||
OUString aMemberTypeName(rMembers[nPos]->getName());
|
||||
ppMemberRefs[nPos] = nullptr;
|
||||
typelib_typedescriptionreference_new(
|
||||
ppMemberRefs + nPos,
|
||||
static_cast<typelib_TypeClass>(pMembers[nPos]->getTypeClass()),
|
||||
static_cast<typelib_TypeClass>(rMembers[nPos]->getTypeClass()),
|
||||
aMemberTypeName.pData );
|
||||
}
|
||||
|
||||
|
||||
@@ -458,11 +458,10 @@ SAL_IMPLEMENT_MAIN()
|
||||
|
||||
// init params
|
||||
Sequence< Any > aInitParams( aParams.getLength() );
|
||||
const OUString * p = aParams.getConstArray();
|
||||
Any * pInitParams = aInitParams.getArray();
|
||||
for ( sal_Int32 i = aParams.getLength(); i--; )
|
||||
{
|
||||
pInitParams[i] <<= p[i];
|
||||
pInitParams[i] <<= aParams[i];
|
||||
}
|
||||
|
||||
// instance provider
|
||||
|
||||
@@ -742,13 +742,11 @@ OUString CuiConfigGroupListBox::GetImage(
|
||||
{
|
||||
throw RuntimeException("SFTreeListBox::Init: failed to get PropertyValue");
|
||||
}
|
||||
beans::PropertyValue const * pmoduleDescr =
|
||||
moduleDescr.getConstArray();
|
||||
for ( sal_Int32 pos = moduleDescr.getLength(); pos--; )
|
||||
{
|
||||
if ( pmoduleDescr[ pos ].Name == "ooSetupFactoryEmptyDocumentURL" )
|
||||
if (moduleDescr[pos].Name == "ooSetupFactoryEmptyDocumentURL")
|
||||
{
|
||||
pmoduleDescr[ pos ].Value >>= factoryURL;
|
||||
moduleDescr[pos].Value >>= factoryURL;
|
||||
SAL_INFO("cui.customize", "factory url for doc images is " << factoryURL);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -821,15 +821,11 @@ void TmpRepositoryCommandEnv::handle(uno::Reference<task::XInteractionRequest> c
|
||||
bool approve = true;
|
||||
|
||||
// select:
|
||||
uno::Sequence<Reference<task::XInteractionContinuation>> conts(xRequest->getContinuations());
|
||||
Reference<task::XInteractionContinuation> const* pConts = conts.getConstArray();
|
||||
sal_Int32 len = conts.getLength();
|
||||
for (sal_Int32 pos = 0; pos < len; ++pos)
|
||||
for (const auto& cont : xRequest->getContinuations())
|
||||
{
|
||||
if (approve)
|
||||
{
|
||||
uno::Reference<task::XInteractionApprove> xInteractionApprove(pConts[pos],
|
||||
uno::UNO_QUERY);
|
||||
uno::Reference<task::XInteractionApprove> xInteractionApprove(cont, uno::UNO_QUERY);
|
||||
if (xInteractionApprove.is())
|
||||
{
|
||||
xInteractionApprove->select();
|
||||
|
||||
@@ -278,7 +278,6 @@ void SpellDialog::Init_Impl()
|
||||
|
||||
void SpellDialog::UpdateBoxes_Impl(bool bCallFromSelectHdl)
|
||||
{
|
||||
sal_Int32 i;
|
||||
m_xSuggestionLB->clear();
|
||||
|
||||
SpellErrorDescription aSpellErrorDescription;
|
||||
@@ -309,26 +308,20 @@ void SpellDialog::UpdateBoxes_Impl(bool bCallFromSelectHdl)
|
||||
int nDicts = InitUserDicts();
|
||||
|
||||
// enter alternatives
|
||||
const OUString *pNewWords = aNewWords.getConstArray();
|
||||
const sal_Int32 nSize = aNewWords.getLength();
|
||||
for ( i = 0; i < nSize; ++i )
|
||||
for (auto& aTmp : aNewWords)
|
||||
{
|
||||
OUString aTmp( pNewWords[i] );
|
||||
if (m_xSuggestionLB->find_text(aTmp) == -1)
|
||||
m_xSuggestionLB->append_text(aTmp);
|
||||
}
|
||||
if(!nSize)
|
||||
m_xSuggestionLB->append_text(m_sNoSuggestionsST);
|
||||
m_xAutoCorrPB->set_sensitive( nSize > 0 );
|
||||
|
||||
m_xSuggestionFT->set_sensitive(nSize > 0);
|
||||
m_xSuggestionLB->set_sensitive(nSize > 0);
|
||||
if( nSize )
|
||||
{
|
||||
m_xSuggestionLB->set_sensitive(aNewWords.hasElements());
|
||||
if (aNewWords.hasElements())
|
||||
m_xSuggestionLB->select(0);
|
||||
}
|
||||
m_xChangePB->set_sensitive( nSize > 0);
|
||||
m_xChangeAllPB->set_sensitive(nSize > 0);
|
||||
else
|
||||
m_xSuggestionLB->append_text(m_sNoSuggestionsST);
|
||||
m_xAutoCorrPB->set_sensitive(aNewWords.hasElements());
|
||||
m_xSuggestionFT->set_sensitive(aNewWords.hasElements());
|
||||
m_xChangePB->set_sensitive(aNewWords.hasElements());
|
||||
m_xChangeAllPB->set_sensitive(aNewWords.hasElements());
|
||||
bool bShowChangeAll = !bIsGrammarError;
|
||||
m_xChangeAllPB->set_visible( bShowChangeAll );
|
||||
m_xExplainFT->set_visible( !bShowChangeAll );
|
||||
@@ -778,8 +771,6 @@ int SpellDialog::InitUserDicts()
|
||||
{
|
||||
const LanguageType nLang = m_xLanguageLB->get_active_id();
|
||||
|
||||
const Reference< XDictionary > *pDic = nullptr;
|
||||
|
||||
// get list of dictionaries
|
||||
Reference< XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() );
|
||||
if (xDicList.is())
|
||||
@@ -798,13 +789,10 @@ int SpellDialog::InitUserDicts()
|
||||
|
||||
// list suitable dictionaries
|
||||
bool bEnable = false;
|
||||
const sal_Int32 nSize = pImpl->aDics.getLength();
|
||||
pDic = pImpl->aDics.getConstArray();
|
||||
m_xAddToDictMB->clear();
|
||||
sal_uInt16 nItemId = 1; // menu items should be enumerated from 1 and not 0
|
||||
for (sal_Int32 i = 0; i < nSize; ++i)
|
||||
for (auto& xDicTmp : pImpl->aDics)
|
||||
{
|
||||
uno::Reference< linguistic2::XDictionary > xDicTmp = pDic[i];
|
||||
if (!xDicTmp.is() || LinguMgr::GetIgnoreAllList() == xDicTmp)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -632,10 +632,8 @@ void FmSearchDialog::LoadParams()
|
||||
{
|
||||
FmSearchParams aParams(m_pConfig->getParams());
|
||||
|
||||
const OUString* pHistory = aParams.aHistory.getConstArray();
|
||||
const OUString* pHistoryEnd = pHistory + aParams.aHistory.getLength();
|
||||
for (; pHistory != pHistoryEnd; ++pHistory)
|
||||
m_pcmbSearchText->append_text( *pHistory );
|
||||
for (auto& historystr : aParams.aHistory)
|
||||
m_pcmbSearchText->append_text(historystr);
|
||||
|
||||
// I do the settings at my UI-elements and then I simply call the respective change-handler,
|
||||
// that way the data is handed on to the SearchEngine and all dependent settings are done
|
||||
|
||||
@@ -729,15 +729,9 @@ namespace svx
|
||||
Reference< XNameContainer > xNameCont = m_xConversionDictionaryList->getDictionaryContainer();
|
||||
if( xNameCont.is() )
|
||||
{
|
||||
Sequence< OUString > aDictNames( xNameCont->getElementNames() );
|
||||
|
||||
const OUString* pDic = aDictNames.getConstArray();
|
||||
sal_Int32 nCount = aDictNames.getLength();
|
||||
|
||||
sal_Int32 i;
|
||||
for( i = 0 ; i < nCount ; ++i )
|
||||
for (auto& name : xNameCont->getElementNames())
|
||||
{
|
||||
Any aAny( xNameCont->getByName( pDic[ i ] ) );
|
||||
Any aAny(xNameCont->getByName(name));
|
||||
Reference< XConversionDictionary > xDic;
|
||||
if( ( aAny >>= xDic ) && xDic.is() )
|
||||
{
|
||||
@@ -1372,20 +1366,13 @@ namespace svx
|
||||
m_xSuggestions->Clear();
|
||||
|
||||
//fill found entries into boxes
|
||||
sal_uInt32 nCnt = aEntries.getLength();
|
||||
if( nCnt )
|
||||
if (aEntries.hasElements())
|
||||
{
|
||||
if( !m_xSuggestions )
|
||||
m_xSuggestions.reset(new SuggestionList);
|
||||
|
||||
const OUString* pSugg = aEntries.getConstArray();
|
||||
sal_uInt32 n = 0;
|
||||
while( nCnt )
|
||||
{
|
||||
m_xSuggestions->Set( pSugg[ n ], sal_uInt16( n ) );
|
||||
++n;
|
||||
--nCnt;
|
||||
}
|
||||
for (sal_Int32 n = 0; n < aEntries.getLength(); ++n)
|
||||
m_xSuggestions->Set(aEntries[n], n);
|
||||
}
|
||||
m_bModifiedSuggestions = false;
|
||||
}
|
||||
|
||||
@@ -302,19 +302,14 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< container::XNameAccess >
|
||||
std::stack<std::pair<std::unique_ptr<weld::TreeIter>, const sal_Int32>> aHeadingsParentEntryStack;
|
||||
|
||||
int nEntries=0;
|
||||
const uno::Sequence< OUString > aNames( xLinks->getElementNames() );
|
||||
const sal_Int32 nLinks = aNames.getLength();
|
||||
const OUString* pNames = aNames.getConstArray();
|
||||
|
||||
static constexpr OUStringLiteral aProp_LinkDisplayName( u"LinkDisplayName" );
|
||||
static constexpr OUStringLiteral aProp_LinkTarget( u"com.sun.star.document.LinkTarget" );
|
||||
static constexpr OUStringLiteral aProp_LinkDisplayBitmap( u"LinkDisplayBitmap" );
|
||||
for( sal_Int32 i = 0; i < nLinks; i++ )
|
||||
for (auto& aLink : xLinks->getElementNames())
|
||||
{
|
||||
uno::Any aAny;
|
||||
OUString aLink( *pNames++ );
|
||||
|
||||
bool bError = false;
|
||||
try
|
||||
{
|
||||
aAny = xLinks->getByName( aLink );
|
||||
@@ -323,10 +318,8 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< container::XNameAccess >
|
||||
{
|
||||
// if the name of the target was invalid (like empty headings)
|
||||
// no object can be provided
|
||||
bError = true;
|
||||
}
|
||||
if(bError)
|
||||
continue;
|
||||
}
|
||||
|
||||
uno::Reference< beans::XPropertySet > xTarget;
|
||||
|
||||
|
||||
@@ -116,43 +116,28 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl()
|
||||
aTxt = m_xPossHyph->getPossibleHyphens();
|
||||
|
||||
m_nHyphenationPositionsOffset = 0;
|
||||
uno::Sequence< sal_Int16 > aHyphenationPositions(
|
||||
m_xPossHyph->getHyphenationPositions() );
|
||||
sal_Int32 nLen = aHyphenationPositions.getLength();
|
||||
const sal_Int16 *pHyphenationPos = aHyphenationPositions.getConstArray();
|
||||
|
||||
// find position nIdx after which all hyphen positions are unusable
|
||||
sal_Int32 nIdx = -1;
|
||||
sal_Int32 nPos = 0, nPos1 = 0;
|
||||
if (nLen)
|
||||
for (sal_Int16 hyphenationPos : m_xPossHyph->getHyphenationPositions())
|
||||
{
|
||||
sal_Int32 nStart = 0;
|
||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
||||
if (hyphenationPos > m_nMaxHyphenationPos)
|
||||
break;
|
||||
else
|
||||
{
|
||||
if (pHyphenationPos[i] > m_nMaxHyphenationPos)
|
||||
break;
|
||||
else
|
||||
{
|
||||
// find corresponding hyphen positions in string
|
||||
nPos = aTxt.indexOf( sal_Unicode( HYPH_POS_CHAR ), nStart );
|
||||
// find corresponding hyphen positions in string
|
||||
nIdx = aTxt.indexOf(sal_Unicode(HYPH_POS_CHAR), nIdx + 1);
|
||||
|
||||
if (nPos == -1)
|
||||
break;
|
||||
else
|
||||
{
|
||||
nIdx = nPos;
|
||||
nStart = nPos + 1;
|
||||
}
|
||||
}
|
||||
if (nIdx == -1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
DBG_ASSERT(nIdx != -1, "no usable hyphenation position");
|
||||
|
||||
// 1) remove all not usable hyphenation positions from the end of the string
|
||||
nPos = nIdx == -1 ? 0 : nIdx + 1;
|
||||
nPos1 = nPos; //save for later use in 2) below
|
||||
sal_Int32 nPos1 = nIdx + 1; //save for later use in 2) below
|
||||
const OUString aTmp( sal_Unicode( HYPH_POS_CHAR ) );
|
||||
while (nPos != -1)
|
||||
for (sal_Int32 nPos = nPos1; nPos != -1;)
|
||||
{
|
||||
nPos++;
|
||||
aTxt = aTxt.replaceFirst( aTmp, "", &nPos);
|
||||
@@ -164,8 +149,7 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl()
|
||||
if (nPos2 != std::u16string_view::npos && nPos2 != 0)
|
||||
{
|
||||
OUString aLeft( aSearchRange.substr( 0, nPos2 ) );
|
||||
nPos = 0;
|
||||
while (nPos != -1)
|
||||
for (sal_Int32 nPos = 0; nPos != -1;)
|
||||
{
|
||||
nPos++;
|
||||
aLeft = aLeft.replaceFirst( aTmp, "", &nPos );
|
||||
@@ -222,7 +206,7 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_Int32 nInsPos )
|
||||
DBG_ASSERT(0 <= nIdxPos && nIdxPos < nLen, "index out of range");
|
||||
if (nLen && 0 <= nIdxPos && nIdxPos < nLen)
|
||||
{
|
||||
nInsPos = aSeq.getConstArray()[ nIdxPos ];
|
||||
nInsPos = aSeq[nIdxPos];
|
||||
m_pHyphWrapper->InsertHyphen( nInsPos );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,6 @@ bool SvxThesaurusDialog::UpdateAlternativesBox_Impl()
|
||||
uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl(
|
||||
aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() );
|
||||
const sal_Int32 nMeanings = aMeanings.getLength();
|
||||
const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray();
|
||||
|
||||
m_xAlternativesCT->freeze();
|
||||
|
||||
@@ -97,22 +96,20 @@ bool SvxThesaurusDialog::UpdateAlternativesBox_Impl()
|
||||
int nRow = 0;
|
||||
for (sal_Int32 i = 0; i < nMeanings; ++i)
|
||||
{
|
||||
OUString rMeaningTxt = pMeanings[i]->getMeaning();
|
||||
uno::Sequence< OUString > aSynonyms( pMeanings[i]->querySynonyms() );
|
||||
const sal_Int32 nSynonyms = aSynonyms.getLength();
|
||||
const OUString *pSynonyms = aSynonyms.getConstArray();
|
||||
OUString rMeaningTxt = aMeanings[i]->getMeaning();
|
||||
uno::Sequence<OUString> aSynonyms(aMeanings[i]->querySynonyms());
|
||||
DBG_ASSERT( !rMeaningTxt.isEmpty(), "meaning with empty text" );
|
||||
DBG_ASSERT( nSynonyms > 0, "meaning without synonym" );
|
||||
DBG_ASSERT(aSynonyms.hasElements(), "meaning without synonym");
|
||||
|
||||
OUString sHeading = OUString::number(i + 1) + ". " + rMeaningTxt;
|
||||
m_xAlternativesCT->append_text(sHeading);
|
||||
m_xAlternativesCT->set_text_emphasis(nRow, true, 0);
|
||||
++nRow;
|
||||
|
||||
for (sal_Int32 k = 0; k < nSynonyms; ++k)
|
||||
for (auto& synonym : aSynonyms)
|
||||
{
|
||||
// GetThesaurusReplaceText will strip the leading spaces
|
||||
m_xAlternativesCT->append_text(" " + pSynonyms[k]);
|
||||
m_xAlternativesCT->append_text(" " + synonym);
|
||||
m_xAlternativesCT->set_text_emphasis(nRow, false, 0);
|
||||
++nRow;
|
||||
}
|
||||
@@ -287,13 +284,11 @@ SvxThesaurusDialog::SvxThesaurusDialog(
|
||||
uno::Sequence< lang::Locale > aLocales;
|
||||
if (xThesaurus.is())
|
||||
aLocales = xThesaurus->getLocales();
|
||||
const sal_Int32 nLocales = aLocales.getLength();
|
||||
const lang::Locale *pLocales = aLocales.getConstArray();
|
||||
m_xLangLB->clear();
|
||||
std::vector< OUString > aLangVec;
|
||||
for (sal_Int32 i = 0; i < nLocales; ++i)
|
||||
for (auto& locale : aLocales)
|
||||
{
|
||||
const LanguageType nLang = LanguageTag::convertToLanguageType( pLocales[i] );
|
||||
const LanguageType nLang = LanguageTag::convertToLanguageType(locale);
|
||||
DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" );
|
||||
aLangVec.push_back( SvtLanguageTable::GetLanguageString( nLang ) );
|
||||
}
|
||||
|
||||
@@ -67,13 +67,10 @@ namespace offapp
|
||||
// then look for which of them settings are stored in the configuration
|
||||
OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(DRIVER_SETTINGS);
|
||||
|
||||
Sequence< OUString > aDriverKeys = aDriverSettings.getNodeNames();
|
||||
const OUString* pDriverKeys = aDriverKeys.getConstArray();
|
||||
const OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
|
||||
for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
|
||||
for (auto& driverKey : aDriverSettings.getNodeNames())
|
||||
{
|
||||
// the name of the driver in this round
|
||||
OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(*pDriverKeys);
|
||||
OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(driverKey);
|
||||
OUString sThisDriverName;
|
||||
aThisDriverSettings.getNodeValue(DRIVER_NAME) >>= sThisDriverName;
|
||||
|
||||
|
||||
@@ -43,14 +43,11 @@ namespace svx
|
||||
Reference< XDatabaseContext > xRegistrations(
|
||||
DatabaseContext::create(xContext) );
|
||||
|
||||
Sequence< OUString > aRegistrationNames( xRegistrations->getRegistrationNames() );
|
||||
const OUString* pRegistrationName = aRegistrationNames.getConstArray();
|
||||
const OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength();
|
||||
for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName )
|
||||
for (auto& registrationName : xRegistrations->getRegistrationNames())
|
||||
{
|
||||
OUString sLocation( xRegistrations->getDatabaseLocation( *pRegistrationName ) );
|
||||
aSettings[ *pRegistrationName ] =
|
||||
DatabaseRegistration( sLocation, xRegistrations->isDatabaseRegistrationReadOnly( *pRegistrationName ) );
|
||||
aSettings[registrationName] = DatabaseRegistration(
|
||||
xRegistrations->getDatabaseLocation(registrationName),
|
||||
xRegistrations->isDatabaseRegistrationReadOnly(registrationName));
|
||||
}
|
||||
}
|
||||
catch( const Exception& )
|
||||
@@ -99,13 +96,10 @@ namespace svx
|
||||
}
|
||||
|
||||
// delete unused entries
|
||||
Sequence< OUString > aRegistrationNames = xRegistrations->getRegistrationNames();
|
||||
const OUString* pRegistrationName = aRegistrationNames.getConstArray();
|
||||
const OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength();
|
||||
for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName )
|
||||
for (auto& registrationName : xRegistrations->getRegistrationNames())
|
||||
{
|
||||
if ( rNewRegistrations.find( *pRegistrationName ) == rNewRegistrations.end() )
|
||||
xRegistrations->revokeDatabaseLocation( *pRegistrationName );
|
||||
if (rNewRegistrations.find(registrationName) == rNewRegistrations.end())
|
||||
xRegistrations->revokeDatabaseLocation(registrationName);
|
||||
}
|
||||
}
|
||||
catch( const Exception& )
|
||||
|
||||
@@ -136,18 +136,6 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
|
||||
|
||||
Reference< XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() );
|
||||
|
||||
Sequence< Reference< XDictionary > > aDics;
|
||||
if (xDicList.is())
|
||||
aDics = xDicList->getDictionaries();
|
||||
const Reference< XDictionary > *pDic = aDics.getConstArray();
|
||||
sal_Int32 nCount = aDics.getLength();
|
||||
|
||||
bool bFound = false;
|
||||
sal_Int32 i;
|
||||
for (i = 0; !bFound && i < nCount; ++i )
|
||||
if ( sDict.equalsIgnoreAsciiCase( pDic[i]->getName()) )
|
||||
bFound = true;
|
||||
|
||||
if ( sDict.indexOf("/") != -1 || sDict.indexOf("\\") != -1 )
|
||||
{
|
||||
// Detected an invalid character.
|
||||
@@ -159,7 +147,12 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
|
||||
return;
|
||||
}
|
||||
|
||||
if ( bFound )
|
||||
Sequence< Reference< XDictionary > > aDics;
|
||||
if (xDicList.is())
|
||||
aDics = xDicList->getDictionaries();
|
||||
|
||||
if (std::any_of(aDics.begin(), aDics.end(),
|
||||
[&sDict](auto& d) { return sDict.equalsIgnoreAsciiCase(d->getName()); }))
|
||||
{
|
||||
// duplicate names?
|
||||
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
|
||||
@@ -276,13 +269,9 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, std::u16
|
||||
m_xReplaceED->connect_activate(LINK(this, SvxEditDictionaryDialog, NewDelActionHdl));
|
||||
|
||||
// fill listbox with all available WB's
|
||||
const Reference< XDictionary > *pDic = aDics.getConstArray();
|
||||
sal_Int32 nCount = aDics.getLength();
|
||||
|
||||
OUString aLookUpEntry;
|
||||
for ( sal_Int32 i = 0; i < nCount; ++i )
|
||||
for (auto& xDic : aDics)
|
||||
{
|
||||
Reference< XDictionary > xDic = pDic[i];
|
||||
if (xDic.is())
|
||||
{
|
||||
bool bNegative = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
|
||||
@@ -298,7 +287,7 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, std::u16
|
||||
|
||||
m_xLangLB->SetLanguageList( SvxLanguageListFlags::ALL, true, true );
|
||||
|
||||
if ( nCount > 0 )
|
||||
if (aDics.hasElements())
|
||||
{
|
||||
m_xAllDictsLB->set_active_text(aLookUpEntry);
|
||||
int nPos = m_xAllDictsLB->get_active();
|
||||
@@ -396,7 +385,7 @@ void SvxEditDictionaryDialog::RemoveDictEntry(int nEntry)
|
||||
{
|
||||
OUString sTmpShort(m_pWordsLB->get_text(nEntry, 0));
|
||||
|
||||
Reference<XDictionary> xDic = aDics.getConstArray()[nLBPos];
|
||||
Reference<XDictionary> xDic = aDics[nLBPos];
|
||||
if (xDic->remove(sTmpShort)) // sal_True on success
|
||||
{
|
||||
m_pWordsLB->remove(nEntry);
|
||||
@@ -462,7 +451,7 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, weld::ComboBox&, vo
|
||||
|
||||
void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId )
|
||||
{
|
||||
Reference< XDictionary > xDic = aDics.getConstArray()[ nId ];
|
||||
Reference<XDictionary> xDic = aDics[nId];
|
||||
|
||||
weld::WaitObject aWait(m_xDialog.get());
|
||||
|
||||
@@ -512,16 +501,14 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId )
|
||||
m_pWordsLB->clear();
|
||||
|
||||
Sequence< Reference< XDictionaryEntry > > aEntries( xDic->getEntries() );
|
||||
const Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray();
|
||||
sal_Int32 nCount = aEntries.getLength();
|
||||
std::vector<OUString> aSortedDicEntries;
|
||||
aSortedDicEntries.reserve(nCount);
|
||||
for (sal_Int32 i = 0; i < nCount; i++)
|
||||
aSortedDicEntries.reserve(aEntries.getLength());
|
||||
for (auto& xDictionaryEntry : aEntries)
|
||||
{
|
||||
OUString aStr = pEntry[i]->getDictionaryWord();
|
||||
if(!pEntry[i]->getReplacementText().isEmpty())
|
||||
OUString aStr = xDictionaryEntry->getDictionaryWord();
|
||||
if (!xDictionaryEntry->getReplacementText().isEmpty())
|
||||
{
|
||||
aStr += "\t" + pEntry[i]->getReplacementText();
|
||||
aStr += "\t" + xDictionaryEntry->getReplacementText();
|
||||
}
|
||||
aSortedDicEntries.push_back(aStr);
|
||||
}
|
||||
@@ -540,10 +527,11 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId )
|
||||
int nRow = 0;
|
||||
for (OUString const & rStr : aSortedDicEntries)
|
||||
{
|
||||
m_pWordsLB->append_text(rStr.getToken(0, '\t'));
|
||||
if (m_pWordsLB == m_xDoubleColumnLB.get())
|
||||
sal_Int32 index = 0;
|
||||
m_pWordsLB->append_text(rStr.getToken(0, '\t', index));
|
||||
if (index != -1 && m_pWordsLB == m_xDoubleColumnLB.get())
|
||||
{
|
||||
OUString sReplace = rStr.getToken(1, '\t');
|
||||
OUString sReplace = rStr.getToken(0, '\t', index);
|
||||
m_pWordsLB->set_text(nRow, sReplace, 1);
|
||||
++nRow;
|
||||
}
|
||||
|
||||
@@ -464,23 +464,18 @@ CanvasSettings::CanvasSettings() :
|
||||
Reference<XHierarchicalNameAccess> xHierarchicalNameAccess(
|
||||
xNameAccess, UNO_QUERY_THROW);
|
||||
|
||||
Sequence<OUString> serviceNames = xNameAccess->getElementNames();
|
||||
const OUString* pCurr = serviceNames.getConstArray();
|
||||
const OUString* const pEnd = pCurr + serviceNames.getLength();
|
||||
while( pCurr != pEnd )
|
||||
for (auto& serviceName : xNameAccess->getElementNames())
|
||||
{
|
||||
Reference<XNameAccess> xEntryNameAccess(
|
||||
xHierarchicalNameAccess->getByHierarchicalName(*pCurr),
|
||||
xHierarchicalNameAccess->getByHierarchicalName(serviceName),
|
||||
UNO_QUERY );
|
||||
|
||||
if( xEntryNameAccess.is() )
|
||||
{
|
||||
Sequence<OUString> preferredImplementations;
|
||||
if( xEntryNameAccess->getByName("PreferredImplementations") >>= preferredImplementations )
|
||||
maAvailableImplementations.emplace_back(*pCurr,preferredImplementations );
|
||||
maAvailableImplementations.emplace_back(serviceName, preferredImplementations);
|
||||
}
|
||||
|
||||
++pCurr;
|
||||
}
|
||||
}
|
||||
catch (const Exception&)
|
||||
@@ -500,15 +495,12 @@ bool CanvasSettings::IsHardwareAccelerationAvailable() const
|
||||
// implementation that presents the "HardwareAcceleration" property
|
||||
for (auto const& availableImpl : maAvailableImplementations)
|
||||
{
|
||||
const OUString* pCurrImpl = availableImpl.second.getConstArray();
|
||||
const OUString* const pEndImpl = pCurrImpl + availableImpl.second.getLength();
|
||||
|
||||
while( pCurrImpl != pEndImpl )
|
||||
for (auto& currImpl : availableImpl.second)
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference<XPropertySet> xPropSet( xFactory->createInstance(
|
||||
pCurrImpl->trim() ),
|
||||
currImpl.trim() ),
|
||||
UNO_QUERY_THROW );
|
||||
bool bHasAccel(false);
|
||||
if( xPropSet->getPropertyValue("HardwareAcceleration") >>= bHasAccel )
|
||||
@@ -521,8 +513,6 @@ bool CanvasSettings::IsHardwareAccelerationAvailable() const
|
||||
catch (const Exception&)
|
||||
{
|
||||
}
|
||||
|
||||
++pCurrImpl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1144,10 +1134,9 @@ static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocal
|
||||
SAL_WARN_IF( !nPatterns, "cui.options", "No date acceptance pattern");
|
||||
if (nPatterns)
|
||||
{
|
||||
const OUString* pPatterns = aDateAcceptancePatterns.getConstArray();
|
||||
aBuf.append( pPatterns[0]);
|
||||
aBuf.append(aDateAcceptancePatterns[0]);
|
||||
for (sal_Int32 i=1; i < nPatterns; ++i)
|
||||
aBuf.append(";" + pPatterns[i]);
|
||||
aBuf.append(";" + aDateAcceptancePatterns[i]);
|
||||
}
|
||||
return aBuf.makeStringAndClear();
|
||||
}
|
||||
|
||||
@@ -84,15 +84,8 @@ constexpr OUString cThes(SN_THESAURUS);
|
||||
static sal_Int32 lcl_SeqGetEntryPos(
|
||||
const Sequence< OUString > &rSeq, std::u16string_view rEntry )
|
||||
{
|
||||
sal_Int32 i;
|
||||
sal_Int32 nLen = rSeq.getLength();
|
||||
const OUString *pItem = rSeq.getConstArray();
|
||||
for (i = 0; i < nLen; ++i)
|
||||
{
|
||||
if (rEntry == pItem[i])
|
||||
break;
|
||||
}
|
||||
return i < nLen ? i : -1;
|
||||
auto it = std::find(rSeq.begin(), rSeq.end(), rEntry);
|
||||
return it == rSeq.end() ? -1 : std::distance(rSeq.begin(), it);
|
||||
}
|
||||
|
||||
static bool KillFile_Impl( const OUString& rURL )
|
||||
@@ -407,20 +400,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
static sal_Int32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, std::u16string_view rTxt )
|
||||
{
|
||||
sal_Int32 nRes = -1;
|
||||
sal_Int32 nLen = rSeq.getLength();
|
||||
const OUString *pString = rSeq.getConstArray();
|
||||
for (sal_Int32 i = 0; i < nLen && nRes == -1; ++i)
|
||||
{
|
||||
if (pString[i] == rTxt)
|
||||
nRes = i;
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
|
||||
|
||||
Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang, sal_uInt8 nType )
|
||||
{
|
||||
LangImplNameTable *pTable = nullptr;
|
||||
@@ -457,7 +436,7 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang,
|
||||
case TYPE_GRAMMAR : aImplName = rInfo.sGrammarImplName; break;
|
||||
}
|
||||
|
||||
if (!aImplName.isEmpty() && (lcl_SeqGetIndex( aRes, aImplName) == -1)) // name not yet added
|
||||
if (!aImplName.isEmpty() && (lcl_SeqGetEntryPos( aRes, aImplName) == -1)) // name not yet added
|
||||
{
|
||||
DBG_ASSERT( nIdx < aRes.getLength(), "index out of range" );
|
||||
if (nIdx < aRes.getLength())
|
||||
@@ -745,20 +724,12 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna
|
||||
|
||||
pInfo->bConfigured = bEnable;
|
||||
|
||||
Sequence< Locale > aLocales;
|
||||
const Locale *pLocale = nullptr;
|
||||
sal_Int32 nLocales = 0;
|
||||
sal_Int32 i;
|
||||
|
||||
// update configured spellchecker entries
|
||||
if (pInfo->xSpell.is())
|
||||
{
|
||||
aLocales = pInfo->xSpell->getLocales();
|
||||
pLocale = aLocales.getConstArray();
|
||||
nLocales = aLocales.getLength();
|
||||
for (i = 0; i < nLocales; ++i)
|
||||
for (auto& locale : pInfo->xSpell->getLocales())
|
||||
{
|
||||
LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
|
||||
LanguageType nLang = LanguageTag::convertToLanguageType(locale);
|
||||
if (!aCfgSpellTable.count( nLang ) && bEnable)
|
||||
aCfgSpellTable[ nLang ] = Sequence< OUString >();
|
||||
if (aCfgSpellTable.count( nLang ))
|
||||
@@ -769,12 +740,9 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna
|
||||
// update configured grammar checker entries
|
||||
if (pInfo->xGrammar.is())
|
||||
{
|
||||
aLocales = pInfo->xGrammar->getLocales();
|
||||
pLocale = aLocales.getConstArray();
|
||||
nLocales = aLocales.getLength();
|
||||
for (i = 0; i < nLocales; ++i)
|
||||
for (auto& locale : pInfo->xGrammar->getLocales())
|
||||
{
|
||||
LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
|
||||
LanguageType nLang = LanguageTag::convertToLanguageType(locale);
|
||||
if (!aCfgGrammarTable.count( nLang ) && bEnable)
|
||||
aCfgGrammarTable[ nLang ] = Sequence< OUString >();
|
||||
if (aCfgGrammarTable.count( nLang ))
|
||||
@@ -785,12 +753,9 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna
|
||||
// update configured hyphenator entries
|
||||
if (pInfo->xHyph.is())
|
||||
{
|
||||
aLocales = pInfo->xHyph->getLocales();
|
||||
pLocale = aLocales.getConstArray();
|
||||
nLocales = aLocales.getLength();
|
||||
for (i = 0; i < nLocales; ++i)
|
||||
for (auto& locale : pInfo->xHyph->getLocales())
|
||||
{
|
||||
LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
|
||||
LanguageType nLang = LanguageTag::convertToLanguageType(locale);
|
||||
if (!aCfgHyphTable.count( nLang ) && bEnable)
|
||||
aCfgHyphTable[ nLang ] = Sequence< OUString >();
|
||||
if (aCfgHyphTable.count( nLang ))
|
||||
@@ -802,12 +767,9 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna
|
||||
if (!pInfo->xThes.is())
|
||||
return;
|
||||
|
||||
aLocales = pInfo->xThes->getLocales();
|
||||
pLocale = aLocales.getConstArray();
|
||||
nLocales = aLocales.getLength();
|
||||
for (i = 0; i < nLocales; ++i)
|
||||
for (auto& locale : pInfo->xThes->getLocales())
|
||||
{
|
||||
LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
|
||||
LanguageType nLang = LanguageTag::convertToLanguageType(locale);
|
||||
if (!aCfgThesTable.count( nLang ) && bEnable)
|
||||
aCfgThesTable[ nLang ] = Sequence< OUString >();
|
||||
if (aCfgThesTable.count( nLang ))
|
||||
@@ -1017,7 +979,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
|
||||
if (aData.GetEntryId() < nDics)
|
||||
{
|
||||
bool bChecked = m_xLinguDicsCLB->get_toggle(i) == TRISTATE_TRUE;
|
||||
uno::Reference< XDictionary > xDic( aDics.getConstArray()[ i ] );
|
||||
uno::Reference<XDictionary> xDic(aDics[i]);
|
||||
if (xDic.is())
|
||||
{
|
||||
if (LinguMgr::GetIgnoreAllList() == xDic)
|
||||
@@ -1124,11 +1086,9 @@ void SvxLinguTabPage::UpdateDicBox_Impl()
|
||||
m_xLinguDicsCLB->freeze();
|
||||
m_xLinguDicsCLB->clear();
|
||||
|
||||
sal_Int32 nDics = aDics.getLength();
|
||||
const uno::Reference< XDictionary > *pDic = aDics.getConstArray();
|
||||
for (sal_Int32 i = 0; i < nDics; ++i)
|
||||
for (sal_Int32 i = 0; i < aDics.getLength(); ++i)
|
||||
{
|
||||
const uno::Reference< XDictionary > &rDic = pDic[i];
|
||||
const uno::Reference<XDictionary>& rDic = aDics[i];
|
||||
if (rDic.is())
|
||||
AddDicBoxEntry( rDic, static_cast<sal_uInt16>(i) );
|
||||
}
|
||||
@@ -1373,7 +1333,7 @@ IMPL_LINK(SvxLinguTabPage, ModulesBoxCheckButtonHdl_Impl, const weld::TreeView::
|
||||
|
||||
IMPL_LINK(SvxLinguTabPage, DicsBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void)
|
||||
{
|
||||
const uno::Reference<XDictionary> &rDic = aDics.getConstArray()[m_xLinguDicsCLB->get_iter_index_in_parent(rRowCol.first)];
|
||||
const uno::Reference<XDictionary> &rDic = aDics[m_xLinguDicsCLB->get_iter_index_in_parent(rRowCol.first)];
|
||||
if (LinguMgr::GetIgnoreAllList() == rDic)
|
||||
m_xLinguDicsCLB->set_toggle(rRowCol.first, TRISTATE_TRUE);
|
||||
}
|
||||
@@ -1438,7 +1398,7 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
|
||||
sal_Int32 nDics = aDics.getLength();
|
||||
if (nDicPos < nDics)
|
||||
{
|
||||
uno::Reference< XDictionary > xDic = aDics.getConstArray()[ nDicPos ];
|
||||
uno::Reference<XDictionary> xDic = aDics[nDicPos];
|
||||
if (xDic.is())
|
||||
{
|
||||
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
||||
@@ -1463,7 +1423,7 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
|
||||
sal_Int32 nDics = aDics.getLength();
|
||||
if (nDicPos < nDics)
|
||||
{
|
||||
uno::Reference< XDictionary > xDic = aDics.getConstArray()[ nDicPos ];
|
||||
uno::Reference<XDictionary> xDic = aDics[nDicPos];
|
||||
if (xDic.is())
|
||||
{
|
||||
if (LinguMgr::GetIgnoreAllList() == xDic)
|
||||
@@ -1778,8 +1738,6 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
|
||||
|
||||
if (LANGUAGE_DONTKNOW != eCurLanguage)
|
||||
{
|
||||
sal_Int32 n;
|
||||
ServiceInfo_Impl* pInfo;
|
||||
bool bReadOnly = false;
|
||||
|
||||
int nRow = 0;
|
||||
@@ -1802,16 +1760,13 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
|
||||
bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
|
||||
}
|
||||
|
||||
Sequence< OUString > aNames( rLinguData.GetSortedImplNames( eCurLanguage, TYPE_SPELL ) );
|
||||
const OUString *pName = aNames.getConstArray();
|
||||
sal_Int32 nNames = aNames.getLength();
|
||||
sal_Int32 nLocalIndex = 0; // index relative to parent
|
||||
for (n = 0; n < nNames; ++n)
|
||||
for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_SPELL))
|
||||
{
|
||||
OUString aImplName;
|
||||
bool bIsSuppLang = false;
|
||||
|
||||
pInfo = rLinguData.GetInfoByImplName( pName[n] );
|
||||
ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name);
|
||||
if (pInfo)
|
||||
{
|
||||
bIsSuppLang = pInfo->xSpell.is() &&
|
||||
@@ -1860,16 +1815,13 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
|
||||
bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
|
||||
}
|
||||
|
||||
aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR );
|
||||
pName = aNames.getConstArray();
|
||||
nNames = aNames.getLength();
|
||||
nLocalIndex = 0;
|
||||
for (n = 0; n < nNames; ++n)
|
||||
for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_GRAMMAR))
|
||||
{
|
||||
OUString aImplName;
|
||||
bool bIsSuppLang = false;
|
||||
|
||||
pInfo = rLinguData.GetInfoByImplName( pName[n] );
|
||||
ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name);
|
||||
if (pInfo)
|
||||
{
|
||||
bIsSuppLang = pInfo->xGrammar.is() &&
|
||||
@@ -1919,16 +1871,13 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
|
||||
bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
|
||||
}
|
||||
|
||||
aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_HYPH );
|
||||
pName = aNames.getConstArray();
|
||||
nNames = aNames.getLength();
|
||||
nLocalIndex = 0;
|
||||
for (n = 0; n < nNames; ++n)
|
||||
for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_HYPH))
|
||||
{
|
||||
OUString aImplName;
|
||||
bool bIsSuppLang = false;
|
||||
|
||||
pInfo = rLinguData.GetInfoByImplName( pName[n] );
|
||||
ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name);
|
||||
if (pInfo)
|
||||
{
|
||||
bIsSuppLang = pInfo->xHyph.is() &&
|
||||
@@ -1977,16 +1926,13 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
|
||||
bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
|
||||
}
|
||||
|
||||
aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_THES );
|
||||
pName = aNames.getConstArray();
|
||||
nNames = aNames.getLength();
|
||||
nLocalIndex = 0;
|
||||
for (n = 0; n < nNames; ++n)
|
||||
for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_THES))
|
||||
{
|
||||
OUString aImplName;
|
||||
bool bIsSuppLang = false;
|
||||
|
||||
pInfo = rLinguData.GetInfoByImplName( pName[n] );
|
||||
ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name);
|
||||
if (pInfo)
|
||||
{
|
||||
bIsSuppLang = pInfo->xThes.is() &&
|
||||
|
||||
@@ -621,14 +621,11 @@ void SvxPathTabPage::GetPathList(
|
||||
Sequence< OUString > aPathSeq;
|
||||
if ( aAny >>= aPathSeq )
|
||||
{
|
||||
tools::Long i, nCount = aPathSeq.getLength();
|
||||
const OUString* pPaths = aPathSeq.getConstArray();
|
||||
|
||||
for ( i = 0; i < nCount; ++i )
|
||||
for (auto& path : aPathSeq)
|
||||
{
|
||||
if ( !_rInternalPath.isEmpty() )
|
||||
_rInternalPath += ";";
|
||||
_rInternalPath += pPaths[i];
|
||||
_rInternalPath += path;
|
||||
}
|
||||
}
|
||||
// load user paths
|
||||
@@ -636,14 +633,11 @@ void SvxPathTabPage::GetPathList(
|
||||
sCfgName + POSTFIX_USER);
|
||||
if ( aAny >>= aPathSeq )
|
||||
{
|
||||
tools::Long i, nCount = aPathSeq.getLength();
|
||||
const OUString* pPaths = aPathSeq.getConstArray();
|
||||
|
||||
for ( i = 0; i < nCount; ++i )
|
||||
for (auto& path : aPathSeq)
|
||||
{
|
||||
if ( !_rUserPath.isEmpty() )
|
||||
_rUserPath += ";";
|
||||
_rUserPath += pPaths[i];
|
||||
_rUserPath += path;
|
||||
}
|
||||
}
|
||||
// then the writable path
|
||||
|
||||
@@ -576,29 +576,22 @@ IMPL_LINK_NOARG(SvxSaveTabPage, BackupClickHdl_Impl, weld::Toggleable&, void)
|
||||
static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, std::u16string_view rExtension)
|
||||
{
|
||||
OUString sName;
|
||||
const PropertyValue* pPropVal = rProperties.getConstArray();
|
||||
const PropertyValue* const pEnd = pPropVal + rProperties.getLength();
|
||||
for( ; pPropVal != pEnd; pPropVal++ )
|
||||
for (auto& propVal : rProperties)
|
||||
{
|
||||
const OUString &rName = pPropVal->Name;
|
||||
const OUString &rName = propVal.Name;
|
||||
if (rName == "UIName")
|
||||
{
|
||||
OUString sUIName;
|
||||
if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() )
|
||||
if ((propVal.Value >>= sUIName) && sUIName.getLength())
|
||||
{
|
||||
if (!rExtension.empty())
|
||||
{
|
||||
return sUIName + " (" + rExtension + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
return sUIName;
|
||||
}
|
||||
sUIName += OUString::Concat(" (") + rExtension + ")";
|
||||
return sUIName;
|
||||
}
|
||||
}
|
||||
else if (rName == "Name")
|
||||
{
|
||||
pPropVal->Value >>= sName;
|
||||
propVal.Value >>= sName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,26 +98,25 @@ static bool bLastRelative = false;
|
||||
|
||||
static SvxNumSettings_Impl* lcl_CreateNumSettingsPtr(const Sequence<PropertyValue>& rLevelProps)
|
||||
{
|
||||
const PropertyValue* pValues = rLevelProps.getConstArray();
|
||||
SvxNumSettings_Impl* pNew = new SvxNumSettings_Impl;
|
||||
for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++)
|
||||
for (auto& prop : rLevelProps)
|
||||
{
|
||||
if ( pValues[j].Name == "NumberingType" )
|
||||
if (prop.Name == "NumberingType")
|
||||
{
|
||||
sal_Int16 nTmp;
|
||||
if (pValues[j].Value >>= nTmp)
|
||||
if (prop.Value >>= nTmp)
|
||||
pNew->nNumberType = static_cast<SvxNumType>(nTmp);
|
||||
}
|
||||
else if ( pValues[j].Name == "Prefix" )
|
||||
pValues[j].Value >>= pNew->sPrefix;
|
||||
else if ( pValues[j].Name == "Suffix" )
|
||||
pValues[j].Value >>= pNew->sSuffix;
|
||||
else if ( pValues[j].Name == "ParentNumbering" )
|
||||
pValues[j].Value >>= pNew->nParentNumbering;
|
||||
else if ( pValues[j].Name == "BulletChar" )
|
||||
pValues[j].Value >>= pNew->sBulletChar;
|
||||
else if ( pValues[j].Name == "BulletFontName" )
|
||||
pValues[j].Value >>= pNew->sBulletFont;
|
||||
else if (prop.Name == "Prefix")
|
||||
prop.Value >>= pNew->sPrefix;
|
||||
else if (prop.Name == "Suffix")
|
||||
prop.Value >>= pNew->sSuffix;
|
||||
else if (prop.Name == "ParentNumbering")
|
||||
prop.Value >>= pNew->nParentNumbering;
|
||||
else if (prop.Name == "BulletChar")
|
||||
prop.Value >>= pNew->sBulletChar;
|
||||
else if (prop.Name == "BulletFontName")
|
||||
prop.Value >>= pNew->sBulletFont;
|
||||
}
|
||||
return pNew;
|
||||
}
|
||||
@@ -176,13 +175,10 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(weld::Container* pPage, weld::D
|
||||
aNumberings =
|
||||
xDefNum->getDefaultContinuousNumberingLevels( rLocale );
|
||||
|
||||
|
||||
sal_Int32 nLength = std::min<sal_Int32>(aNumberings.getLength(), NUM_VALUSET_COUNT);
|
||||
|
||||
const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray();
|
||||
for(sal_Int32 i = 0; i < nLength; i++)
|
||||
{
|
||||
SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]);
|
||||
SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(aNumberings[i]);
|
||||
aNumSettingsArr.push_back(std::unique_ptr<SvxNumSettings_Impl>(pNew));
|
||||
}
|
||||
}
|
||||
@@ -501,7 +497,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(weld::Container* pPage, weld::DialogControl
|
||||
{
|
||||
SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ];
|
||||
|
||||
Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem];
|
||||
Reference<XIndexAccess> xLevel = aOutlineAccess[nItem];
|
||||
for(sal_Int32 nLevel = 0; nLevel < SVX_MAX_NUM; nLevel++)
|
||||
{
|
||||
// use the last locale-defined level for all remaining levels.
|
||||
|
||||
Reference in New Issue
Block a user