Kaydet (Commit) 9152f16b authored tarafından Szymon Kłos's avatar Szymon Kłos Kaydeden (comit) Maxim Monastirsky

tdf#102059 NotebookBar accessible using F6 key

Change-Id: I873c49d8c0557eb3702de921fb5d2281acfed526
Reviewed-on: https://gerrit.libreoffice.org/32459Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
üst 4f55dedc
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <sfx2/notebookbar/NotebookbarContextControl.hxx> #include <sfx2/notebookbar/NotebookbarContextControl.hxx>
#include <com/sun/star/ui/XContextChangeEventListener.hpp> #include <com/sun/star/ui/XContextChangeEventListener.hpp>
class SystemWindow;
/// This implements Widget Layout-based notebook-like menu bar. /// This implements Widget Layout-based notebook-like menu bar.
class VCL_DLLPUBLIC NotebookBar : public Control, public VclBuilderContainer class VCL_DLLPUBLIC NotebookBar : public Control, public VclBuilderContainer
{ {
...@@ -25,13 +27,17 @@ public: ...@@ -25,13 +27,17 @@ public:
virtual ~NotebookBar() override; virtual ~NotebookBar() override;
virtual void dispose() SAL_OVERRIDE; virtual void dispose() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) override;
virtual Size GetOptimalSize() const SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE;
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) SAL_OVERRIDE; virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) SAL_OVERRIDE;
void SetIconClickHdl(Link<NotebookBar*, void> aHdl); void SetIconClickHdl(Link<NotebookBar*, void> aHdl);
void SetSystemWindow(SystemWindow* pSystemWindow);
const css::uno::Reference<css::ui::XContextChangeEventListener>& getContextChangeEventListener() const { return m_pEventListener; } const css::uno::Reference<css::ui::XContextChangeEventListener>& getContextChangeEventListener() const { return m_pEventListener; }
private: private:
VclPtr<SystemWindow> m_pSystemWindow;
css::uno::Reference<css::ui::XContextChangeEventListener> m_pEventListener; css::uno::Reference<css::ui::XContextChangeEventListener> m_pEventListener;
NotebookbarContextControl* m_pContextContainer; NotebookbarContextControl* m_pContextContainer;
}; };
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
#include <vcl/tabctrl.hxx> #include <vcl/tabctrl.hxx>
#include <vcl/notebookbar.hxx> #include <vcl/notebookbar.hxx>
#include <vcl/taskpanelist.hxx>
#include <cppuhelper/queryinterface.hxx> #include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
...@@ -50,11 +51,27 @@ NotebookBar::~NotebookBar() ...@@ -50,11 +51,27 @@ NotebookBar::~NotebookBar()
void NotebookBar::dispose() void NotebookBar::dispose()
{ {
if (m_pSystemWindow && m_pSystemWindow->ImplIsInTaskPaneList(this))
{
m_pSystemWindow->GetTaskPaneList()->RemoveWindow(this);
m_pSystemWindow.clear();
}
disposeBuilder(); disposeBuilder();
m_pEventListener.clear(); m_pEventListener.clear();
Control::dispose(); Control::dispose();
} }
bool NotebookBar::PreNotify(NotifyEvent& rNEvt)
{
// capture KeyEvents for taskpane cycling
if (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT)
{
if (m_pSystemWindow)
return m_pSystemWindow->PreNotify(rNEvt);
}
return Window::PreNotify( rNEvt );
}
Size NotebookBar::GetOptimalSize() const Size NotebookBar::GetOptimalSize() const
{ {
if (isLayoutEnabled(this)) if (isLayoutEnabled(this))
...@@ -98,6 +115,16 @@ void NotebookBar::SetIconClickHdl(Link<NotebookBar*, void> aHdl) ...@@ -98,6 +115,16 @@ void NotebookBar::SetIconClickHdl(Link<NotebookBar*, void> aHdl)
m_pContextContainer->SetIconClickHdl(aHdl); m_pContextContainer->SetIconClickHdl(aHdl);
} }
void NotebookBar::SetSystemWindow(SystemWindow* pSystemWindow)
{
if (m_pSystemWindow)
m_pSystemWindow.clear();
m_pSystemWindow = VclPtr<SystemWindow>(pSystemWindow);
if (!m_pSystemWindow->ImplIsInTaskPaneList(this))
m_pSystemWindow->GetTaskPaneList()->AddWindow(this);
}
void SAL_CALL NotebookBarContextChangeEventListener::notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent) void SAL_CALL NotebookBarContextChangeEventListener::notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent)
throw (css::uno::RuntimeException, std::exception) throw (css::uno::RuntimeException, std::exception)
{ {
......
...@@ -979,6 +979,8 @@ void SystemWindow::SetNotebookBar(const OUString& rUIXMLDescription, const css:: ...@@ -979,6 +979,8 @@ void SystemWindow::SetNotebookBar(const OUString& rUIXMLDescription, const css::
{ {
static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetNotebookBar(rUIXMLDescription, rFrame); static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetNotebookBar(rUIXMLDescription, rFrame);
maNotebookBarUIFile = rUIXMLDescription; maNotebookBarUIFile = rUIXMLDescription;
if(GetNotebookBar())
GetNotebookBar()->SetSystemWindow(this);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment