diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-09-14 14:40:25 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-09-14 14:40:25 +0200 |
commit | a4462f247fb92233a1f89a98c689e32af33d3e3f (patch) | |
tree | 2f42e2fcfff9a61afa5d5f834097e24c5bbbd52e /sw | |
parent | 8cdf71a97cd53e9e1035017febf226765cf0697d (diff) |
Set ContentTypeId::UNKNOWN to -1
...which matches the original situation better, where ContentTypeId was
sal_uInt16, and so the default -1 for
/org.openoffice.Office/Writer/Navigator/RootType happened to match UNKNOWN being
USHRT_MAX. Follow-up to 874cc6cb72e6e795f48bcee5d4fe5c595fb1f702 "Don't read
out-of-range ContentTypeId from configuration."
Change-Id: I6d136412982c3cfb06ddef3b6c1acd800d92ae05
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/inc/swcont.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/utlui/navicfg.cxx | 13 | ||||
-rw-r--r-- | sw/source/uibase/utlui/navipi.cxx | 2 |
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); |