Kaydet (Commit) 0252f24c authored tarafından Michael Stahl's avatar Michael Stahl

sw: clean up some defensive programming in modcfg.cxx

Change-Id: I901d934d1c2bdf6f15760292481091eb740dfda1
üst c150d910
......@@ -347,16 +347,14 @@ void SwRevisionConfig::Load()
const Sequence<OUString>& aNames = GetPropertyNames();
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aNames.getLength())
assert(aValues.getLength() == aNames.getLength());
for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
{
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
if (pValues[nProp].hasValue())
{
sal_Int32 nVal = 0;
pValues[nProp] >>= nVal;
switch(nProp)
switch (nProp)
{
case 0 : lcl_ConvertCfgToAttr(nVal, aInsertAttr); break;
case 1 : aInsertAttr.nColor = nVal; break;
......@@ -369,7 +367,6 @@ void SwRevisionConfig::Load()
}
}
}
}
}
enum InsertConfigProp
......@@ -874,9 +871,7 @@ void SwInsertConfig::Load()
const Sequence<OUString>& aNames = GetPropertyNames();
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aNames.getLength())
{
assert(aValues.getLength() == aNames.getLength());
InsCaptionOpt* pWriterTableOpt = 0;
InsCaptionOpt* pWriterFrameOpt = 0;
InsCaptionOpt* pWriterGraphicOpt = 0;
......@@ -885,7 +880,7 @@ void SwInsertConfig::Load()
InsCaptionOpt* pOLEChartOpt = 0;
InsCaptionOpt* pOLEFormulaOpt = 0;
InsCaptionOpt* pOLEDrawOpt = 0;
if(pCapOptions)
if (pCapOptions)
{
pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0);
pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0);
......@@ -896,16 +891,16 @@ void SwInsertConfig::Load()
pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH ]);
pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART ]);
}
else if(!bIsWeb)
else if (!bIsWeb)
return;
sal_uInt16 nInsTblFlags = 0;
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
{
if(pValues[nProp].hasValue())
if (pValues[nProp].hasValue())
{
bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE && *static_cast<sal_Bool const *>(pValues[nProp].getValue());
switch(nProp)
switch (nProp)
{
case INS_PROP_TABLE_HEADER:
{
......@@ -1087,7 +1082,7 @@ void SwInsertConfig::Load()
break;
}
}
else if(nProp == INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST)
else if (nProp == INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST)
{
//#i61007# initialize caption order, right now only HUNGARIAN seems to need a different order
SvtSysLocaleOptions aSysLocaleOptions;
......@@ -1097,7 +1092,6 @@ void SwInsertConfig::Load()
}
aInsTblOpts.mnInsMode = nInsTblFlags;
}
}
const Sequence<OUString>& SwTableConfig::GetPropertyNames()
......@@ -1162,15 +1156,13 @@ void SwTableConfig::Load()
const Sequence<OUString>& aNames = GetPropertyNames();
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aNames.getLength())
{
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
assert(aValues.getLength() == aNames.getLength());
for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
{
if(pValues[nProp].hasValue())
if (pValues[nProp].hasValue())
{
sal_Int32 nTemp = 0;
switch(nProp)
switch (nProp)
{
case 0 : pValues[nProp] >>= nTemp; nTblHMove = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Shift/Row",
case 1 : pValues[nProp] >>= nTemp; nTblVMove = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Shift/Column",
......@@ -1183,7 +1175,6 @@ void SwTableConfig::Load()
}
}
}
}
}
SwMiscConfig::SwMiscConfig() :
......@@ -1271,15 +1262,13 @@ void SwMiscConfig::Load()
const Sequence<OUString>& aNames = GetPropertyNames();
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aNames.getLength())
{
assert(aValues.getLength() == aNames.getLength());
OUString sTmp;
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
{
if(pValues[nProp].hasValue())
if (pValues[nProp].hasValue())
{
switch(nProp)
switch (nProp)
{
case 0 : pValues[nProp] >>= sTmp;
sWordDelimiter = SwModuleOptions::ConvertWordDelimiter(sTmp, true);
......@@ -1298,7 +1287,6 @@ void SwMiscConfig::Load()
}
}
}
}
}
const Sequence<OUString>& SwCompareConfig::GetPropertyNames()
......@@ -1360,12 +1348,10 @@ void SwCompareConfig::Load()
const Sequence<OUString>& aNames = GetPropertyNames();
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aNames.getLength())
assert(aValues.getLength() == aNames.getLength());
for (sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++)
{
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
if (pValues[nProp].hasValue())
{
sal_Int32 nVal = 0;
pValues[nProp] >>= nVal;
......@@ -1380,7 +1366,6 @@ void SwCompareConfig::Load()
}
}
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment