diff options
author | Jan Holesovsky <kendy@collabora.com> | 2016-03-30 10:28:10 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-03-30 11:01:30 +0200 |
commit | d150cc71a37f11c6e47cc528a74782722bff048c (patch) | |
tree | ed82c05e97b9403e0fd58c48ae098121cacea24d /sfx2 | |
parent | d039c4812db5ba4beed72deb44fe6b04137af6e5 (diff) |
notebookbar: Trying to use the SfxChildWindow for it does not work too well.
The notebookbar is not a child window, so trying to graft it on the
SfxChildWindow infrastructure is more pain than gain, unfortunately...
Instead, it's enough to create the appropriate functions for ExecMethod and
StateMethod, and call them from Writer / Calc / etc. with the appropriate .ui
file; that's easier & works equally well.
Change-Id: I08d98d4f481bd02e90ba11df0bd1c1149697a7fa
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/Library_sfx.mk | 2 | ||||
-rw-r--r-- | sfx2/sdi/frmslots.sdi | 5 | ||||
-rw-r--r-- | sfx2/source/dialog/dialog.src | 5 | ||||
-rw-r--r-- | sfx2/source/inc/helpid.hrc | 1 | ||||
-rw-r--r-- | sfx2/source/notebookbar/NotebookBarChildWindow.cxx | 32 | ||||
-rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 46 |
6 files changed, 47 insertions, 44 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index a537e02cd50e..f4d61cd589d6 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -237,7 +237,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/doc/templatedlg \ sfx2/source/explorer/nochaos \ sfx2/source/inet/inettbc \ - sfx2/source/notebookbar/NotebookBarChildWindow \ + sfx2/source/notebookbar/SfxNotebookBar \ sfx2/source/notify/eventsupplier \ sfx2/source/notify/globalevents \ sfx2/source/notify/hintpost \ diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index 03d52bb39fd6..3d41c1c72d6a 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -43,11 +43,6 @@ interface Window ExecMethod = ChildWindowExecute ; StateMethod = ChildWindowState ; ] - SID_NOTEBOOKBAR // status(final|play) - [ - ExecMethod = ChildWindowExecute ; - StateMethod = ChildWindowState ; - ] SID_SHOW_BROWSER // ole(no) api(final/play/rec) [ ExecMethod = ChildWindowExecute ; diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index 1ed960d861bd..a3ed837987c8 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -98,11 +98,6 @@ String SID_SIDEBAR Text [ en-US ] = "Sidebar"; }; -String SID_NOTEBOOKBAR -{ - Text [ en-US ] = "Notebookbar"; -}; - String STR_ERROR_WRONG_CONFIRM { Text [ en-US ] = "Faulty password confirmation"; diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index 81e2dd00197e..1794246c1be2 100644 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -61,7 +61,6 @@ #define HID_TASKPANE_VIEW_MENU "SFX2_HID_TASKPANE_VIEW_MENU" #define HID_SIDEBAR_WINDOW "SFX2_HID_SIDEBAR_WINDOW" -#define HID_NOTEBOOKBAR_WINDOW "SFX2_HID_NOTEBOOKBAR_WINDOW" #endif // #ifndef _SFX_HELPID_HRC diff --git a/sfx2/source/notebookbar/NotebookBarChildWindow.cxx b/sfx2/source/notebookbar/NotebookBarChildWindow.cxx deleted file mode 100644 index 365d6ef8c546..000000000000 --- a/sfx2/source/notebookbar/NotebookBarChildWindow.cxx +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <sfx2/bindings.hxx> -#include <sfx2/notebookbar/NotebookBarChildWindow.hxx> -#include <sfx2/sfxsids.hrc> -#include "helpid.hrc" -#include <sfx2/dockwin.hxx> -#include <sfx2/dispatch.hxx> - -using namespace sfx2; - -SFX_IMPL_DOCKINGWINDOW_WITHID(NotebookBarChildWindow, SID_NOTEBOOKBAR); - -NotebookBarChildWindow::NotebookBarChildWindow (vcl::Window* pParentWindow, sal_uInt16 nId, - SfxBindings* pBindings, SfxChildWinInfo*) - : SfxChildWindow(pParentWindow, nId) -{ - SfxFrame& rFrame = pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(); - rFrame.GetSystemWindow()->SetNotebookBar("vcl/ui/notebookbar.ui", rFrame.GetFrameInterface()); - - VclPtr<NotebookBar> pNotebookBar(rFrame.GetSystemWindow()->GetNotebookBar()); - pNotebookBar->SetHelpId(HID_NOTEBOOKBAR_WINDOW); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx new file mode 100644 index 000000000000..d2d9409fc6f0 --- /dev/null +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/notebookbar/SfxNotebookBar.hxx> +#include <unotools/viewoptions.hxx> +#include <vcl/notebookbar.hxx> +#include <vcl/syswin.hxx> + +using namespace sfx2; + +void SfxNotebookBar::ExecMethod(SfxBindings& rBindings) +{ + SvtViewOptions aViewOpt(E_WINDOW, "notebookbar"); + aViewOpt.SetVisible(!aViewOpt.IsVisible()); + + // trigger the StateMethod + rBindings.Invalidate(SID_NOTEBOOKBAR); + rBindings.Update(); +} + +void SfxNotebookBar::StateMethod(SfxBindings& rBindings, const OUString& rUIFile) +{ + SfxFrame& rFrame = rBindings.GetDispatcher_Impl()->GetFrame()->GetFrame(); + + SvtViewOptions aViewOpt(E_WINDOW, "notebookbar"); + + if (aViewOpt.IsVisible()) + { + // setup if necessary + rFrame.GetSystemWindow()->SetNotebookBar(rUIFile, rFrame.GetFrameInterface()); + + rFrame.GetSystemWindow()->GetNotebookBar()->Show(); + } + else if (auto pNotebookBar = rFrame.GetSystemWindow()->GetNotebookBar()) + pNotebookBar->Hide(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |