summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2016-03-30 10:28:10 +0200
committerJan Holesovsky <kendy@collabora.com>2016-03-30 11:01:30 +0200
commitd150cc71a37f11c6e47cc528a74782722bff048c (patch)
treeed82c05e97b9403e0fd58c48ae098121cacea24d
parentd039c4812db5ba4beed72deb44fe6b04137af6e5 (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
-rw-r--r--include/sfx2/notebookbar/NotebookBarChildWindow.hxx35
-rw-r--r--include/sfx2/notebookbar/SfxNotebookBar.hxx35
-rw-r--r--sfx2/Library_sfx.mk2
-rw-r--r--sfx2/sdi/frmslots.sdi5
-rw-r--r--sfx2/source/dialog/dialog.src5
-rw-r--r--sfx2/source/inc/helpid.hrc1
-rw-r--r--sfx2/source/notebookbar/NotebookBarChildWindow.cxx32
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx46
-rw-r--r--sw/sdi/docsh.sdi5
-rw-r--r--sw/source/uibase/app/docsh.cxx7
-rw-r--r--sw/source/uibase/app/docsh2.cxx7
-rw-r--r--sw/source/uibase/app/swmodule.cxx5
-rw-r--r--sw/source/uibase/uiview/view0.cxx2
13 files changed, 101 insertions, 86 deletions
diff --git a/include/sfx2/notebookbar/NotebookBarChildWindow.hxx b/include/sfx2/notebookbar/NotebookBarChildWindow.hxx
deleted file mode 100644
index 610c4f84645b..000000000000
--- a/include/sfx2/notebookbar/NotebookBarChildWindow.hxx
+++ /dev/null
@@ -1,35 +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/.
- */
-
-#ifndef INCLUDED_SFX2_NOTEBOOKBAR_NOTEBOOKBARCHILDWINDOW_HXX
-#define INCLUDED_SFX2_NOTEBOOKBAR_NOTEBOOKBARCHILDWINDOW_HXX
-
-#include <sfx2/childwin.hxx>
-
-namespace sfx2 {
-
-/** Outer container of the notebookbar window.
-
- Has to be registered for every application via the
- RegisterChildWindow() method from the RegisterControllers() method
- of the applications DLL.
-*/
-class SFX2_DLLPUBLIC NotebookBarChildWindow : public SfxChildWindow
-{
-public:
- NotebookBarChildWindow(vcl::Window* pParent, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo);
-
- SFX_DECL_CHILDWINDOW_WITHID(NotebookBarChildWindow);
-};
-
-} // namespace sfx2
-
-#endif // INCLUDED_SFX2_NOTEBOOKBAR_NOTEBOOKBARCHILDWINDOW_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx b/include/sfx2/notebookbar/SfxNotebookBar.hxx
new file mode 100644
index 000000000000..7f40e8ab2fa9
--- /dev/null
+++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx
@@ -0,0 +1,35 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
+#define INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
+
+#include <sfx2/dllapi.h>
+
+class SfxBindings;
+
+namespace sfx2 {
+
+/** Helpers for easier access to NotebookBar via the sfx2 infrastructure.
+*/
+class SFX2_DLLPUBLIC SfxNotebookBar
+{
+public:
+ /// Function to be called from the sdi's ExecMethod.
+ static void ExecMethod(SfxBindings& rBindings);
+
+ /// Function to be called from the sdi's StateMethod.
+ static void StateMethod(SfxBindings& rBindings, const OUString& rUIFile);
+};
+
+} // namespace sfx2
+
+#endif // INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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: */
diff --git a/sw/sdi/docsh.sdi b/sw/sdi/docsh.sdi
index 17132216de71..511823fbaeb9 100644
--- a/sw/sdi/docsh.sdi
+++ b/sw/sdi/docsh.sdi
@@ -56,6 +56,11 @@ interface TextDocument : BaseTextDocument
ExecMethod = Execute;
StateMethod = GetState;
]
+ SID_NOTEBOOKBAR
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
}
shell SwDocShell
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 7c097d88818b..6a7db05c9fa1 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -40,6 +40,7 @@
#include <sfx2/docfile.hxx>
#include <sfx2/evntconf.hxx>
#include <sfx2/docfilt.hxx>
+#include <sfx2/notebookbar/SfxNotebookBar.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/linkmgr.hxx>
#include <svl/srchitem.hxx>
@@ -1070,6 +1071,12 @@ void SwDocShell::GetState(SfxItemSet& rSet)
rSet.Put( SfxBoolItem( nWhich, bRet ) );
}
break;
+ case SID_NOTEBOOKBAR:
+ {
+ SfxViewShell* pViewShell = GetView()? GetView(): SfxViewShell::Current();
+ sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame()->GetBindings(), "vcl/ui/notebookbar.ui");
+ }
+ break;
default: OSL_ENSURE(false,"You cannot get here!");
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 80a03b7131d6..5bd534872163 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -43,6 +43,7 @@
#include <sfx2/request.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/new.hxx>
+#include <sfx2/notebookbar/SfxNotebookBar.hxx>
#include <sfx2/filedlghelper.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/evntconf.hxx>
@@ -1151,6 +1152,12 @@ void SwDocShell::Execute(SfxRequest& rReq)
SAL_WARN("sw.ui", "missing parameter for SID_CLASSIFICATION_APPLY");
}
break;
+ case SID_NOTEBOOKBAR:
+ {
+ SfxViewShell* pViewShell = GetView()? GetView(): SfxViewShell::Current();
+ sfx2::SfxNotebookBar::ExecMethod(pViewShell->GetViewFrame()->GetBindings());
+ }
+ break;
default: OSL_FAIL("wrong Dispatcher");
}
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 6199616a939d..54fe827fe9ac 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -98,7 +98,6 @@
#include <modcfg.hxx>
#include <fontcfg.hxx>
#include <sfx2/sidebar/SidebarChildWindow.hxx>
-#include <sfx2/notebookbar/NotebookBarChildWindow.hxx>
#include <sfx2/evntconf.hxx>
#include <swatrset.hxx>
#include <idxmrk.hxx>
@@ -368,10 +367,6 @@ void SwDLL::RegisterControls()
::avmedia::MediaPlayer::RegisterChildWindow(false, pMod);
::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod);
- ::sfx2::NotebookBarChildWindow::RegisterChildWindow(false, pMod);
-
- //SfxFrame& rFrame = GetActiveView()->GetViewFrame()->GetFrame();
- //rFrame.GetSystemWindow()->SetNotebookBar("vcl/ui/notebookbar.ui", rFrame.GetFrameInterface());
SwJumpToSpecificPageControl::RegisterControl(SID_JUMP_TO_SPECIFIC_PAGE, pMod);
}
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index cd4cd0e7acc8..37631c6480a0 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -37,7 +37,6 @@
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/sidebar/SidebarChildWindow.hxx>
-#include <sfx2/notebookbar/NotebookBarChildWindow.hxx>
#include <uivwimp.hxx>
#include <avmedia/mediaplayer.hxx>
#include <swmodule.hxx>
@@ -99,7 +98,6 @@ void SwView::InitInterface_Impl()
GetStaticInterface()->RegisterChildWindow(SID_NAVIGATOR, true);
GetStaticInterface()->RegisterChildWindow(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
- GetStaticInterface()->RegisterChildWindow(::sfx2::NotebookBarChildWindow::GetChildWindowId());
GetStaticInterface()->RegisterChildWindow(SfxInfoBarContainerChild::GetChildWindowId());
GetStaticInterface()->RegisterChildWindow(SvxSearchDialogWrapper::GetChildWindowId());