convert SW_CHAIN_ constants to enum class
Change-Id: If3cd86cbb0b01f975456b93b05232e18ec742828
This commit is contained in:
parent
019ab2b00f
commit
f9ba16e44b
7 changed files with 42 additions and 39 deletions
|
@ -1532,8 +1532,8 @@ public:
|
|||
sal_uInt16 GetBoxAlign( const SwCursor& rCursor ) const;
|
||||
void AdjustCellWidth( const SwCursor& rCursor, bool bBalance = false );
|
||||
|
||||
int Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest );
|
||||
int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
|
||||
SwChainRet Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest );
|
||||
SwChainRet Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
|
||||
void Unchain( SwFrmFmt &rFmt );
|
||||
|
||||
// For Copy/Move from FrmShell.
|
||||
|
|
|
@ -447,9 +447,9 @@ public:
|
|||
|
||||
/** For Chain always connect Fly specified by format with that hit by point.
|
||||
rRect contains rect of Fly (for its highlight). */
|
||||
int Chainable( SwRect &rRect, const SwFrmFmt &rSource, const Point &rPt ) const;
|
||||
int Chain( SwFrmFmt &rSource, const Point &rPt );
|
||||
int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
|
||||
SwChainRet Chainable( SwRect &rRect, const SwFrmFmt &rSource, const Point &rPt ) const;
|
||||
SwChainRet Chain( SwFrmFmt &rSource, const Point &rPt );
|
||||
SwChainRet Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
|
||||
void Unchain( SwFrmFmt &rFmt );
|
||||
void HideChainMarker();
|
||||
void SetChainMarker();
|
||||
|
|
|
@ -30,14 +30,17 @@ enum FlyCntType
|
|||
};
|
||||
|
||||
// Return values for chainable and chain.
|
||||
#define SW_CHAIN_OK 0
|
||||
#define SW_CHAIN_NOT_EMPTY 1 ///< Only empty frames may be connected.
|
||||
#define SW_CHAIN_IS_IN_CHAIN 2 ///< Destination already in chain.
|
||||
#define SW_CHAIN_WRONG_AREA 3 /**< Destination in section where it shouldn't be
|
||||
enum class SwChainRet
|
||||
{
|
||||
OK = 0,
|
||||
NOT_EMPTY = 1, ///< Only empty frames may be connected.
|
||||
IS_IN_CHAIN = 2, ///< Destination already in chain.
|
||||
WRONG_AREA = 3, /**< Destination in section where it shouldn't be
|
||||
(header, footer). */
|
||||
#define SW_CHAIN_NOT_FOUND 4 ///< Destination and/or source not found.
|
||||
#define SW_CHAIN_SOURCE_CHAINED 5 ///< Source already has a follow.
|
||||
#define SW_CHAIN_SELF 6 ///< Self-chaining is not allowed.
|
||||
NOT_FOUND = 4, ///< Destination and/or source not found.
|
||||
SOURCE_CHAINED = 5, ///< Source already has a follow.
|
||||
SELF = 6 ///< Self-chaining is not allowed.
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -929,45 +929,45 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
|
|||
return bUnmark;
|
||||
}
|
||||
|
||||
int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest )
|
||||
SwChainRet SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest )
|
||||
{
|
||||
// The Source must not yet have a Follow.
|
||||
const SwFmtChain &rOldChain = rSource.GetChain();
|
||||
if ( rOldChain.GetNext() )
|
||||
return SW_CHAIN_SOURCE_CHAINED;
|
||||
return SwChainRet::SOURCE_CHAINED;
|
||||
|
||||
// Target must not be equal to Source and we also must not have a closed chain.
|
||||
const SwFrmFmt *pFmt = &rDest;
|
||||
do {
|
||||
if( pFmt == &rSource )
|
||||
return SW_CHAIN_SELF;
|
||||
return SwChainRet::SELF;
|
||||
pFmt = pFmt->GetChain().GetNext();
|
||||
} while ( pFmt );
|
||||
|
||||
// There must not be a chaining from outside to inside or the other way around.
|
||||
if( rDest.IsLowerOf( rSource ) || rSource .IsLowerOf( rDest ) )
|
||||
return SW_CHAIN_SELF;
|
||||
return SwChainRet::SELF;
|
||||
|
||||
// The Target must not yet have a Master.
|
||||
const SwFmtChain &rChain = rDest.GetChain();
|
||||
if( rChain.GetPrev() )
|
||||
return SW_CHAIN_IS_IN_CHAIN;
|
||||
return SwChainRet::IS_IN_CHAIN;
|
||||
|
||||
// Target must be empty.
|
||||
const SwNodeIndex* pCntIdx = rDest.GetCntnt().GetCntntIdx();
|
||||
if( !pCntIdx )
|
||||
return SW_CHAIN_NOT_FOUND;
|
||||
return SwChainRet::NOT_FOUND;
|
||||
|
||||
SwNodeIndex aNxtIdx( *pCntIdx, 1 );
|
||||
const SwTxtNode* pTxtNd = aNxtIdx.GetNode().GetTxtNode();
|
||||
if( !pTxtNd )
|
||||
return SW_CHAIN_NOT_FOUND;
|
||||
return SwChainRet::NOT_FOUND;
|
||||
|
||||
const sal_uLong nFlySttNd = pCntIdx->GetIndex();
|
||||
if( 2 != ( pCntIdx->GetNode().EndOfSectionIndex() - nFlySttNd ) ||
|
||||
pTxtNd->GetTxt().getLength() )
|
||||
{
|
||||
return SW_CHAIN_NOT_EMPTY;
|
||||
return SwChainRet::NOT_EMPTY;
|
||||
}
|
||||
|
||||
for( auto pSpzFrmFm : *GetSpzFrmFmts() )
|
||||
|
@ -982,7 +982,7 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest )
|
|||
rAnchor.GetCntntAnchor()->nNode.GetIndex() ) &&
|
||||
nTstSttNd < nFlySttNd + 2 )
|
||||
{
|
||||
return SW_CHAIN_NOT_EMPTY;
|
||||
return SwChainRet::NOT_EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1023,13 +1023,13 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest )
|
|||
bAllowed = true;
|
||||
}
|
||||
|
||||
return bAllowed ? SW_CHAIN_OK : SW_CHAIN_WRONG_AREA;
|
||||
return bAllowed ? SwChainRet::OK : SwChainRet::WRONG_AREA;
|
||||
}
|
||||
|
||||
int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest )
|
||||
SwChainRet SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest )
|
||||
{
|
||||
int nErr = Chainable( rSource, rDest );
|
||||
if ( !nErr )
|
||||
SwChainRet nErr = Chainable( rSource, rDest );
|
||||
if ( nErr == SwChainRet::OK )
|
||||
{
|
||||
GetIDocumentUndoRedo().StartUndo( UNDO_CHAINE, NULL );
|
||||
|
||||
|
|
|
@ -1857,14 +1857,14 @@ void SwFEShell::GetConnectableFrmFmts(SwFrmFmt & rFmt,
|
|||
after pFmt.
|
||||
*/
|
||||
|
||||
int nChainState;
|
||||
SwChainRet nChainState;
|
||||
|
||||
if (bSuccessors)
|
||||
nChainState = mpDoc->Chainable(rFmt, rFmt1);
|
||||
else
|
||||
nChainState = mpDoc->Chainable(rFmt1, rFmt);
|
||||
|
||||
if (nChainState == SW_CHAIN_OK)
|
||||
if (nChainState == SwChainRet::OK)
|
||||
{
|
||||
aTmpSpzArray.push_back(&rFmt1);
|
||||
|
||||
|
|
|
@ -2496,7 +2496,7 @@ void SwFEShell::SetCalcFieldValueHdl(Outliner* pOutliner)
|
|||
GetDoc()->SetCalcFieldValueHdl(pOutliner);
|
||||
}
|
||||
|
||||
int SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource,
|
||||
SwChainRet SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource,
|
||||
const Point &rPt ) const
|
||||
{
|
||||
rRect.Clear();
|
||||
|
@ -2504,9 +2504,9 @@ int SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource,
|
|||
// The source is not allowed to have a follow.
|
||||
const SwFmtChain &rChain = rSource.GetChain();
|
||||
if ( rChain.GetNext() )
|
||||
return SW_CHAIN_SOURCE_CHAINED;
|
||||
return SwChainRet::SOURCE_CHAINED;
|
||||
|
||||
int nRet = SW_CHAIN_NOT_FOUND;
|
||||
SwChainRet nRet = SwChainRet::NOT_FOUND;
|
||||
if( Imp()->HasDrawView() )
|
||||
{
|
||||
SdrObject* pObj;
|
||||
|
@ -2530,16 +2530,16 @@ int SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource,
|
|||
return nRet;
|
||||
}
|
||||
|
||||
int SwFEShell::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest )
|
||||
SwChainRet SwFEShell::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest )
|
||||
{
|
||||
return GetDoc()->Chain(rSource, rDest);
|
||||
}
|
||||
|
||||
int SwFEShell::Chain( SwFrmFmt &rSource, const Point &rPt )
|
||||
SwChainRet SwFEShell::Chain( SwFrmFmt &rSource, const Point &rPt )
|
||||
{
|
||||
SwRect aDummy;
|
||||
int nErr = Chainable( aDummy, rSource, rPt );
|
||||
if ( !nErr )
|
||||
SwChainRet nErr = Chainable( aDummy, rSource, rPt );
|
||||
if ( nErr == SwChainRet::OK )
|
||||
{
|
||||
StartAllAction();
|
||||
SdrObject* pObj;
|
||||
|
|
|
@ -385,10 +385,10 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
|
|||
if ( IsChainMode() )
|
||||
{
|
||||
SwRect aRect;
|
||||
int nChainable = rSh.Chainable( aRect, *rSh.GetFlyFrmFmt(), rLPt );
|
||||
PointerStyle eStyle = nChainable
|
||||
SwChainRet nChainable = rSh.Chainable( aRect, *rSh.GetFlyFrmFmt(), rLPt );
|
||||
PointerStyle eStyle = nChainable != SwChainRet::OK
|
||||
? POINTER_CHAIN_NOTALLOWED : POINTER_CHAIN;
|
||||
if ( !nChainable )
|
||||
if ( nChainable == SwChainRet::OK )
|
||||
{
|
||||
Rectangle aTmp( aRect.SVRect() );
|
||||
|
||||
|
@ -2957,7 +2957,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
|
|||
SetChainMode( false );
|
||||
SwRect aDummy;
|
||||
SwFlyFrmFmt *pFmt = static_cast<SwFlyFrmFmt*>(rSh.GetFlyFrmFmt());
|
||||
if ( !rSh.Chainable( aDummy, *pFmt, aDocPos ) )
|
||||
if ( rSh.Chainable( aDummy, *pFmt, aDocPos ) == SwChainRet::OK )
|
||||
rSh.Chain( *pFmt, aDocPos );
|
||||
UpdatePointer( aDocPos, rMEvt.GetModifier() );
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue