diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2016-08-11 13:53:20 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <s.mehrbrodt@gmail.com> | 2016-08-16 07:11:25 +0000 |
commit | af97c180983e5a8ac147b97f7773d483bba8cfef (patch) | |
tree | dc16d54bdb452b7ce2a18aa83bd1585ed6ea76e4 /sfx2 | |
parent | 5b1095fc03e90506cb8ed956fafb528d4f6b0044 (diff) |
GSoC notebookbar: multiple .ui implementations
+ added menu controller for .uno:Notebookbar showing
all implementations
+ switching between .ui files
+ officecfg stores implementation description
+ added second implementation file notebookbar_groups.ui
Change-Id: I9f406daced7a111793f61a2e9f939cba27d92184
Reviewed-on: https://gerrit.libreoffice.org/28067
Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
Tested-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/sdi/sfx.sdi | 1 | ||||
-rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 42 |
2 files changed, 29 insertions, 14 deletions
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 023c84af7dd0..b80b5fdde711 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -2625,6 +2625,7 @@ SfxBoolItem Sidebar SID_SIDEBAR SfxBoolItem Notebookbar SID_NOTEBOOKBAR +(SfxStringItem File SID_NOTEBOOKBAR) [ AutoUpdate = TRUE, FastCall = FALSE, diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index ad8e7e5625cb..c20e35e865a8 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> #include "NotebookBarPopupMenu.hxx" +#include <officecfg/Office/UI/Notebookbar.hxx> using namespace sfx2; using namespace css::uno; @@ -46,6 +47,12 @@ void SfxNotebookBar::CloseMethod(SystemWindow* pSysWindow) m_xFrame.clear(); } +bool SfxNotebookBar::IsActive() +{ + SvtViewOptions aViewOpt(E_WINDOW, "notebookbar"); + return aViewOpt.IsVisible(); +} + void SfxNotebookBar::ExecMethod(SfxBindings& rBindings) { SvtViewOptions aViewOpt(E_WINDOW, "notebookbar"); @@ -87,25 +94,32 @@ void SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, { RemoveListeners(pSysWindow); - // setup if necessary - pSysWindow->SetNotebookBar(rUIFile, xFrame); + OUString sFile = officecfg::Office::UI::Notebookbar::Active::get(); + if ( !sFile.isEmpty() ) + { + OUStringBuffer aBuf(rUIFile); + aBuf.append( sFile ); - pSysWindow->GetNotebookBar()->Show(); - pSysWindow->GetNotebookBar()->SetIconClickHdl(LINK(nullptr, SfxNotebookBar, ToggleMenubar)); + // setup if necessary + pSysWindow->SetNotebookBar(aBuf.makeStringAndClear(), xFrame); - SfxViewFrame* pView = SfxViewFrame::Current(); + pSysWindow->GetNotebookBar()->Show(); + pSysWindow->GetNotebookBar()->SetIconClickHdl(LINK(nullptr, SfxNotebookBar, ToggleMenubar)); - if(pView) - { - Reference<XContextChangeEventMultiplexer> xMultiplexer - = ContextChangeEventMultiplexer::get( - ::comphelper::getProcessComponentContext()); + SfxViewFrame* pView = SfxViewFrame::Current(); - if(xFrame.is() && xMultiplexer.is()) + if(pView) { - xMultiplexer->addContextChangeEventListener( - pSysWindow->GetNotebookBar()->getContextChangeEventListener(), - xFrame->getController()); + Reference<XContextChangeEventMultiplexer> xMultiplexer + = ContextChangeEventMultiplexer::get( + ::comphelper::getProcessComponentContext()); + + if(xFrame.is() && xMultiplexer.is()) + { + xMultiplexer->addContextChangeEventListener( + pSysWindow->GetNotebookBar()->getContextChangeEventListener(), + xFrame->getController()); + } } } } |