summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-05-03 15:26:01 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-05-03 15:26:01 +0200
commit0b1e4a306705d8c25db6e233244101ba6c4c16b6 (patch)
treee3ce34a2d884bb5469aa0e15e8d66b6aa08a876e /editeng
parentab3d2e568fe1595584c66c2ff07843e72f608944 (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
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/misc/acorrcfg.cxx68
1 files changed, 33 insertions, 35 deletions
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",