summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui/navipi.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/utlui/navipi.cxx')
-rw-r--r--sw/source/uibase/utlui/navipi.cxx93
1 files changed, 25 insertions, 68 deletions
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: */