diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-12 15:55:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-13 06:54:23 +0000 |
commit | 8fce16fb573506c24aa06e86b476fa6f42ea60b9 (patch) | |
tree | 2817c8c6ff49b141dcb2dfd38582b7272ecff0f1 /sw/source/uibase/utlui/uitool.cxx | |
parent | b39feae4f12b07a0fdb2c8c2a48d5aae613cd7c9 (diff) |
convert SvxPageUsage to scoped enum
and expand out the bit-tricks some of the code was playing to make it
more obvious what is going on
Change-Id: I9c98334393b939b1d900425f6133556ce88247ae
Reviewed-on: https://gerrit.libreoffice.org/29734
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/utlui/uitool.cxx')
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 571b0ba394f1..a6be386e0be0 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -234,30 +234,30 @@ void FillHdFt(SwFrameFormat* pFormat, const SfxItemSet& rSet) /// Convert from UseOnPage to SvxPageUsage. SvxPageUsage lcl_convertUseToSvx(UseOnPage nUse) { - int nRet = 0; + SvxPageUsage nRet = SvxPageUsage::NONE; if (nUse & UseOnPage::Left) - nRet |= SVX_PAGE_LEFT; + nRet = SvxPageUsage::Left; if (nUse & UseOnPage::Right) - nRet |= SVX_PAGE_RIGHT; + nRet = SvxPageUsage::Right; if ((nUse & UseOnPage::All) == UseOnPage::All) - nRet |= SVX_PAGE_ALL; + nRet = SvxPageUsage::All; if ((nUse & UseOnPage::Mirror) == UseOnPage::Mirror) - nRet |= SVX_PAGE_MIRROR; - return (SvxPageUsage)nRet; + nRet = SvxPageUsage::Mirror; + return nRet; } /// Convert from SvxPageUsage to UseOnPage. UseOnPage lcl_convertUseFromSvx(SvxPageUsage nUse) { UseOnPage nRet = UseOnPage::NONE; - if ((nUse & SVX_PAGE_LEFT) == SVX_PAGE_LEFT) - nRet |= UseOnPage::Left; - if ((nUse & SVX_PAGE_RIGHT) == SVX_PAGE_RIGHT) - nRet |= UseOnPage::Right; - if ((nUse & SVX_PAGE_ALL) == SVX_PAGE_ALL) - nRet |= UseOnPage::All; - if ((nUse & SVX_PAGE_MIRROR) == SVX_PAGE_MIRROR) - nRet |= UseOnPage::Mirror; + if (nUse == SvxPageUsage::Left) + nRet = UseOnPage::Left; + else if (nUse == SvxPageUsage::Right) + nRet = UseOnPage::Right; + else if (nUse == SvxPageUsage::All) + nRet = UseOnPage::All; + else if (nUse == SvxPageUsage::Mirror) + nRet = UseOnPage::Mirror; return nRet; } @@ -276,8 +276,8 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ) { const SvxPageItem& rPageItem = static_cast<const SvxPageItem&>(rSet.Get(SID_ATTR_PAGE)); - const SvxPageUsage nUse = (SvxPageUsage)rPageItem.GetPageUsage(); - if(nUse) + const SvxPageUsage nUse = rPageItem.GetPageUsage(); + if(nUse != SvxPageUsage::NONE) rPageDesc.SetUseOn( lcl_convertUseFromSvx(nUse) ); rPageDesc.SetLandscape(rPageItem.IsLandscape()); SvxNumberType aNumType; |