diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-05-03 15:26:01 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-05-03 15:26:01 +0200 |
commit | 0b1e4a306705d8c25db6e233244101ba6c4c16b6 (patch) | |
tree | e3ce34a2d884bb5469aa0e15e8d66b6aa08a876e | |
parent | ab3d2e568fe1595584c66c2ff07843e72f608944 (diff) |
Prevent Any::setValue from reinterpreting bool* as sal_Bool*
...which only happens ot work in environments where sizeof (bool) == 1. The
simpler alternative is to use the operator <<= template without passing explicit
UNO type information, anyway.
The std::nullptr_t overloads are needed to disambiguate calls with a nullptr
argument. (Which can at least be meaningful for VOID, but for other types what
it happens to do is store a default value of the given type.) As std::nullptr_t
is only C++11, this all needs to be LIBO_INTERNAL_ONLY.
Change-Id: Iff06a6ba94250bd4ae4afc937c2a2bfa75f0888f
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSetBase.cxx | 2 | ||||
-rw-r--r-- | editeng/source/misc/acorrcfg.cxx | 68 | ||||
-rw-r--r-- | extensions/source/bibliography/bibconfig.cxx | 4 | ||||
-rw-r--r-- | include/com/sun/star/uno/Any.h | 12 | ||||
-rw-r--r-- | include/comphelper/property.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dptabsrc.cxx | 23 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 6 | ||||
-rw-r--r-- | svl/source/config/cjkoptions.cxx | 19 | ||||
-rw-r--r-- | svl/source/config/ctloptions.cxx | 10 | ||||
-rw-r--r-- | svl/source/numbers/numfmuno.cxx | 25 | ||||
-rw-r--r-- | svtools/source/config/apearcfg.cxx | 5 | ||||
-rw-r--r-- | svtools/source/config/colorcfg.cxx | 3 | ||||
-rw-r--r-- | svtools/source/config/fontsubstconfig.cxx | 10 | ||||
-rw-r--r-- | svtools/source/config/htmlcfg.cxx | 2 | ||||
-rw-r--r-- | unotools/source/config/fltrcfg.cxx | 14 | ||||
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 41 | ||||
-rw-r--r-- | unotools/source/config/misccfg.cxx | 7 | ||||
-rw-r--r-- | unotools/source/config/saveopt.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/text/XMLIndexTabStopEntryContext.cxx | 6 |
20 files changed, 121 insertions, 147 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 18a95db85ec2..cc248329e631 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -380,10 +380,10 @@ void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const switch(nHandle) { case PROPERTY_ID_ISMODIFIED: - rValue.setValue(&m_bModified,cppu::UnoType<bool>::get()); + rValue <<= m_bModified; break; case PROPERTY_ID_ISNEW: - rValue.setValue(&m_bNew,cppu::UnoType<bool>::get()); + rValue <<= m_bNew; break; case PROPERTY_ID_PRIVILEGES: rValue <<= m_pCache->m_nPrivileges; diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 42dc249bcfcd..a007159155c9 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -141,7 +141,7 @@ void SAL_CALL ORowSetBase::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) c rValue <<= impl_getRowCount(); break; case PROPERTY_ID_ISROWCOUNTFINAL: - rValue.setValue(&m_pCache->m_bRowCountFinal,cppu::UnoType<bool>::get()); + rValue <<= m_pCache->m_bRowCountFinal; break; default: OPropertyStateContainer::getFastPropertyValue(rValue,nHandle); diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index aaf923366982..b838791ef00e 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -551,32 +551,30 @@ void SvxSwAutoCorrCfg::ImplCommit() Sequence<Any> aValues(aNames.getLength()); Any* pValues = aValues.getArray(); - const Type& rType = cppu::UnoType<bool>::get(); - sal_Bool bVal; SvxSwAutoFormatFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags(); for(int nProp = 0; nProp < aNames.getLength(); nProp++) { switch(nProp) { - case 0: pValues[nProp].setValue(&rParent.bFileRel, rType); break; // "Text/FileLinks", - case 1: pValues[nProp].setValue(&rParent.bNetRel, rType); break; // "Text/InternetLinks", - case 2: pValues[nProp].setValue(&rParent.bAutoTextPreview, rType); break; // "Text/ShowPreview", - case 3: pValues[nProp].setValue(&rParent.bAutoTextTip, rType); break; // "Text/ShowToolTip", - case 4: pValues[nProp].setValue(&rParent.bSearchInAllCategories, rType );break; //"Text/SearchInAllCategories" - case 5: bVal = rSwFlags.bAutoCorrect; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/UseReplacementTable", - case 6: bVal = rSwFlags.bCapitalStartSentence; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/TwoCapitalsAtStart", - case 7: bVal = rSwFlags.bCapitalStartWord; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/CapitalAtStartSentence", - case 8: bVal = rSwFlags.bChgWeightUnderl; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeUnderlineWeight", - case 9: bVal = rSwFlags.bSetINetAttr; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/SetInetAttribute", - case 10: bVal = rSwFlags.bChgOrdinalNumber; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeOrdinalNumber", - case 11: bVal = rSwFlags.bAddNonBrkSpace; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/AddNonBreakingSpace", + case 0: pValues[nProp] <<= rParent.bFileRel; break; // "Text/FileLinks", + case 1: pValues[nProp] <<= rParent.bNetRel; break; // "Text/InternetLinks", + case 2: pValues[nProp] <<= rParent.bAutoTextPreview; break; // "Text/ShowPreview", + case 3: pValues[nProp] <<= rParent.bAutoTextTip; break; // "Text/ShowToolTip", + case 4: pValues[nProp] <<= rParent.bSearchInAllCategories;break; //"Text/SearchInAllCategories" + case 5: pValues[nProp] <<= rSwFlags.bAutoCorrect; break; // "Format/Option/UseReplacementTable", + case 6: pValues[nProp] <<= rSwFlags.bCapitalStartSentence;; break; // "Format/Option/TwoCapitalsAtStart", + case 7: pValues[nProp] <<= rSwFlags.bCapitalStartWord; break; // "Format/Option/CapitalAtStartSentence", + case 8: pValues[nProp] <<= rSwFlags.bChgWeightUnderl; break; // "Format/Option/ChangeUnderlineWeight", + case 9: pValues[nProp] <<= rSwFlags.bSetINetAttr; break; // "Format/Option/SetInetAttribute", + case 10: pValues[nProp] <<= rSwFlags.bChgOrdinalNumber; break; // "Format/Option/ChangeOrdinalNumber", + case 11: pValues[nProp] <<= rSwFlags.bAddNonBrkSpace; break; // "Format/Option/AddNonBreakingSpace", // it doesn't exist here - the common flags are used for that -> LM case 12: - bVal = true; pValues[nProp].setValue(&bVal, rType); + pValues[nProp] <<= true; break; // "Format/Option/ChangeDash", - case 13: bVal = rSwFlags.bDelEmptyNode; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelEmptyParagraphs", - case 14: bVal = rSwFlags.bChgUserColl; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ReplaceUserStyle", - case 15: bVal = rSwFlags.bChgEnumNum; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeToBullets/Enable", + case 13: pValues[nProp] <<= rSwFlags.bDelEmptyNode; break; // "Format/Option/DelEmptyParagraphs", + case 14: pValues[nProp] <<= rSwFlags.bChgUserColl; break; // "Format/Option/ReplaceUserStyle", + case 15: pValues[nProp] <<= rSwFlags.bChgEnumNum; break; // "Format/Option/ChangeToBullets/Enable", case 16: pValues[nProp] <<= (sal_Int32)rSwFlags.cBullet; break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char", @@ -592,35 +590,35 @@ void SvxSwAutoCorrCfg::ImplCommit() case 20: pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetPitch(); break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch", - case 21: bVal = rSwFlags.bRightMargin; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/CombineParagraphs", + case 21: pValues[nProp] <<= rSwFlags.bRightMargin; break; // "Format/Option/CombineParagraphs", case 22: pValues[nProp] <<= (sal_Int32)rSwFlags.nRightMargin; break; // "Format/Option/CombineValue", - case 23: bVal = rSwFlags.bAFormatDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesAtStartEnd", - case 24: bVal = rSwFlags.bAFormatDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesBetween", - case 25: bVal = rParent.bAutoFmtByInput; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/Enable", - case 26: bVal = rSwFlags.bChgToEnEmDash; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeDash", - case 27: bVal = rSwFlags.bSetNumRule; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ApplyNumbering/Enable", - case 28: bVal = rSwFlags.bSetBorder; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToBorders", - case 29: bVal = rSwFlags.bCreateTable; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToTable", - case 30: bVal = rSwFlags.bReplaceStyles; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ReplaceStyle", - case 31: bVal = rSwFlags.bAFormatByInpDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesAtStartEnd", - case 32: bVal = rSwFlags.bAFormatByInpDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesBetween", - case 33: bVal = rSwFlags.bAutoCompleteWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/Enable", + case 23: pValues[nProp] <<= rSwFlags.bAFormatDelSpacesAtSttEnd; break; // "Format/Option/DelSpacesAtStartEnd", + case 24: pValues[nProp] <<= rSwFlags.bAFormatDelSpacesBetweenLines; break; // "Format/Option/DelSpacesBetween", + case 25: pValues[nProp] <<= rParent.bAutoFmtByInput; break; // "Format/ByInput/Enable", + case 26: pValues[nProp] <<= rSwFlags.bChgToEnEmDash; break; // "Format/ByInput/ChangeDash", + case 27: pValues[nProp] <<= rSwFlags.bSetNumRule; break; // "Format/ByInput/ApplyNumbering/Enable", + case 28: pValues[nProp] <<= rSwFlags.bSetBorder; break; // "Format/ByInput/ChangeToBorders", + case 29: pValues[nProp] <<= rSwFlags.bCreateTable; break; // "Format/ByInput/ChangeToTable", + case 30: pValues[nProp] <<= rSwFlags.bReplaceStyles; break; // "Format/ByInput/ReplaceStyle", + case 31: pValues[nProp] <<= rSwFlags.bAFormatByInpDelSpacesAtSttEnd; break; // "Format/ByInput/DelSpacesAtStartEnd", + case 32: pValues[nProp] <<= rSwFlags.bAFormatByInpDelSpacesBetweenLines; break; // "Format/ByInput/DelSpacesBetween", + case 33: pValues[nProp] <<= rSwFlags.bAutoCompleteWords; break; // "Completion/Enable", case 34: pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltWordLen; break; // "Completion/MinWordLen", case 35: pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltListLen; break; // "Completion/MaxListLen", - case 36: bVal = rSwFlags.bAutoCmpltCollectWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/CollectWords", - case 37: bVal = rSwFlags.bAutoCmpltEndless; pValues[nProp].setValue(&bVal, rType); break; // "Completion/EndlessList", - case 38: bVal = rSwFlags.bAutoCmpltAppendBlanc; pValues[nProp].setValue(&bVal, rType); break; // "Completion/AppendBlank", - case 39: bVal = rSwFlags.bAutoCmpltShowAsTip; pValues[nProp].setValue(&bVal, rType); break; // "Completion/ShowAsTip", + case 36: pValues[nProp] <<= rSwFlags.bAutoCmpltCollectWords; break; // "Completion/CollectWords", + case 37: pValues[nProp] <<= rSwFlags.bAutoCmpltEndless; break; // "Completion/EndlessList", + case 38: pValues[nProp] <<= rSwFlags.bAutoCmpltAppendBlanc; break; // "Completion/AppendBlank", + case 39: pValues[nProp] <<= rSwFlags.bAutoCmpltShowAsTip; break; // "Completion/ShowAsTip", case 40: pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltExpandKey; break; // "Completion/AcceptKey" - case 41 :bVal = rSwFlags.bAutoCmpltKeepList; pValues[nProp].setValue(&bVal, rType); break;// "Completion/KeepList" + case 41 : pValues[nProp] <<= rSwFlags.bAutoCmpltKeepList; break;// "Completion/KeepList" case 42 : pValues[nProp] <<= (sal_Int32)rSwFlags.cByInputBullet; break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char", diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index e5779e2249aa..a5d9733b8301 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -234,9 +234,7 @@ void BibConfig::ImplCommit() case 4: pValues[nProp] <<= nViewSize; break; case 5: pValues[nProp] <<= sQueryText; break; case 6: pValues[nProp] <<= sQueryField; break; - case 7: - pValues[nProp].setValue(&bShowColumnAssignmentWarning, cppu::UnoType<bool>::get()); - break; + case 7: pValues[nProp] <<= bShowColumnAssignmentWarning; break; } } PutProperties(aPropertyNames, aValues); diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h index c46a59e2f0cc..90107d5cbb4b 100644 --- a/include/com/sun/star/uno/Any.h +++ b/include/com/sun/star/uno/Any.h @@ -213,6 +213,18 @@ public: */ inline void SAL_CALL setValue( const void * pData_, typelib_TypeDescription * pTypeDescr ); +#if defined LIBO_INTERNAL_ONLY + void setValue(bool const *, Type const &) = delete; + void setValue(bool const *, typelib_TypeDescriptionReference *) = delete; + void setValue(bool const *, typelib_TypeDescription *) = delete; + void setValue(std::nullptr_t, Type const & type) + { setValue(static_cast<void *>(nullptr), type); } + void setValue(std::nullptr_t, typelib_TypeDescriptionReference * type) + { setValue(static_cast<void *>(nullptr), type); } + void setValue(std::nullptr_t, typelib_TypeDescription * type) + { setValue(static_cast<void *>(nullptr), type); } +#endif + /** Clears this any. If the any already contains a value, that value will be destructed and its memory freed. After this has been called, the any does not contain a value. */ diff --git a/include/comphelper/property.hxx b/include/comphelper/property.hxx index 1b79ccb8aec6..bc13cd0bc42d 100644 --- a/include/comphelper/property.hxx +++ b/include/comphelper/property.hxx @@ -132,7 +132,7 @@ inline bool tryPropertyValue(css::uno::Any& /*out*/_rConvertedValue, css::uno::A if (bool(bNewValue) != _bCurrentValue) { _rConvertedValue.setValue(&bNewValue, cppu::UnoType<bool>::get()); - _rOldValue.setValue(&_bCurrentValue, cppu::UnoType<bool>::get()); + _rOldValue <<= _bCurrentValue; bModified = true; } return bModified; diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index 0217fe5b4154..c652cf2af303 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -90,11 +90,6 @@ static bool lcl_GetBoolFromAny( const uno::Any& aAny ) return false; } -static void lcl_SetBoolInAny( uno::Any& rAny, bool bValue ) -{ - rAny.setValue( &bValue, cppu::UnoType<bool>::get() ); -} - ScDPSource::ScDPSource( ScDPTableData* pD ) : pData( pD ), pDimensions( nullptr ), @@ -1168,13 +1163,13 @@ uno::Any SAL_CALL ScDPSource::getPropertyValue( const OUString& aPropertyName ) { uno::Any aRet; if ( aPropertyName == SC_UNO_DP_COLGRAND ) - lcl_SetBoolInAny(aRet, bColumnGrand); + aRet <<= bColumnGrand; else if ( aPropertyName == SC_UNO_DP_ROWGRAND ) - lcl_SetBoolInAny(aRet, bRowGrand); + aRet <<= bRowGrand; else if ( aPropertyName == SC_UNO_DP_IGNOREEMPTY ) - lcl_SetBoolInAny(aRet, bIgnoreEmptyRows); + aRet <<= bIgnoreEmptyRows; else if ( aPropertyName == SC_UNO_DP_REPEATEMPTY ) - lcl_SetBoolInAny(aRet, bRepeatIfEmpty); + aRet <<= bRepeatIfEmpty; else if ( aPropertyName == SC_UNO_DP_DATADESC ) // read-only aRet <<= getDataDescription(); else if ( aPropertyName == SC_UNO_DP_ROWFIELDCOUNT ) // read-only @@ -1614,7 +1609,7 @@ uno::Any SAL_CALL ScDPDimension::getPropertyValue( const OUString& aPropertyName else if ( aPropertyName == SC_UNO_DP_REFVALUE ) aRet <<= aReferenceValue; else if ( aPropertyName == SC_UNO_DP_ISDATALAYOUT ) // read-only properties - lcl_SetBoolInAny( aRet, getIsDataLayoutDimension() ); + aRet <<= getIsDataLayoutDimension(); else if ( aPropertyName == SC_UNO_DP_NUMBERFO ) { sal_Int32 nFormat = 0; @@ -2233,9 +2228,9 @@ uno::Any SAL_CALL ScDPLevel::getPropertyValue( const OUString& aPropertyName ) { uno::Any aRet; if ( aPropertyName == SC_UNO_DP_SHOWEMPTY ) - lcl_SetBoolInAny(aRet, bShowEmpty); + aRet <<= bShowEmpty; else if ( aPropertyName == SC_UNO_DP_REPEATITEMLABELS ) - lcl_SetBoolInAny(aRet, bRepeatItemLabels); + aRet <<= bRepeatItemLabels; else if ( aPropertyName == SC_UNO_DP_SUBTOTAL ) { uno::Sequence<sheet::GeneralFunction> aSeq = getSubTotals(); //TODO: avoid extra copy? @@ -2681,9 +2676,9 @@ uno::Any SAL_CALL ScDPMember::getPropertyValue( const OUString& aPropertyName ) { uno::Any aRet; if ( aPropertyName == SC_UNO_DP_ISVISIBLE ) - lcl_SetBoolInAny(aRet, bVisible); + aRet <<= bVisible; else if ( aPropertyName == SC_UNO_DP_SHOWDETAILS ) - lcl_SetBoolInAny(aRet, bShowDet); + aRet <<= bShowDet; else if ( aPropertyName == SC_UNO_DP_POSITION ) aRet <<= nPosition; else if (aPropertyName == SC_UNO_DP_LAYOUTNAME) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index e6e9279342a0..10cea81039c9 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -737,8 +737,7 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu case HANDLE_FONT_TEXT_POSTURE : { const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); - bool bVal = IsItalic( rFace ); - (*pValue).setValue(&bVal, (*ppEntries)->maType); + *pValue <<= IsItalic( rFace ); } break; case HANDLE_CUSTOM_FONT_FIXED_WEIGHT : @@ -750,8 +749,7 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu case HANDLE_FONT_TEXT_WEIGHT : { const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); - bool bVal = IsBold( rFace ); // bold? - (*pValue).setValue(&bVal, (*ppEntries)->maType); + *pValue <<= IsBold( rFace ); } break; case HANDLE_BASE_FONT_HEIGHT : diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx index 906250174d41..3c7d9f201cc6 100644 --- a/svl/source/config/cjkoptions.cxx +++ b/svl/source/config/cjkoptions.cxx @@ -246,7 +246,6 @@ void SvtCJKOptions_Impl::ImplCommit() Any* pValues = aValues.getArray(); sal_Int32 nRealCount = 0; - const Type& rType = cppu::UnoType<bool>::get(); for(int nProp = 0; nProp < nOrgCount; nProp++) { switch(nProp) @@ -256,7 +255,7 @@ void SvtCJKOptions_Impl::ImplCommit() if (!bROCJKFont) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bCJKFont, rType); + pValues[nRealCount] <<= bCJKFont; ++nRealCount; } } @@ -267,7 +266,7 @@ void SvtCJKOptions_Impl::ImplCommit() if (!bROVerticalText) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bVerticalText, rType); + pValues[nRealCount] <<= bVerticalText; ++nRealCount; } } @@ -278,7 +277,7 @@ void SvtCJKOptions_Impl::ImplCommit() if (!bROAsianTypography) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bAsianTypography, rType); + pValues[nRealCount] <<= bAsianTypography; ++nRealCount; } } @@ -289,7 +288,7 @@ void SvtCJKOptions_Impl::ImplCommit() if (!bROJapaneseFind) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bJapaneseFind, rType); + pValues[nRealCount] <<= bJapaneseFind; ++nRealCount; } } @@ -300,7 +299,7 @@ void SvtCJKOptions_Impl::ImplCommit() if (!bRORuby) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bRuby, rType); + pValues[nRealCount] <<= bRuby; ++nRealCount; } } @@ -311,7 +310,7 @@ void SvtCJKOptions_Impl::ImplCommit() if (!bROChangeCaseMap) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bChangeCaseMap, rType); + pValues[nRealCount] <<= bChangeCaseMap; ++nRealCount; } } @@ -322,7 +321,7 @@ void SvtCJKOptions_Impl::ImplCommit() if (!bRODoubleLines) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bDoubleLines, rType); + pValues[nRealCount] <<= bDoubleLines; ++nRealCount; } } @@ -333,7 +332,7 @@ void SvtCJKOptions_Impl::ImplCommit() if (!bROEmphasisMarks) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bEmphasisMarks, rType); + pValues[nRealCount] <<= bEmphasisMarks; ++nRealCount; } } @@ -344,7 +343,7 @@ void SvtCJKOptions_Impl::ImplCommit() if (!bROVerticalCallOut) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bVerticalCallOut, rType); + pValues[nRealCount] <<= bVerticalCallOut; ++nRealCount; } } diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index 7aed551e926a..d95d4c5e7723 100644 --- a/svl/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -150,8 +150,6 @@ void SvtCTLOptions_Impl::ImplCommit() Any* pValues = aValues.getArray(); sal_Int32 nRealCount = 0; - const uno::Type& rType = cppu::UnoType<bool>::get(); - for ( int nProp = 0; nProp < nOrgCount; nProp++ ) { switch ( nProp ) @@ -161,7 +159,7 @@ void SvtCTLOptions_Impl::ImplCommit() if (!m_bROCTLFontEnabled) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue( &m_bCTLFontEnabled, rType ); + pValues[nRealCount] <<= m_bCTLFontEnabled; ++nRealCount; } } @@ -172,7 +170,7 @@ void SvtCTLOptions_Impl::ImplCommit() if (!m_bROCTLSequenceChecking) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue( &m_bCTLSequenceChecking, rType ); + pValues[nRealCount] <<= m_bCTLSequenceChecking; ++nRealCount; } } @@ -205,7 +203,7 @@ void SvtCTLOptions_Impl::ImplCommit() if (!m_bROCTLRestricted) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue( &m_bCTLRestricted, rType ); + pValues[nRealCount] <<= m_bCTLRestricted; ++nRealCount; } } @@ -215,7 +213,7 @@ void SvtCTLOptions_Impl::ImplCommit() if(!m_bROCTLTypeAndReplace) { pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue( &m_bCTLTypeAndReplace, rType ); + pValues[nRealCount] <<= m_bCTLTypeAndReplace; ++nRealCount; } } diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index 368dde3e3174..0f87d6809b5e 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -737,13 +737,11 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const OUString& aProperty else if (aPropertyName == PROPERTYNAME_STDFORM) { //! Pass through SvNumberformat Member bStandard? - sal_Bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 ); - aRet.setValue( &bStandard, cppu::UnoType<bool>::get() ); + aRet <<= ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 ); } else if (aPropertyName == PROPERTYNAME_USERDEF) { - sal_Bool bUserDef = ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 ); - aRet.setValue( &bUserDef, cppu::UnoType<bool>::get() ); + aRet <<= ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 ); } else if (aPropertyName == PROPERTYNAME_DECIMALS) { @@ -758,12 +756,12 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const OUString& aProperty else if (aPropertyName == PROPERTYNAME_NEGRED) { pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); - aRet.setValue( &bRed, cppu::UnoType<bool>::get() ); + aRet <<= bRed; } else if (aPropertyName == PROPERTYNAME_THOUS) { pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); - aRet.setValue( &bThousand, cppu::UnoType<bool>::get() ); + aRet <<= bThousand; } else if (aPropertyName == PROPERTYNAME_CURRSYM) { @@ -852,9 +850,9 @@ uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValue OUString aFmtStr = pFormat->GetFormatstring(); OUString aComment = pFormat->GetComment(); - sal_Bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 ); + bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 ); //! Pass through SvNumberformat Member bStandard? - sal_Bool bUserDef = ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 ); + bool bUserDef = ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 ); bool bThousand, bRed; sal_uInt16 nDecimals, nLeading; pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); @@ -872,17 +870,17 @@ uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValue pArray[3].Name = PROPERTYNAME_COMMENT; pArray[3].Value <<= aComment; pArray[4].Name = PROPERTYNAME_STDFORM; - pArray[4].Value.setValue( &bStandard, cppu::UnoType<bool>::get() ); + pArray[4].Value <<= bStandard; pArray[5].Name = PROPERTYNAME_USERDEF; - pArray[5].Value.setValue( &bUserDef, cppu::UnoType<bool>::get() ); + pArray[5].Value <<= bUserDef; pArray[6].Name = PROPERTYNAME_DECIMALS; pArray[6].Value <<= (sal_Int16)( nDecimals ); pArray[7].Name = PROPERTYNAME_LEADING; pArray[7].Value <<= (sal_Int16)( nLeading ); pArray[8].Name = PROPERTYNAME_NEGRED; - pArray[8].Value.setValue( &bRed, cppu::UnoType<bool>::get() ); + pArray[8].Value <<= bRed; pArray[9].Name = PROPERTYNAME_THOUS; - pArray[9].Value.setValue( &bThousand, cppu::UnoType<bool>::get() ); + pArray[9].Value <<= bThousand; pArray[10].Name = PROPERTYNAME_CURRSYM; pArray[10].Value <<= aSymbol; pArray[11].Name = PROPERTYNAME_CURREXT; @@ -1001,8 +999,7 @@ uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const OUString& a { if (aPropertyName == PROPERTYNAME_NOZERO) { - sal_Bool bNoZero = pFormatter->GetNoZero(); - aRet.setValue( &bNoZero, cppu::UnoType<bool>::get() ); + aRet <<= pFormatter->GetNoZero(); } else if (aPropertyName == PROPERTYNAME_NULLDATE) { diff --git a/svtools/source/config/apearcfg.cxx b/svtools/source/config/apearcfg.cxx index 1507d13aa783..378eb7f38ab8 100644 --- a/svtools/source/config/apearcfg.cxx +++ b/svtools/source/config/apearcfg.cxx @@ -116,18 +116,17 @@ void SvtTabAppearanceCfg::ImplCommit() Sequence<Any> aValues(rNames.getLength()); Any* pValues = aValues.getArray(); - const Type& rType = cppu::UnoType<bool>::get(); for(int nProp = 0; nProp < rNames.getLength(); nProp++) { switch(nProp) { case 0: pValues[nProp] <<= nScaleFactor; break; // "FontScaling", case 1: pValues[nProp] <<= nDragMode; break; //"Window/Drag", - case 2: pValues[nProp].setValue(&bMenuMouseFollow, rType); break; //"Menu/FollowMouse", + case 2: pValues[nProp] <<= bMenuMouseFollow; break; //"Menu/FollowMouse", case 3: pValues[nProp] <<= nSnapMode; break; //"Dialog/MousePositioning", case 4: pValues[nProp] <<= static_cast<short>(nMiddleMouse); break; //"Dialog/MiddleMouseButton", #if defined( UNX ) - case 5: pValues[nProp].setValue(&bFontAntialiasing, rType); break; // "FontAntialising/Enabled", + case 5: pValues[nProp] <<= bFontAntialiasing; break; // "FontAntialising/Enabled", case 6: pValues[nProp] <<= nAAMinPixelHeight; break; // "FontAntialising/MinPixelHeight", #endif } diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index ef1c8681dd65..1d1d07e0911c 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -271,7 +271,6 @@ void ColorConfig_Impl::ImplCommit() beans::PropertyValue* pPropValues = aPropValues.getArray(); const OUString* pColorNames = aColorNames.getConstArray(); sal_Int32 nIndex = 0; - const uno::Type& rBoolType = cppu::UnoType<bool>::get(); for(int i = 0; i < 2 * ColorConfigEntryCount && aColorNames.getLength() > nIndex; i+= 2) { pPropValues[nIndex].Name = pColorNames[nIndex]; @@ -286,7 +285,7 @@ void ColorConfig_Impl::ImplCommit() if(pColorNames[nIndex].endsWith(g_sIsVisible)) { pPropValues[nIndex].Name = pColorNames[nIndex]; - pPropValues[nIndex].Value.setValue(&m_aConfigValues[i/2].bIsVisible, rBoolType); + pPropValues[nIndex].Value <<= m_aConfigValues[i/2].bIsVisible; nIndex++; } } diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx index 742aa45ac99e..473c20ba08eb 100644 --- a/svtools/source/config/fontsubstconfig.cxx +++ b/svtools/source/config/fontsubstconfig.cxx @@ -97,10 +97,7 @@ void SvtFontSubstConfig::Notify( const css::uno::Sequence< OUString >& ) void SvtFontSubstConfig::ImplCommit() { - Sequence<OUString> aNames { cReplacement }; - Sequence<Any> aValues(1); - aValues.getArray()[0].setValue(&bIsEnabled, cppu::UnoType<bool>::get()); - PutProperties(aNames, aValues); + PutProperties({cReplacement}, {css::uno::Any(bIsEnabled)}); OUString sNode(cFontPairs); if(pImpl->aSubstArr.empty()) @@ -116,7 +113,6 @@ void SvtFontSubstConfig::ImplCommit() const OUString sAlways(cAlways); const OUString sOnScreenOnly(cOnScreenOnly); - const uno::Type& rBoolType = cppu::UnoType<bool>::get(); for(size_t i = 0; i < pImpl->aSubstArr.size(); i++) { OUString sPrefix = sNode + "/_" + OUString::number(i) + "/"; @@ -127,9 +123,9 @@ void SvtFontSubstConfig::ImplCommit() pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sSubstituteFont; pSetValues[nSetValue++].Value <<= rSubst.sReplaceBy; pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sAlways; - pSetValues[nSetValue++].Value.setValue(&rSubst.bReplaceAlways, rBoolType); + pSetValues[nSetValue++].Value <<= rSubst.bReplaceAlways; pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sOnScreenOnly; - pSetValues[nSetValue++].Value.setValue(&rSubst.bReplaceOnScreenOnly, rBoolType); + pSetValues[nSetValue++].Value <<= rSubst.bReplaceOnScreenOnly; } ReplaceSetProperties(sNode, aSetValues); } diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx index 4372052e2751..bfb4252b439b 100644 --- a/svtools/source/config/htmlcfg.cxx +++ b/svtools/source/config/htmlcfg.cxx @@ -236,7 +236,7 @@ void SvxHtmlOptions::ImplCommit() case 15: bSet = 0 != (pImp->nFlags & HTMLCFG_NUMBERS_ENGLISH_US);break;//"Import/NumbersEnglishUS" } if(nProp < 2 || ( nProp > 9 && nProp < 14 ) || nProp == 15) - pValues[nProp].setValue(&bSet, cppu::UnoType<bool>::get()); + pValues[nProp] <<= bSet; } PutProperties(aNames, aValues); } diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx index 93127a2005ef..ad19c6b3d856 100644 --- a/unotools/source/config/fltrcfg.cxx +++ b/unotools/source/config/fltrcfg.cxx @@ -93,18 +93,8 @@ SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl() void SvtAppFilterOptions_Impl::ImplCommit() { - Sequence<OUString> aNames(2); - OUString* pNames = aNames.getArray(); - pNames[0] = "Load"; - pNames[1] = "Save"; - Sequence<Any> aValues(aNames.getLength()); - Any* pValues = aValues.getArray(); - - const Type& rType = cppu::UnoType<bool>::get(); - pValues[0].setValue(&bLoadVBA, rType); - pValues[1].setValue(&bSaveVBA, rType); - - PutProperties(aNames, aValues); + PutProperties( + {"Load", "Save"}, {css::uno::Any(bLoadVBA), css::uno::Any(bSaveVBA)}); } void SvtAppFilterOptions_Impl::Notify( const Sequence< OUString >& ) diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index cab762af4d91..03b2275cc2be 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -671,7 +671,6 @@ bool SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyN osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get()); bool bRet = false; - const uno::Type &rBOOL = cppu::UnoType<bool>::get(); const uno::Type &rINT16 = cppu::UnoType<sal_Int16>::get(); const uno::Type &rINT32 = cppu::UnoType<sal_Int32>::get(); @@ -686,41 +685,41 @@ bool SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyN OUString aTmp( lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage ) ); *pValue++ = uno::makeAny( aTmp ); // 0 *pValue++ = uno::makeAny( rOpt.aActiveDics ); // 1 - pValue++->setValue( &rOpt.bIsUseDictionaryList, rBOOL ); // 2 - pValue++->setValue( &rOpt.bIsIgnoreControlCharacters, rBOOL ); // 3 + *pValue++ <<= rOpt.bIsUseDictionaryList; // 2 + *pValue++ <<= rOpt.bIsIgnoreControlCharacters; // 3 aTmp = lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage_CJK ); *pValue++ = uno::makeAny( aTmp ); // 5 aTmp = lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage_CTL ); *pValue++ = uno::makeAny( aTmp ); // 6 - pValue++->setValue( &rOpt.bIsSpellUpperCase, rBOOL ); // 7 - pValue++->setValue( &rOpt.bIsSpellWithDigits, rBOOL ); // 8 - pValue++->setValue( &rOpt.bIsSpellCapitalization, rBOOL ); // 9 - pValue++->setValue( &rOpt.bIsSpellAuto, rBOOL ); // 10 - pValue++->setValue( &rOpt.bIsSpellSpecial, rBOOL ); // 11 - pValue++->setValue( &rOpt.bIsSpellReverse, rBOOL ); // 14 + *pValue++ <<= rOpt.bIsSpellUpperCase; // 7 + *pValue++ <<= rOpt.bIsSpellWithDigits; // 8 + *pValue++ <<= rOpt.bIsSpellCapitalization; // 9 + *pValue++ <<= rOpt.bIsSpellAuto; // 10 + *pValue++ <<= rOpt.bIsSpellSpecial; // 11 + *pValue++ <<= rOpt.bIsSpellReverse; // 14 pValue++->setValue( &rOpt.nHyphMinLeading, rINT16 ); // 15 pValue++->setValue( &rOpt.nHyphMinTrailing, rINT16 ); // 16 pValue++->setValue( &rOpt.nHyphMinWordLength, rINT16 ); // 17 - pValue++->setValue( &rOpt.bIsHyphSpecial, rBOOL ); // 18 - pValue++->setValue( &rOpt.bIsHyphAuto, rBOOL ); // 19 + *pValue++ <<= rOpt.bIsHyphSpecial; // 18 + *pValue++ <<= rOpt.bIsHyphAuto; // 19 *pValue++ = uno::makeAny( rOpt.aActiveConvDics ); // 20 - pValue++->setValue( &rOpt.bIsIgnorePostPositionalWord, rBOOL ); // 21 - pValue++->setValue( &rOpt.bIsAutoCloseDialog, rBOOL ); // 22 - pValue++->setValue( &rOpt.bIsShowEntriesRecentlyUsedFirst, rBOOL ); // 23 - pValue++->setValue( &rOpt.bIsAutoReplaceUniqueEntries, rBOOL ); // 24 + *pValue++ <<= rOpt.bIsIgnorePostPositionalWord; // 21 + *pValue++ <<= rOpt.bIsAutoCloseDialog; // 22 + *pValue++ <<= rOpt.bIsShowEntriesRecentlyUsedFirst; // 23 + *pValue++ <<= rOpt.bIsAutoReplaceUniqueEntries; // 24 - pValue++->setValue( &rOpt.bIsDirectionToSimplified, rBOOL ); // 25 - pValue++->setValue( &rOpt.bIsUseCharacterVariants, rBOOL ); // 26 - pValue++->setValue( &rOpt.bIsTranslateCommonTerms, rBOOL ); // 27 - pValue++->setValue( &rOpt.bIsReverseMapping, rBOOL ); // 28 + *pValue++ <<= rOpt.bIsDirectionToSimplified; // 25 + *pValue++ <<= rOpt.bIsUseCharacterVariants; // 26 + *pValue++ <<= rOpt.bIsTranslateCommonTerms; // 27 + *pValue++ <<= rOpt.bIsReverseMapping; // 28 pValue++->setValue( &rOpt.nDataFilesChangedCheckValue, rINT32 ); // 29 - pValue++->setValue( &rOpt.bIsGrammarAuto, rBOOL ); // 30 - pValue++->setValue( &rOpt.bIsGrammarInteractive, rBOOL ); // 31 + *pValue++ <<= rOpt.bIsGrammarAuto; // 30 + *pValue++ <<= rOpt.bIsGrammarInteractive; // 31 bRet |= PutProperties( rProperyNames, aValues ); } diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx index c32a90cb565d..e2ef188fdea3 100644 --- a/unotools/source/config/misccfg.cxx +++ b/unotools/source/config/misccfg.cxx @@ -161,14 +161,13 @@ void SfxMiscCfg::ImplCommit() Sequence<Any> aValues(rNames.getLength()); Any* pValues = aValues.getArray(); - const Type& rType = cppu::UnoType<bool>::get(); for(int nProp = 0; nProp < rNames.getLength(); nProp++) { switch(nProp) { - case 0: pValues[nProp].setValue(&bPaperSize, rType);break; //"Print/Warning/PaperSize", - case 1: pValues[nProp].setValue(&bPaperOrientation, rType);break; //"Print/Warning/PaperOrientation", - case 2: pValues[nProp].setValue(&bNotFound, rType);break; //"Print/Warning/NotFound", + case 0: pValues[nProp] <<= bPaperSize;break; //"Print/Warning/PaperSize", + case 1: pValues[nProp] <<= bPaperOrientation;break; //"Print/Warning/PaperOrientation", + case 2: pValues[nProp] <<= bNotFound;break; //"Print/Warning/NotFound", case 3: pValues[nProp] <<= nYear2000;break; //"DateFormat/TwoDigitYear", } } diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 84b0e979c9c7..9a340748989c 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -799,9 +799,8 @@ SvtLoadOptions_Impl::~SvtLoadOptions_Impl() void SvtLoadOptions_Impl::ImplCommit() { - Sequence< OUString > aNames { cUserDefinedSettings }; - Sequence< Any > aValues { Any(bLoadUserDefinedSettings) }; - PutProperties( aNames, aValues ); + PutProperties( + {cUserDefinedSettings}, {css::uno::Any(bLoadUserDefinedSettings)}); } void SvtLoadOptions_Impl::Notify( const Sequence<OUString>& ) diff --git a/xmloff/source/text/XMLIndexTabStopEntryContext.cxx b/xmloff/source/text/XMLIndexTabStopEntryContext.cxx index 51764f72b047..1822fd251b0a 100644 --- a/xmloff/source/text/XMLIndexTabStopEntryContext.cxx +++ b/xmloff/source/text/XMLIndexTabStopEntryContext.cxx @@ -129,8 +129,7 @@ void XMLIndexTabStopEntryContext::FillPropertyValues( // right aligned? pValues[nNextEntry].Name = rTemplateContext.sTabStopRightAligned; - pValues[nNextEntry].Value.setValue( &bTabRightAligned, - cppu::UnoType<bool>::get()); + pValues[nNextEntry].Value <<= bTabRightAligned; nNextEntry++; // position @@ -151,8 +150,7 @@ void XMLIndexTabStopEntryContext::FillPropertyValues( // tab character #i21237# pValues[nNextEntry].Name = "WithTab"; - pValues[nNextEntry].Value.setValue( &bWithTab, - cppu::UnoType<bool>::get()); + pValues[nNextEntry].Value <<= bWithTab; nNextEntry++; // check whether we really filled all elements of the sequence |