summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-15 14:26:24 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-01-15 20:43:10 +0100
commit33baa14a1130aed90c232231a1b5fd9120737b96 (patch)
treed49105c07caa6640cb13c4dddf5cf7a398832dbc
parent160cde8ec0473b4a0c8e15ee13520d83171aea8d (diff)
rework SwScrollNaviPopup to be a simple popdown
this has never worked right for me, it appears and disappears immediately under gtk3, automatically turns into a floating window under gen rework it to be a simpler non-floating popdown Change-Id: I3d13ddf81c22e0fb9616defd7d0435e9116c0ac7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86874 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/uibase/inc/navipi.hxx13
-rw-r--r--sw/source/uibase/inc/workctrl.hxx37
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx245
-rw-r--r--sw/source/uibase/utlui/navipi.cxx74
-rw-r--r--sw/uiconfig/swriter/ui/floatingnavigation.ui341
5 files changed, 521 insertions, 189 deletions
diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx
index 967bdc805161..7bee0d2e0197 100644
--- a/sw/source/uibase/inc/navipi.hxx
+++ b/sw/source/uibase/inc/navipi.hxx
@@ -38,8 +38,9 @@ class SwNavigationPI;
class SwNavigationChild;
class SfxBindings;
class NumEditAction;
-class SwView;
class SwNavigationConfig;
+class SwScrollNaviPopup;
+class SwView;
class SfxObjectShellLock;
class SfxChildWindowContext;
enum class RegionMode;
@@ -48,7 +49,6 @@ class SpinField;
class SwNavHelpToolBox : public ToolBox
{
VclPtr<SwNavigationPI> m_xDialog;
- virtual void MouseButtonDown(const MouseEvent &rEvt) override;
virtual void RequestHelp( const HelpEvent& rHEvt ) override;
virtual void dispose() override;
public:
@@ -86,8 +86,7 @@ class SwNavigationPI : public PanelLayout,
SwWrtShell *m_pContentWrtShell;
SwView *m_pActContView;
SwView *m_pCreateView;
- VclPtr<SfxPopupWindow> m_pPopupWindow;
- VclPtr<SfxPopupWindow> m_pFloatingWindow;
+ VclPtr<SwScrollNaviPopup> m_xPopupWindow;
SwNavigationConfig *m_pConfig;
SfxBindings &m_rBindings;
@@ -114,11 +113,9 @@ class SwNavigationPI : public PanelLayout,
DECL_LINK( MenuSelectHdl, Menu *, bool );
DECL_LINK( ChangePageHdl, Timer*, void );
DECL_LINK( PageEditModifyHdl, SpinField&, void );
- DECL_LINK( PopupModeEndHdl, FloatingWindow*, void );
- DECL_LINK( ClosePopupWindow, SfxPopupWindow *, void );
void UsePage();
- void SetPopupWindow( SfxPopupWindow* );
+ void SetPopupWindow( SwScrollNaviPopup* );
protected:
@@ -156,7 +153,7 @@ public:
bool IsGlobalMode() const {return m_bGlobalMode;}
SwView* GetCreateView() const;
- void CreateNavigationTool(const tools::Rectangle& rRect, bool bSetFocus, vcl::Window *pParent);
+ void CreateNavigationTool();
FactoryFunction GetUITestFactory() const override;
};
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx
index 6aa03352bd94..80c9fa157592 100644
--- a/sw/source/uibase/inc/workctrl.hxx
+++ b/sw/source/uibase/inc/workctrl.hxx
@@ -50,6 +50,8 @@ class SwView;
#define NID_TABLE_FORMULA_ERROR 20019
#define NID_COUNT 20
+#define NID_LINE_COUNT 10
+
class SwTbxAutoTextCtrl : public SfxToolBoxControl
{
public:
@@ -66,29 +68,16 @@ public:
DECL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, Menu*, bool);
};
-class SwScrollNaviPopup;
-
-class SwScrollNaviToolBox : public ToolBox
+class SwScrollNaviPopup : public DockingWindow
{
- VclPtr<SwScrollNaviPopup> m_pNaviPopup;
-
- virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
- virtual void RequestHelp( const HelpEvent& rHEvt ) override;
-
-public:
- SwScrollNaviToolBox(vcl::Window* pParent, SwScrollNaviPopup* pNaviPopup, WinBits nWinStyle)
- : ToolBox(pParent, nWinStyle)
- , m_pNaviPopup(pNaviPopup)
- {
- }
- virtual ~SwScrollNaviToolBox() override;
- virtual void dispose() override;
-};
+ VclPtr<ToolBox> m_xToolBox1;
+ VclPtr<ToolBox> m_xToolBox2;
+ VclPtr<FixedText> m_xInfoField;
-class SwScrollNaviPopup : public SfxPopupWindow
-{
- VclPtr<SwScrollNaviToolBox> m_pToolBox;
- VclPtr<FixedText> m_pInfoField;
+ 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];
@@ -96,15 +85,15 @@ protected:
DECL_LINK(SelectHdl, ToolBox*, void);
public:
- SwScrollNaviPopup( sal_uInt16 nId, const css::uno::Reference< css::frame::XFrame >& rFrame, vcl::Window *pParent );
+ SwScrollNaviPopup(vcl::Window *pParent);
virtual ~SwScrollNaviPopup() override;
virtual void dispose() override;
static OUString GetToolTip(bool bNext);
- void GrabFocus() { m_pToolBox->GrabFocus(); }
+ void GrabFocus() { m_xToolBox1->GrabFocus(); }
- virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
+ void syncFromDoc();
};
class SwPreviewZoomControl : public SfxToolBoxControl
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 077e987398fc..ac3cdff611b0 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -20,6 +20,7 @@
#include <i18nutil/unicode.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/bindings.hxx>
+#include <sfx2/viewfrm.hxx>
#include <swmodule.hxx>
#include <view.hxx>
#include <initui.hxx>
@@ -305,32 +306,22 @@ static const char* STR_IMGBTN_ARY[] =
STR_IMGBTN_TBLFML_ERR_UP
};
-SwScrollNaviPopup::SwScrollNaviPopup(sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window *pParent)
- : SfxPopupWindow(nId, pParent, "FloatingNavigation",
- "modules/swriter/ui/floatingnavigation.ui", rFrame)
+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_pToolBox = VclPtr<SwScrollNaviToolBox>::Create(get<vcl::Window>("box"), this, 0);
- get(m_pInfoField, "label");
+ m_xToolBox1->SetHelpId(HID_NAVI_VS);
+ m_xToolBox2->SetHelpId(HID_NAVI_VS);
- size_t i;
+ for (size_t i = 0; i < NID_LINE_COUNT; ++i)
+ m_xToolBox1->SetHelpId(m_xToolBox1->GetItemId(i), aNavigationHelpIds[i]);
- m_pToolBox->SetHelpId(HID_NAVI_VS);
- m_pToolBox->SetLineCount( 2 );
- m_pToolBox->SetOutStyle(TOOLBOX_STYLE_FLAT);
- for( i = 0; i < NID_COUNT; i++)
- {
- sal_uInt16 nNaviId = aNavigationInsertIds[i];
- ToolBoxItemBits nTbxBits = ToolBoxItemBits::NONE;
- if ((NID_PREV != nNaviId) && (NID_NEXT != nNaviId))
- nTbxBits = ToolBoxItemBits::CHECKABLE;
- m_pToolBox->InsertItem(nNaviId, Image(StockImage::Yes, aNavigationImgIds[i]),
- SwResId(aNavigationStrIds[i]), nTbxBits);
- m_pToolBox->SetHelpId(nNaviId, aNavigationHelpIds[i]);
- }
+ for (size_t i = 0; i < NID_LINE_COUNT; ++i)
+ m_xToolBox2->SetHelpId(m_xToolBox2->GetItemId(i), aNavigationHelpIds[i + NID_LINE_COUNT]);
- m_pToolBox->InsertBreak(NID_COUNT/2);
-
- for (i = 0; i < SAL_N_ELEMENTS(STR_IMGBTN_ARY); ++i)
+ for (size_t i = 0; i < SAL_N_ELEMENTS(STR_IMGBTN_ARY); ++i)
{
const char* id = STR_IMGBTN_ARY[i];
if (!id)
@@ -339,14 +330,11 @@ SwScrollNaviPopup::SwScrollNaviPopup(sal_uInt16 nId, const Reference< XFrame >&
}
sal_uInt16 nItemId = SwView::GetMoveType();
- m_pInfoField->SetText(m_pToolBox->GetItemText(nItemId));
- m_pToolBox->CheckItem( nItemId );
-
- m_pToolBox->SetSelectHdl(LINK(this, SwScrollNaviPopup, SelectHdl));
- m_pToolBox->StartSelection();
- m_pToolBox->Show();
+ m_xInfoField->SetText(GetItemText(nItemId));
+ CheckItem(nItemId, true);
- AddStatusListener(".uno:NavElement");
+ m_xToolBox1->SetSelectHdl(LINK(this, SwScrollNaviPopup, SelectHdl));
+ m_xToolBox2->SetSelectHdl(LINK(this, SwScrollNaviPopup, SelectHdl));
}
SwScrollNaviPopup::~SwScrollNaviPopup()
@@ -356,82 +344,193 @@ SwScrollNaviPopup::~SwScrollNaviPopup()
void SwScrollNaviPopup::dispose()
{
- m_pToolBox.disposeAndClear();
- m_pInfoField.clear();
- SfxPopupWindow::dispose();
+ m_xToolBox2.disposeAndClear();
+ m_xToolBox1.disposeAndClear();
+ m_xInfoField.clear();
+ DockingWindow::dispose();
}
-IMPL_LINK(SwScrollNaviPopup, SelectHdl, ToolBox*, pSet, void)
+IMPL_LINK_NOARG(SwScrollNaviPopup, SelectHdl, ToolBox*, void)
{
- sal_uInt16 nSet = pSet->GetCurItemId();
+ sal_uInt16 nSet = GetCurItemId();
if( nSet != NID_PREV && nSet != NID_NEXT )
{
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
SwView::SetMoveType( nSet );
- Sequence< PropertyValue > aArgs;
- SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
- ".uno:NavElement", aArgs );
+ GetActiveView()->GetViewFrame()->GetDispatcher()->Execute(FN_NAV_ELEMENT);
+ syncFromDoc();
}
else
{
- Sequence< PropertyValue > aArgs;
- OUString cmd(".uno:ScrollToPrevious");
+ sal_uInt16 cmd(FN_SCROLL_PREV);
if (NID_NEXT == nSet)
- cmd = ".uno:ScrollToNext";
- SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
- cmd, aArgs );
+ cmd = FN_SCROLL_NEXT;
+ GetActiveView()->GetViewFrame()->GetDispatcher()->Execute(cmd);
}
}
-SwScrollNaviToolBox::~SwScrollNaviToolBox()
+OUString SwScrollNaviPopup::GetToolTip(bool bNext)
{
- disposeOnce();
+ sal_uInt16 nResId = SwView::GetMoveType();
+ if (!bNext)
+ nResId += NID_COUNT;
+ const char* id = STR_IMGBTN_ARY[nResId - NID_START];
+ return id ? SwResId(id): OUString();
}
-void SwScrollNaviToolBox::dispose()
+void SwScrollNaviPopup::syncFromDoc()
{
- m_pNaviPopup.disposeAndClear();
- ToolBox::dispose();
+ 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);
+ }
}
-void SwScrollNaviToolBox::MouseButtonUp( const MouseEvent& rMEvt )
+namespace
{
- ToolBox::MouseButtonUp(rMEvt);
- if (m_pNaviPopup->IsInPopupMode())
- m_pNaviPopup->EndPopupMode(FloatWinPopupEndFlags::CloseAll);
+ 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 "";
+ }
}
-void SwScrollNaviToolBox::RequestHelp( const HelpEvent& rHEvt )
+sal_uInt16 SwScrollNaviPopup::GetCurItemId() const
{
- SetItemText(NID_NEXT, SwScrollNaviPopup::GetToolTip(true));
- SetItemText(NID_PREV, SwScrollNaviPopup::GetToolTip(false));
- ToolBox::RequestHelp( rHEvt );
+ OUString sItemId = m_xToolBox1->GetItemCommand(m_xToolBox1->GetCurItemId());
+ if (sItemId.isEmpty())
+ sItemId = m_xToolBox2->GetItemCommand(m_xToolBox2->GetCurItemId());
+ return IdToIdent(sItemId);
}
-OUString SwScrollNaviPopup::GetToolTip(bool bNext)
+OUString SwScrollNaviPopup::GetItemText(sal_uInt16 nId) const
{
- sal_uInt16 nResId = SwView::GetMoveType();
- if (!bNext)
- nResId += NID_COUNT;
- const char* id = STR_IMGBTN_ARY[nResId - NID_START];
- return id ? SwResId(id): OUString();
+ const OUString sId(IdentToId(nId));
+ 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::statusChanged( const css::frame::FeatureStateEvent& rEvent )
+void SwScrollNaviPopup::SetItemText(sal_uInt16 nId, const OUString &rText)
{
- if ( rEvent.FeatureURL.Path == "NavElement" )
+ const OUString sId(IdentToId(nId));
+ sal_uInt16 nItemId = m_xToolBox1->GetItemId(sId);
+ if (nItemId)
{
- sal_uInt16 nSet = SwView::GetMoveType();
- m_pToolBox->SetItemText( NID_NEXT, sQuickHelp[nSet - NID_START] );
- m_pToolBox->SetItemText( NID_PREV, sQuickHelp[nSet - NID_START + NID_COUNT] );
- m_pInfoField->SetText( m_pToolBox->GetItemText( nSet ) );
- // check the current button only
- for( ToolBox::ImplToolItems::size_type i = 0; i < NID_COUNT; i++ )
- {
- sal_uInt16 nItemId = m_pToolBox->GetItemId( i );
- m_pToolBox->CheckItem( nItemId, nItemId == nSet );
- }
+ m_xToolBox1->SetItemText(nItemId, rText);
+ return;
+ }
+ nItemId = m_xToolBox2->GetItemId(sId);
+ m_xToolBox2->SetItemText(nItemId, rText);
+}
+
+void SwScrollNaviPopup::CheckItem(sal_uInt16 nId, bool bOn)
+{
+ const OUString sId(IdentToId(nId));
+ 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 {
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index 061550ad5b35..7b8832e58249 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -354,7 +354,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox, void )
const sal_uInt16 nCurrItemId = pBox->GetCurItemId();
const OUString sCommand = pBox->GetItemCommand(nCurrItemId);
if (sCommand == "navigation")
- CreateNavigationTool(pBox->GetItemRect(nCurrItemId), true, this);
+ CreateNavigationTool();
else if (sCommand == "dragmode")
{
static const char* aHIDs[] =
@@ -404,33 +404,16 @@ SwNavHelpToolBox::SwNavHelpToolBox(Window* pParent)
VCL_BUILDER_FACTORY(SwNavHelpToolBox)
-void SwNavHelpToolBox::MouseButtonDown(const MouseEvent &rEvt)
+void SwNavigationPI::CreateNavigationTool()
{
- sal_uInt16 nItemId = GetItemId(rEvt.GetPosPixel());
- if (rEvt.GetButtons() == MOUSE_LEFT && GetItemCommand(nItemId) == "navigation")
- {
- m_xDialog->CreateNavigationTool(GetItemRect(nItemId), false, this);
- return;
- }
- ToolBox::MouseButtonDown(rEvt);
-}
+ auto xPopup = VclPtr<SwScrollNaviPopup>::Create(m_aContentToolBox.get());
-void SwNavigationPI::CreateNavigationTool(const tools::Rectangle& rRect, bool bSetFocus, vcl::Window *pParent)
-{
- Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame().GetFrameInterface();
- VclPtrInstance<SwScrollNaviPopup> pPopup(FN_SCROLL_NAVIGATION, xFrame, pParent);
-
- tools::Rectangle aRect(rRect);
- Point aT1 = aRect.TopLeft();
- aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(m_aContentToolBox->OutputToAbsoluteScreenPixel(aT1)));
- aRect.SetPos(aT1);
- pPopup->StartPopupMode(aRect, FloatWinPopupFlags::Right|FloatWinPopupFlags::AllowTearOff);
- SetPopupWindow( pPopup );
- if(bSetFocus)
- {
- pPopup->EndPopupMode(FloatWinPopupEndFlags::TearOff);
- pPopup->GrabFocus();
- }
+ xPopup->EnableDocking();
+
+ SetPopupWindow( xPopup );
+
+ xPopup->Show();
+ vcl::Window::GetDockingManager()->StartPopupMode(m_aContentToolBox, xPopup, FloatWinPopupFlags::GrabFocus);
}
FactoryFunction SwNavigationPI::GetUITestFactory() const
@@ -574,8 +557,6 @@ SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings,
, m_pContentWrtShell(nullptr)
, m_pActContView(nullptr)
, m_pCreateView(nullptr)
- , m_pPopupWindow(nullptr)
- , m_pFloatingWindow(nullptr)
, m_pConfig(SW_MOD()->GetNavigationConfig())
, m_rBindings(*_pBindings)
, m_nRegionMode(RegionMode::NONE)
@@ -756,8 +737,7 @@ void SwNavigationPI::dispose()
if (IsBound())
m_rBindings.Release(*this);
- m_pFloatingWindow.disposeAndClear();
- m_pPopupWindow.disposeAndClear();
+ m_xPopupWindow.disposeAndClear();
m_aDocListBox.clear();
m_aGlobalTree.disposeAndClear();
m_aGlobalBox.clear();
@@ -774,38 +754,10 @@ void SwNavigationPI::dispose()
PanelLayout::dispose();
}
-void SwNavigationPI::SetPopupWindow( SfxPopupWindow* pWindow )
+void SwNavigationPI::SetPopupWindow( SwScrollNaviPopup* pWindow )
{
- m_pPopupWindow.disposeAndClear();
- m_pPopupWindow = pWindow;
- m_pPopupWindow->SetPopupModeEndHdl( LINK( this, SwNavigationPI, PopupModeEndHdl ));
- m_pPopupWindow->SetDeleteLink_Impl( LINK( this, SwNavigationPI, ClosePopupWindow ));
-}
-
-IMPL_LINK_NOARG(SwNavigationPI, PopupModeEndHdl, FloatingWindow*, void)
-{
- if ( m_pPopupWindow->IsVisible() )
- {
- // Replace floating window with popup window and destroy
- // floating window instance.
- m_pFloatingWindow.disposeAndClear();
- m_pFloatingWindow = m_pPopupWindow;
- m_pPopupWindow = nullptr;
- }
- else
- {
- // Popup window has been closed by the user. No replacement, instance
- // will destroy itself.
- m_pPopupWindow = nullptr;
- }
-}
-
-IMPL_LINK( SwNavigationPI, ClosePopupWindow, SfxPopupWindow *, pWindow, void )
-{
- if ( pWindow == m_pFloatingWindow )
- m_pFloatingWindow = nullptr;
- else
- m_pPopupWindow = nullptr;
+ m_xPopupWindow.disposeAndClear();
+ m_xPopupWindow = pWindow;
}
void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
diff --git a/sw/uiconfig/swriter/ui/floatingnavigation.ui b/sw/uiconfig/swriter/ui/floatingnavigation.ui
index 41fbb0cc78aa..82a76cfe1ff1 100644
--- a/sw/uiconfig/swriter/ui/floatingnavigation.ui
+++ b/sw/uiconfig/swriter/ui/floatingnavigation.ui
@@ -1,51 +1,346 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
<requires lib="gtk+" version="3.18"/>
- <object class="GtkWindow" id="FloatingNavigation">
+ <object class="GtkPopover" id="FloatingNavigation">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="border_width">6</property>
- <property name="title" translatable="yes" context="floatingnavigation|FloatingNavigation">Navigation</property>
- <property name="resizable">False</property>
- <property name="type_hint">utility</property>
+ <property name="no_show_all">True</property>
+ <property name="border_width">4</property>
<child>
- <object class="GtkGrid" id="grid1">
+ <object class="GtkGrid" id="container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">12</property>
<child>
- <object class="GtkLabel" id="label">
+ <object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkToolbar" id="line1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="toolbar_style">icons</property>
+ <property name="show_arrow">False</property>
+ <child>
+ <object class="GtkToggleToolButton" id="tbl">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">tbl</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_TBL">Table</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20002.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="frm">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">frm</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_FRM">Text Frame</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20003.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="grf">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">grf</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_GRF">Graphics</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20009.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="ole">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">ole</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_OLE">OLE object</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20010.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="pge">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">pge</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_PGE">Page</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20004.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="outl">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">outl</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_OUTL">Headings</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20011.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="mark">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">mark</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_MARK">Reminder</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20014.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="drw">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">drw</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_DRW">Drawing</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20005.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="ctrl">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">ctrl</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_CTRL">Control</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20006.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="prev">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">prev</property>
+ <property name="label" translatable="yes" context="floatingnavigation|STR_IMGBTN_PGE_UP">Previous page</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20001.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolbar" id="line2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="toolbar_style">icons</property>
+ <property name="show_arrow">False</property>
+ <child>
+ <object class="GtkToggleToolButton" id="reg">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">reg</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_REG">Section</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20007.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="bkm">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">bkm</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_BKM">Bookmark</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20008.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="sel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">sel</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_SEL">Selection</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20012.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="ftn">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">ftn</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_FTN">Footnote</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20013.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="postit">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">postit</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_POSTIT">Comment</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20015.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="rep">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">rep</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_SRCH_REP">Repeat search</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20016.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="entry">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">entry</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_INDEX_ENTRY">Index entry</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20017.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="formula">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">formula</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_TABLE_FORMULA">Table formula</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20018.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="formulaerror">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">formulaerror</property>
+ <property name="label" translatable="yes" context="floatingnavigation|ST_TABLE_FORMULA_ERROR">Wrong table formula</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20019.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="next">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action_name">next</property>
+ <property name="label" translatable="yes" context="floatingnavigation|STR_IMGBTN_PGE_DOWN">Next page</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">sw/res/sr20000.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkBox" id="box">
+ <object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="orientation">vertical</property>
- <child>
- <placeholder/>
- </child>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ <property name="top_attach">1</property>
</packing>
</child>
</object>