[Libreoffice-commits] core.git: sw/source sw/uiconfig
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 14 04:37:41 UTC 2020
sw/source/uibase/inc/navipi.hxx | 29 --
sw/source/uibase/inc/workctrl.hxx | 67 +----
sw/source/uibase/ribbar/workctrl.cxx | 330 +---------------------------
sw/source/uibase/sidebar/SwPanelFactory.cxx | 2
sw/source/uibase/uiview/view2.cxx | 1
sw/source/uibase/utlui/navipi.cxx | 93 ++-----
sw/uiconfig/swriter/ui/navigatorpanel.ui | 120 ++++------
7 files changed, 127 insertions(+), 515 deletions(-)
New commits:
commit 350bf42540ff810a142538c5fd8ec2a78d430091
Author: Jim Raykowski <raykowj at gmail..com>
AuthorDate: Fri Jan 17 21:19:08 2020 -0900
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Fri Feb 14 05:37:00 2020 +0100
tdf#89566 Replace navigation toolbox in Writer navigator
Replaces the navigation toolbox with the navigate by elements control.
Change-Id: Idba18e63ac29f37d8e614b6459ea67b71b65c885
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87005
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj at gmail.com>
diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx
index 2c14d9aea412..103dd6ac6255 100644
--- a/sw/source/uibase/inc/navipi.hxx
+++ b/sw/source/uibase/inc/navipi.hxx
@@ -28,6 +28,7 @@
#include <sfx2/childwin.hxx>
#include <sfx2/ctrlitem.hxx>
#include <sfx2/tbxctrl.hxx>
+#include <sfx2/sidebar/SidebarToolBox.hxx>
#include <svx/sidebar/PanelLayout.hxx>
#include "conttree.hxx"
#include <ndarr.hxx>
@@ -39,25 +40,12 @@ class SwNavigationChild;
class SfxBindings;
class NumEditAction;
class SwNavigationConfig;
-class SwScrollNaviPopup;
class SwView;
class SfxObjectShellLock;
class SfxChildWindowContext;
enum class RegionMode;
class SpinField;
-class NaviStateListener final : public SfxControllerItem
-{
-private:
- VclPtr<SwNavigationPI> m_xNavigation;
-public:
- NaviStateListener(SfxBindings& rBindings, SwNavigationPI* pNavigation);
- virtual ~NaviStateListener() override;
-
- virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
- const SfxPoolItem* pState) override;
-};
-
class SwNavigationPI : public PanelLayout,
public SfxControllerItem, public SfxListener
{
@@ -66,8 +54,7 @@ class SwNavigationPI : public PanelLayout,
friend class SwGlobalTree;
friend class SwNavigationPIUIObject;
- VclPtr<ToolBox> m_aContentToolBox;
- std::unique_ptr<NaviStateListener> m_xNaviListener;
+ VclPtr<sfx2::sidebar::SidebarToolBox> m_aContentToolBox;
VclPtr<ToolBox> m_aGlobalToolBox;
VclPtr<NumEditAction> m_xEdit;
VclPtr<VclContainer> m_aContentBox;
@@ -85,7 +72,6 @@ class SwNavigationPI : public PanelLayout,
SwWrtShell *m_pContentWrtShell;
SwView *m_pActContView;
SwView *m_pCreateView;
- VclPtr<SwScrollNaviPopup> m_xPopupWindow;
SwNavigationConfig *m_pConfig;
SfxBindings &m_rBindings;
@@ -114,8 +100,6 @@ class SwNavigationPI : public PanelLayout,
DECL_LINK( PageEditModifyHdl, SpinField&, void );
void UsePage();
- void SetPopupWindow( SwScrollNaviPopup* );
-
protected:
// release ObjectShellLock early enough for app end
@@ -127,7 +111,12 @@ protected:
public:
- SwNavigationPI(SfxBindings*, vcl::Window*);
+ static VclPtr<vcl::Window> Create(vcl::Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
+ SfxBindings* pBindings);
+ SwNavigationPI(vcl::Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
+ SfxBindings* _pBindings);
virtual ~SwNavigationPI() override;
virtual void dispose() override;
@@ -154,8 +143,6 @@ public:
SwView* GetCreateView() const;
void CreateNavigationTool();
- void NaviStateChanged();
-
FactoryFunction GetUITestFactory() const override;
};
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx
index 64b0d3c6a756..dd359b63a30a 100644
--- a/sw/source/uibase/inc/workctrl.hxx
+++ b/sw/source/uibase/inc/workctrl.hxx
@@ -28,29 +28,25 @@ class SwView;
// double entry! hrc and hxx
// these Ids say what the buttons below the scrollbar are doing
#define NID_START 20000
-#define NID_NEXT 20000
-#define NID_PREV 20001
-#define NID_TBL 20002
-#define NID_FRM 20003
-#define NID_PGE 20004
-#define NID_DRW 20005
-#define NID_CTRL 20006
-#define NID_REG 20007
-#define NID_BKM 20008
-#define NID_GRF 20009
-#define NID_OLE 20010
-#define NID_OUTL 20011
-#define NID_SEL 20012
-#define NID_FTN 20013
-#define NID_MARK 20014
-#define NID_POSTIT 20015
-#define NID_SRCH_REP 20016
-#define NID_INDEX_ENTRY 20017
-#define NID_TABLE_FORMULA 20018
-#define NID_TABLE_FORMULA_ERROR 20019
-#define NID_COUNT 20
-
-#define NID_LINE_COUNT 10
+#define NID_TBL 20000
+#define NID_FRM 20001
+#define NID_PGE 20002
+#define NID_DRW 20003
+#define NID_CTRL 20004
+#define NID_REG 20005
+#define NID_BKM 20006
+#define NID_GRF 20007
+#define NID_OLE 20008
+#define NID_OUTL 20009
+#define NID_SEL 20010
+#define NID_FTN 20011
+#define NID_MARK 20012
+#define NID_POSTIT 20013
+#define NID_SRCH_REP 20014
+#define NID_INDEX_ENTRY 20015
+#define NID_TABLE_FORMULA 20016
+#define NID_TABLE_FORMULA_ERROR 20017
+#define NID_COUNT 18
class SwTbxAutoTextCtrl : public SfxToolBoxControl
{
@@ -68,31 +64,6 @@ public:
DECL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, Menu*, bool);
};
-class SwScrollNaviPopup final : public DockingWindow
-{
- VclPtr<ToolBox> m_xToolBox1;
- VclPtr<ToolBox> m_xToolBox2;
- VclPtr<FixedText> m_xInfoField;
-
- sal_uInt16 GetCurItemId() const;
- OUString GetItemText(sal_uInt16 nItemId) const;
- void SetItemText(sal_uInt16 nItemId, const OUString& rText);
- void CheckItem(sal_uInt16 nItemId, bool bOn);
-
- OUString sQuickHelp[2 * NID_COUNT];
-
- DECL_LINK(SelectHdl, ToolBox*, void);
-
-public:
- SwScrollNaviPopup(vcl::Window *pParent);
- virtual ~SwScrollNaviPopup() override;
- virtual void dispose() override;
-
- static OUString GetToolTip(bool bNext);
-
- void syncFromDoc();
-};
-
class SwPreviewZoomControl : public SfxToolBoxControl
{
public:
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 0886e3a7ff5c..74f1d2d12760 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -54,10 +54,7 @@
#include <com/sun/star/util/XURLTransformer.hpp>
// Size check
-#define NAVI_ENTRIES 20
-#if NAVI_ENTRIES != NID_COUNT
-#error SwScrollNaviPopup-CTOR static array wrong size. Are new IDs added?
-#endif
+#define NAVI_ENTRIES 18
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -159,7 +156,6 @@ IMPL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, Menu*, pMenu, bool)
// determine the order of the toolbox items
static sal_uInt16 aNavigationInsertIds[ NAVI_ENTRIES ] =
{
- // -- first line
NID_TBL,
NID_FRM,
NID_GRF,
@@ -169,8 +165,6 @@ static sal_uInt16 aNavigationInsertIds[ NAVI_ENTRIES ] =
NID_MARK,
NID_DRW,
NID_CTRL,
- NID_PREV,
- // -- second line
NID_REG,
NID_BKM,
NID_SEL,
@@ -179,13 +173,11 @@ static sal_uInt16 aNavigationInsertIds[ NAVI_ENTRIES ] =
NID_SRCH_REP,
NID_INDEX_ENTRY,
NID_TABLE_FORMULA,
- NID_TABLE_FORMULA_ERROR,
- NID_NEXT
+ NID_TABLE_FORMULA_ERROR
};
static OUStringLiteral const aNavigationImgIds[ NAVI_ENTRIES ] =
{
- // -- first line
RID_BMP_RIBBAR_TBL,
RID_BMP_RIBBAR_FRM,
RID_BMP_RIBBAR_GRF,
@@ -195,8 +187,6 @@ static OUStringLiteral const aNavigationImgIds[ NAVI_ENTRIES ] =
RID_BMP_RIBBAR_MARK,
RID_BMP_RIBBAR_DRW,
RID_BMP_RIBBAR_CTRL,
- RID_BMP_RIBBAR_PREV,
- // -- second line
RID_BMP_RIBBAR_REG,
RID_BMP_RIBBAR_BKM,
RID_BMP_RIBBAR_SEL,
@@ -205,39 +195,11 @@ static OUStringLiteral const aNavigationImgIds[ NAVI_ENTRIES ] =
RID_BMP_RIBBAR_REP,
RID_BMP_RIBBAR_ENTRY,
RID_BMP_RIBBAR_FORMULA,
- RID_BMP_RIBBAR_ERROR,
- RID_BMP_RIBBAR_NEXT
-};
-
-static const char* aNavigationHelpIds[ NAVI_ENTRIES ] =
-{
- // -- first line
- HID_NID_TBL,
- HID_NID_FRM,
- HID_NID_GRF,
- HID_NID_OLE,
- HID_NID_PGE,
- HID_NID_OUTL,
- HID_NID_MARK,
- HID_NID_DRW,
- HID_NID_CTRL,
- HID_NID_PREV,
- // -- second line
- HID_NID_REG,
- HID_NID_BKM,
- HID_NID_SEL,
- HID_NID_FTN,
- HID_NID_POSTIT,
- HID_NID_SRCH_REP,
- HID_NID_INDEX_ENTRY,
- HID_NID_TABLE_FORMULA,
- HID_NID_TABLE_FORMULA_ERROR,
- HID_NID_NEXT
+ RID_BMP_RIBBAR_ERROR
};
static const char* aNavigationStrIds[ NAVI_ENTRIES ] =
{
- // -- first line
ST_TBL,
ST_FRM,
ST_GRF,
@@ -247,8 +209,6 @@ static const char* aNavigationStrIds[ NAVI_ENTRIES ] =
ST_MARK,
ST_DRW,
ST_CTRL,
- STR_IMGBTN_PGE_UP,
- // -- second line
ST_REG,
ST_BKM,
ST_SEL,
@@ -257,15 +217,12 @@ static const char* aNavigationStrIds[ NAVI_ENTRIES ] =
ST_SRCH_REP,
ST_INDEX_ENTRY,
ST_TABLE_FORMULA,
- ST_TABLE_FORMULA_ERROR,
- STR_IMGBTN_PGE_DOWN
+ ST_TABLE_FORMULA_ERROR
};
// these are global strings
static const char* STR_IMGBTN_ARY[] =
{
- nullptr,
- nullptr,
STR_IMGBTN_TBL_DOWN,
STR_IMGBTN_FRM_DOWN,
STR_IMGBTN_PGE_DOWN,
@@ -284,8 +241,6 @@ static const char* STR_IMGBTN_ARY[] =
STR_IMGBTN_INDEX_ENTRY_DOWN,
STR_IMGBTN_TBLFML_DOWN,
STR_IMGBTN_TBLFML_ERR_DOWN,
- nullptr,
- nullptr,
STR_IMGBTN_TBL_UP,
STR_IMGBTN_FRM_UP,
STR_IMGBTN_PGE_UP,
@@ -306,69 +261,7 @@ static const char* STR_IMGBTN_ARY[] =
STR_IMGBTN_TBLFML_ERR_UP
};
-SwScrollNaviPopup::SwScrollNaviPopup(vcl::Window *pParent)
- : DockingWindow(pParent, "FloatingNavigation", "modules/swriter/ui/floatingnavigation.ui")
- , m_xToolBox1(get<ToolBox>("line1"))
- , m_xToolBox2(get<ToolBox>("line2"))
- , m_xInfoField(get<FixedText>("label"))
-{
- m_xToolBox1->SetHelpId(HID_NAVI_VS);
- m_xToolBox2->SetHelpId(HID_NAVI_VS);
-
- for (size_t i = 0; i < NID_LINE_COUNT; ++i)
- m_xToolBox1->SetHelpId(m_xToolBox1->GetItemId(i), aNavigationHelpIds[i]);
-
- for (size_t i = 0; i < NID_LINE_COUNT; ++i)
- m_xToolBox2->SetHelpId(m_xToolBox2->GetItemId(i), aNavigationHelpIds[i + NID_LINE_COUNT]);
-
- for (size_t i = 0; i < SAL_N_ELEMENTS(STR_IMGBTN_ARY); ++i)
- {
- const char* id = STR_IMGBTN_ARY[i];
- if (!id)
- continue;
- sQuickHelp[i] = SwResId(id);
- }
-
- sal_uInt16 nItemId = SwView::GetMoveType();
- m_xInfoField->SetText(GetItemText(nItemId));
- CheckItem(nItemId, true);
-
- m_xToolBox1->SetSelectHdl(LINK(this, SwScrollNaviPopup, SelectHdl));
- m_xToolBox2->SetSelectHdl(LINK(this, SwScrollNaviPopup, SelectHdl));
-}
-
-SwScrollNaviPopup::~SwScrollNaviPopup()
-{
- disposeOnce();
-}
-
-void SwScrollNaviPopup::dispose()
-{
- m_xToolBox2.disposeAndClear();
- m_xToolBox1.disposeAndClear();
- m_xInfoField.clear();
- DockingWindow::dispose();
-}
-
-IMPL_LINK_NOARG(SwScrollNaviPopup, SelectHdl, ToolBox*, void)
-{
- sal_uInt16 nSet = GetCurItemId();
- if( nSet != NID_PREV && nSet != NID_NEXT )
- {
- SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
- SwView::SetMoveType( nSet );
- GetActiveView()->GetViewFrame()->GetDispatcher()->Execute(FN_NAV_ELEMENT);
- }
- else
- {
- sal_uInt16 cmd(FN_SCROLL_PREV);
- if (NID_NEXT == nSet)
- cmd = FN_SCROLL_NEXT;
- GetActiveView()->GetViewFrame()->GetDispatcher()->Execute(cmd);
- }
-}
-
-OUString SwScrollNaviPopup::GetToolTip(bool bNext)
+static OUString lcl_GetScrollToolTip(bool bNext)
{
sal_uInt16 nResId = SwView::GetMoveType();
if (!bNext)
@@ -377,161 +270,6 @@ OUString SwScrollNaviPopup::GetToolTip(bool bNext)
return id ? SwResId(id): OUString();
}
-void SwScrollNaviPopup::syncFromDoc()
-{
- sal_uInt16 nSet = SwView::GetMoveType();
- SetItemText( NID_NEXT, sQuickHelp[nSet - NID_START] );
- SetItemText( NID_PREV, sQuickHelp[nSet - NID_START + NID_COUNT] );
- m_xInfoField->SetText( GetItemText( nSet ) );
- // check the current button only
- for( ToolBox::ImplToolItems::size_type i = 0; i < NID_COUNT; i++ )
- {
- sal_uInt16 nItemId = aNavigationInsertIds[i];
- CheckItem(nItemId, nItemId == nSet);
- }
-}
-
-namespace
-{
- sal_uInt16 IdToIdent(const OUString& rId)
- {
- if (rId == "tbl")
- return NID_TBL;
- if (rId == "frm")
- return NID_FRM;
- if (rId == "grf")
- return NID_GRF;
- if (rId == "ole")
- return NID_OLE;
- if (rId == "pge")
- return NID_PGE;
- if (rId == "outl")
- return NID_OUTL;
- if (rId == "mark")
- return NID_MARK;
- if (rId == "drw")
- return NID_DRW;
- if (rId == "ctrl")
- return NID_CTRL;
- if (rId == "prev")
- return NID_PREV;
-
- if (rId == "reg")
- return NID_REG;
- if (rId == "bkm")
- return NID_BKM;
- if (rId == "sel")
- return NID_SEL;
- if (rId == "ftn")
- return NID_FTN;
- if (rId == "postit")
- return NID_POSTIT;
- if (rId == "rep")
- return NID_SRCH_REP;
- if (rId == "entry")
- return NID_INDEX_ENTRY;
- if (rId == "formula")
- return NID_TABLE_FORMULA;
- if (rId == "formulaerror")
- return NID_TABLE_FORMULA_ERROR;
- if (rId == "next")
- return NID_NEXT;
-
- return 0;
- }
-
- OUString IdentToId(sal_uInt16 nId)
- {
- if (nId == NID_TBL)
- return "tbl";
- if (nId == NID_FRM)
- return "frm";
- if (nId == NID_GRF)
- return "grf";
- if (nId == NID_OLE)
- return "ole";
- if (nId == NID_PGE)
- return "pge";
- if (nId == NID_OUTL)
- return "outl";
- if (nId == NID_MARK)
- return "mark";
- if (nId == NID_DRW)
- return "drw";
- if (nId == NID_CTRL)
- return "ctrl";
- if (nId == NID_PREV)
- return "prev";
-
- if (nId == NID_REG)
- return "reg";
- if (nId == NID_BKM)
- return "bkm";
- if (nId == NID_SEL)
- return "sel";
- if (nId == NID_FTN)
- return "ftn";
- if (nId == NID_POSTIT)
- return "postit";
- if (nId == NID_SRCH_REP)
- return "rep";
- if (nId == NID_INDEX_ENTRY)
- return "entry";
- if (nId == NID_TABLE_FORMULA)
- return "formula";
- if (nId == NID_TABLE_FORMULA_ERROR)
- return "formulaerror";
- if (nId == NID_NEXT)
- return "next";
-
- return "";
- }
-}
-
-sal_uInt16 SwScrollNaviPopup::GetCurItemId() const
-{
- OUString sItemId = m_xToolBox1->GetItemCommand(m_xToolBox1->GetCurItemId());
- if (sItemId.isEmpty())
- sItemId = m_xToolBox2->GetItemCommand(m_xToolBox2->GetCurItemId());
- return IdToIdent(sItemId);
-}
-
-OUString SwScrollNaviPopup::GetItemText(sal_uInt16 nNaviId) const
-{
- const OUString sId(IdentToId(nNaviId));
- sal_uInt16 nItemId = m_xToolBox1->GetItemId(sId);
- if (nItemId)
- return m_xToolBox1->GetItemText(nItemId);
- nItemId = m_xToolBox2->GetItemId(sId);
- return m_xToolBox2->GetItemText(nItemId);
-}
-
-void SwScrollNaviPopup::SetItemText(sal_uInt16 nNaviId, const OUString &rText)
-{
- const OUString sId(IdentToId(nNaviId));
- sal_uInt16 nItemId = m_xToolBox1->GetItemId(sId);
- if (nItemId)
- {
- m_xToolBox1->SetItemText(nItemId, rText);
- return;
- }
- nItemId = m_xToolBox2->GetItemId(sId);
- m_xToolBox2->SetItemText(nItemId, rText);
-}
-
-void SwScrollNaviPopup::CheckItem(sal_uInt16 nNaviId, bool bOn)
-{
- const OUString sId(IdentToId(nNaviId));
- sal_uInt16 nItemId = m_xToolBox1->GetItemId(sId);
- if (nItemId)
- {
- m_xToolBox1->CheckItem(nItemId, bOn);
- return;
- }
- nItemId = m_xToolBox2->GetItemId(sId);
- m_xToolBox2->CheckItem(nItemId, bOn);
-}
-
namespace {
class SwZoomBox_Impl final : public InterimItemWindow
@@ -906,11 +644,7 @@ NavElementBox_Impl::NavElementBox_Impl(
sal_uInt16 i;
for ( i = 0; i < NID_COUNT; i++ )
- {
- sal_uInt16 nNaviId = aNavigationInsertIds[i];
- if ( ( NID_PREV != nNaviId ) && ( NID_NEXT != nNaviId ) )
- InsertEntry( SwResId( aNavigationStrIds[i] ), Image( StockImage::Yes, aNavigationImgIds[i] ) );
- }
+ InsertEntry( SwResId( aNavigationStrIds[i] ), Image( StockImage::Yes, aNavigationImgIds[i] ) );
}
void NavElementBox_Impl::ReleaseFocus_Impl()
@@ -934,10 +668,6 @@ void NavElementBox_Impl::Select()
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
sal_uInt16 nPos = GetSelectedEntryPos();
- // adjust array index for Ids after NID_PREV in aNavigationInsertIds
- if ( nPos >= NID_COUNT/2 - 1 )
- ++nPos;
-
sal_uInt16 nMoveType = aNavigationInsertIds[nPos];
SwView::SetMoveType( nMoveType );
@@ -973,21 +703,23 @@ bool NavElementBox_Impl::EventNotify( NotifyEvent& rNEvt )
if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
{
- sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+ vcl::KeyCode aKeyCode = rNEvt.GetKeyEvent()->GetKeyCode();
+ sal_uInt16 nCode = aKeyCode.GetCode();
switch ( nCode )
{
- case KEY_RETURN:
case KEY_TAB:
{
- if ( KEY_TAB == nCode )
- m_bRelease = false;
- else
- bHandled = true;
+ static_cast<ToolBox*>(GetParent())->ChangeHighlightUpDn( aKeyCode.IsShift() );
+ m_bRelease = false;
+ [[fallthrough]];
+ }
+ case KEY_RETURN:
+ {
+ bHandled = true;
Select();
break;
}
-
case KEY_ESCAPE:
ReleaseFocus_Impl();
bHandled = true;
@@ -1155,10 +887,6 @@ public:
// XComponent
virtual void SAL_CALL dispose() override;
- // XToolbarController
- virtual void SAL_CALL execute( sal_Int16 /* KeyModifier */ ) override;
- virtual void SAL_CALL click() override;
-
// XStatusListener
virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
@@ -1223,30 +951,6 @@ void SAL_CALL PrevNextScrollToolboxController::dispose()
svt::ToolboxController::dispose();
}
-// XToolbarController
-void SAL_CALL PrevNextScrollToolboxController::execute( sal_Int16 /* KeyModifier */ )
-{
-}
-
-void SAL_CALL PrevNextScrollToolboxController::click()
-{
- uno::Sequence< beans::PropertyValue > rArgs;
-
- uno::Reference< frame::XDispatchProvider > xDispatchProvider( m_xFrame, uno::UNO_QUERY );
- if ( xDispatchProvider.is() )
- {
- util::URL aURL;
- uno::Reference< frame::XDispatch > xDispatch;
- uno::Reference< util::XURLTransformer > xURLTransformer = getURLTransformer();
-
- aURL.Complete = getCommandURL();
- xURLTransformer->parseStrict( aURL );
- xDispatch = xDispatchProvider->queryDispatch( aURL, OUString(), 0 );
- if ( xDispatch.is() )
- xDispatch->dispatch( aURL, rArgs );
- }
-}
-
// XStatusListener
void SAL_CALL PrevNextScrollToolboxController::statusChanged( const css::frame::FeatureStateEvent& rEvent )
{
@@ -1255,8 +959,8 @@ void SAL_CALL PrevNextScrollToolboxController::statusChanged( const css::frame::
ToolBox* pToolBox = nullptr;
sal_uInt16 nId = 0;
if ( getToolboxId( nId, &pToolBox ) )
- pToolBox->SetQuickHelpText( nId, ( meType == PrevNextScrollToolboxController::PREVIOUS?SwScrollNaviPopup::GetToolTip( false ):
- SwScrollNaviPopup::GetToolTip( true ) ) );
+ pToolBox->SetQuickHelpText( nId, ( meType == PrevNextScrollToolboxController::PREVIOUS?lcl_GetScrollToolTip( false ):
+ lcl_GetScrollToolTip( true ) ) );
}
}
diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx
index 91697e1d7ad0..37b6694e467d 100644
--- a/sw/source/uibase/sidebar/SwPanelFactory.cxx
+++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx
@@ -153,7 +153,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
}
else if (rsResourceURL.endsWith("/NavigatorPanel"))
{
- VclPtrInstance<SwNavigationPI> pPanel(pBindings, pParentWindow);
+ VclPtr<vcl::Window> pPanel = SwNavigationPI::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 8c394e3faa6f..f464ce1f640a 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1091,7 +1091,6 @@ void SwView::Execute(SfxRequest &rReq)
case FN_SCROLL_PREV:
case FN_SCROLL_NEXT:
{
- // call the handlers of PageUp/DownButtons, only
bool *pbNext = new bool(true); // FN_SCROLL_NEXT
if (nSlot == FN_SCROLL_PREV)
*pbNext = false;
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index 77faca82124d..cdda8dbe783b 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -215,17 +215,13 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox, void )
bool bOutlineWithChildren = ( KEY_MOD1 != pBox->GetModifier());
int nFuncId = 0;
bool bFocusToDoc = false;
- if (sCommand == "back")
+ if (sCommand == ".uno:ScrollToPrevious")
{
- // #i75416# move the execution of the search to an asynchronously called static link
- bool* pbNext = new bool(false);
- Application::PostUserEvent(LINK(pView, SwView, MoveNavigationHdl), pbNext);
+ rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_SCROLL_PREV, SfxCallMode::ASYNCHRON);
}
- else if (sCommand == "forward")
+ else if (sCommand == ".uno:ScrollToNext")
{
- // #i75416# move the execution of the search to an asynchronously called static link
- bool* pbNext = new bool(true);
- Application::PostUserEvent(LINK(pView, SwView, MoveNavigationHdl), pbNext);
+ rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_SCROLL_NEXT, SfxCallMode::ASYNCHRON);
}
else if (sCommand == "root")
{
@@ -344,9 +340,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox, void )
{
const sal_uInt16 nCurrItemId = pBox->GetCurItemId();
const OUString sCommand = pBox->GetItemCommand(nCurrItemId);
- if (sCommand == "navigation")
- CreateNavigationTool();
- else if (sCommand == "dragmode")
+ if (sCommand == "dragmode")
{
static const char* aHIDs[] =
{
@@ -388,18 +382,6 @@ IMPL_LINK( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox, void )
}
}
-void SwNavigationPI::CreateNavigationTool()
-{
- auto xPopup = VclPtr<SwScrollNaviPopup>::Create(m_aContentToolBox.get());
-
- xPopup->EnableDocking();
-
- SetPopupWindow( xPopup );
-
- xPopup->Show();
- vcl::Window::GetDockingManager()->StartPopupMode(m_aContentToolBox, xPopup, FloatWinPopupFlags::GrabFocus);
-}
-
FactoryFunction SwNavigationPI::GetUITestFactory() const
{
return SwNavigationPIUIObject::create;
@@ -511,9 +493,23 @@ enum StatusIndex
}
-SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings,
- vcl::Window* pParent)
- : PanelLayout(pParent, "NavigatorPanel", "modules/swriter/ui/navigatorpanel.ui", nullptr)
+VclPtr<vcl::Window> SwNavigationPI::Create(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings)
+{
+ if( pParent == nullptr )
+ throw css::lang::IllegalArgumentException("no parent window given to SwNavigationPI::Create", nullptr, 0);
+ if( !rxFrame.is() )
+ throw css::lang::IllegalArgumentException("no XFrame given to SwNavigationPI::Create", nullptr, 0);
+ if( pBindings == nullptr )
+ throw css::lang::IllegalArgumentException("no SfxBindings given to SwNavigationPI::Create", nullptr, 0);
+ return VclPtr<SwNavigationPI>::Create(pParent, rxFrame, pBindings);
+}
+
+SwNavigationPI::SwNavigationPI(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* _pBindings)
+ : PanelLayout(pParent, "NavigatorPanel", "modules/swriter/ui/navigatorpanel.ui", rxFrame/*, true*/)
, SfxControllerItem(SID_DOCFULLNAME, *_pBindings)
, m_pContentView(nullptr)
, m_pContentWrtShell(nullptr)
@@ -527,7 +523,7 @@ SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings,
{
get(m_aContentToolBox, "content");
m_aContentToolBox->SetLineCount(2);
- m_aContentToolBox->InsertBreak(8);
+ m_aContentToolBox->InsertBreak(4);
get(m_aGlobalToolBox, "global");
get(m_aDocListBox, "documents");
@@ -668,9 +664,6 @@ SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings,
m_aDocListBox->SetAccessibleName(m_aStatusArr[3]);
m_aExpandedSize = GetOptimalSize();
-
- m_xNaviListener.reset(new NaviStateListener(GetBindings(), this));
- NaviStateChanged();
}
SwNavigationPI::~SwNavigationPI()
@@ -680,8 +673,6 @@ SwNavigationPI::~SwNavigationPI()
void SwNavigationPI::dispose()
{
- m_xNaviListener.reset();
-
if (IsGlobalDoc() && !IsGlobalMode())
{
SwView *pView = GetCreateView();
@@ -704,7 +695,6 @@ void SwNavigationPI::dispose()
if (IsBound())
m_rBindings.Release(*this);
- m_xPopupWindow.disposeAndClear();
m_aDocListBox.clear();
m_aGlobalTree.disposeAndClear();
m_aGlobalBox.clear();
@@ -721,12 +711,6 @@ void SwNavigationPI::dispose()
PanelLayout::dispose();
}
-void SwNavigationPI::SetPopupWindow( SwScrollNaviPopup* pWindow )
-{
- m_xPopupWindow.disposeAndClear();
- m_xPopupWindow = pWindow;
-}
-
void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
const SfxPoolItem* /*pState*/ )
{
@@ -1125,7 +1109,8 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent,
SfxBindings* _pBindings )
: SfxChildWindowContext( nId )
{
- VclPtr<SwNavigationPI> pNavi = VclPtr<SwNavigationPI>::Create(_pBindings, pParent);
+ Reference< XFrame > xFrame = _pBindings->GetActiveFrame();
+ VclPtr< SwNavigationPI > pNavi = VclPtr< SwNavigationPI >::Create( pParent, xFrame, _pBindings );
_pBindings->Invalidate(SID_NAVIGATOR);
SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig();
@@ -1156,32 +1141,4 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent,
SetWindow(pNavi);
}
-NaviStateListener::NaviStateListener(SfxBindings& rBindings, SwNavigationPI* pNavigation)
- : SfxControllerItem(FN_NAV_ELEMENT, rBindings)
- , m_xNavigation(pNavigation)
-{
-}
-
-NaviStateListener::~NaviStateListener()
-{
-}
-
-void NaviStateListener::StateChanged(sal_uInt16 /*nSID*/, SfxItemState /*eState*/,
- const SfxPoolItem* /*pState*/)
-{
- m_xNavigation->NaviStateChanged();
-}
-
-void SwNavigationPI::NaviStateChanged()
-{
- if (m_xPopupWindow)
- m_xPopupWindow->syncFromDoc();
-
- if (m_aContentToolBox)
- {
- m_aContentToolBox->SetQuickHelpText(m_aContentToolBox->GetItemId("back"), SwScrollNaviPopup::GetToolTip(false));
- m_aContentToolBox->SetQuickHelpText(m_aContentToolBox->GetItemId("forward"), SwScrollNaviPopup::GetToolTip(true));
- }
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/uiconfig/swriter/ui/navigatorpanel.ui b/sw/uiconfig/swriter/ui/navigatorpanel.ui
index d82314958905..28c08eb21c38 100644
--- a/sw/uiconfig/swriter/ui/navigatorpanel.ui
+++ b/sw/uiconfig/swriter/ui/navigatorpanel.ui
@@ -23,7 +23,7 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <object class="GtkToolbar" id="content">
+ <object class="sfxlo-SidebarToolBox" id="content">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="toolbar_style">icons</property>
@@ -41,12 +41,10 @@
</packing>
</child>
<child>
- <object class="GtkMenuToolButton" id="navigation">
+ <object class="GtkToolButton" id=".uno:NavElement">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes" context="navigatorpanel|navigation|tooltip_text">Navigation</property>
- <property name="action_name">navigation</property>
- <property name="icon_name">sw/res/sc20249.png</property>
+ <property name="action_name">.uno:NavElement</property>
</object>
<packing>
<property name="expand">False</property>
@@ -57,9 +55,7 @@
<object class="GtkToolButton" id="back">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes" context="navigatorpanel|back|tooltip_text">Back</property>
- <property name="action_name">back</property>
- <property name="icon_name">sw/res/sc20186.png</property>
+ <property name="action_name">.uno:ScrollToPrevious</property>
</object>
<packing>
<property name="expand">False</property>
@@ -70,58 +66,7 @@
<object class="GtkToolButton" id="forward">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes" context="navigatorpanel|forward|tooltip_text">Forward</property>
- <property name="action_name">forward</property>
- <property name="icon_name">sw/res/sc20175.png</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="dragmode">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes" context="navigatorpanel|dragmode|tooltip_text">Drag Mode</property>
- <property name="action_name">dragmode</property>
- <property name="icon_name">sw/res/sc20235.png</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkSeparatorToolItem" id="separator1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="chapterup">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes" context="navigatorpanel|chapterup|tooltip_text">Promote Chapter</property>
- <property name="action_name">up</property>
- <property name="icon_name">sw/res/sc20174.png</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="chapterdown">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes" context="navigatorpanel|chapterdown|tooltip_text">Demote Chapter</property>
- <property name="action_name">down</property>
- <property name="icon_name">sw/res/sc20171.png</property>
+ <property name="action_name">.uno:ScrollToNext</property>
</object>
<packing>
<property name="expand">False</property>
@@ -259,6 +204,29 @@
<property name="homogeneous">True</property>
</packing>
</child>
+ <child>
+ <object class="GtkToolButton" id="dragmode">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes" context="navigatorpanel|dragmode|tooltip_text">Drag Mode</property>
+ <property name="action_name">dragmode</property>
+ <property name="icon_name">sw/res/sc20235.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparatorToolItem" id="separator6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
<child>
<object class="GtkToolButton" id="promote">
<property name="visible">True</property>
@@ -285,6 +253,32 @@
<property name="homogeneous">True</property>
</packing>
</child>
+ <child>
+ <object class="GtkToolButton" id="chapterup">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes" context="navigatorpanel|chapterup|tooltip_text">Promote Chapter</property>
+ <property name="action_name">up</property>
+ <property name="icon_name">sw/res/sc20174.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="chapterdown">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes" context="navigatorpanel|chapterdown|tooltip_text">Demote Chapter</property>
+ <property name="action_name">down</property>
+ <property name="icon_name">sw/res/sc20171.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -348,7 +342,7 @@
</packing>
</child>
<child>
- <object class="GtkSeparatorToolItem" id="separator6">
+ <object class="GtkSeparatorToolItem" id="separator7">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@@ -397,7 +391,7 @@
</packing>
</child>
<child>
- <object class="GtkSeparatorToolItem" id="separator7">
+ <object class="GtkSeparatorToolItem" id="separator8">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@@ -420,7 +414,7 @@
</packing>
</child>
<child>
- <object class="GtkSeparatorToolItem" id="separator8">
+ <object class="GtkSeparatorToolItem" id="separator9">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
More information about the Libreoffice-commits
mailing list