summaryrefslogtreecommitdiff
path: root/svtools
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 /svtools
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 'svtools')
-rw-r--r--svtools/source/config/apearcfg.cxx5
-rw-r--r--svtools/source/config/colorcfg.cxx3
-rw-r--r--svtools/source/config/fontsubstconfig.cxx10
-rw-r--r--svtools/source/config/htmlcfg.cxx2
4 files changed, 7 insertions, 13 deletions
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);
}