officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu | 14 + sw/inc/cmdid.h | 1 sw/inc/strings.hrc | 2 sw/sdi/_viewsh.sdi | 5 sw/sdi/swriter.sdi | 17 + sw/source/uibase/docvw/edtwin.cxx | 113 +++++++--- sw/source/uibase/uiview/view2.cxx | 8 sw/source/uibase/uiview/viewstat.cxx | 13 + 8 files changed, 150 insertions(+), 23 deletions(-)
New commits: commit 12ff89af74cd12375436b67b85674a4a2064ef8d Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Mon Jul 27 20:24:52 2020 -0800 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Jul 30 12:04:39 2020 +0200 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.kagan...@collabora.com> 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 ); commit 5ab17ad2696aeb8acfc21cd2442908b785a53e86 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Mon Jul 27 19:42:17 2020 -0800 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Jul 30 12:04:25 2020 +0200 tdf#38093 Writer outline folding - ctrl + click toggle visibility Patch 3/6 that breaks down https://gerrit.libreoffice.org/c/core/+/96672 Adds ctrl + mouse-click to toggle outline content visibility. Right click includes sub levels. Outline content visibility of sub levels is set to that of the clicked outline content toggled visibility. Change-Id: I428b3c683bec48bec147385dcdb1708e1f28d791 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99654 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 86733bf6bb3a..20d45f5cc19b 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -645,6 +645,8 @@ #define STR_OUTLINE_TRACKING_OFF NC_("STR_OUTLINE_TRACKING_OFF", "Off") #define STR_OUTLINE_CONTENT_TOGGLE_VISIBILITY NC_("STR_OUTLINE_CONTENT_TOGGLE_VISIBILITY", "Toggle Outline Content Visibility") #define STR_OUTLINE_CONTENT_TOGGLE_VISIBILITY_EXT NC_("STR_OUTLINE_CONTENT_TOGGLE_VISIBILITY_EXT", "hold Ctrl or right-click to include sub levels") +#define STR_ClICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY NC_("STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY", "Click to Toggle Outline Content Visibility") +#define STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY_EXT NC_("STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY_EXT", "right-click to include sub levels") #define STR_EXPANDALL NC_("STR_EXPANDALL", "Expand All") #define STR_COLLAPSEALL NC_("STR_COLLAPSEALL", "Collapse All") diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 8f0751024e2d..b2d43874a13d 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -143,6 +143,7 @@ #include <ndtxt.hxx> #include <cntfrm.hxx> #include <txtfrm.hxx> +#include <strings.hrc> using namespace sw::mark; using namespace ::com::sun::star; @@ -332,6 +333,7 @@ static bool IsDrawObjSelectable( const SwWrtShell& rSh, const Point& rPt ) */ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) { + SetQuickHelpText(OUString()); SwWrtShell &rSh = m_rView.GetWrtShell(); if( m_pApplyTempl ) { @@ -556,13 +558,37 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) IsAttrAtPos::ClickField | IsAttrAtPos::InetAttr | IsAttrAtPos::Ftn | - IsAttrAtPos::SmartTag ); + IsAttrAtPos::SmartTag | + IsAttrAtPos::Outline); if( rSh.GetContentAtPos( rLPt, aSwContentAtPos) ) { + if (IsAttrAtPos::Outline == aSwContentAtPos.eContentAtPos) + { + if (nModifier == KEY_MOD1 + && GetView().GetWrtShell().GetViewOptions()->IsShowOutlineContentVisibilityButton()) + { + eStyle = PointerStyle::RefHand; + // set quick help + if(aSwContentAtPos.aFnd.pNode && aSwContentAtPos.aFnd.pNode->IsTextNode()) + { + const SwNodes& rNds = GetView().GetWrtShell().GetDoc()->GetNodes(); + SwOutlineNodes::size_type nPos; + rNds.GetOutLineNds().Seek_Entry(aSwContentAtPos.aFnd.pNode->GetTextNode(), &nPos); + SwOutlineNodes::size_type nOutlineNodesCount + = rSh.getIDocumentOutlineNodesAccess()->getOutlineNodesCount(); + int nLevel = rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos); + OUString sQuickHelp(SwResId(STR_ClICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY)); + if (nPos + 1 < nOutlineNodesCount + && rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos + 1) > nLevel) + sQuickHelp += " (" + SwResId(STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY_EXT) + ")"; + SetQuickHelpText(sQuickHelp); + } + } + } // Is edit inline input field - if (IsAttrAtPos::Field == aSwContentAtPos.eContentAtPos - && aSwContentAtPos.pFndTextAttr != nullptr - && aSwContentAtPos.pFndTextAttr->Which() == RES_TXTATR_INPUTFIELD) + else if (IsAttrAtPos::Field == aSwContentAtPos.eContentAtPos + && aSwContentAtPos.pFndTextAttr != nullptr + && aSwContentAtPos.pFndTextAttr->Which() == RES_TXTATR_INPUTFIELD) { const SwField *pCursorField = rSh.CursorInsideInputField() ? rSh.GetCurField( true ) : nullptr; if (!(pCursorField && pCursorField == aSwContentAtPos.pFndTextAttr->GetFormatField().GetField())) @@ -3490,6 +3516,20 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) case KEY_MOD1: if ( !bExecDrawTextLink ) { + if (rSh.GetViewOptions()->IsShowOutlineContentVisibilityButton()) + { + SwContentAtPos aContentAtPos(IsAttrAtPos::Outline); + if(rSh.GetContentAtPos(aDocPos, aContentAtPos)) + { + // move cursor to outline para start and toggle outline content visibility + 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)) + rSh.ToggleOutlineContentVisibility(nPos); + return; + } + } if ( !m_bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) && !lcl_urlOverBackground( rSh, aDocPos ) ) { m_rView.NoRotate(); @@ -3721,28 +3761,55 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) } } } - else if ( MOUSE_RIGHT == rMEvt.GetButtons() && !rMEvt.GetModifier() - && static_cast< sal_uInt8 >(rMEvt.GetClicks() % 4) == 1 - && !rSh.TestCurrPam( aDocPos ) ) + else if (MOUSE_RIGHT == rMEvt.GetButtons()) { - SwContentAtPos aFieldAtPos(IsAttrAtPos::Field); - - // Are we clicking on a field? - if (g_bValidCursorPos - && rSh.GetContentAtPos(aDocPos, aFieldAtPos) - && aFieldAtPos.pFndTextAttr != nullptr - && aFieldAtPos.pFndTextAttr->Which() == RES_TXTATR_INPUTFIELD - && (!pCursorField || pCursorField != aFieldAtPos.pFndTextAttr->GetFormatField().GetField())) + if (rSh.GetViewOptions()->IsShowOutlineContentVisibilityButton() && rMEvt.GetModifier() == KEY_MOD1) { - // Move the cursor - MoveCursor( rSh, aDocPos, rSh.IsObjSelectable( aDocPos ), m_bWasShdwCursor ); - bCallBase = false; + SwContentAtPos aContentAtPos(IsAttrAtPos::Outline); + if(rSh.GetContentAtPos(aDocPos, aContentAtPos)) + { + // move cursor to para start toggle outline content visibility and set the same visibility for subs + MoveCursor(rSh, aDocPos, false, true); + SwPaM aPam(*rSh.GetCurrentShellCursor().GetPoint()); + 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.IsOutlineContentFolded(nPos) == bFold) + rSh.ToggleOutlineContentVisibility(nPos); + } while (++nPos < nOutlineNodesCount + && rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos) > nLevel); + return; + } + } + } + else if ( !rMEvt.GetModifier() + && static_cast< sal_uInt8 >(rMEvt.GetClicks() % 4) == 1 + && !rSh.TestCurrPam( aDocPos ) ) + { + SwContentAtPos aFieldAtPos(IsAttrAtPos::Field); + + // Are we clicking on a field? + if (g_bValidCursorPos + && rSh.GetContentAtPos(aDocPos, aFieldAtPos) + && aFieldAtPos.pFndTextAttr != nullptr + && aFieldAtPos.pFndTextAttr->Which() == RES_TXTATR_INPUTFIELD + && (!pCursorField || pCursorField != aFieldAtPos.pFndTextAttr->GetFormatField().GetField())) + { + // Move the cursor + MoveCursor( rSh, aDocPos, rSh.IsObjSelectable( aDocPos ), m_bWasShdwCursor ); + bCallBase = false; - // select content of Input Field, but exclude CH_TXT_ATR_INPUTFIELDSTART - // and CH_TXT_ATR_INPUTFIELDEND - rSh.SttSelect(); - rSh.SelectText( aFieldAtPos.pFndTextAttr->GetStart() + 1, - *(aFieldAtPos.pFndTextAttr->End()) - 1 ); + // select content of Input Field, but exclude CH_TXT_ATR_INPUTFIELDSTART + // and CH_TXT_ATR_INPUTFIELDEND + rSh.SttSelect(); + rSh.SelectText( aFieldAtPos.pFndTextAttr->GetStart() + 1, + *(aFieldAtPos.pFndTextAttr->End()) - 1 ); + } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits