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

Change-Id: Ib689146520a99bbdaa7020583a4f34603c26ca19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124412
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2021-10-29 10:25:38 +03:00
parent 951c4ceb2e
commit ac31338c19
2 changed files with 10 additions and 8 deletions

View File

@@ -232,6 +232,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccEditableText::setAttributes(long startOffs
vecAttr.push_back(ouStr.getToken(0, ';', nIndex)); vecAttr.push_back(ouStr.getToken(0, ';', nIndex));
Sequence< PropertyValue > beanSeq(vecAttr.size()); Sequence< PropertyValue > beanSeq(vecAttr.size());
auto beanSeqRange = asNonConstRange(beanSeq);
for(std::vector<OUString>::size_type i = 0; i < vecAttr.size(); i ++) for(std::vector<OUString>::size_type i = 0; i < vecAttr.size(); i ++)
{ {
OUString attr = vecAttr[i]; OUString attr = vecAttr[i];
@@ -240,8 +241,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccEditableText::setAttributes(long startOffs
{ {
OUString attrName = attr.copy(0, nPos); OUString attrName = attr.copy(0, nPos);
OUString attrValue = attr.copy(nPos + 1); OUString attrValue = attr.copy(nPos + 1);
beanSeq[i].Name = attrName; beanSeqRange[i].Name = attrName;
get_AnyFromOLECHAR(attrName, attrValue, beanSeq[i].Value); get_AnyFromOLECHAR(attrName, attrValue, beanSeqRange[i].Value);
} }
} }
@@ -398,22 +399,23 @@ void CAccEditableText::get_AnyFromOLECHAR(std::u16string_view ouName, const OUSt
// Dump into Sequence. // Dump into Sequence.
int iSeqLen = (vecTabStop.size() == 0) ? 1 : vecTabStop.size(); int iSeqLen = (vecTabStop.size() == 0) ? 1 : vecTabStop.size();
Sequence< css::style::TabStop > seqTabStop(iSeqLen); Sequence< css::style::TabStop > seqTabStop(iSeqLen);
auto pseqTabStop = seqTabStop.getArray();
if(vecTabStop.size() != 0) if(vecTabStop.size() != 0)
{ {
// Dump every element. // Dump every element.
for(int i = 0; i < iSeqLen; i ++) for(int i = 0; i < iSeqLen; i ++)
{ {
seqTabStop[i] = vecTabStop[i]; pseqTabStop[i] = vecTabStop[i];
} }
} }
else else
{ {
// Create default value. // Create default value.
seqTabStop[0].Position = 0; pseqTabStop[0].Position = 0;
seqTabStop[0].Alignment = css::style::TabAlign_DEFAULT; pseqTabStop[0].Alignment = css::style::TabAlign_DEFAULT;
seqTabStop[0].DecimalChar = '.'; pseqTabStop[0].DecimalChar = '.';
seqTabStop[0].FillChar = ' '; pseqTabStop[0].FillChar = ' ';
} }
// Assign to Any object. // Assign to Any object.

View File

@@ -157,7 +157,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccTextBase::get_attributes(long offset, long
for(int i =0; i<nCount; i++) for(int i =0; i<nCount; i++)
{ {
css::beans::PropertyValue &pValue = pValues[i]; const css::beans::PropertyValue &pValue = pValues[i];
if(pValue.Name == "NumberingLevel") if(pValue.Name == "NumberingLevel")
{ {
if (pValue.Value != Any()) if (pValue.Value != Any())