sw: reindent etc. SwContentTree::ExecCommand

Change-Id: Icacc4b235c17d64003652c81ffca7bcc247431e7
This commit is contained in:
Michael Stahl
2016-11-29 22:21:09 +01:00
parent 86e8d7aa49
commit 032b63195e

View File

@@ -2242,11 +2242,14 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bModifier)
const bool bLeftRight = bLeft || rCmd == "demote";
if (!bUpDown && !bLeftRight)
return;
if( !GetWrtShell()->GetView().GetDocShell()->IsReadOnly() &&
(State::ACTIVE == m_eState ||
(State::CONSTANT == m_eState && m_pActiveShell == GetParentWindow()->GetCreateView()->GetWrtShellPtr())))
if (GetWrtShell()->GetView().GetDocShell()->IsReadOnly() ||
(State::ACTIVE != m_eState &&
(State::CONSTANT != m_eState || m_pActiveShell != GetParentWindow()->GetCreateView()->GetWrtShellPtr())))
{
SwWrtShell* pShell = GetWrtShell();
return;
}
SwWrtShell *const pShell = GetWrtShell();
sal_Int8 nActOutlineLevel = m_nOutlineLevel;
sal_uInt16 nActPos = pShell->GetOutlinePos(nActOutlineLevel);
SvTreeListEntry* pFirstEntry = FirstSelected();
@@ -2260,14 +2263,12 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bModifier)
nActPos = static_cast<SwOutlineContent*>(pFirstEntry->GetUserData())->GetPos();
}
}
if ( nActPos < USHRT_MAX &&
( !bUpDown || pShell->IsOutlineMovable( nActPos )) )
if (nActPos < USHRT_MAX && (!bUpDown || pShell->IsOutlineMovable(nActPos)))
{
pShell->StartAllAction();
pShell->GotoOutline( nActPos); // If text selection != box selection
pShell->Push();
pShell->MakeOutlineSel( nActPos, nActPos,
bModifier);
pShell->MakeOutlineSel(nActPos, nActPos, bModifier);
if (bUpDown)
{
short nDir = bUp ? -1 : 1;
@@ -2290,8 +2291,7 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bModifier)
static_cast<SwTypeNumber*>(pEntry->GetUserData())->GetTypeId())
{
assert(dynamic_cast<SwOutlineContent*>(static_cast<SwTypeNumber*>(pEntry->GetUserData())));
if(nActLevel >= static_cast<SwOutlineContent*>(
pEntry->GetUserData())->GetOutlineLevel())
if (nActLevel >= static_cast<SwOutlineContent*>(pEntry->GetUserData())->GetOutlineLevel())
break;
pEntry = Next(pEntry);
assert(pEntry == nullptr || dynamic_cast<SwTypeNumber*>(static_cast<SwTypeNumber*>(pEntry->GetUserData())));
@@ -2299,15 +2299,15 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bModifier)
}
if (nDir == 1)
{
// If the last entry is to be moved it is over!
// If the last entry is to be moved we're done
if (pEntry && CTYPE_CNT ==
static_cast<SwTypeNumber*>(pEntry->GetUserData())->GetTypeId())
{
// pEntry now points to the following entry of the last
// pEntry now points to the entry following the last
// selected entry.
sal_uInt16 nDest = nActEndPos + 1;
// here needs to found the next record after next.
// The selection must be inserted in front of.
// here needs to found the next entry after next.
// The selection must be inserted in front of that.
while (pEntry)
{
pEntry = Next(pEntry);
@@ -2322,8 +2322,8 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bModifier)
}
}
nDir = nDest - nActEndPos;
// If no entry was found which corresponds the condition
// of the previously paste, it needs to be pushed slightly less.
// If no entry was found that allows insertion before
// it, we just move it to the end.
}
else
nDir = 0;
@@ -2361,7 +2361,7 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bModifier)
}
pShell->ClearMark();
pShell->Pop(false); // Cursor is now back at the current superscription.
pShell->Pop(false); // Cursor is now back at the current heading.
pShell->EndAllAction();
if (m_aActiveContentArr[ContentTypeId::OUTLINE])
m_aActiveContentArr[ContentTypeId::OUTLINE]->Invalidate();
@@ -2383,7 +2383,6 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bModifier)
}
}
}
}
void SwContentTree::ShowTree()
{