summaryrefslogtreecommitdiff
path: root/sw/source/uibase
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 /sw/source/uibase
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>
Diffstat (limited to 'sw/source/uibase')
-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
6 files changed, 53 insertions, 34 deletions
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;
}