summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/uibase/inc/swcont.hxx2
-rw-r--r--sw/source/uibase/utlui/navicfg.cxx13
-rw-r--r--sw/source/uibase/utlui/navipi.cxx2
3 files changed, 11 insertions, 6 deletions
diff --git a/sw/source/uibase/inc/swcont.hxx b/sw/source/uibase/inc/swcont.hxx
index 153661b1e89b..29179d789a8b 100644
--- a/sw/source/uibase/inc/swcont.hxx
+++ b/sw/source/uibase/inc/swcont.hxx
@@ -41,7 +41,7 @@ enum class ContentTypeId
POSTIT = 10,
DRAWOBJECT = 11,
LAST = DRAWOBJECT,
- UNKNOWN = USHRT_MAX
+ UNKNOWN = -1
};
// strings for context menus
diff --git a/sw/source/uibase/utlui/navicfg.cxx b/sw/source/uibase/utlui/navicfg.cxx
index f9440e7c029b..d7dcab652c08 100644
--- a/sw/source/uibase/utlui/navicfg.cxx
+++ b/sw/source/uibase/utlui/navicfg.cxx
@@ -75,11 +75,16 @@ SwNavigationConfig::SwNavigationConfig() :
{
case 0:
{
- sal_uInt32 nTmp;
+ sal_Int32 nTmp;
if (pValues[nProp] >>= nTmp)
{
- if (nTmp > sal_uInt32(ContentTypeId::LAST)) {
- nTmp = sal_uInt32(ContentTypeId::UNKNOWN);
+ if (nTmp < sal_Int32(ContentTypeId::UNKNOWN)
+ || nTmp > sal_Int32(ContentTypeId::LAST))
+ {
+ SAL_WARN(
+ "sw",
+ "out-of-bounds ContentTypeId " << nTmp);
+ nTmp = sal_Int32(ContentTypeId::UNKNOWN);
}
nRootType = static_cast<ContentTypeId>(nTmp);
}
@@ -117,7 +122,7 @@ void SwNavigationConfig::ImplCommit()
{
switch(nProp)
{
- case 0: pValues[nProp] <<= static_cast<sal_uInt32>(nRootType); break;
+ case 0: pValues[nProp] <<= static_cast<sal_Int32>(nRootType); break;
case 1: pValues[nProp] <<= nSelectedPos; break;
case 2: pValues[nProp] <<= nOutlineLevel; break;
case 3: pValues[nProp] <<= static_cast<sal_uInt16>(nRegionMode); break;
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index 200a8d2ccba4..075c3bda1441 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -1295,7 +1295,7 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent,
SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig();
const ContentTypeId nRootType = pNaviConfig->GetRootType();
- if( nRootType <= ContentTypeId::LAST )
+ if( nRootType != ContentTypeId::UNKNOWN )
{
pNavi->aContentTree->SetRootType(nRootType);
pNavi->aContentToolBox->CheckItem(FN_SHOW_ROOT);