convert PD_ constants to typed_flags

Change-Id: Ia651dfae33cb1e901f124541a1e12f240d4a7458
This commit is contained in:
Noel Grandin 2016-10-12 11:34:54 +02:00
parent 8ee31c5aac
commit cbd4266bef
18 changed files with 101 additions and 97 deletions

View File

@ -27,14 +27,16 @@
#include <editeng/numitem.hxx>
#include <editeng/borderline.hxx>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
using namespace ::com::sun::star;
#include <o3tl/typed_flags_set.hxx>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/random_access_index.hpp>
using namespace ::com::sun::star;
class SfxPoolItem;
class SwTextFormatColl;
class SwNode;
@ -121,20 +123,22 @@ public:
* document (contents are created or removed according to SHARE-information).
*/
typedef sal_uInt16 UseOnPage;
namespace nsUseOnPage
enum class UseOnPage : sal_uInt16
{
const UseOnPage PD_NONE = 0x0000; ///< For internal use only.
const UseOnPage PD_LEFT = 0x0001;
const UseOnPage PD_RIGHT = 0x0002;
const UseOnPage PD_ALL = 0x0003;
const UseOnPage PD_MIRROR = 0x0007;
const UseOnPage PD_HEADERSHARE = 0x0040;
const UseOnPage PD_FOOTERSHARE = 0x0080;
const UseOnPage PD_FIRSTSHARE = 0x0100;
const UseOnPage PD_NOHEADERSHARE = 0xFFBF; ///< For internal use only.
const UseOnPage PD_NOFOOTERSHARE = 0xFF7F; ///< For internal use only.
const UseOnPage PD_NOFIRSTSHARE = 0xFEFF;
NONE = 0x0000, ///< For internal use only.
Left = 0x0001,
Right = 0x0002,
All = 0x0003,
Mirror = 0x0007,
HeaderShare = 0x0040,
FooterShare = 0x0080,
FirstShare = 0x0100,
NoHeaderShare = 0xFFBF, ///< For internal use only.
NoFooterShare = 0xFF7F, ///< For internal use only.
NoFirstShare = 0xFEFF
};
namespace o3tl {
template<> struct typed_flags<UseOnPage> : is_typed_flags<UseOnPage, 0xffff> {};
}
class SW_DLLPUBLIC SwPageDesc : public SwModify
@ -206,7 +210,7 @@ public:
bool IsHidden() const { return m_IsHidden; }
void SetHidden(bool const bValue) { m_IsHidden = bValue; }
/// Same as WriteUseOn(), but the >= PD_HEADERSHARE part of the bitfield is not modified.
/// Same as WriteUseOn(), but the >= HeaderShare part of the bitfield is not modified.
inline void SetUseOn( UseOnPage eNew );
inline UseOnPage GetUseOn() const;
@ -296,44 +300,44 @@ inline void SwPageDesc::SetFollow( const SwPageDesc* pNew )
inline bool SwPageDesc::IsHeaderShared() const
{
return (m_eUse & nsUseOnPage::PD_HEADERSHARE) != 0;
return bool(m_eUse & UseOnPage::HeaderShare);
}
inline bool SwPageDesc::IsFooterShared() const
{
return (m_eUse & nsUseOnPage::PD_FOOTERSHARE) != 0;
return bool(m_eUse & UseOnPage::FooterShare);
}
inline void SwPageDesc::ChgHeaderShare( bool bNew )
{
if ( bNew )
m_eUse = (UseOnPage) (m_eUse | nsUseOnPage::PD_HEADERSHARE);
m_eUse |= UseOnPage::HeaderShare;
else
m_eUse = (UseOnPage) (m_eUse & nsUseOnPage::PD_NOHEADERSHARE);
m_eUse &= UseOnPage::NoHeaderShare;
}
inline void SwPageDesc::ChgFooterShare( bool bNew )
{
if ( bNew )
m_eUse = (UseOnPage) (m_eUse | nsUseOnPage::PD_FOOTERSHARE);
m_eUse |= UseOnPage::FooterShare;
else
m_eUse = (UseOnPage) (m_eUse & nsUseOnPage::PD_NOFOOTERSHARE);
m_eUse &= UseOnPage::NoFooterShare;
}
inline void SwPageDesc::SetUseOn( UseOnPage eNew )
{
UseOnPage eTmp = nsUseOnPage::PD_NONE;
if (m_eUse & nsUseOnPage::PD_HEADERSHARE)
eTmp = nsUseOnPage::PD_HEADERSHARE;
if (m_eUse & nsUseOnPage::PD_FOOTERSHARE)
eTmp = (UseOnPage) (eTmp | nsUseOnPage::PD_FOOTERSHARE);
if (m_eUse & nsUseOnPage::PD_FIRSTSHARE)
eTmp = (UseOnPage) (eTmp | nsUseOnPage::PD_FIRSTSHARE);
m_eUse = (UseOnPage) (eTmp | eNew);
UseOnPage eTmp = UseOnPage::NONE;
if (m_eUse & UseOnPage::HeaderShare)
eTmp = UseOnPage::HeaderShare;
if (m_eUse & UseOnPage::FooterShare)
eTmp |= UseOnPage::FooterShare;
if (m_eUse & UseOnPage::FirstShare)
eTmp |= UseOnPage::FirstShare;
m_eUse = eTmp | eNew;
}
inline UseOnPage SwPageDesc::GetUseOn() const
{
UseOnPage eRet = m_eUse;
eRet = (UseOnPage) (eRet & nsUseOnPage::PD_NOHEADERSHARE);
eRet = (UseOnPage) (eRet & nsUseOnPage::PD_NOFOOTERSHARE);
eRet = (UseOnPage) (eRet & nsUseOnPage::PD_NOFIRSTSHARE);
eRet &= UseOnPage::NoHeaderShare;
eRet &= UseOnPage::NoFooterShare;
eRet &= UseOnPage::NoFirstShare;
return eRet;
}

View File

@ -1728,7 +1728,7 @@ void SwUiWriterTest::testTdf69282WithMirror()
SwPageDesc* sPageDesc = source->MakePageDesc("SourceStyle");
SwPageDesc* tPageDesc = target->MakePageDesc("TargetStyle");
//Enabling Mirror
sPageDesc->SetUseOn(nsUseOnPage::PD_MIRROR);
sPageDesc->SetUseOn(UseOnPage::Mirror);
SwFrameFormat& rSourceMasterFormat = sPageDesc->GetMaster();
//Setting horizontal spaces on master
SvxLRSpaceItem horizontalSpace(RES_LR_SPACE);

View File

@ -1428,7 +1428,7 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
{
aSet.Put( aLR );
aSet.Put( aUL );
pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL | nsUseOnPage::PD_FIRSTSHARE );
pNewPgDsc->SetUseOn( UseOnPage::All | UseOnPage::FirstShare );
}
break;
@ -1438,7 +1438,7 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
lcl_PutStdPageSizeIntoItemSet( &m_rDoc, aSet );
aSet.Put( aLR );
aSet.Put( aUL );
pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
pNewPgDsc->SetUseOn( UseOnPage::All );
if( RES_POOLPAGE_FIRST == nId )
pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_STANDARD ));
}
@ -1450,7 +1450,7 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
aSet.Put( aLR );
aSet.Put( aUL );
bSetLeft = false;
pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT );
pNewPgDsc->SetUseOn( UseOnPage::Left );
// this relies on GetPageDescFromPool() not going into infinite recursion
// (by this point RES_POOLPAGE_LEFT will not reach this place again)
pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_RIGHT ));
@ -1462,7 +1462,7 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
aSet.Put( aLR );
aSet.Put( aUL );
bSetLeft = false;
pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT );
pNewPgDsc->SetUseOn( UseOnPage::Right );
pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_LEFT ));
}
break;
@ -1477,7 +1477,7 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
aSet.Put( aLR );
aSet.Put( aUL );
pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
pNewPgDsc->SetUseOn( UseOnPage::All );
pNewPgDsc->SetLandscape( true );
}
break;
@ -1491,7 +1491,7 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
aSet.Put( aLR );
aSet.Put( aUL );
pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
pNewPgDsc->SetUseOn( UseOnPage::All );
}
break;
@ -1501,7 +1501,7 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
lcl_PutStdPageSizeIntoItemSet( &m_rDoc, aSet );
aSet.Put( aLR );
aSet.Put( aUL );
pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
pNewPgDsc->SetUseOn( UseOnPage::All );
SwPageFootnoteInfo aInf( pNewPgDsc->GetFootnoteInfo() );
aInf.SetLineWidth( 0 );
aInf.SetTopDist( 0 );
@ -1523,7 +1523,7 @@ SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool
aSet.Put( aFrameSz );
aSet.Put( aLR );
aSet.Put( aUL );
pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
pNewPgDsc->SetUseOn( UseOnPage::All );
pNewPgDsc->SetLandscape( true );
}
break;

View File

@ -391,7 +391,7 @@ void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged )
::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
// Mirror at first if needed.
if ( rChged.GetUseOn() == nsUseOnPage::PD_MIRROR )
if ( rChged.GetUseOn() == UseOnPage::Mirror )
const_cast<SwPageDesc&>(rChged).Mirror();
else
{

View File

@ -592,12 +592,12 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
if( SwHeaderStartNode == pSttNd->GetStartNodeType())
{
nId = RES_HEADER;
eAskUse = nsUseOnPage::PD_HEADERSHARE;
eAskUse = UseOnPage::HeaderShare;
}
else
{
nId = RES_FOOTER;
eAskUse = nsUseOnPage::PD_FOOTERSHARE;
eAskUse = UseOnPage::FooterShare;
}
for( size_t n = pDoc->GetPageDescCnt(); n && !pPgDesc; )

View File

@ -1057,7 +1057,7 @@ bool SwAutoFormat::HasBreakAttr( const SwTextNode& rTextNd )
if( SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem )
&& static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc()
&& nsUseOnPage::PD_NONE != static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc()->GetUseOn() )
&& UseOnPage::NONE != static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc()->GetUseOn() )
return true;
return false;
}

View File

@ -48,7 +48,7 @@ SwPageDesc::SwPageDesc(const OUString& rName, SwFrameFormat *pFormat, SwDoc *con
, m_nRegHeight( 0 )
, m_nRegAscent( 0 )
, m_nVerticalAdjustment( drawing::TextVerticalAdjust_TOP )
, m_eUse( (UseOnPage)(nsUseOnPage::PD_ALL | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE | nsUseOnPage::PD_FIRSTSHARE) )
, m_eUse( UseOnPage::All | UseOnPage::HeaderShare | UseOnPage::FooterShare | UseOnPage::FirstShare )
, m_IsLandscape( false )
, m_IsHidden( false )
, m_pdList( nullptr )
@ -324,29 +324,29 @@ bool SwPageDesc::IsFollowNextPageOfNode( const SwNode& rNd ) const
SwFrameFormat *SwPageDesc::GetLeftFormat(bool const bFirst)
{
return (nsUseOnPage::PD_LEFT & m_eUse)
return (UseOnPage::Left & m_eUse)
? ((bFirst) ? &m_FirstLeft : &m_Left)
: nullptr;
}
SwFrameFormat *SwPageDesc::GetRightFormat(bool const bFirst)
{
return (nsUseOnPage::PD_RIGHT & m_eUse)
? ((bFirst) ? &m_FirstMaster : &m_Master)
return (UseOnPage::Right & m_eUse)
? (bFirst ? &m_FirstMaster : &m_Master)
: nullptr;
}
bool SwPageDesc::IsFirstShared() const
{
return (m_eUse & nsUseOnPage::PD_FIRSTSHARE) != 0;
return bool(m_eUse & UseOnPage::FirstShare);
}
void SwPageDesc::ChgFirstShare( bool bNew )
{
if ( bNew )
m_eUse = (UseOnPage) (m_eUse | nsUseOnPage::PD_FIRSTSHARE);
m_eUse |= UseOnPage::FirstShare;
else
m_eUse = (UseOnPage) (m_eUse & nsUseOnPage::PD_NOFIRSTSHARE);
m_eUse &= UseOnPage::NoFirstShare;
}
SwPageDesc* SwPageDesc::GetByName(SwDoc& rDoc, const OUString& rName)

View File

@ -2655,7 +2655,7 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault()
if(pDesc)
{
pPageFormat = &pDesc->GetMaster();
pDesc->SetUseOn(nsUseOnPage::PD_ALL);
pDesc->SetUseOn(UseOnPage::All);
}
else
pPageFormat = lcl_GetFormatForStyle(m_pDoc, xStyle, m_rEntry.m_eFamily);

View File

@ -1312,7 +1312,7 @@ void DocxExport::WriteEmbeddings()
bool DocxExport::isMirroredMargin()
{
bool bMirroredMargins = false;
if ( nsUseOnPage::PD_MIRROR == (nsUseOnPage::PD_MIRROR & m_pDoc->GetPageDesc(0).ReadUseOn()) )
if ( UseOnPage::Mirror == (UseOnPage::Mirror & m_pDoc->GetPageDesc(0).ReadUseOn()) )
{
bMirroredMargins = true;
}

View File

@ -543,7 +543,7 @@ void RtfExport::WritePageDescTable()
Strm().WriteCharPtr(SAL_NEWLINE_STRING).WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSC);
OutULong(n).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCUSE);
OutULong(rPageDesc.ReadUseOn());
OutULong((sal_uLong)rPageDesc.ReadUseOn());
OutPageDescription(rPageDesc, false, false);
@ -613,7 +613,7 @@ void RtfExport::ExportDocument_Impl()
if (RedlineFlags::On & m_nOrigRedlineFlags)
Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_REVISIONS);
// Mirror margins?
if ((nsUseOnPage::PD_MIRROR & m_pDoc->GetPageDesc(0).ReadUseOn()) == nsUseOnPage::PD_MIRROR)
if ((UseOnPage::Mirror & m_pDoc->GetPageDesc(0).ReadUseOn()) == UseOnPage::Mirror)
Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_MARGMIRROR);
// Init sections
m_pSections = new MSWordSections(*this);

View File

@ -1276,10 +1276,10 @@ void MSWordSections::CheckForFacinPg( WW8Export& rWrt ) const
else if( !( 1 & nEnde ) &&
pPd->GetFollow() && pPd != pPd->GetFollow() &&
pPd->GetFollow()->GetFollow() == pPd &&
(( nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) &&
nsUseOnPage::PD_RIGHT == ( nsUseOnPage::PD_ALL & pPd->GetFollow()->ReadUseOn() )) ||
( nsUseOnPage::PD_RIGHT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) &&
nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->GetFollow()->ReadUseOn() )) ))
(( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) &&
UseOnPage::Right == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ||
( UseOnPage::Right == ( UseOnPage::All & pPd->ReadUseOn() ) &&
UseOnPage::Left == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ))
{
rWrt.pDop->fFacingPages = rWrt.pDop->fMirrorMargins = true;
nEnde |= 1;
@ -1292,7 +1292,7 @@ void MSWordSections::CheckForFacinPg( WW8Export& rWrt ) const
nEnde |= 1;
}
if( !( 2 & nEnde ) &&
nsUseOnPage::PD_MIRROR == ( nsUseOnPage::PD_MIRROR & pPd->ReadUseOn() ))
UseOnPage::Mirror == ( UseOnPage::Mirror & pPd->ReadUseOn() ))
{
rWrt.pDop->fSwapBordersFacingPgs =
rWrt.pDop->fMirrorMargins = true;
@ -1657,16 +1657,16 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
// left-/right chain of pagedescs ?
if ( pPd->GetFollow() && pPd != pPd->GetFollow() &&
pPd->GetFollow()->GetFollow() == pPd &&
(( nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) &&
nsUseOnPage::PD_RIGHT == ( nsUseOnPage::PD_ALL & pPd->GetFollow()->ReadUseOn() )) ||
( nsUseOnPage::PD_RIGHT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) &&
nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->GetFollow()->ReadUseOn() )) ))
(( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) &&
UseOnPage::Right == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ||
( UseOnPage::Right == ( UseOnPage::All & pPd->ReadUseOn() ) &&
UseOnPage::Left == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ))
{
bLeftRightPgChain = true;
// which is the reference point? (left or right?)
// assume it is on the right side!
if ( nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) )
if ( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) )
{
nBreakCode = 3;
pPd = pPd->GetFollow();
@ -1688,9 +1688,9 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
// werden es nur linke oder nur rechte Seiten?
if ( 2 == nBreakCode )
{
if ( nsUseOnPage::PD_LEFT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) )
if ( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) )
nBreakCode = 3;
else if ( nsUseOnPage::PD_RIGHT == ( nsUseOnPage::PD_ALL & pPd->ReadUseOn() ) )
else if ( UseOnPage::Right == ( UseOnPage::All & pPd->ReadUseOn() ) )
nBreakCode = 4;
}
}

View File

@ -4355,12 +4355,12 @@ void wwSectionManager::SetUseOn(wwSection &rSection)
bool bMirror = mrReader.m_pWDop->fMirrorMargins ||
mrReader.m_pWDop->doptypography.f2on1;
UseOnPage eUseBase = bMirror ? nsUseOnPage::PD_MIRROR : nsUseOnPage::PD_ALL;
UseOnPage eUseBase = bMirror ? UseOnPage::Mirror : UseOnPage::All;
UseOnPage eUse = eUseBase;
if (!mrReader.m_pWDop->fFacingPages)
eUse = (UseOnPage)(eUse | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE);
eUse |= UseOnPage::HeaderShare | UseOnPage::FooterShare;
if (!rSection.HasTitlePage())
eUse = (UseOnPage)(eUse | nsUseOnPage::PD_FIRSTSHARE);
eUse |= UseOnPage::FirstShare;
OSL_ENSURE(rSection.mpPage, "Makes no sense to call me with no pages to set");
if (rSection.mpPage)
@ -4533,9 +4533,9 @@ void wwSectionManager::InsertSegments()
*aIter = aTmpSection;
// Handle the section break
UseOnPage eUseOnPage = nsUseOnPage::PD_LEFT;
UseOnPage eUseOnPage = UseOnPage::Left;
if ( aIter->maSep.bkc == 4 ) // Odd ( right ) Section break
eUseOnPage = nsUseOnPage::PD_RIGHT;
eUseOnPage = UseOnPage::Right;
// Keep the share flags.
aDesc.GetPageDesc()->SetUseOn( eUseOnPage );

View File

@ -107,10 +107,10 @@ IMPL_LINK_NOARG(SwBreakDlg, OkHdl, Button*, void)
bool bOk = true;
switch(pPageDesc->GetUseOn())
{
case nsUseOnPage::PD_MIRROR:
case nsUseOnPage::PD_ALL: break;
case nsUseOnPage::PD_LEFT: bOk = 0 == nUserPage % 2; break;
case nsUseOnPage::PD_RIGHT: bOk = 1 == nUserPage % 2; break;
case UseOnPage::Mirror:
case UseOnPage::All: break;
case UseOnPage::Left: bOk = 0 == nUserPage % 2; break;
case UseOnPage::Right: bOk = 1 == nUserPage % 2; break;
default:; //prevent warning
}
if(!bOk) {

View File

@ -386,7 +386,7 @@ void SwModule::InsertEnv( SfxRequest& rReq )
pDesc->ChgFooterShare(false);
// Page numbering
pDesc->SetUseOn(nsUseOnPage::PD_ALL);
pDesc->SetUseOn(UseOnPage::All);
// Page size
rFormat.SetFormatAttr(SwFormatFrameSize(ATT_FIX_SIZE,

View File

@ -256,7 +256,7 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel)
rFormat.SetFormatAttr(SwFormatFooter(false));
aDesc.ChgFooterShare(false);
aDesc.SetUseOn(nsUseOnPage::PD_ALL); // Site numbering
aDesc.SetUseOn(UseOnPage::All); // Site numbering
// Set page size
long lPgWidth, lPgHeight;

View File

@ -105,7 +105,7 @@ void SwView::SetZoom_( const Size &rEditSize, SvxZoomType eZoomType,
const MapMode aTmpMap( MapUnit::MapTwip );
const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
if( nsUseOnPage::PD_MIRROR == rDesc.GetUseOn() ) // mirrored pages
if( UseOnPage::Mirror == rDesc.GetUseOn() ) // mirrored pages
{
const SvxLRSpaceItem &rLeftLRSpace = rDesc.GetLeft().GetLRSpace();
aPageSize.Width() += std::abs( long(rLeftLRSpace.GetLeft()) - long(rLRSpace.GetLeft()) );

View File

@ -168,7 +168,7 @@ void SwView::SwapPageMargin(const SwPageDesc& rDesc, SvxLRSpaceItem& rLRSpace)
sal_uInt16 nPhyPage, nVirPage;
GetWrtShell().GetPageNum( nPhyPage, nVirPage );
if ( rDesc.GetUseOn() == nsUseOnPage::PD_MIRROR && (nPhyPage % 2) == 0 )
if ( rDesc.GetUseOn() == UseOnPage::Mirror && (nPhyPage % 2) == 0 )
{
long nTmp = rLRSpace.GetRight();
rLRSpace.SetRight( rLRSpace.GetLeft() );

View File

@ -232,32 +232,32 @@ void FillHdFt(SwFrameFormat* pFormat, const SfxItemSet& rSet)
}
/// Convert from UseOnPage to SvxPageUsage.
UseOnPage lcl_convertUseToSvx(UseOnPage nUse)
SvxPageUsage lcl_convertUseToSvx(UseOnPage nUse)
{
UseOnPage nRet = nsUseOnPage::PD_NONE;
if ((nUse & nsUseOnPage::PD_LEFT) == nsUseOnPage::PD_LEFT)
int nRet = 0;
if (nUse & UseOnPage::Left)
nRet |= SVX_PAGE_LEFT;
if ((nUse & nsUseOnPage::PD_RIGHT) == nsUseOnPage::PD_RIGHT)
if (nUse & UseOnPage::Right)
nRet |= SVX_PAGE_RIGHT;
if ((nUse & nsUseOnPage::PD_ALL) == nsUseOnPage::PD_ALL)
if ((nUse & UseOnPage::All) == UseOnPage::All)
nRet |= SVX_PAGE_ALL;
if ((nUse & nsUseOnPage::PD_MIRROR) == nsUseOnPage::PD_MIRROR)
if ((nUse & UseOnPage::Mirror) == UseOnPage::Mirror)
nRet |= SVX_PAGE_MIRROR;
return nRet;
return (SvxPageUsage)nRet;
}
/// Convert from SvxPageUsage to UseOnPage.
UseOnPage lcl_convertUseFromSvx(UseOnPage nUse)
UseOnPage lcl_convertUseFromSvx(SvxPageUsage nUse)
{
UseOnPage nRet = nsUseOnPage::PD_NONE;
UseOnPage nRet = UseOnPage::NONE;
if ((nUse & SVX_PAGE_LEFT) == SVX_PAGE_LEFT)
nRet |= nsUseOnPage::PD_LEFT;
nRet |= UseOnPage::Left;
if ((nUse & SVX_PAGE_RIGHT) == SVX_PAGE_RIGHT)
nRet |= nsUseOnPage::PD_RIGHT;
nRet |= UseOnPage::Right;
if ((nUse & SVX_PAGE_ALL) == SVX_PAGE_ALL)
nRet |= nsUseOnPage::PD_ALL;
nRet |= UseOnPage::All;
if ((nUse & SVX_PAGE_MIRROR) == SVX_PAGE_MIRROR)
nRet |= nsUseOnPage::PD_MIRROR;
nRet |= UseOnPage::Mirror;
return nRet;
}
@ -276,9 +276,9 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc )
{
const SvxPageItem& rPageItem = static_cast<const SvxPageItem&>(rSet.Get(SID_ATTR_PAGE));
const sal_uInt16 nUse = rPageItem.GetPageUsage();
const SvxPageUsage nUse = (SvxPageUsage)rPageItem.GetPageUsage();
if(nUse)
rPageDesc.SetUseOn( lcl_convertUseFromSvx((UseOnPage) nUse) );
rPageDesc.SetUseOn( lcl_convertUseFromSvx(nUse) );
rPageDesc.SetLandscape(rPageItem.IsLandscape());
SvxNumberType aNumType;
aNumType.SetNumberingType( static_cast< sal_Int16 >(rPageItem.GetNumType()) );