diff options
author | Jim Raykowski <raykowj@gmail.com> | 2021-04-18 23:00:38 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2021-05-14 06:14:35 +0200 |
commit | 6b09276d157abada74e1a4989700139167207778 (patch) | |
tree | d90e2036f47b3acc5caa777a33847e4096731fb6 /sw/source/uibase/app | |
parent | 6c8ca02c5935a800cff70f3c173319b454b63c41 (diff) |
Outline folding experimental feature rehack
* Changes the way the outline content visibility button is shown to
similiar how the table un-float button is shown.
* Toggle function is replaced by an invalidate function that makes
outline content visible or not visible only if needed.
* Removes the left and right arrow keys restrictions of cursor movement
in and out of an outline node paragraph having outline content
visibility attribute set false (folded outline content). These were
prevented due to causing an assert in txtfrm.cxx
SwTextFrame::MapModelToView but seems to do no harm here if allowed.
* Makes a selection read-only if it spans an outline node that has
folded content and disallows actions that would cause loss of folded
content.
* Adds RestoreSavePos when Move fails in SwCursor::LeftRight to fix a
bug that occurs in documents with outline content folded at the end of
the document. When the cursor is at the end of the visible document and
right arrow key is pressed Move fails after moving the cursor to the
end of the document model, which doesn't have a node frame and causes
wierd numbers to be displayed in the statusbar page number count. Left
arrow, when in this state causes a crash without the added
RestoreSavePos.
* Addresses tdf#141390 concerning position of view when feature is
turned off and on.
Change-Id: I0430f73643201aa08ffc347c1597b44b1de290e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114255
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase/app')
-rw-r--r-- | sw/source/uibase/app/appopt.cxx | 59 | ||||
-rw-r--r-- | sw/source/uibase/app/docst.cxx | 2 |
2 files changed, 11 insertions, 50 deletions
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 9862da388021..1b22068ebe7f 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -261,51 +261,23 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) } // Elements - interpret Item - std::vector<SwNode*> aFoldedOutlineNdsArray; - bool bShow = false; + bool bFlag = true; if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_ELEM, false, &pItem ) ) { const SwElemItem* pElemItem = static_cast<const SwElemItem*>(pItem); pElemItem->FillViewOptions( aViewOpt ); SwWrtShell* pWrtShell = GetActiveWrtShell(); - bShow = pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton(); + bFlag = pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton(); bool bTreatSubsChanged = aViewOpt.IsTreatSubOutlineLevelsAsContent() != pWrtShell->GetViewOptions()->IsTreatSubOutlineLevelsAsContent(); - - // move cursor to top if something with the outline mode changed - if ((bShow != aViewOpt.IsShowOutlineContentVisibilityButton()) || - (pWrtShell->GetViewOptions()->IsTreatSubOutlineLevelsAsContent() != - aViewOpt.IsTreatSubOutlineLevelsAsContent())) - { - // move cursor to top of document - if (pWrtShell->IsSelFrameMode()) - { - pWrtShell->UnSelectFrame(); - pWrtShell->LeaveSelFrameMode(); - } - pWrtShell->EnterStdMode(); - pWrtShell->SttEndDoc(true); - } - - if (bShow && (!aViewOpt.IsShowOutlineContentVisibilityButton() || bTreatSubsChanged)) + if (bFlag && (!aViewOpt.IsShowOutlineContentVisibilityButton() || bTreatSubsChanged)) { // outline mode options have change which require to show all content - const SwOutlineNodes& rOutlineNds = pWrtShell->GetNodes().GetOutLineNds(); - for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNds.size(); ++nPos) - { - SwNode* pNd = rOutlineNds[nPos]; - if (pNd->IsTextNode()) // should always be true - { - bool bOutlineContentVisibleAttr = true; - pNd->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); - if (!bOutlineContentVisibleAttr) - { - aFoldedOutlineNdsArray.push_back(pNd); - pWrtShell->ToggleOutlineContentVisibility(nPos); - } - } - } + pWrtShell->MakeAllFoldedOutlineContentVisible(); + + if (bTreatSubsChanged) + bFlag = false; // folding method changed, set bFlag false to refold below } } @@ -429,21 +401,8 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) if (SfxItemState::SET != rSet.GetItemState(FN_PARAM_ELEM, false)) return; - if (!GetActiveWrtShell()->GetViewOptions()->IsShowOutlineContentVisibilityButton()) - { - // outline mode is no longer active - // set outline content visible attribute to false for nodes in the array - for (SwNode* pNd : aFoldedOutlineNdsArray) - pNd->GetTextNode()->SetAttrOutlineContentVisible(false); - } - else if (bShow) - { - // outline mode remained active - // sub level treatment might have changed - // ToggleOutlineContentVisibility only knows sub level treatment after ApplyUserPref - for (SwNode* pNd : aFoldedOutlineNdsArray) - GetActiveWrtShell()->ToggleOutlineContentVisibility(pNd, true); - } + if (!bFlag) + GetActiveWrtShell()->MakeAllFoldedOutlineContentVisible(false); } std::unique_ptr<SfxTabPage> SwModule::CreateTabPage( sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ) diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index aceb1c548ded..654ff05a0650 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -1108,6 +1108,8 @@ void SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidde SfxStyleFamily SwDocShell::ApplyStyles(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell, const sal_uInt16 nMode ) { + MakeAllOutlineContentTemporarilyVisible a(GetDoc()); + SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>( m_xBasePool->Find( rName, nFamily ) ); SAL_WARN_IF( !pStyle, "sw.ui", "Style not found" ); |