summaryrefslogtreecommitdiff
path: root/sw/source/uibase/app
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-12-05 20:57:15 -0900
committerJim Raykowski <raykowj@gmail.com>2020-12-24 07:12:59 +0100
commitc405bae468d887ec77dd3830b7678fcedc2debfd (patch)
tree711071ec86bfc55b74d2250e5e3b9bce6740b431 /sw/source/uibase/app
parent85f39dc62b7feb357535582deec1c18f72f9ef0d (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/app')
-rw-r--r--sw/source/uibase/app/appopt.cxx63
1 files changed, 63 insertions, 0 deletions
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index 263017fb4604..1d813793cff6 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -56,6 +56,8 @@
#include <swabstdlg.hxx>
#include <swwrtshitem.hxx>
+#include <ndtxt.hxx>
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -259,11 +261,52 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
}
// Elements - interpret Item
+ std::vector<SwNode*> aFoldedOutlineNdsArray;
+ bool bShow = false;
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();
+ 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))
+ {
+ // 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);
+ }
+ }
+ }
+ }
}
if( SfxItemState::SET == rSet.GetItemState(SID_ATTR_METRIC, false, &pItem ) )
@@ -381,6 +424,26 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
// set elements for the current view and shell
ApplyUsrPref( aViewOpt, pAppView, bTextDialog? SvViewOpt::DestText : SvViewOpt::DestWeb);
+
+ // must be done after ApplyUsrPref
+ if (SfxItemState::SET == rSet.GetItemState(FN_PARAM_ELEM, false))
+ {
+ 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
+ // ToggleOutlineContentVisiblity only knows sub level treatment after ApplyUserPref
+ for (SwNode* pNd : aFoldedOutlineNdsArray)
+ GetActiveWrtShell()->ToggleOutlineContentVisibility(pNd, true);
+ }
+ }
}
std::unique_ptr<SfxTabPage> SwModule::CreateTabPage( sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet )