summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-12-22 22:20:45 -0900
committerJim Raykowski <raykowj@gmail.com>2021-01-14 00:10:44 +0100
commit9f9798f07f0b56ae474f31ded671cc8da598d244 (patch)
tree4ece056191029b06a6b6a123c106e60f3c9e7336
parent1a24fef6b3e24645dccfa7f13dd71d8f5019dd94 (diff)
tdf#115817 Add navigation recency to Navigate By
- Adds Recency to Navigate By and when selected, previous and next scroll controls navigate the navigation manager stack backwards and forward. - Removes the code that makes the Navigation tool bar appear when an entry is added to the navigation manager stack so the tool bar doesn't appear unless the user explicilty chooses for it to. - Changes Navigation toolbar context sensitivity to false. Change-Id: I246dd442b4bc5191324c35f9b91a9cb2eac8e7f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108316 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu2
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu2
-rw-r--r--sw/inc/bitmaps.hlst1
-rw-r--r--sw/inc/strings.hrc3
-rw-r--r--sw/sdi/_viewsh.sdi2
-rw-r--r--sw/sdi/swriter.sdi4
-rw-r--r--sw/source/uibase/inc/workctrl.hxx3
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx36
-rw-r--r--sw/source/uibase/uiview/view2.cxx5
-rw-r--r--sw/source/uibase/uiview/viewmdi.cxx5
-rw-r--r--sw/source/uibase/uiview/viewstat.cxx13
-rw-r--r--sw/source/uibase/wrtsh/navmgr.cxx25
12 files changed, 63 insertions, 38 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu
index ce94fe093942..68f272c16e3e 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu
@@ -757,7 +757,7 @@
<value>false</value>
</prop>
<prop oor:name="ContextSensitive" oor:type="xs:boolean">
- <value>true</value>
+ <value>false</value>
</prop>
</node>
<node oor:name="private:resource/toolbar/changes" oor:op="replace">
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
index f5d7bdf862d3..76373392b26b 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
@@ -844,7 +844,7 @@
<value>false</value>
</prop>
<prop oor:name="ContextSensitive" oor:type="xs:boolean">
- <value>true</value>
+ <value>false</value>
</prop>
</node>
<node oor:name="private:resource/toolbar/addon_LibreLogo.OfficeToolBar" oor:op="replace" install:module="librelogo">
diff --git a/sw/inc/bitmaps.hlst b/sw/inc/bitmaps.hlst
index 4f5d5e985bd4..5b7d13195135 100644
--- a/sw/inc/bitmaps.hlst
+++ b/sw/inc/bitmaps.hlst
@@ -71,6 +71,7 @@
#define RID_BMP_RIBBAR_ENTRY "sw/res/sr20017.png"
#define RID_BMP_RIBBAR_FORMULA "sw/res/sr20018.png"
#define RID_BMP_RIBBAR_ERROR "sw/res/sr20019.png"
+#define RID_BMP_RIBBAR_RECENCY "sw/res/sc20244.png"
#define RID_BMP_NAVI_OUTLINE "sw/res/nc20000.png"
#define RID_BMP_NAVI_TABLE "sw/res/nc20001.png"
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index bee9222b4fc8..0d39c2adc9ba 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1163,6 +1163,7 @@
#define ST_INDEX_ENTRY NC_("ST_INDEX_ENTRY", "Index entry")
#define ST_TABLE_FORMULA NC_("ST_TABLE_FORMULA", "Table formula")
#define ST_TABLE_FORMULA_ERROR NC_("ST_TABLE_FORMULA_ERROR", "Wrong table formula")
+#define ST_RECENCY NC_("ST_RECENCY", "Recency")
// Strings for the quickhelp of the View-PgUp/Down-Buttons
#define STR_IMGBTN_TBL_DOWN NC_("STR_IMGBTN_TBL_DOWN", "Next table")
#define STR_IMGBTN_FRM_DOWN NC_("STR_IMGBTN_FRM_DOWN", "Next text frame")
@@ -1200,6 +1201,8 @@
#define STR_IMGBTN_TBLFML_DOWN NC_("STR_IMGBTN_TBLFML_DOWN", "Next table formula")
#define STR_IMGBTN_TBLFML_ERR_UP NC_("STR_IMGBTN_TBLFML_ERR_UP", "Previous faulty table formula")
#define STR_IMGBTN_TBLFML_ERR_DOWN NC_("STR_IMGBTN_TBLFML_ERR_DOWN", "Next faulty table formula")
+#define STR_IMGBTN_RECENCY_UP NC_("STR_IMGBTN_RECENCY_UP", "Go back")
+#define STR_IMGBTN_RECENCY_DOWN NC_("STR_IMGBTN_RECENCY_DOWN", "Go forward")
#define STR_REDLINE_INSERT NC_("STR_REDLINE_INSERT", "Inserted")
#define STR_REDLINE_DELETE NC_("STR_REDLINE_DELETE", "Deleted")
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index 61bd43768cf0..06a5a5f6893c 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -107,10 +107,12 @@ interface BaseTextEditView
FN_SCROLL_PREV
[
ExecMethod = Execute;
+ StateMethod = GetState;
]
FN_SCROLL_NEXT
[
ExecMethod = Execute;
+ StateMethod = GetState;
]
FN_SET_PAGE_STYLE // status(final|play)
[
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 9a03663dc19d..7d24e76b9ed2 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -5107,7 +5107,7 @@ SfxVoidItem ScrollToPrevious FN_SCROLL_PREV
RecordAbsolute = FALSE,
RecordPerSet;
- AccelConfig = FALSE,
+ AccelConfig = TRUE,
MenuConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Navigator;
@@ -5124,7 +5124,7 @@ SfxVoidItem ScrollToNext FN_SCROLL_NEXT
RecordAbsolute = FALSE,
RecordPerSet;
- AccelConfig = FALSE,
+ AccelConfig = TRUE,
MenuConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Navigator;
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx
index 20949f728ecc..69d5ea4466ab 100644
--- a/sw/source/uibase/inc/workctrl.hxx
+++ b/sw/source/uibase/inc/workctrl.hxx
@@ -46,7 +46,8 @@ class SwView;
#define NID_INDEX_ENTRY 20015
#define NID_TABLE_FORMULA 20016
#define NID_TABLE_FORMULA_ERROR 20017
-#define NID_COUNT 18
+#define NID_RECENCY 20018
+#define NID_COUNT 19
class SwTbxAutoTextCtrl : public SfxToolBoxControl
{
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index e31483102e53..fb01e8b9ff2f 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -56,8 +56,10 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
+#include <sfx2/viewfrm.hxx>
+
// Size check
-#define NAVI_ENTRIES 18
+#define NAVI_ENTRIES 19
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -176,7 +178,8 @@ static sal_uInt16 aNavigationInsertIds[ NAVI_ENTRIES ] =
NID_SRCH_REP,
NID_INDEX_ENTRY,
NID_TABLE_FORMULA,
- NID_TABLE_FORMULA_ERROR
+ NID_TABLE_FORMULA_ERROR,
+ NID_RECENCY
};
std::u16string_view const aNavigationImgIds[ NAVI_ENTRIES ] =
@@ -198,7 +201,8 @@ std::u16string_view const aNavigationImgIds[ NAVI_ENTRIES ] =
u"" RID_BMP_RIBBAR_REP,
u"" RID_BMP_RIBBAR_ENTRY,
u"" RID_BMP_RIBBAR_FORMULA,
- u"" RID_BMP_RIBBAR_ERROR
+ u"" RID_BMP_RIBBAR_ERROR,
+ u"" RID_BMP_RIBBAR_RECENCY
};
static const char* aNavigationStrIds[ NAVI_ENTRIES ] =
@@ -220,7 +224,8 @@ static const char* aNavigationStrIds[ NAVI_ENTRIES ] =
ST_SRCH_REP,
ST_INDEX_ENTRY,
ST_TABLE_FORMULA,
- ST_TABLE_FORMULA_ERROR
+ ST_TABLE_FORMULA_ERROR,
+ ST_RECENCY
};
// these are global strings
@@ -244,6 +249,7 @@ static const char* STR_IMGBTN_ARY[] =
STR_IMGBTN_INDEX_ENTRY_DOWN,
STR_IMGBTN_TBLFML_DOWN,
STR_IMGBTN_TBLFML_ERR_DOWN,
+ STR_IMGBTN_RECENCY_DOWN,
STR_IMGBTN_TBL_UP,
STR_IMGBTN_FRM_UP,
STR_IMGBTN_PGE_UP,
@@ -261,7 +267,8 @@ static const char* STR_IMGBTN_ARY[] =
STR_IMGBTN_SRCH_REP_UP,
STR_IMGBTN_INDEX_ENTRY_UP,
STR_IMGBTN_TBLFML_UP,
- STR_IMGBTN_TBLFML_ERR_UP
+ STR_IMGBTN_TBLFML_ERR_UP,
+ STR_IMGBTN_RECENCY_UP
};
static OUString lcl_GetScrollToolTip(bool bNext)
@@ -852,6 +859,13 @@ void SAL_CALL NavElementToolBoxControl::statusChanged( const frame::FeatureState
}
else
m_pBox->set_sensitive(true);
+
+ SwView* pView = GetActiveView();
+ if (pView && pView->GetViewFrame())
+ {
+ pView->GetViewFrame()->GetBindings().Invalidate(FN_SCROLL_NEXT);
+ pView->GetViewFrame()->GetBindings().Invalidate(FN_SCROLL_PREV);
+ }
}
}
@@ -1032,6 +1046,18 @@ void SAL_CALL PrevNextScrollToolboxController::statusChanged( const css::frame::
pToolBox->SetQuickHelpText(nId, lcl_GetScrollToolTip(meType != PrevNextScrollToolboxController::PREVIOUS));
}
}
+ else if (rEvent.FeatureURL.Path == "ScrollToPrevious" || rEvent.FeatureURL.Path == "ScrollToNext")
+ {
+ if (m_pToolbar)
+ m_pToolbar->set_item_sensitive(m_aCommandURL.toUtf8(), rEvent.IsEnabled);
+ else
+ {
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if (getToolboxId(nId, &pToolBox))
+ pToolBox->EnableItem(nId, rEvent.IsEnabled);
+ }
+ }
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index adeb5ed16e6a..248a75a3416b 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1159,11 +1159,10 @@ void SwView::Execute(SfxRequest &rReq)
case FN_SCROLL_PREV:
case FN_SCROLL_NEXT:
{
- bool *pbNext = new bool(true); // FN_SCROLL_NEXT
+ bool *pbNext = new bool(true);
if (nSlot == FN_SCROLL_PREV)
*pbNext = false;
- // #i75416# move the execution of the search to an asynchronously called static link
- Application::PostUserEvent( LINK(this, SwView, MoveNavigationHdl), pbNext );
+ MoveNavigationHdl(pbNext);
}
break;
case SID_JUMPTOMARK:
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 30aed9abf826..bfa8ec038f8a 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -551,6 +551,11 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
case NID_TABLE_FORMULA_ERROR:
rSh.GotoNxtPrvTableFormula( bNext, true );
break;
+
+ case NID_RECENCY :
+ rSh.EnterStdMode();
+ bNext ? rSh.GetNavigationMgr().goForward() : rSh.GetNavigationMgr().goBack();
+ break;
}
m_pEditWin->GrabFocus();
delete pbNext;
diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx
index b69effc8542d..8dbcbe650090 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -54,6 +54,7 @@
#include <IDocumentRedlineAccess.hxx>
#include <doc.hxx>
+#include <workctrl.hxx>
using namespace ::com::sun::star;
@@ -97,6 +98,18 @@ void SwView::GetState(SfxItemSet &rSet)
// used to update all instances of this control
rSet.InvalidateItem( nWhich );
break;
+ case FN_SCROLL_PREV:
+ case FN_SCROLL_NEXT:
+ {
+ if (m_nMoveType == NID_RECENCY)
+ {
+ if (!m_pWrtShell->GetNavigationMgr().forwardEnabled())
+ rSet.DisableItem(FN_SCROLL_NEXT);
+ if (!m_pWrtShell->GetNavigationMgr().backEnabled())
+ rSet.DisableItem(FN_SCROLL_PREV);
+ }
+ }
+ break;
case FN_EDIT_LINK_DLG:
if( m_pWrtShell->GetLinkManager().GetLinks().empty() )
rSet.DisableItem(nWhich);
diff --git a/sw/source/uibase/wrtsh/navmgr.cxx b/sw/source/uibase/wrtsh/navmgr.cxx
index b123408b820e..b8c1f32582d1 100644
--- a/sw/source/uibase/wrtsh/navmgr.cxx
+++ b/sw/source/uibase/wrtsh/navmgr.cxx
@@ -216,31 +216,6 @@ bool SwNavigationMgr::addEntry(const SwPosition& rPos) {
if (bForwardWasEnabled)
m_rMyShell.GetView().GetViewFrame()->GetBindings().Invalidate(FN_NAVIGATION_FORWARD);
- // show the Navigation toolbar
- css::uno::Reference< css::frame::XFrame > xFrame =
- m_rMyShell.GetView().GetViewFrame()->GetFrame().GetFrameInterface();
- if (xFrame.is())
- {
- css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
- if (xPropSet.is())
- {
- css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
- css::uno::Any aValue = xPropSet->getPropertyValue("LayoutManager");
-
- aValue >>= xLayoutManager;
- if (xLayoutManager.is())
- {
- const OUString sResourceURL( "private:resource/toolbar/navigationobjectbar" );
- css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL);
- if (!xUIElement.is())
- {
- xLayoutManager->createElement( sResourceURL );
- xLayoutManager->showElement( sResourceURL );
- }
- }
- }
- }
-
return bRet;
}