diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-28 11:15:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-29 09:00:52 +0200 |
commit | 6dbae37b8d2d2d1ecad85c772fd684803b5a52cb (patch) | |
tree | cb6637327913a5f9641c2c0065de4c6a00983947 | |
parent | dc06c8f4989fc28d0c31ebd333e53dfe0e0f5f66 (diff) |
loplugin:constantparam (1)
Change-Id: I25077e391ecca1b678062d261a83d88daadf0a58
Reviewed-on: https://gerrit.libreoffice.org/59701
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/source/model/template/ScatterChartType.cxx | 14 | ||||
-rw-r--r-- | chart2/source/model/template/ScatterChartType.hxx | 5 | ||||
-rw-r--r-- | comphelper/source/misc/sequence.cxx | 49 | ||||
-rw-r--r-- | connectivity/source/commontools/ConnectionWrapper.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/commontools/dbtools2.cxx | 6 | ||||
-rw-r--r-- | cppu/source/uno/sequence.cxx | 78 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/connection.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryTableView.cxx | 12 | ||||
-rw-r--r-- | editeng/source/items/textitem.cxx | 4 | ||||
-rw-r--r-- | include/comphelper/sequence.hxx | 6 | ||||
-rw-r--r-- | include/connectivity/dbtools.hxx | 5 | ||||
-rw-r--r-- | include/editeng/nhypitem.hxx | 3 | ||||
-rw-r--r-- | reportdesign/source/core/api/ReportDefinition.cxx | 2 | ||||
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/bastyp/init.cxx | 2 |
15 files changed, 74 insertions, 128 deletions
diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx index 749a3e049c9d..fb73766efb75 100644 --- a/chart2/source/model/template/ScatterChartType.cxx +++ b/chart2/source/model/template/ScatterChartType.cxx @@ -136,20 +136,8 @@ struct StaticScatterChartTypeInfo : public rtl::StaticAggregate< uno::Reference< namespace chart { -ScatterChartType::ScatterChartType( - chart2::CurveStyle eCurveStyle /* chart2::CurveStyle_LINES */ , - sal_Int32 nResolution /* = 20 */, - sal_Int32 nOrder /* = 3 */ ) +ScatterChartType::ScatterChartType() { - if( eCurveStyle != chart2::CurveStyle_LINES ) - setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_CURVE_STYLE, - uno::Any( eCurveStyle )); - if( nResolution != 20 ) - setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION, - uno::Any( nResolution )); - if( nOrder != 3 ) - setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_SPLINE_ORDER, - uno::Any( nOrder )); } ScatterChartType::ScatterChartType( const ScatterChartType & rOther ) : diff --git a/chart2/source/model/template/ScatterChartType.hxx b/chart2/source/model/template/ScatterChartType.hxx index cf61b9421537..28a7aab24488 100644 --- a/chart2/source/model/template/ScatterChartType.hxx +++ b/chart2/source/model/template/ScatterChartType.hxx @@ -28,10 +28,7 @@ namespace chart class ScatterChartType final : public ChartType { public: - ScatterChartType( - css::chart2::CurveStyle eCurveStyle = css::chart2::CurveStyle_LINES, - sal_Int32 nResolution = 20, - sal_Int32 nOrder = 3 ); + ScatterChartType(); virtual ~ScatterChartType() override; virtual OUString SAL_CALL diff --git a/comphelper/source/misc/sequence.cxx b/comphelper/source/misc/sequence.cxx index 9236ee7d9bb6..81079de2223c 100644 --- a/comphelper/source/misc/sequence.cxx +++ b/comphelper/source/misc/sequence.cxx @@ -21,56 +21,21 @@ namespace comphelper { -css::uno::Sequence<sal_Int16> findValue(const css::uno::Sequence< OUString >& _rList, const OUString& _rValue, bool _bOnlyFirst) +sal_Int32 findValue(const css::uno::Sequence< OUString >& _rList, const OUString& _rValue) { sal_Int32 nLength = _rList.getLength(); - if( _bOnlyFirst ) + // at which position do I find the value? + const OUString* pTArray = _rList.getConstArray(); + for (sal_Int32 i = 0; i < nLength; ++i, ++pTArray) { - // at which position do I find the value? - sal_Int32 nPos = -1; - const OUString* pTArray = _rList.getConstArray(); - for (sal_Int32 i = 0; i < nLength; ++i, ++pTArray) + if( *pTArray == _rValue ) { - if( *pTArray == _rValue ) - { - nPos = i; - break; - } + return i; } - - // fill sequence - if( nPos>-1 ) - { - css::uno::Sequence<sal_Int16> aRetSeq( 1 ); - aRetSeq.getArray()[0] = static_cast<sal_Int16>(nPos); - - return aRetSeq; - } - - return css::uno::Sequence<sal_Int16>(); - } - else - { - css::uno::Sequence<sal_Int16> aRetSeq( nLength ); - sal_Int16* pReturn = aRetSeq.getArray(); - - // how often does the value occur? - const OUString* pTArray = _rList.getConstArray(); - for (sal_Int32 i = 0; i < nLength; ++i, ++pTArray) - { - if( *pTArray == _rValue ) - { - *pReturn = static_cast<sal_Int16>(i); - ++pReturn; - } - } - - aRetSeq.realloc(pReturn - aRetSeq.getArray()); - return aRetSeq; - } + return -1; } } // namespace comphelper diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx b/connectivity/source/commontools/ConnectionWrapper.cxx index ff966e65bbee..bd62d64990be 100644 --- a/connectivity/source/commontools/ConnectionWrapper.cxx +++ b/connectivity/source/commontools/ConnectionWrapper.cxx @@ -120,7 +120,7 @@ css::uno::Sequence< OUString > SAL_CALL OConnectionWrapper::getSupportedServiceN // append our own service, if necessary OUString sConnectionService( "com.sun.star.sdbc.Connection" ); - if ( 0 == ::comphelper::findValue( aSupported, sConnectionService, true ).getLength() ) + if ( ::comphelper::findValue( aSupported, sConnectionService ) == -1 ) { sal_Int32 nLen = aSupported.getLength(); aSupported.realloc( nLen + 1 ); diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 5e1296adbbc6..535baadb49d1 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -997,10 +997,10 @@ bool isAggregateColumn(const Reference< XSingleSelectQueryComposer > &_xParser, if (xColumnsSupplier.is()) xCols = xColumnsSupplier->getColumns(); - return isAggregateColumn(xCols, sName, false/*whenNotFound*/); + return isAggregateColumn(xCols, sName); } -bool isAggregateColumn(const Reference< XNameAccess > &_xColumns, const OUString &_sName, bool whenNotFound) +bool isAggregateColumn(const Reference< XNameAccess > &_xColumns, const OUString &_sName) { if ( _xColumns.is() && _xColumns->hasByName(_sName) ) { @@ -1008,7 +1008,7 @@ bool isAggregateColumn(const Reference< XNameAccess > &_xColumns, const OUString assert(xProp.is()); return isAggregateColumn( xProp ); } - return whenNotFound; + return false; } bool isAggregateColumn( const Reference< XPropertySet > &_xColumn ) diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx index 3420e5c8ec27..513ae613c93a 100644 --- a/cppu/source/uno/sequence.cxx +++ b/cppu/source/uno/sequence.cxx @@ -313,7 +313,7 @@ static inline bool idefaultConstructElements( static inline bool icopyConstructFromElements( uno_Sequence ** ppSeq, void * pSourceElements, typelib_TypeDescriptionReference * pElementType, - sal_Int32 nStartIndex, sal_Int32 nStopIndex, + sal_Int32 nStopIndex, uno_AcquireFunc acquire, sal_Int32 nAlloc ) { @@ -325,9 +325,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Unicode) * nStartIndex), - static_cast<char *>(pSourceElements) + (sizeof(sal_Unicode) * nStartIndex), - sizeof(sal_Unicode) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Unicode) * nStopIndex ); } break; case typelib_TypeClass_BOOLEAN: @@ -335,9 +335,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Bool) * nStartIndex), - static_cast<char *>(pSourceElements) + (sizeof(sal_Bool) * nStartIndex), - sizeof(sal_Bool) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Bool) * nStopIndex ); } break; case typelib_TypeClass_BYTE: @@ -345,9 +345,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Int8) * nStartIndex), - static_cast<char *>(pSourceElements) + (sizeof(sal_Int8) * nStartIndex), - sizeof(sal_Int8) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Int8) * nStopIndex ); } break; case typelib_TypeClass_SHORT: @@ -356,9 +356,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Int16) * nStartIndex), - static_cast<char *>(pSourceElements) + (sizeof(sal_Int16) * nStartIndex), - sizeof(sal_Int16) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Int16) * nStopIndex ); } break; case typelib_TypeClass_LONG: @@ -367,9 +367,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Int32) * nStartIndex), - static_cast<char *>(pSourceElements) + (sizeof(sal_Int32) * nStartIndex), - sizeof(sal_Int32) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Int32) * nStopIndex ); } break; case typelib_TypeClass_HYPER: @@ -378,9 +378,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Int64) * nStartIndex), - static_cast<char *>(pSourceElements) + (sizeof(sal_Int64) * nStartIndex), - sizeof(sal_Int64) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Int64) * nStopIndex ); } break; case typelib_TypeClass_FLOAT: @@ -388,9 +388,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(float) * nStartIndex), - static_cast<char *>(pSourceElements) + (sizeof(float) * nStartIndex), - sizeof(float) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(float) * nStopIndex ); } break; case typelib_TypeClass_DOUBLE: @@ -398,9 +398,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(double) * nStartIndex), - static_cast<char *>(pSourceElements) + (sizeof(double) * nStartIndex), - sizeof(double) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(double) * nStopIndex ); } break; case typelib_TypeClass_ENUM: @@ -408,9 +408,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Int32) * nStartIndex), - static_cast<char *>(pSourceElements) + (sizeof(sal_Int32) * nStartIndex), - sizeof(sal_Int32) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Int32) * nStopIndex ); } break; case typelib_TypeClass_STRING: @@ -419,7 +419,7 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { rtl_uString ** pDestElements = reinterpret_cast<rtl_uString **>(pSeq->elements); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { // This code tends to trigger coverity's overrun-buffer-arg warning // coverity[index_parm_via_loop_bound] - https://communities.coverity.com/thread/2993 @@ -438,7 +438,7 @@ static inline bool icopyConstructFromElements( { typelib_TypeDescriptionReference ** pDestElements = reinterpret_cast<typelib_TypeDescriptionReference **>(pSeq->elements); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { TYPE_ACQUIRE( static_cast<typelib_TypeDescriptionReference **>( @@ -456,7 +456,7 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { uno_Any * pDestElements = reinterpret_cast<uno_Any *>(pSeq->elements); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { uno_Any * pSource = static_cast<uno_Any *>(pSourceElements) + nPos; _copyConstructAny( @@ -482,7 +482,7 @@ static inline bool icopyConstructFromElements( typelib_CompoundTypeDescription * pTypeDescr = reinterpret_cast<typelib_CompoundTypeDescription *>(pElementTypeDescr); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { char * pDest = pDestElements + (nElementSize * nPos); @@ -527,7 +527,7 @@ static inline bool icopyConstructFromElements( typelib_TypeDescriptionReference * pSeqElementType = reinterpret_cast<typelib_IndirectTypeDescription *>(pElementTypeDescr)->pType; uno_Sequence ** pDestElements = reinterpret_cast<uno_Sequence **>(pSeq->elements); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { uno_Sequence * pNew = icopyConstructSequence( static_cast<uno_Sequence **>(pSourceElements)[nPos], @@ -547,7 +547,7 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { void ** pDestElements = reinterpret_cast<void **>(pSeq->elements); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { _acquire( pDestElements[nPos] = static_cast<void **>(pSourceElements)[nPos], acquire ); @@ -596,7 +596,7 @@ static inline bool ireallocSequence( { ret = icopyConstructFromElements( &pNew, pSeq->elements, pElementType, - 0, nCopy, acquire, + nCopy, acquire, nSize ); // alloc to nSize } if (ret && nRest > 0) @@ -683,7 +683,7 @@ sal_Bool SAL_CALL uno_type_sequence_construct( { ret = icopyConstructFromElements( ppSequence, pElements, pElementType, - 0, len, acquire, + len, acquire, len ); // alloc to len } @@ -724,7 +724,7 @@ sal_Bool SAL_CALL uno_sequence_construct( { ret = icopyConstructFromElements( ppSequence, pElements, pElementType, - 0, len, acquire, + len, acquire, len ); // alloc to len } } @@ -800,7 +800,7 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One( ret = icopyConstructFromElements( &pNew, pSequence->elements, reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType, - 0, pSequence->nElements, acquire, + pSequence->nElements, acquire, pSequence->nElements ); // alloc nElements if (ret) { @@ -844,7 +844,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One( ret = icopyConstructFromElements( &pNew, pSequence->elements, reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType, - 0, pSequence->nElements, acquire, + pSequence->nElements, acquire, pSequence->nElements ); // alloc nElements if (ret) { diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 4919c9b42615..598b4e815c0f 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -89,7 +89,7 @@ Sequence< OUString > OConnection::getSupportedServiceNames( ) { Sequence< OUString > aSupported = OConnectionWrapper::getSupportedServiceNames(); - if ( 0 == findValue( aSupported, SERVICE_SDB_CONNECTION, true ).getLength() ) + if ( comphelper::findValue( aSupported, SERVICE_SDB_CONNECTION ) == -1 ) { sal_Int32 nLen = aSupported.getLength(); aSupported.realloc( nLen + 1 ); diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx index 12688f0b4877..58d0fe320cb4 100644 --- a/dbaccess/source/ui/querydesign/QueryTableView.cxx +++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx @@ -150,9 +150,9 @@ namespace xColumn->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedColumn; { - Sequence< sal_Int16> aFind(::comphelper::findValue(_rSource.GetOriginalColumns()->getElementNames(),rElement,true)); - if(aFind.getLength()) - pNewConnData->SetFieldIndex(JTCS_FROM,aFind[0]+1); + sal_Int32 nFindIndex = ::comphelper::findValue(_rSource.GetOriginalColumns()->getElementNames(),rElement); + if(nFindIndex != -1) + pNewConnData->SetFieldIndex(JTCS_FROM,nFindIndex+1); else OSL_FAIL("Column not found!"); } @@ -160,9 +160,9 @@ namespace Reference<XNameAccess> xRefColumns = _rDest.GetOriginalColumns(); if(xRefColumns.is()) { - Sequence< sal_Int16> aFind(::comphelper::findValue(xRefColumns->getElementNames(),sRelatedColumn,true)); - if(aFind.getLength()) - pNewConnData->SetFieldIndex(JTCS_TO,aFind[0]+1); + sal_Int32 nFindIndex = ::comphelper::findValue(xRefColumns->getElementNames(),sRelatedColumn); + if(nFindIndex != -1) + pNewConnData->SetFieldIndex(JTCS_TO,nFindIndex+1); else OSL_FAIL("Column not found!"); } diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index de0d985c96bc..9f6a0f22ba74 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -2160,8 +2160,8 @@ bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) // class SvxNoHyphenItem ------------------------------------------------- -SvxNoHyphenItem::SvxNoHyphenItem( const bool bHyphen, const sal_uInt16 nId ) : - SfxBoolItem( nId , bHyphen ) +SvxNoHyphenItem::SvxNoHyphenItem( const sal_uInt16 nId ) : + SfxBoolItem( nId , true ) { } diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx index c3bddb28aaa9..ee1cdf6edf4f 100644 --- a/include/comphelper/sequence.hxx +++ b/include/comphelper/sequence.hxx @@ -29,10 +29,10 @@ namespace comphelper { - /** search the given string within the given sequence, return the positions where it was found. - if _bOnlyFirst is sal_True, only the first occurrence will be returned. + /** Search the given string within the given sequence, return the position of the first occurence. + Returns -1 if nothing found. */ - COMPHELPER_DLLPUBLIC css::uno::Sequence<sal_Int16> findValue(const css::uno::Sequence< OUString >& _rList, const OUString& _rValue, bool _bOnlyFirst); + COMPHELPER_DLLPUBLIC sal_Int32 findValue(const css::uno::Sequence< OUString >& _rList, const OUString& _rValue); namespace internal { diff --git a/include/connectivity/dbtools.hxx b/include/connectivity/dbtools.hxx index b777635a100b..c10963cd6796 100644 --- a/include/connectivity/dbtools.hxx +++ b/include/connectivity/dbtools.hxx @@ -796,13 +796,10 @@ namespace dbtools look for column sName in there @param _sName name of the column - @param whenNotFound - value returned when _sName is not in _xColumns */ OOO_DLLPUBLIC_DBTOOLS bool isAggregateColumn( const css::uno::Reference< css::container::XNameAccess > &_xColumns, - const OUString &_sName, - bool whenNotFound + const OUString &_sName ); /** is this column an aggregate? diff --git a/include/editeng/nhypitem.hxx b/include/editeng/nhypitem.hxx index b05569f0599f..69f5477678d4 100644 --- a/include/editeng/nhypitem.hxx +++ b/include/editeng/nhypitem.hxx @@ -26,8 +26,7 @@ class EDITENG_DLLPUBLIC SvxNoHyphenItem : public SfxBoolItem { public: - SvxNoHyphenItem( const bool bHyphen /*= true*/, - const sal_uInt16 nId ); + SvxNoHyphenItem( const sal_uInt16 nId ); // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 593d7eb54640..1b7e66981d55 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -703,7 +703,7 @@ uno::Sequence< OUString > SAL_CALL OReportDefinition::getSupportedServiceNames( aSupported = m_aProps->m_xServiceInfo->getSupportedServiceNames(); // append our own service, if necessary - if ( 0 == ::comphelper::findValue( aSupported, SERVICE_REPORTDEFINITION, true ).getLength() ) + if ( ::comphelper::findValue( aSupported, SERVICE_REPORTDEFINITION ) == -1 ) { sal_Int32 nLen = aSupported.getLength(); aSupported.realloc( nLen + 1 ); diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 59a559a33aff..b4d5695ec178 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -2602,9 +2602,9 @@ OUString DbListBox::GetFormatText(const Reference< css::sdb::XColumn >& _rxField sText = _rxField->getString(); if ( m_bBound ) { - Sequence< sal_Int16 > aPosSeq = ::comphelper::findValue( m_aValueList, sText, true ); - if ( aPosSeq.getLength() ) - sText = static_cast<ListBox*>(m_pWindow.get())->GetEntry(aPosSeq.getConstArray()[0]); + sal_Int32 nPos = ::comphelper::findValue( m_aValueList, sText ); + if ( nPos != -1 ) + sText = static_cast<ListBox*>(m_pWindow.get())->GetEntry(nPos); else sText.clear(); } @@ -2952,9 +2952,9 @@ void DbFilterField::SetText(const OUString& rText) } break; case css::form::FormComponentType::LISTBOX: { - Sequence<sal_Int16> aPosSeq = ::comphelper::findValue(m_aValueList, m_aText, true); - if (aPosSeq.getLength()) - static_cast<ListBox*>(m_pWindow.get())->SelectEntryPos(aPosSeq.getConstArray()[0]); + sal_Int32 nPos = ::comphelper::findValue(m_aValueList, m_aText); + if (nPos != -1) + static_cast<ListBox*>(m_pWindow.get())->SelectEntryPos(nPos); else static_cast<ListBox*>(m_pWindow.get())->SetNoSelection(); } break; diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 89e412f174b1..657c7b1fb795 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -470,7 +470,7 @@ void InitCore() aAttrTab[ RES_CHRATR_WORDLINEMODE- POOLATTR_BEGIN ] = new SvxWordLineModeItem( false, RES_CHRATR_WORDLINEMODE ); aAttrTab[ RES_CHRATR_AUTOKERN- POOLATTR_BEGIN ] = new SvxAutoKernItem( false, RES_CHRATR_AUTOKERN ); aAttrTab[ RES_CHRATR_BLINK - POOLATTR_BEGIN ] = new SvxBlinkItem( false, RES_CHRATR_BLINK ); - aAttrTab[ RES_CHRATR_NOHYPHEN - POOLATTR_BEGIN ] = new SvxNoHyphenItem( true, RES_CHRATR_NOHYPHEN ); + aAttrTab[ RES_CHRATR_NOHYPHEN - POOLATTR_BEGIN ] = new SvxNoHyphenItem( RES_CHRATR_NOHYPHEN ); aAttrTab[ RES_CHRATR_UNUSED2- POOLATTR_BEGIN ] = new SfxVoidItem( RES_CHRATR_UNUSED2 ); aAttrTab[ RES_CHRATR_BACKGROUND - POOLATTR_BEGIN ] = new SvxBrushItem( RES_CHRATR_BACKGROUND ); |