diff options
author | Jim Raykowski <raykowj@gmail.com> | 2020-07-27 20:24:52 -0800 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-07-30 12:04:39 +0200 |
commit | 12ff89af74cd12375436b67b85674a4a2064ef8d (patch) | |
tree | 067fb3a06ec898b9353bac70d02ae998b775ab03 | |
parent | 5ab17ad2696aeb8acfc21cd2442908b785a53e86 (diff) |
tdf#38093 Writer outline folding - .uno:ToggleOutlineContentVisibility
Patch 4/6 that breaks down https://gerrit.libreoffice.org/c/core/+/96672
Add UNO command to toggle outline content visibility
Change-Id: I5365b29ab88d67a449b551b303f050b52063b977
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99655
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu | 14 | ||||
-rw-r--r-- | sw/inc/cmdid.h | 1 | ||||
-rw-r--r-- | sw/sdi/_viewsh.sdi | 5 | ||||
-rw-r--r-- | sw/sdi/swriter.sdi | 17 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewstat.cxx | 13 |
6 files changed, 58 insertions, 0 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index 7d3292add406..4aa43ea00bae 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -3679,6 +3679,20 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:ToggleOutlineContentVisibility" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Toggle Outline Content Visibility</value> + </prop> + <prop oor:name="TooltipLabel" oor:type="xs:string"> + <value xml:lang="en-US">Fold or unfold outline content in document</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + <prop oor:name="IsExperimental" oor:type="xs:boolean"> + <value>true</value> + </prop> + </node> </node> </node> </oor:component-data> diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index d5332f02ca73..fda0486edbe2 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -187,6 +187,7 @@ #define FN_VIEW_SHOW_WHITESPACE (FN_VIEW + 62) /* Show header, footer, and pagebreak */ #define FN_SHOW_OUTLINECONTENTVISIBILITYBUTTON (FN_VIEW + 63) /* Show outline content visibility toggle button */ +#define FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY (FN_VIEW + 64) // Region: Insert #define FN_INSERT_BOOKMARK (FN_INSERT + 2 ) /* Bookmark */ diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index f26e4f0f615e..3959e54b3cc2 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -18,6 +18,11 @@ interface BaseTextEditView { + FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] FN_REFRESH_VIEW // status(final|play) [ ExecMethod = Execute ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index b17737f06c36..ae5c0765ccd4 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -4818,6 +4818,23 @@ SfxVoidItem PrintPagePreview FN_PRINT_PAGEPREVIEW GroupId = SfxGroupId::View; ] +SfxVoidItem ToggleOutlineContentVisibility FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::View; +] + SfxVoidItem Protect FN_TABLE_SET_READ_ONLY_CELLS () [ diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 2768719cc696..87d0a64f33bc 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1123,6 +1123,14 @@ void SwView::Execute(SfxRequest &rReq) lcl_SetAllTextToDefaultLanguage( *m_pWrtShell, RES_CHRATR_CJK_LANGUAGE ); } break; + case FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY: + { + m_pWrtShell->EnterStdMode(); + size_t nPos(m_pWrtShell->GetOutlinePos()); + m_pWrtShell->ToggleOutlineContentVisibility(nPos); + m_pWrtShell->GotoOutline(nPos); + } + break; case FN_NAV_ELEMENT: { // nothing here on purpose - if removed only the listbox that changed is changed diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 969eea90971d..c9ace0d854a0 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -69,6 +69,19 @@ void SwView::GetState(SfxItemSet &rSet) { switch(nWhich) { + case FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY: + { + bool bDisable(true); + if (m_pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton()) + { + SwOutlineNodes::size_type nPos = m_pWrtShell->GetOutlinePos(); + if (nPos != SwOutlineNodes::npos) + bDisable = false; + } + if (bDisable) + rSet.DisableItem(nWhich); + } + break; case FN_NAV_ELEMENT: // used to update all instances of this control rSet.InvalidateItem( nWhich ); |