[Libreoffice-commits] core.git: 3 commits - sw/source vcl/source
Noel Grandin
noel at peralex.com
Fri May 13 06:40:07 UTC 2016
sw/source/core/inc/dbg_lay.hxx | 82 ++++++++++---------
sw/source/core/layout/calcmove.cxx | 6 -
sw/source/core/layout/dbg_lay.cxx | 159 ++++++++++++++++++-------------------
sw/source/core/layout/flowfrm.cxx | 4
sw/source/core/layout/layact.cxx | 2
sw/source/core/layout/paintfrm.cxx | 2
sw/source/core/layout/sectfrm.cxx | 20 ++--
sw/source/core/layout/tabfrm.cxx | 2
sw/source/core/layout/wsfrm.cxx | 6 -
sw/source/core/text/txtfrm.cxx | 2
vcl/source/window/scrwnd.cxx | 30 +++---
vcl/source/window/scrwnd.hxx | 29 +++---
12 files changed, 179 insertions(+), 165 deletions(-)
New commits:
commit 7074b5e4be3954e3650f8fb92c766e0dd7c2a419
Author: Noel Grandin <noel at peralex.com>
Date: Thu May 12 16:07:49 2016 +0200
Convert ACT to scoped enum
Change-Id: I68ec79c9c85abcd91da379eecf3ed4331a15861b
diff --git a/sw/source/core/inc/dbg_lay.hxx b/sw/source/core/inc/dbg_lay.hxx
index a431bd4..4f7b9f7 100644
--- a/sw/source/core/inc/dbg_lay.hxx
+++ b/sw/source/core/inc/dbg_lay.hxx
@@ -48,15 +48,14 @@ namespace o3tl {
template<> struct typed_flags<PROT> : is_typed_flags<PROT, 0x0007ffff> {};
}
-#define ACT_START 1
-#define ACT_END 2
-#define ACT_CREATE_MASTER 3
-#define ACT_CREATE_FOLLOW 4
-#define ACT_DEL_MASTER 5
-#define ACT_DEL_FOLLOW 6
-#define ACT_MERGE 7
-#define ACT_NEXT_SECT 8
-#define ACT_PREV_SECT 9
+enum class DbgAction {
+ NONE,
+ Start, End,
+ CreateMaster, CreateFollow,
+ DelMaster, DelFollow,
+ Merge,
+ NextSect, PrevSect
+};
#ifdef DBG_UTIL
@@ -78,7 +77,7 @@ public:
static PROT Record() { return nRecord; }
static void SetRecord( PROT nNew ) { nRecord = nNew; }
static bool Record( PROT nFunc ) { return bool(( nFunc | PROT::Init ) & nRecord); }
- static void Record( const SwFrame* pFrame, PROT nFunction, sal_uLong nAction, void* pParam );
+ static void Record( const SwFrame* pFrame, PROT nFunction, DbgAction nAction, void* pParam );
static void Init();
static void Stop();
};
@@ -86,11 +85,11 @@ public:
class SwEnterLeave
{
SwImplEnterLeave* pImpl;
- void Ctor( const SwFrame* pFrame, PROT nFunc, sal_uLong nAct, void* pPar );
+ void Ctor( const SwFrame* pFrame, PROT nFunc, DbgAction nAct, void* pPar );
void Dtor();
public:
- SwEnterLeave( const SwFrame* pFrame, PROT nFunc, sal_uLong nAct, void* pPar )
+ SwEnterLeave( const SwFrame* pFrame, PROT nFunc, DbgAction nAct, void* pPar )
{
if( SwProtocol::Record( nFunc ) )
Ctor( pFrame, nFunc, nAct, pPar );
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 969290f..8afb53c 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -707,7 +707,7 @@ size_t SwPageFrame::GetContentHeight(const long nTop, const long nBottom) const
void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext)
{
- PROTOCOL_ENTER( this, PROT::MakeAll, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::MakeAll, DbgAction::NONE, nullptr )
const SwRect aOldRect( Frame() ); // Adjust root size
const SwLayNotify aNotify( this ); // takes care of the notification in the dtor
@@ -835,7 +835,7 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext)
void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
{
- PROTOCOL_ENTER( this, PROT::MakeAll, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::MakeAll, DbgAction::NONE, nullptr )
// takes care of the notification in the dtor
const SwLayNotify aNotify( this );
@@ -1107,7 +1107,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
long nFormatCount = 0;
// - loop prevention
int nConsecutiveFormatsWithoutChange = 0;
- PROTOCOL_ENTER( this, PROT::MakeAll, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::MakeAll, DbgAction::NONE, nullptr )
#ifdef DBG_UTIL
const SwDoc *pDoc = GetAttrSet()->GetDoc();
diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index 18e0c67..74c1a3d 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -30,8 +30,8 @@
* 1. A pointer to an SwFrame (usually "this" or "rThis")
* 2. The function group i.e. PROT::MakeAll. This is used to decide (inline)
* whether this event shall be logged at the current time.
- * 3. The action, usually 0. For example ACT_START indents output in the log
- * file and ACT_END stops the indentation. This allows for example
+ * 3. The action, usually 0. For example DbgAction::Start indents output in the log
+ * file and DbgAction::End stops the indentation. This allows for example
* PROTOCOL_ENTER to indent at the beginning of a method and stop indenting
* when leaving the method.
* 4. The fourth parameter is a void pointer which allows to pass anything
@@ -129,15 +129,15 @@ class SwImplProtocol
sal_uInt16 nMaxLines; // max lines to be printed
sal_uInt8 nInitFile; // range (FrameId,FrameType,Record) during reading of the INI file
sal_uInt8 nTestMode; // special for test formatting, logging may only be done in test formatting.
- void Record_( const SwFrame* pFrame, PROT nFunction, sal_uLong nAct, void* pParam );
+ void Record_( const SwFrame* pFrame, PROT nFunction, DbgAction nAct, void* pParam );
bool NewStream();
void CheckLine( OString& rLine );
- static void SectFunc( OStringBuffer& rOut, const SwFrame* pFrame, sal_uLong nAct, void* pParam );
+ static void SectFunc( OStringBuffer& rOut, const SwFrame* pFrame, DbgAction nAct, void* pParam );
public:
SwImplProtocol();
~SwImplProtocol();
// logging
- void Record( const SwFrame* pFrame, PROT nFunction, sal_uLong nAct, void* pParam )
+ void Record( const SwFrame* pFrame, PROT nFunction, DbgAction nAct, void* pParam )
{ if( pStream ) Record_( pFrame, nFunction, nAct, pParam ); }
bool InsertFrame( sal_uInt16 nFrameId ); // take FrameId for logging
bool DeleteFrame( sal_uInt16 nFrameId ); // remove FrameId; don't log him anymore
@@ -150,7 +150,7 @@ public:
* The funny thing here is, that the Ctor of the Impl object is automatically
* called at the beginning of the function and the Dtor is automatically called
* when leaving the function. In the base implementation the Ctor calls only
- * PROTOCOL(..) with ACT_START and in the Dtor a PROTOCOL(..) with ACT_END.
+ * PROTOCOL(..) with DbgAction::Start and in the Dtor a PROTOCOL(..) with DbgAction::End.
* It's possible to derive from this class, for example to be able to document
* frame resize while leaving a function. To do this, one only needs to add the
* desired SwImplEnterLeave class in SwEnterLeave::Ctor().
@@ -161,10 +161,10 @@ class SwImplEnterLeave
protected:
const SwFrame* pFrame; // the frame
PROT nFunction; // the function
- sal_uLong nAction; // the action if needed
+ DbgAction nAction; // the action if needed
void* pParam; // further parameter
public:
- SwImplEnterLeave( const SwFrame* pF, PROT nFunct, sal_uLong nAct, void* pPar )
+ SwImplEnterLeave( const SwFrame* pF, PROT nFunct, DbgAction nAct, void* pPar )
: pFrame( pF ), nFunction( nFunct ), nAction( nAct ), pParam( pPar ) {}
virtual ~SwImplEnterLeave() {}
virtual void Enter(); // message when entering
@@ -175,7 +175,7 @@ class SwSizeEnterLeave : public SwImplEnterLeave
{
long nFrameHeight;
public:
- SwSizeEnterLeave( const SwFrame* pF, PROT nFunct, sal_uLong nAct, void* pPar )
+ SwSizeEnterLeave( const SwFrame* pF, PROT nFunct, DbgAction nAct, void* pPar )
: SwImplEnterLeave( pF, nFunct, nAct, pPar ), nFrameHeight( pF->Frame().Height() ) {}
virtual ~SwSizeEnterLeave() {}
virtual void Leave() override; // resize message
@@ -185,7 +185,7 @@ class SwUpperEnterLeave : public SwImplEnterLeave
{
sal_uInt16 nFrameId;
public:
- SwUpperEnterLeave( const SwFrame* pF, PROT nFunct, sal_uLong nAct, void* pPar )
+ SwUpperEnterLeave( const SwFrame* pF, PROT nFunct, DbgAction nAct, void* pPar )
: SwImplEnterLeave( pF, nFunct, nAct, pPar ), nFrameId( 0 ) {}
virtual ~SwUpperEnterLeave() {}
virtual void Enter() override; // message
@@ -196,14 +196,14 @@ class SwFrameChangesLeave : public SwImplEnterLeave
{
SwRect aFrame;
public:
- SwFrameChangesLeave( const SwFrame* pF, PROT nFunct, sal_uLong nAct, void* pPar )
+ SwFrameChangesLeave( const SwFrame* pF, PROT nFunct, DbgAction nAct, void* pPar )
: SwImplEnterLeave( pF, nFunct, nAct, pPar ), aFrame( pF->Frame() ) {}
virtual ~SwFrameChangesLeave() {}
virtual void Enter() override; // no message
virtual void Leave() override; // message when resizing the Frame area
};
-void SwProtocol::Record( const SwFrame* pFrame, PROT nFunction, sal_uLong nAct, void* pParam )
+void SwProtocol::Record( const SwFrame* pFrame, PROT nFunction, DbgAction nAct, void* pParam )
{
if( Start() )
{ // We reach this point if SwProtocol::nRecord is binary OR'd with PROT::Init(0x1) using the debugger
@@ -416,15 +416,15 @@ void SwImplProtocol::FileInit()
aStream.Close();
}
-/// enable indentation by two spaces during ACT_START and disable it again at ACT_END.
-static void lcl_Start(OStringBuffer& rOut, OStringBuffer& rLay, sal_uLong nAction)
+/// enable indentation by two spaces during DbgAction::Start and disable it again at DbgAction::End.
+static void lcl_Start(OStringBuffer& rOut, OStringBuffer& rLay, DbgAction nAction)
{
- if( nAction == ACT_START )
+ if( nAction == DbgAction::Start )
{
rLay.append(" ");
rOut.append(" On");
}
- else if( nAction == ACT_END )
+ else if( nAction == DbgAction::End )
{
if( rLay.getLength() > 1 )
{
@@ -499,7 +499,7 @@ static void lcl_FrameType( OStringBuffer& rOut, const SwFrame* pFrame )
*
* In this method we also check if FrameId and frame type should be logged.
*/
-void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, sal_uLong nAct, void* pParam )
+void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction nAct, void* pParam )
{
sal_uInt16 nSpecial = 0;
if( nSpecial ) // the possible debugger manipulations
@@ -536,7 +536,7 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, sal_uLong n
break;
case PROT::MakeAll: aOut.append("MakeAll");
lcl_Start( aOut, aLayer, nAct );
- if( nAct == ACT_START )
+ if( nAct == DbgAction::Start )
lcl_Flags( aOut, pFrame );
break;
case PROT::MoveFwd: bTmp = true;
@@ -553,11 +553,11 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, sal_uLong n
aOut.append(static_cast<sal_Int32>(*static_cast<sal_uInt16*>(pParam)));
}
break;
- case PROT::GrowTest: if( ACT_START != nAct )
+ case PROT::GrowTest: if( DbgAction::Start != nAct )
return;
aOut.append("TestGrow");
break;
- case PROT::ShrinkTest: if( ACT_START != nAct )
+ case PROT::ShrinkTest: if( DbgAction::Start != nAct )
return;
aOut.append("TestShrink");
break;
@@ -616,7 +616,7 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, sal_uLong n
case PROT::TestFormat:
aOut.append("Test");
lcl_Start( aOut, aLayer, nAct );
- if( ACT_START == nAct )
+ if( DbgAction::Start == nAct )
nTestMode |= 2;
else
nTestMode &= ~2;
@@ -664,32 +664,33 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, sal_uLong n
}
/// Handle the output of the SectionFrames.
-void SwImplProtocol::SectFunc(OStringBuffer &rOut, const SwFrame* , sal_uLong nAct, void* pParam)
+void SwImplProtocol::SectFunc(OStringBuffer &rOut, const SwFrame* , DbgAction nAct, void* pParam)
{
bool bTmp = false;
switch( nAct )
{
- case ACT_MERGE: rOut.append("Merge Section ");
+ case DbgAction::Merge: rOut.append("Merge Section ");
rOut.append(static_cast<sal_Int64>(lcl_GetFrameId(static_cast<SwFrame*>(pParam))));
break;
- case ACT_CREATE_MASTER: bTmp = true;
+ case DbgAction::CreateMaster: bTmp = true;
SAL_FALLTHROUGH;
- case ACT_CREATE_FOLLOW: rOut.append("Create Section ");
+ case DbgAction::CreateFollow: rOut.append("Create Section ");
if (bTmp)
rOut.append("Master to ");
else
rOut.append("Follow from ");
rOut.append(static_cast<sal_Int64>(lcl_GetFrameId(static_cast<SwFrame*>(pParam))));
break;
- case ACT_DEL_MASTER: bTmp = true;
+ case DbgAction::DelMaster: bTmp = true;
SAL_FALLTHROUGH;
- case ACT_DEL_FOLLOW: rOut.append("Delete Section ");
+ case DbgAction::DelFollow: rOut.append("Delete Section ");
if (bTmp)
rOut.append("Master to ");
else
rOut.append("Follow from ");
rOut.append(static_cast<sal_Int64>(lcl_GetFrameId(static_cast<SwFrame*>(pParam))));
break;
+ default: break;
}
}
@@ -725,7 +726,7 @@ bool SwImplProtocol::DeleteFrame( sal_uInt16 nId )
* The task here is to find the right SwImplEnterLeave object based on the
* function; everything else is then done in his Ctor/Dtor.
*/
-void SwEnterLeave::Ctor( const SwFrame* pFrame, PROT nFunc, sal_uLong nAct, void* pPar )
+void SwEnterLeave::Ctor( const SwFrame* pFrame, PROT nFunc, DbgAction nAct, void* pPar )
{
switch( nFunc )
{
@@ -755,30 +756,30 @@ void SwEnterLeave::Dtor()
void SwImplEnterLeave::Enter()
{
- SwProtocol::Record( pFrame, nFunction, ACT_START, pParam );
+ SwProtocol::Record( pFrame, nFunction, DbgAction::Start, pParam );
}
void SwImplEnterLeave::Leave()
{
- SwProtocol::Record( pFrame, nFunction, ACT_END, pParam );
+ SwProtocol::Record( pFrame, nFunction, DbgAction::End, pParam );
}
void SwSizeEnterLeave::Leave()
{
nFrameHeight = pFrame->Frame().Height() - nFrameHeight;
- SwProtocol::Record( pFrame, nFunction, ACT_END, &nFrameHeight );
+ SwProtocol::Record( pFrame, nFunction, DbgAction::End, &nFrameHeight );
}
void SwUpperEnterLeave::Enter()
{
nFrameId = pFrame->GetUpper() ? sal_uInt16(lcl_GetFrameId( pFrame->GetUpper() )) : 0;
- SwProtocol::Record( pFrame, nFunction, ACT_START, &nFrameId );
+ SwProtocol::Record( pFrame, nFunction, DbgAction::Start, &nFrameId );
}
void SwUpperEnterLeave::Leave()
{
nFrameId = pFrame->GetUpper() ? sal_uInt16(lcl_GetFrameId( pFrame->GetUpper() )) : 0;
- SwProtocol::Record( pFrame, nFunction, ACT_END, &nFrameId );
+ SwProtocol::Record( pFrame, nFunction, DbgAction::End, &nFrameId );
}
void SwFrameChangesLeave::Enter()
@@ -788,7 +789,7 @@ void SwFrameChangesLeave::Enter()
void SwFrameChangesLeave::Leave()
{
if( pFrame->Frame() != aFrame )
- SwProtocol::Record( pFrame, PROT::FrmChanges, 0, &aFrame );
+ SwProtocol::Record( pFrame, PROT::FrmChanges, DbgAction::NONE, &aFrame );
}
#endif // DBG_UTIL
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index f2db886..7946f5b 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1841,7 +1841,7 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways )
if ( pNewUpper )
{
- PROTOCOL_ENTER( &m_rThis, PROT::MoveFwd, 0, nullptr );
+ PROTOCOL_ENTER( &m_rThis, PROT::MoveFwd, DbgAction::NONE, nullptr );
SwPageFrame *pOldPage = pOldBoss->FindPageFrame();
// We move ourself and all the direct successors before the
// first ContentFrame below the new Upper.
@@ -2399,7 +2399,7 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat )
"<SwFlowFrame::MoveBwd(..)> - moving backward to the current upper frame!?" );
if ( pNewUpper )
{
- PROTOCOL_ENTER( &m_rThis, PROT::MoveBack, 0, nullptr );
+ PROTOCOL_ENTER( &m_rThis, PROT::MoveBack, DbgAction::NONE, nullptr );
if ( pNewUpper->IsFootnoteContFrame() )
{
// I may have gotten a Container
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 0a119a6..d238d38 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -540,7 +540,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
( pPage->IsInvalid() ||
(IS_FLYS && IS_INVAFLY) ) )
{
- PROTOCOL( pPage, PROT::FileInit, 0, nullptr)
+ PROTOCOL( pPage, PROT::FileInit, DbgAction::NONE, nullptr)
XCHECKPAGE;
// #i81146# new loop control
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 6979e22..ff9dc02 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3186,7 +3186,7 @@ void SwRootFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect,
{
OSL_ENSURE( Lower() && Lower()->IsPageFrame(), "Lower of root is no page." );
- PROTOCOL( this, PROT::FileInit, 0, nullptr)
+ PROTOCOL( this, PROT::FileInit, DbgAction::NONE, nullptr)
bool bResetRootPaint = false;
SwViewShell *pSh = mpCurrShell;
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index e7a1c7b..86dac9e 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -68,7 +68,7 @@ SwSectionFrame::SwSectionFrame( SwSectionFrame &rSect, bool bMaster ) :
{
mnFrameType = SwFrameType::Section;
- PROTOCOL( this, PROT::Section, bMaster ? ACT_CREATE_MASTER : ACT_CREATE_FOLLOW, &rSect )
+ PROTOCOL( this, PROT::Section, bMaster ? DbgAction::CreateMaster : DbgAction::CreateFollow, &rSect )
if( bMaster )
{
@@ -129,7 +129,7 @@ void SwSectionFrame::DestroyImpl()
SwSectionFrame *pMaster = FindMaster();
if( pMaster )
{
- PROTOCOL( this, PROT::Section, ACT_DEL_FOLLOW, pMaster )
+ PROTOCOL( this, PROT::Section, DbgAction::DelFollow, pMaster )
pMaster->SetFollow( GetFollow() );
// A Master always grabs the space until the lower edge of his
// Upper. If he doesn't have a Follow anymore, he can
@@ -141,7 +141,7 @@ void SwSectionFrame::DestroyImpl()
}
else if( HasFollow() )
{
- PROTOCOL( this, PROT::Section, ACT_DEL_MASTER, GetFollow() )
+ PROTOCOL( this, PROT::Section, DbgAction::DelMaster, GetFollow() )
}
}
@@ -218,7 +218,7 @@ void SwSectionFrame::Cut_( bool bRemove )
{
OSL_ENSURE( GetUpper(), "Cut ohne Upper()." );
- PROTOCOL( this, PROT::Cut, 0, GetUpper() )
+ PROTOCOL( this, PROT::Cut, DbgAction::NONE, GetUpper() )
SwPageFrame *pPage = FindPageFrame();
InvalidatePage( pPage );
@@ -299,7 +299,7 @@ void SwSectionFrame::Paste( SwFrame* pParent, SwFrame* pSibling )
OSL_ENSURE( !GetPrev() && !GetUpper(),
"I am still registered somewhere." );
- PROTOCOL( this, PROT::Paste, 0, GetUpper() )
+ PROTOCOL( this, PROT::Paste, DbgAction::NONE, GetUpper() )
// Add to the tree
SwSectionFrame* pSect = pParent->FindSctFrame();
@@ -429,7 +429,7 @@ void SwSectionFrame::MergeNext( SwSectionFrame* pNxt )
if (!pNxt->IsJoinLocked() && GetSection() == pNxt->GetSection())
{
- PROTOCOL( this, PROT::Section, ACT_MERGE, pNxt )
+ PROTOCOL( this, PROT::Section, DbgAction::Merge, pNxt )
SwFrame* pTmp = ::SaveContent( pNxt );
if( pTmp )
@@ -1223,7 +1223,7 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA
SWRECTFN( this )
if ( !mbValidPrtArea )
{
- PROTOCOL( this, PROT::PrintArea, 0, nullptr )
+ PROTOCOL( this, PROT::PrintArea, DbgAction::NONE, nullptr )
mbValidPrtArea = true;
SwTwips nUpper = CalcUpperSpace();
@@ -1243,7 +1243,7 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA
if ( !mbValidSize )
{
- PROTOCOL_ENTER( this, PROT::Size, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::Size, DbgAction::NONE, nullptr )
const long nOldHeight = (Frame().*fnRect->fnGetHeight)();
bool bOldLock = IsColLocked();
ColLock();
@@ -1431,7 +1431,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
{
// Attention: Nested sections are currently not supported
- PROTOCOL_ENTER( this, PROT::Leaf, ACT_NEXT_SECT, GetUpper()->FindSctFrame() )
+ PROTOCOL_ENTER( this, PROT::Leaf, DbgAction::NextSect, GetUpper()->FindSctFrame() )
// Shortcuts for "columned" sections, if we're not in the last column
// Can we slide to the next column of the section?
@@ -1649,7 +1649,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
/// Returns the preceding layout sheet where the frame can be moved into
SwLayoutFrame *SwFrame::GetPrevSctLeaf( MakePageType )
{
- PROTOCOL_ENTER( this, PROT::Leaf, ACT_PREV_SECT, GetUpper()->FindSctFrame() )
+ PROTOCOL_ENTER( this, PROT::Leaf, DbgAction::PrevSect, GetUpper()->FindSctFrame() )
SwLayoutFrame* pCol;
// ColumnFrame always contain a BodyFrame now
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 21b5bc8..002b653 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1745,7 +1745,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
return;
}
- PROTOCOL_ENTER( this, PROT::MakeAll, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::MakeAll, DbgAction::NONE, nullptr )
LockJoin(); //I don't want to be destroyed on the way.
SwLayNotify aNotify( this ); //does the notification in the DTor
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 1c9dbd3..1635463 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1156,7 +1156,7 @@ SwTwips SwFrame::Grow( SwTwips nDist, bool bTst, bool bInfo )
{
OSL_ENSURE( nDist >= 0, "Negative growth?" );
- PROTOCOL_ENTER( this, bTst ? PROT::GrowTest : PROT::Grow, 0, &nDist )
+ PROTOCOL_ENTER( this, bTst ? PROT::GrowTest : PROT::Grow, DbgAction::NONE, &nDist )
if ( nDist )
{
@@ -1200,7 +1200,7 @@ SwTwips SwFrame::Shrink( SwTwips nDist, bool bTst, bool bInfo )
{
OSL_ENSURE( nDist >= 0, "Negative reduction?" );
- PROTOCOL_ENTER( this, bTst ? PROT::ShrinkTest : PROT::Shrink, 0, &nDist )
+ PROTOCOL_ENTER( this, bTst ? PROT::ShrinkTest : PROT::Shrink, DbgAction::NONE, &nDist )
if ( nDist )
{
@@ -1259,7 +1259,7 @@ SwTwips SwFrame::Shrink( SwTwips nDist, bool bTst, bool bInfo )
*/
SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
{
- PROTOCOL_ENTER( this, PROT::AdjustN, 0, &nDiff );
+ PROTOCOL_ENTER( this, PROT::AdjustN, DbgAction::NONE, &nDiff );
if ( !nDiff || !GetUpper()->IsFootnoteBossFrame() ) // only inside pages/columns
return 0L;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index a1cb454..f2b93ff 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1909,7 +1909,7 @@ SwTestFormat::~SwTestFormat()
bool SwTextFrame::TestFormat( const SwFrame* pPrv, SwTwips &rMaxHeight, bool &bSplit )
{
- PROTOCOL_ENTER( this, PROT::TestFormat, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::TestFormat, DbgAction::NONE, nullptr )
if( IsLocked() && GetUpper()->Prt().Width() <= 0 )
return false;
commit a01a492d1089799ee721dc34e421a36c10270215
Author: Noel Grandin <noel at peralex.com>
Date: Thu May 12 15:41:34 2016 +0200
convert PROT to scoped enum
Change-Id: I7aaa5c45a224d2f97861864bed00eaddb9b7f317
diff --git a/sw/source/core/inc/dbg_lay.hxx b/sw/source/core/inc/dbg_lay.hxx
index 04bf1e6..a431bd4 100644
--- a/sw/source/core/inc/dbg_lay.hxx
+++ b/sw/source/core/inc/dbg_lay.hxx
@@ -20,26 +20,33 @@
#ifndef INCLUDED_SW_SOURCE_CORE_INC_DBG_LAY_HXX
#define INCLUDED_SW_SOURCE_CORE_INC_DBG_LAY_HXX
-#define PROT_FILE_INIT 0x00000000
-#define PROT_INIT 0x00000001
-#define PROT_MAKEALL 0x00000002
-#define PROT_MOVE_FWD 0x00000004
-#define PROT_MOVE_BWD 0x00000008
-#define PROT_GROW 0x00000010
-#define PROT_SHRINK 0x00000020
-#define PROT_GROW_TST 0x00000040
-#define PROT_SHRINK_TST 0x00000080
-#define PROT_SIZE 0x00000100
-#define PROT_PRTAREA 0x00000200
-#define PROT_POS 0x00000400
-#define PROT_ADJUSTN 0x00000800
-#define PROT_SECTION 0x00001000
-#define PROT_CUT 0x00002000
-#define PROT_PASTE 0x00004000
-#define PROT_LEAF 0x00008000
-#define PROT_TESTFORMAT 0x00010000
-#define PROT_FRMCHANGES 0x00020000
-#define PROT_SNAPSHOT 0x00040000
+#include <o3tl/typed_flags_set.hxx>
+
+enum class PROT {
+ FileInit = 0x00000000,
+ Init = 0x00000001,
+ MakeAll = 0x00000002,
+ MoveFwd = 0x00000004,
+ MoveBack = 0x00000008,
+ Grow = 0x00000010,
+ Shrink = 0x00000020,
+ GrowTest = 0x00000040,
+ ShrinkTest = 0x00000080,
+ Size = 0x00000100,
+ PrintArea = 0x00000200,
+ Pos = 0x00000400,
+ AdjustN = 0x00000800,
+ Section = 0x00001000,
+ Cut = 0x00002000,
+ Paste = 0x00004000,
+ Leaf = 0x00008000,
+ TestFormat = 0x00010000,
+ FrmChanges = 0x00020000,
+ Snapshot = 0x00040000
+};
+namespace o3tl {
+ template<> struct typed_flags<PROT> : is_typed_flags<PROT, 0x0007ffff> {};
+}
#define ACT_START 1
#define ACT_END 2
@@ -63,15 +70,15 @@ class SwImplEnterLeave;
class SwProtocol
{
- static sal_uLong nRecord;
+ static PROT nRecord;
static SwImplProtocol* pImpl;
- static bool Start() { return 0 != ( PROT_INIT & nRecord ); }
+ static bool Start() { return bool( PROT::Init & nRecord ); }
public:
- static sal_uLong Record() { return nRecord; }
- static void SetRecord( sal_uLong nNew ) { nRecord = nNew; }
- static bool Record( sal_uLong nFunc ) { return 0 != (( nFunc | PROT_INIT ) & nRecord); }
- static void Record( const SwFrame* pFrame, sal_uLong nFunction, sal_uLong nAction, void* pParam );
+ static PROT Record() { return nRecord; }
+ static void SetRecord( PROT nNew ) { nRecord = nNew; }
+ static bool Record( PROT nFunc ) { return bool(( nFunc | PROT::Init ) & nRecord); }
+ static void Record( const SwFrame* pFrame, PROT nFunction, sal_uLong nAction, void* pParam );
static void Init();
static void Stop();
};
@@ -79,11 +86,11 @@ public:
class SwEnterLeave
{
SwImplEnterLeave* pImpl;
- void Ctor( const SwFrame* pFrame, sal_uLong nFunc, sal_uLong nAct, void* pPar );
+ void Ctor( const SwFrame* pFrame, PROT nFunc, sal_uLong nAct, void* pPar );
void Dtor();
public:
- SwEnterLeave( const SwFrame* pFrame, sal_uLong nFunc, sal_uLong nAct, void* pPar )
+ SwEnterLeave( const SwFrame* pFrame, PROT nFunc, sal_uLong nAct, void* pPar )
{
if( SwProtocol::Record( nFunc ) )
Ctor( pFrame, nFunc, nAct, pPar );
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index c54c7ef..969290f 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -707,7 +707,7 @@ size_t SwPageFrame::GetContentHeight(const long nTop, const long nBottom) const
void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext)
{
- PROTOCOL_ENTER( this, PROT_MAKEALL, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::MakeAll, 0, nullptr )
const SwRect aOldRect( Frame() ); // Adjust root size
const SwLayNotify aNotify( this ); // takes care of the notification in the dtor
@@ -835,7 +835,7 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext)
void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
{
- PROTOCOL_ENTER( this, PROT_MAKEALL, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::MakeAll, 0, nullptr )
// takes care of the notification in the dtor
const SwLayNotify aNotify( this );
@@ -1107,7 +1107,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
long nFormatCount = 0;
// - loop prevention
int nConsecutiveFormatsWithoutChange = 0;
- PROTOCOL_ENTER( this, PROT_MAKEALL, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::MakeAll, 0, nullptr )
#ifdef DBG_UTIL
const SwDoc *pDoc = GetAttrSet()->GetDoc();
diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index 00eaf23..18e0c67 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -28,14 +28,14 @@
*
* The PROTOCOL macros accept the following parameters:
* 1. A pointer to an SwFrame (usually "this" or "rThis")
- * 2. The function group i.e. PROT_MAKEALL. This is used to decide (inline)
+ * 2. The function group i.e. PROT::MakeAll. This is used to decide (inline)
* whether this event shall be logged at the current time.
* 3. The action, usually 0. For example ACT_START indents output in the log
* file and ACT_END stops the indentation. This allows for example
* PROTOCOL_ENTER to indent at the beginning of a method and stop indenting
* when leaving the method.
* 4. The fourth parameter is a void pointer which allows to pass anything
- * which can be used in the log. A good example is PROT_GROW: this requires
+ * which can be used in the log. A good example is PROT::Grow: this requires
* a pointer to the value which defines how much to grow.
*
* The log file is called "dbg_lay.out", which is saved in the current (BIN-)
@@ -45,8 +45,8 @@
* What exactly is going to be logged, can be defined as follows:
* 1. The static variable SwProtocol::nRecord contains the function groups
* which shall be logged.
- * A value of i.e. PROT_GROW causes calls to SwFrame::Grow to be
- * logged; PROT_MAKEALL logs the calls to xxx::MakeAll.
+ * A value of i.e. PROT::Grow causes calls to SwFrame::Grow to be
+ * logged; PROT::MakeAll logs the calls to xxx::MakeAll.
* The PROT_XY values can be combined using binary OR, the default value
* is null - no method calls are logged.
* 2. The SwImplProtocol class contains a filter for frame types, only method
@@ -64,7 +64,7 @@
* 1. Set a breakpoint in SwProtocol::Init() and manipulate nRecord there, set
* FrameIds accordingly then start logging during program start.
* 2. Set a breakpoint before any PROTOCOL or PROTOCOL_ENTER macro during
- * program execution, then set the lowest bit (PROT_INIT) of
+ * program execution, then set the lowest bit (PROT::Init) of
* SwProtocol::nRecord. This activates the function group of the following
* macro and causes it to be logged in the future.
* 3. There's a special case for 2: If one uses 2. in SwRootFrame::Paint(..),
@@ -103,7 +103,7 @@
#include <comphelper/string.hxx>
-sal_uLong SwProtocol::nRecord = 0;
+PROT SwProtocol::nRecord = PROT::FileInit;
SwImplProtocol* SwProtocol::pImpl = nullptr;
static sal_uLong lcl_GetFrameId( const SwFrame* pFrame )
@@ -129,7 +129,7 @@ class SwImplProtocol
sal_uInt16 nMaxLines; // max lines to be printed
sal_uInt8 nInitFile; // range (FrameId,FrameType,Record) during reading of the INI file
sal_uInt8 nTestMode; // special for test formatting, logging may only be done in test formatting.
- void Record_( const SwFrame* pFrame, sal_uLong nFunction, sal_uLong nAct, void* pParam );
+ void Record_( const SwFrame* pFrame, PROT nFunction, sal_uLong nAct, void* pParam );
bool NewStream();
void CheckLine( OString& rLine );
static void SectFunc( OStringBuffer& rOut, const SwFrame* pFrame, sal_uLong nAct, void* pParam );
@@ -137,7 +137,7 @@ public:
SwImplProtocol();
~SwImplProtocol();
// logging
- void Record( const SwFrame* pFrame, sal_uLong nFunction, sal_uLong nAct, void* pParam )
+ void Record( const SwFrame* pFrame, PROT nFunction, sal_uLong nAct, void* pParam )
{ if( pStream ) Record_( pFrame, nFunction, nAct, pParam ); }
bool InsertFrame( sal_uInt16 nFrameId ); // take FrameId for logging
bool DeleteFrame( sal_uInt16 nFrameId ); // remove FrameId; don't log him anymore
@@ -159,11 +159,12 @@ public:
class SwImplEnterLeave
{
protected:
- const SwFrame* pFrame; // the frame
- sal_uLong nFunction, nAction; // the function, the action if needed
- void* pParam; // further parameter
+ const SwFrame* pFrame; // the frame
+ PROT nFunction; // the function
+ sal_uLong nAction; // the action if needed
+ void* pParam; // further parameter
public:
- SwImplEnterLeave( const SwFrame* pF, sal_uLong nFunct, sal_uLong nAct, void* pPar )
+ SwImplEnterLeave( const SwFrame* pF, PROT nFunct, sal_uLong nAct, void* pPar )
: pFrame( pF ), nFunction( nFunct ), nAction( nAct ), pParam( pPar ) {}
virtual ~SwImplEnterLeave() {}
virtual void Enter(); // message when entering
@@ -174,7 +175,7 @@ class SwSizeEnterLeave : public SwImplEnterLeave
{
long nFrameHeight;
public:
- SwSizeEnterLeave( const SwFrame* pF, sal_uLong nFunct, sal_uLong nAct, void* pPar )
+ SwSizeEnterLeave( const SwFrame* pF, PROT nFunct, sal_uLong nAct, void* pPar )
: SwImplEnterLeave( pF, nFunct, nAct, pPar ), nFrameHeight( pF->Frame().Height() ) {}
virtual ~SwSizeEnterLeave() {}
virtual void Leave() override; // resize message
@@ -184,7 +185,7 @@ class SwUpperEnterLeave : public SwImplEnterLeave
{
sal_uInt16 nFrameId;
public:
- SwUpperEnterLeave( const SwFrame* pF, sal_uLong nFunct, sal_uLong nAct, void* pPar )
+ SwUpperEnterLeave( const SwFrame* pF, PROT nFunct, sal_uLong nAct, void* pPar )
: SwImplEnterLeave( pF, nFunct, nAct, pPar ), nFrameId( 0 ) {}
virtual ~SwUpperEnterLeave() {}
virtual void Enter() override; // message
@@ -195,26 +196,26 @@ class SwFrameChangesLeave : public SwImplEnterLeave
{
SwRect aFrame;
public:
- SwFrameChangesLeave( const SwFrame* pF, sal_uLong nFunct, sal_uLong nAct, void* pPar )
+ SwFrameChangesLeave( const SwFrame* pF, PROT nFunct, sal_uLong nAct, void* pPar )
: SwImplEnterLeave( pF, nFunct, nAct, pPar ), aFrame( pF->Frame() ) {}
virtual ~SwFrameChangesLeave() {}
virtual void Enter() override; // no message
virtual void Leave() override; // message when resizing the Frame area
};
-void SwProtocol::Record( const SwFrame* pFrame, sal_uLong nFunction, sal_uLong nAct, void* pParam )
+void SwProtocol::Record( const SwFrame* pFrame, PROT nFunction, sal_uLong nAct, void* pParam )
{
if( Start() )
- { // We reach this point if SwProtocol::nRecord is binary OR'd with PROT_INIT(0x1) using the debugger
+ { // We reach this point if SwProtocol::nRecord is binary OR'd with PROT::Init(0x1) using the debugger
bool bFinit = false; // This gives the possibility to stop logging of this action in the debugger
if( bFinit )
{
nRecord &= ~nFunction; // Don't log this function any longer
- nRecord &= ~PROT_INIT; // Always reset PROT_INIT
+ nRecord &= ~PROT::Init; // Always reset PROT::Init
return;
}
nRecord |= nFunction; // Activate logging of this function
- nRecord &= ~PROT_INIT; // Always reset PROT_INIT
+ nRecord &= ~PROT::Init; // Always reset PROT::Init
if( pImpl )
pImpl->ChkStream();
}
@@ -229,7 +230,7 @@ void SwProtocol::Record( const SwFrame* pFrame, sal_uLong nFunction, sal_uLong n
void SwProtocol::Init()
{
- nRecord = 0;
+ nRecord = PROT::FileInit;
OUString aName("dbg_lay.go");
SvFileStream aStream( aName, StreamMode::READ );
if( aStream.IsOpen() )
@@ -251,7 +252,7 @@ void SwProtocol::Stop()
if( pFntCache )
pFntCache->Flush();
}
- nRecord = 0;
+ nRecord = PROT::FileInit;
}
SwImplProtocol::SwImplProtocol()
@@ -311,7 +312,7 @@ void SwImplProtocol::CheckLine( OString& rLine )
else if (aTmp == "[record")// section functions
{
nInitFile = 3;
- SwProtocol::SetRecord( 0 );// default: don't log any function
+ SwProtocol::SetRecord( PROT::FileInit );// default: don't log any function
}
else if (aTmp == "[test")// section functions
{
@@ -360,11 +361,11 @@ void SwImplProtocol::CheckLine( OString& rLine )
}
break;
case 3: {
- sal_uLong nOld = SwProtocol::Record();
+ PROT nOld = SwProtocol::Record();
if( bNo )
- nOld &= ~sal_uLong(nVal); // remove function
+ nOld &= ~PROT(nVal); // remove function
else
- nOld |= sal_uLong(nVal); // remove function
+ nOld |= PROT(nVal); // remove function
SwProtocol::SetRecord( nOld );
}
break;
@@ -498,7 +499,7 @@ static void lcl_FrameType( OStringBuffer& rOut, const SwFrame* pFrame )
*
* In this method we also check if FrameId and frame type should be logged.
*/
-void SwImplProtocol::Record_( const SwFrame* pFrame, sal_uLong nFunction, sal_uLong nAct, void* pParam )
+void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, sal_uLong nAct, void* pParam )
{
sal_uInt16 nSpecial = 0;
if( nSpecial ) // the possible debugger manipulations
@@ -522,7 +523,7 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, sal_uLong nFunction, sal_uL
if( !(pFrame->GetType() & nTypes) )
return; // the type is unwanted
- if( 1 == nTestMode && nFunction != PROT_TESTFORMAT )
+ if( 1 == nTestMode && nFunction != PROT::TestFormat )
return; // we may only log inside a test formatting
bool bTmp = false;
OStringBuffer aOut(aLayer);
@@ -531,17 +532,17 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, sal_uLong nFunction, sal_uL
lcl_FrameType( aOut, pFrame ); // then the frame type
switch ( nFunction ) // and the function
{
- case PROT_SNAPSHOT: lcl_Flags( aOut, pFrame );
+ case PROT::Snapshot: lcl_Flags( aOut, pFrame );
break;
- case PROT_MAKEALL: aOut.append("MakeAll");
+ case PROT::MakeAll: aOut.append("MakeAll");
lcl_Start( aOut, aLayer, nAct );
if( nAct == ACT_START )
lcl_Flags( aOut, pFrame );
break;
- case PROT_MOVE_FWD: bTmp = true;
+ case PROT::MoveFwd: bTmp = true;
SAL_FALLTHROUGH;
- case PROT_MOVE_BWD:
- if (nFunction == (bTmp ? 1U : 0U))
+ case PROT::MoveBack:
+ if (nFunction == (bTmp ? PROT::Init : PROT::FileInit))
aOut.append("Fwd");
else
aOut.append("Bwd");
@@ -552,23 +553,23 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, sal_uLong nFunction, sal_uL
aOut.append(static_cast<sal_Int32>(*static_cast<sal_uInt16*>(pParam)));
}
break;
- case PROT_GROW_TST: if( ACT_START != nAct )
+ case PROT::GrowTest: if( ACT_START != nAct )
return;
aOut.append("TestGrow");
break;
- case PROT_SHRINK_TST: if( ACT_START != nAct )
+ case PROT::ShrinkTest: if( ACT_START != nAct )
return;
aOut.append("TestShrink");
break;
- case PROT_ADJUSTN :
- case PROT_SHRINK: bTmp = true;
+ case PROT::AdjustN :
+ case PROT::Shrink: bTmp = true;
SAL_FALLTHROUGH;
- case PROT_GROW:
+ case PROT::Grow:
if (!bTmp)
aOut.append("Grow");
else
{
- if (nFunction == PROT_SHRINK)
+ if (nFunction == PROT::Shrink)
aOut.append("Shrink");
else
aOut.append("AdjustNgbhd");
@@ -580,16 +581,16 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, sal_uLong nFunction, sal_uL
aOut.append(static_cast<sal_Int64>(*static_cast<long*>(pParam)));
}
break;
- case PROT_POS: break;
- case PROT_PRTAREA: aOut.append("PrtArea");
+ case PROT::Pos: break;
+ case PROT::PrintArea: aOut.append("PrtArea");
lcl_Start( aOut, aLayer, nAct );
break;
- case PROT_SIZE: aOut.append("Size");
+ case PROT::Size: aOut.append("Size");
lcl_Start( aOut, aLayer, nAct );
aOut.append(' ');
aOut.append(static_cast<sal_Int64>(pFrame->Frame().Height()));
break;
- case PROT_LEAF: aOut.append("Prev/NextLeaf");
+ case PROT::Leaf: aOut.append("Prev/NextLeaf");
lcl_Start( aOut, aLayer, nAct );
aOut.append(' ');
if( pParam )
@@ -598,21 +599,21 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, sal_uLong nFunction, sal_uL
aOut.append(static_cast<sal_Int64>(lcl_GetFrameId(static_cast<SwFrame*>(pParam))));
}
break;
- case PROT_FILE_INIT: FileInit();
+ case PROT::FileInit: FileInit();
aOut.append("Initialize");
break;
- case PROT_SECTION: SectFunc(aOut, pFrame, nAct, pParam);
+ case PROT::Section: SectFunc(aOut, pFrame, nAct, pParam);
break;
- case PROT_CUT: bTmp = true;
+ case PROT::Cut: bTmp = true;
SAL_FALLTHROUGH;
- case PROT_PASTE:
+ case PROT::Paste:
if (bTmp)
aOut.append("Cut from ");
else
aOut.append("Paste to ");
aOut.append(static_cast<sal_Int64>(lcl_GetFrameId(static_cast<SwFrame*>(pParam))));
break;
- case PROT_TESTFORMAT:
+ case PROT::TestFormat:
aOut.append("Test");
lcl_Start( aOut, aLayer, nAct );
if( ACT_START == nAct )
@@ -620,7 +621,7 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, sal_uLong nFunction, sal_uL
else
nTestMode &= ~2;
break;
- case PROT_FRMCHANGES:
+ case PROT::FrmChanges:
{
SwRect& rFrame = *static_cast<SwRect*>(pParam);
if( pFrame->Frame().Pos() != rFrame.Pos() )
@@ -653,12 +654,13 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, sal_uLong nFunction, sal_uL
}
break;
}
+ default: break;
}
pStream->WriteCharPtr( aOut.getStr() );
(*pStream) << endl; // output
pStream->Flush(); // to the disk, so we can read it immediately
if( ++nLineCount >= nMaxLines ) // max number of lines reached?
- SwProtocol::SetRecord( 0 ); // => end f logging
+ SwProtocol::SetRecord( PROT::FileInit ); // => end f logging
}
/// Handle the output of the SectionFrames.
@@ -723,16 +725,16 @@ bool SwImplProtocol::DeleteFrame( sal_uInt16 nId )
* The task here is to find the right SwImplEnterLeave object based on the
* function; everything else is then done in his Ctor/Dtor.
*/
-void SwEnterLeave::Ctor( const SwFrame* pFrame, sal_uLong nFunc, sal_uLong nAct, void* pPar )
+void SwEnterLeave::Ctor( const SwFrame* pFrame, PROT nFunc, sal_uLong nAct, void* pPar )
{
switch( nFunc )
{
- case PROT_ADJUSTN :
- case PROT_GROW:
- case PROT_SHRINK : pImpl = new SwSizeEnterLeave( pFrame, nFunc, nAct, pPar ); break;
- case PROT_MOVE_FWD:
- case PROT_MOVE_BWD : pImpl = new SwUpperEnterLeave( pFrame, nFunc, nAct, pPar ); break;
- case PROT_FRMCHANGES : pImpl = new SwFrameChangesLeave( pFrame, nFunc, nAct, pPar ); break;
+ case PROT::AdjustN :
+ case PROT::Grow:
+ case PROT::Shrink : pImpl = new SwSizeEnterLeave( pFrame, nFunc, nAct, pPar ); break;
+ case PROT::MoveFwd:
+ case PROT::MoveBack : pImpl = new SwUpperEnterLeave( pFrame, nFunc, nAct, pPar ); break;
+ case PROT::FrmChanges : pImpl = new SwFrameChangesLeave( pFrame, nFunc, nAct, pPar ); break;
default: pImpl = new SwImplEnterLeave( pFrame, nFunc, nAct, pPar ); break;
}
pImpl->Enter();
@@ -786,7 +788,7 @@ void SwFrameChangesLeave::Enter()
void SwFrameChangesLeave::Leave()
{
if( pFrame->Frame() != aFrame )
- SwProtocol::Record( pFrame, PROT_FRMCHANGES, 0, &aFrame );
+ SwProtocol::Record( pFrame, PROT::FrmChanges, 0, &aFrame );
}
#endif // DBG_UTIL
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 39a9113..f2db886 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1841,7 +1841,7 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways )
if ( pNewUpper )
{
- PROTOCOL_ENTER( &m_rThis, PROT_MOVE_FWD, 0, nullptr );
+ PROTOCOL_ENTER( &m_rThis, PROT::MoveFwd, 0, nullptr );
SwPageFrame *pOldPage = pOldBoss->FindPageFrame();
// We move ourself and all the direct successors before the
// first ContentFrame below the new Upper.
@@ -2399,7 +2399,7 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat )
"<SwFlowFrame::MoveBwd(..)> - moving backward to the current upper frame!?" );
if ( pNewUpper )
{
- PROTOCOL_ENTER( &m_rThis, PROT_MOVE_BWD, 0, nullptr );
+ PROTOCOL_ENTER( &m_rThis, PROT::MoveBack, 0, nullptr );
if ( pNewUpper->IsFootnoteContFrame() )
{
// I may have gotten a Container
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index de3b7d8..0a119a6 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -540,7 +540,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
( pPage->IsInvalid() ||
(IS_FLYS && IS_INVAFLY) ) )
{
- PROTOCOL( pPage, PROT_FILE_INIT, 0, nullptr)
+ PROTOCOL( pPage, PROT::FileInit, 0, nullptr)
XCHECKPAGE;
// #i81146# new loop control
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 6696675..6979e22 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3186,7 +3186,7 @@ void SwRootFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect,
{
OSL_ENSURE( Lower() && Lower()->IsPageFrame(), "Lower of root is no page." );
- PROTOCOL( this, PROT_FILE_INIT, 0, nullptr)
+ PROTOCOL( this, PROT::FileInit, 0, nullptr)
bool bResetRootPaint = false;
SwViewShell *pSh = mpCurrShell;
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 8335368..e7a1c7b 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -68,7 +68,7 @@ SwSectionFrame::SwSectionFrame( SwSectionFrame &rSect, bool bMaster ) :
{
mnFrameType = SwFrameType::Section;
- PROTOCOL( this, PROT_SECTION, bMaster ? ACT_CREATE_MASTER : ACT_CREATE_FOLLOW, &rSect )
+ PROTOCOL( this, PROT::Section, bMaster ? ACT_CREATE_MASTER : ACT_CREATE_FOLLOW, &rSect )
if( bMaster )
{
@@ -129,7 +129,7 @@ void SwSectionFrame::DestroyImpl()
SwSectionFrame *pMaster = FindMaster();
if( pMaster )
{
- PROTOCOL( this, PROT_SECTION, ACT_DEL_FOLLOW, pMaster )
+ PROTOCOL( this, PROT::Section, ACT_DEL_FOLLOW, pMaster )
pMaster->SetFollow( GetFollow() );
// A Master always grabs the space until the lower edge of his
// Upper. If he doesn't have a Follow anymore, he can
@@ -141,7 +141,7 @@ void SwSectionFrame::DestroyImpl()
}
else if( HasFollow() )
{
- PROTOCOL( this, PROT_SECTION, ACT_DEL_MASTER, GetFollow() )
+ PROTOCOL( this, PROT::Section, ACT_DEL_MASTER, GetFollow() )
}
}
@@ -218,7 +218,7 @@ void SwSectionFrame::Cut_( bool bRemove )
{
OSL_ENSURE( GetUpper(), "Cut ohne Upper()." );
- PROTOCOL( this, PROT_CUT, 0, GetUpper() )
+ PROTOCOL( this, PROT::Cut, 0, GetUpper() )
SwPageFrame *pPage = FindPageFrame();
InvalidatePage( pPage );
@@ -299,7 +299,7 @@ void SwSectionFrame::Paste( SwFrame* pParent, SwFrame* pSibling )
OSL_ENSURE( !GetPrev() && !GetUpper(),
"I am still registered somewhere." );
- PROTOCOL( this, PROT_PASTE, 0, GetUpper() )
+ PROTOCOL( this, PROT::Paste, 0, GetUpper() )
// Add to the tree
SwSectionFrame* pSect = pParent->FindSctFrame();
@@ -429,7 +429,7 @@ void SwSectionFrame::MergeNext( SwSectionFrame* pNxt )
if (!pNxt->IsJoinLocked() && GetSection() == pNxt->GetSection())
{
- PROTOCOL( this, PROT_SECTION, ACT_MERGE, pNxt )
+ PROTOCOL( this, PROT::Section, ACT_MERGE, pNxt )
SwFrame* pTmp = ::SaveContent( pNxt );
if( pTmp )
@@ -1223,7 +1223,7 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA
SWRECTFN( this )
if ( !mbValidPrtArea )
{
- PROTOCOL( this, PROT_PRTAREA, 0, nullptr )
+ PROTOCOL( this, PROT::PrintArea, 0, nullptr )
mbValidPrtArea = true;
SwTwips nUpper = CalcUpperSpace();
@@ -1243,7 +1243,7 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA
if ( !mbValidSize )
{
- PROTOCOL_ENTER( this, PROT_SIZE, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::Size, 0, nullptr )
const long nOldHeight = (Frame().*fnRect->fnGetHeight)();
bool bOldLock = IsColLocked();
ColLock();
@@ -1431,7 +1431,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
{
// Attention: Nested sections are currently not supported
- PROTOCOL_ENTER( this, PROT_LEAF, ACT_NEXT_SECT, GetUpper()->FindSctFrame() )
+ PROTOCOL_ENTER( this, PROT::Leaf, ACT_NEXT_SECT, GetUpper()->FindSctFrame() )
// Shortcuts for "columned" sections, if we're not in the last column
// Can we slide to the next column of the section?
@@ -1649,7 +1649,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
/// Returns the preceding layout sheet where the frame can be moved into
SwLayoutFrame *SwFrame::GetPrevSctLeaf( MakePageType )
{
- PROTOCOL_ENTER( this, PROT_LEAF, ACT_PREV_SECT, GetUpper()->FindSctFrame() )
+ PROTOCOL_ENTER( this, PROT::Leaf, ACT_PREV_SECT, GetUpper()->FindSctFrame() )
SwLayoutFrame* pCol;
// ColumnFrame always contain a BodyFrame now
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index e87418f..21b5bc8 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1745,7 +1745,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
return;
}
- PROTOCOL_ENTER( this, PROT_MAKEALL, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::MakeAll, 0, nullptr )
LockJoin(); //I don't want to be destroyed on the way.
SwLayNotify aNotify( this ); //does the notification in the DTor
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 52042e9..1c9dbd3 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1156,7 +1156,7 @@ SwTwips SwFrame::Grow( SwTwips nDist, bool bTst, bool bInfo )
{
OSL_ENSURE( nDist >= 0, "Negative growth?" );
- PROTOCOL_ENTER( this, bTst ? PROT_GROW_TST : PROT_GROW, 0, &nDist )
+ PROTOCOL_ENTER( this, bTst ? PROT::GrowTest : PROT::Grow, 0, &nDist )
if ( nDist )
{
@@ -1200,7 +1200,7 @@ SwTwips SwFrame::Shrink( SwTwips nDist, bool bTst, bool bInfo )
{
OSL_ENSURE( nDist >= 0, "Negative reduction?" );
- PROTOCOL_ENTER( this, bTst ? PROT_SHRINK_TST : PROT_SHRINK, 0, &nDist )
+ PROTOCOL_ENTER( this, bTst ? PROT::ShrinkTest : PROT::Shrink, 0, &nDist )
if ( nDist )
{
@@ -1259,7 +1259,7 @@ SwTwips SwFrame::Shrink( SwTwips nDist, bool bTst, bool bInfo )
*/
SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
{
- PROTOCOL_ENTER( this, PROT_ADJUSTN, 0, &nDiff );
+ PROTOCOL_ENTER( this, PROT::AdjustN, 0, &nDiff );
if ( !nDiff || !GetUpper()->IsFootnoteBossFrame() ) // only inside pages/columns
return 0L;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index acb8831..a1cb454 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1909,7 +1909,7 @@ SwTestFormat::~SwTestFormat()
bool SwTextFrame::TestFormat( const SwFrame* pPrv, SwTwips &rMaxHeight, bool &bSplit )
{
- PROTOCOL_ENTER( this, PROT_TESTFORMAT, 0, nullptr )
+ PROTOCOL_ENTER( this, PROT::TestFormat, 0, nullptr )
if( IsLocked() && GetUpper()->Prt().Width() <= 0 )
return false;
commit 383e00bde033981eacdfc45ee6d1a9e0c4b030ef
Author: Noel Grandin <noel at peralex.com>
Date: Thu May 12 14:47:01 2016 +0200
Convert WHEELMODE to scoped enum
Change-Id: Ia65f88b94c6c1151546f3e2d592b6a02ac49aaa4
diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx
index 2c0bc7f..60355ee 100644
--- a/vcl/source/window/scrwnd.cxx
+++ b/vcl/source/window/scrwnd.cxx
@@ -40,7 +40,7 @@ ImplWheelWindow::ImplWheelWindow( vcl::Window* pParent ) :
FloatingWindow ( pParent, 0 ),
mnRepaintTime ( 1UL ),
mnTimeout ( DEF_TIMEOUT ),
- mnWheelMode ( WHEELMODE_NONE ),
+ mnWheelMode ( WheelMode::NONE ),
mnActDist ( 0UL ),
mnActDeltaX ( 0L ),
mnActDeltaY ( 0L )
@@ -67,11 +67,11 @@ ImplWheelWindow::ImplWheelWindow( vcl::Window* pParent ) :
// set wheel mode
if( bHorz && bVert )
- ImplSetWheelMode( WHEELMODE_VH );
+ ImplSetWheelMode( WheelMode::VH );
else if( bHorz )
- ImplSetWheelMode( WHEELMODE_H );
+ ImplSetWheelMode( WheelMode::H );
else
- ImplSetWheelMode( WHEELMODE_V );
+ ImplSetWheelMode( WheelMode::V );
// init timer
mpTimer = new Timer("WheelWindowTimer");
@@ -126,13 +126,13 @@ void ImplWheelWindow::ImplCreateImageList()
( ResId( SV_RESID_BITMAP_SCROLLBMP, *pResMgr ), 6, nullptr );
}
-void ImplWheelWindow::ImplSetWheelMode( sal_uLong nWheelMode )
+void ImplWheelWindow::ImplSetWheelMode( WheelMode nWheelMode )
{
if( nWheelMode != mnWheelMode )
{
mnWheelMode = nWheelMode;
- if( WHEELMODE_NONE == mnWheelMode )
+ if( WheelMode::NONE == mnWheelMode )
{
if( IsVisible() )
Hide();
@@ -153,22 +153,22 @@ void ImplWheelWindow::ImplDrawWheel(vcl::RenderContext& rRenderContext)
switch (mnWheelMode)
{
- case WHEELMODE_VH:
+ case WheelMode::VH:
nId = 1;
break;
- case WHEELMODE_V:
+ case WheelMode::V:
nId = 2;
break;
- case WHEELMODE_H:
+ case WheelMode::H:
nId = 3;
break;
- case WHEELMODE_SCROLL_VH:
+ case WheelMode::ScrollVH:
nId = 4;
break;
- case WHEELMODE_SCROLL_V:
+ case WheelMode::ScrollV:
nId = 5;
break;
- case WHEELMODE_SCROLL_H:
+ case WheelMode::ScrollH:
nId = 6;
break;
default:
@@ -344,11 +344,11 @@ void ImplWheelWindow::MouseMove( const MouseEvent& rMEvt )
SetPointer( eActStyle );
if( bHorz && bVert )
- ImplSetWheelMode( bOuter ? WHEELMODE_SCROLL_VH : WHEELMODE_VH );
+ ImplSetWheelMode( bOuter ? WheelMode::ScrollVH : WheelMode::VH );
else if( bHorz )
- ImplSetWheelMode( bOuter ? WHEELMODE_SCROLL_H : WHEELMODE_H );
+ ImplSetWheelMode( bOuter ? WheelMode::ScrollH : WheelMode::H );
else
- ImplSetWheelMode( bOuter ? WHEELMODE_SCROLL_V : WHEELMODE_V );
+ ImplSetWheelMode( bOuter ? WheelMode::ScrollV : WheelMode::V );
}
void ImplWheelWindow::MouseButtonUp( const MouseEvent& rMEvt )
diff --git a/vcl/source/window/scrwnd.hxx b/vcl/source/window/scrwnd.hxx
index e9edae3..dc438cb 100644
--- a/vcl/source/window/scrwnd.hxx
+++ b/vcl/source/window/scrwnd.hxx
@@ -24,16 +24,21 @@
#include <vcl/bitmap.hxx>
#include <vcl/image.hxx>
-#define WHEELMODE_NONE 0x00000000UL
-#define WHEELMODE_VH 0x00000001UL
-#define WHEELMODE_V 0x00000002UL
-#define WHEELMODE_H 0x00000004UL
-#define WHEELMODE_SCROLL_VH 0x00000008UL
-#define WHEELMODE_SCROLL_V 0x00000010UL
-#define WHEELMODE_SCROLL_H 0x00000020UL
-
class Timer;
+enum class WheelMode {
+ NONE = 0x0000,
+ VH = 0x0001,
+ V = 0x0002,
+ H = 0x0004,
+ ScrollVH = 0x0008,
+ ScrollV = 0x0010,
+ ScrollH = 0x0020
+};
+namespace o3tl {
+ template<> struct typed_flags<WheelMode> : is_typed_flags<WheelMode, 0x003f> {};
+}
+
class ImplWheelWindow : public FloatingWindow
{
private:
@@ -44,9 +49,9 @@ private:
Timer* mpTimer;
sal_uInt64 mnRepaintTime;
sal_uInt64 mnTimeout;
- sal_uLong mnWheelMode;
- sal_uLong mnMaxWidth;
- sal_uLong mnActDist;
+ WheelMode mnWheelMode;
+ sal_uLong mnMaxWidth;
+ sal_uLong mnActDist;
long mnActDeltaX;
long mnActDeltaY;
@@ -72,7 +77,7 @@ public:
virtual void dispose() override;
void ImplStop();
- void ImplSetWheelMode( sal_uLong nWheelMode );
+ void ImplSetWheelMode( WheelMode nWheelMode );
};
#endif // INCLUDED_VCL_SOURCE_WINDOW_SCRWND_HXX
More information about the Libreoffice-commits
mailing list