diff options
author | Jim Raykowski <raykowj@gmail.com> | 2020-12-05 20:57:15 -0900 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2020-12-24 07:12:59 +0100 |
commit | c405bae468d887ec77dd3830b7678fcedc2debfd (patch) | |
tree | 711071ec86bfc55b74d2250e5e3b9bce6740b431 /sw/source/uibase/docvw/edtwin.cxx | |
parent | 85f39dc62b7feb357535582deec1c18f72f9ef0d (diff) |
tdf#138136 tdf#38093 add option to treat sub outline levels as content
Also included in this patch:
- Modifications to make all outline content visible during move
operations.
- Removal of code intended to redraw buttons when layout is changed that
seems not to work as intended.
- Function IsOutlineContentFolded changed to IsOutlineContentVisible
- Change of delay before button is shown to half of what it was.
Change-Id: I0dde555ccd0693ca382c1f15326edfdc2fc44a93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107815
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase/docvw/edtwin.cxx')
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 80 |
1 files changed, 28 insertions, 52 deletions
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 32ca8139fdc5..303bb7b7aa8f 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -577,7 +577,8 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) = rSh.getIDocumentOutlineNodesAccess()->getOutlineNodesCount(); int nLevel = rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos); OUString sQuickHelp(SwResId(STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY)); - if (nPos + 1 < nOutlineNodesCount + if (!rSh.GetViewOptions()->IsTreatSubOutlineLevelsAsContent() + && nPos + 1 < nOutlineNodesCount && rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos + 1) > nLevel) sQuickHelp += " (" + SwResId(STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY_EXT) + ")"; SetQuickHelpText(sQuickHelp); @@ -1362,7 +1363,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) if (rSh.GetViewOptions()->IsShowOutlineContentVisibilityButton()) { - // not allowed if outline content is folded + // not allowed if outline content visibility is false sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode(); if ((rSh.IsSttPara() && (nKey == KEY_BACKSPACE || nKey == KEY_LEFT)) || (rSh.IsEndOfPara() && (nKey == KEY_DELETE || nKey == KEY_RETURN || nKey == KEY_RIGHT))) @@ -1374,13 +1375,13 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) bool bOutlineContentVisibleAttr = true; pContentNode->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); if (!bOutlineContentVisibleAttr) - return; // outline node is folded + return; // outline content visibility is false if (rSh.IsSttPara() && (nKey == KEY_BACKSPACE || nKey == KEY_LEFT) && (nPos-1 != SwOutlineNodes::npos)) { bOutlineContentVisibleAttr = true; rSh.GetDoc()->GetNodes().GetOutLineNds()[nPos-1]->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); if (!bOutlineContentVisibleAttr) - return; // previous outline node is folded + return; // previous outline node has content visibility false } } } @@ -3538,7 +3539,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) MoveCursor(rSh, aDocPos, bOnlyText, bLockView); SwPaM aPam(*rSh.GetCurrentShellCursor().GetPoint()); SwOutlineNodes::size_type nPos; - if (rSh.GetNodes().GetOutLineNds().Seek_Entry( &aPam.GetPoint()->nNode.GetNode(), &nPos)) + if (rSh.GetNodes().GetOutLineNds().Seek_Entry(&aPam.GetPoint()->nNode.GetNode(), &nPos)) rSh.ToggleOutlineContentVisibility(nPos); return; } @@ -3787,15 +3788,20 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) SwOutlineNodes::size_type nPos; if (rSh.GetNodes().GetOutLineNds().Seek_Entry(&aPam.GetPoint()->nNode.GetNode(), &nPos)) { - SwOutlineNodes::size_type nOutlineNodesCount = rSh.getIDocumentOutlineNodesAccess()->getOutlineNodesCount(); - int nLevel = rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos); - bool bFold = rSh.IsOutlineContentFolded(nPos); - do + if (rSh.GetViewOptions()->IsTreatSubOutlineLevelsAsContent()) + rSh.ToggleOutlineContentVisibility(nPos); + else { - if (rSh.IsOutlineContentFolded(nPos) == bFold) - rSh.ToggleOutlineContentVisibility(nPos); - } while (++nPos < nOutlineNodesCount - && rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos) > nLevel); + SwOutlineNodes::size_type nOutlineNodesCount = rSh.getIDocumentOutlineNodesAccess()->getOutlineNodesCount(); + int nLevel = rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos); + bool bVisible = rSh.IsOutlineContentVisible(nPos); + do + { + if (rSh.IsOutlineContentVisible(nPos) == bVisible) + rSh.ToggleOutlineContentVisibility(nPos); + } while (++nPos < nOutlineNodesCount + && rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos) > nLevel); + } return; } } @@ -3944,15 +3950,15 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) // remove collapse button when saved frame is not frame at mouse position if (m_pSavedOutlineFrame && /* is it possible that m_pSavedOutlineFrame is removed? */ !m_pSavedOutlineFrame->IsInDtor() && rNds.GetOutLineNds().Seek_Entry(static_cast<SwTextFrame*>(m_pSavedOutlineFrame)->GetTextNodeFirst(), &nPos) && - !rSh.IsOutlineContentFolded(nPos)) + rSh.IsOutlineContentVisible(nPos)) { GetFrameControlsManager().RemoveControlsByType(FrameControlType::Outline, m_pSavedOutlineFrame); } m_pSavedOutlineFrame = pContentFrame; } // show collapse button - if (rNds.GetOutLineNds().Seek_Entry(aSwContentAtPos.aFnd.pNode->GetTextNode(), &nPos) && - !rSh.IsOutlineContentFolded(nPos)) + if (rNds.GetOutLineNds().Seek_Entry(aSwContentAtPos.aFnd.pNode->GetTextNode(), + &nPos) && rSh.IsOutlineContentVisible(nPos)) { GetFrameControlsManager().SetOutlineContentVisibilityButton(aSwContentAtPos.aFnd.pNode->GetTextNode()); } @@ -3965,10 +3971,12 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) // remove collapse button if showing const SwNodes& rNds = rSh.GetDoc()->GetNodes(); SwOutlineNodes::size_type nPos; - if (rNds.GetOutLineNds().Seek_Entry(static_cast<SwTextFrame*>(m_pSavedOutlineFrame)->GetTextNodeFirst(), &nPos) && - !rSh.IsOutlineContentFolded(nPos)) + if (rNds.GetOutLineNds().Seek_Entry(static_cast<SwTextFrame*>(m_pSavedOutlineFrame)-> + GetTextNodeFirst(), &nPos) && + rSh.IsOutlineContentVisible(nPos)) { - GetFrameControlsManager().RemoveControlsByType(FrameControlType::Outline, m_pSavedOutlineFrame); + GetFrameControlsManager().RemoveControlsByType(FrameControlType::Outline, + m_pSavedOutlineFrame); } m_pSavedOutlineFrame = nullptr; } @@ -4017,7 +4025,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) const SwNodes& rNds = rSh.GetDoc()->GetNodes(); SwOutlineNodes::size_type nPos; rNds.GetOutLineNds().Seek_Entry(static_cast<SwTextFrame*>(m_pSavedOutlineFrame)->GetTextNodeFirst(), &nPos); - if (!rSh.IsOutlineContentFolded(nPos)) + if (rSh.IsOutlineContentVisible(nPos)) GetFrameControlsManager().RemoveControlsByType(FrameControlType::Outline, m_pSavedOutlineFrame); m_pSavedOutlineFrame = nullptr; } @@ -6631,38 +6639,6 @@ void SwEditWin::SetGraphicTwipPosition(bool bStart, const Point& rPosition) } } -void SwEditWin::SetOutlineContentVisibilityButtons() -{ - SwWrtShell& rSh = m_rView.GetWrtShell(); - const SwOutlineNodes& rOutlineNodes = rSh.GetDoc()->GetNodes().GetOutLineNds(); - if (!rSh.GetViewOptions()->IsShowOutlineContentVisibilityButton()) - { - for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNodes.size(); ++nPos) - { - bool bOutlineContentVisibleAttr = true; - rOutlineNodes[nPos]->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); - if (!bOutlineContentVisibleAttr) - { - // unfold and then set outline content visible attr to false for persistence - rSh.ToggleOutlineContentVisibility(nPos); - rOutlineNodes[nPos]->GetTextNode()->SetAttrOutlineContentVisible(false); - } - } - GetFrameControlsManager().HideControls(FrameControlType::Outline); - } - else - { - for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNodes.size(); ++nPos) - { - bool bOutlineContentVisibleAttr = true; - rOutlineNodes[nPos]->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); - if (!bOutlineContentVisibleAttr) - rSh.ToggleOutlineContentVisibility(nPos, true); - } - } - GetView().Invalidate(); // set state of dependent slots (FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY) -} - SwFrameControlsManager& SwEditWin::GetFrameControlsManager() { return *m_pFrameControlsManager; |