diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2016-08-19 10:20:03 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-08-25 11:46:39 +0000 |
commit | 6488d249b0c5649313b6611660aca939e5c374bf (patch) | |
tree | 64646f153fd5ef2999dff69a51462dc72fd27369 /include | |
parent | b9ab0dd3e5eb3c948ee9a29006637e48d5751a5e (diff) |
GSoC notebookbar: container with context support
+ added sfxlo-ContextVBox
+ notebookbar's .ui file must contain control
implementing NotebookbarContextControl interface
with id "ContextContainer"
Change-Id: Ice81e23c4ba742564ebceeda95be120ea3f58c99
Reviewed-on: https://gerrit.libreoffice.org/28247
Tested-by: Jenkins <ci@libreoffice.org>
Tested-by: Yousuf Philips <philipz85@hotmail.com>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/notebookbar/NotebookbarContextControl.hxx | 27 | ||||
-rw-r--r-- | include/sfx2/notebookbar/SfxNotebookBar.hxx | 2 | ||||
-rw-r--r-- | include/vcl/IContext.hxx | 54 | ||||
-rw-r--r-- | include/vcl/layout.hxx | 4 | ||||
-rw-r--r-- | include/vcl/notebookbar.hxx | 4 | ||||
-rw-r--r-- | include/vcl/tabctrl.hxx | 8 | ||||
-rw-r--r-- | include/vcl/tabpage.hxx | 8 |
7 files changed, 94 insertions, 13 deletions
diff --git a/include/sfx2/notebookbar/NotebookbarContextControl.hxx b/include/sfx2/notebookbar/NotebookbarContextControl.hxx new file mode 100644 index 000000000000..348b52101df1 --- /dev/null +++ b/include/sfx2/notebookbar/NotebookbarContextControl.hxx @@ -0,0 +1,27 @@ +/* -*- 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_NOTEBOOKBARCONTEXTCONTROL_HXX +#define INCLUDED_SFX2_NOTEBOOKBAR_NOTEBOOKBARCONTEXTCONTROL_HXX + +#include <vcl/EnumContext.hxx> + +class NotebookBar; + +class NotebookbarContextControl +{ +public: + virtual ~NotebookbarContextControl() {} + virtual void SetContext( vcl::EnumContext::Context eContext ) = 0; + virtual void SetIconClickHdl( Link<NotebookBar*, void> aHdl ) = 0; +}; + +#endif // INCLUDED_SFX2_NOTEBOOKBAR_NOTEBOOKBARCONTEXTCONTROL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx b/include/sfx2/notebookbar/SfxNotebookBar.hxx index 67ee405fb355..e3735658d857 100644 --- a/include/sfx2/notebookbar/SfxNotebookBar.hxx +++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx @@ -46,7 +46,7 @@ private: static css::uno::Reference<css::frame::XLayoutManager> m_xLayoutManager; static css::uno::Reference<css::frame::XFrame> m_xFrame; - DECL_STATIC_LINK_TYPED(SfxNotebookBar, ToggleMenubar, NotebookBar*, void); + DECL_STATIC_LINK_TYPED(SfxNotebookBar, OpenNotebookbarPopupMenu, NotebookBar*, void); }; } // namespace sfx2 diff --git a/include/vcl/IContext.hxx b/include/vcl/IContext.hxx new file mode 100644 index 000000000000..09f9722a4597 --- /dev/null +++ b/include/vcl/IContext.hxx @@ -0,0 +1,54 @@ +/* -*- 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_VCL_ICONTEXT_HXX +#define INCLUDED_VCL_ICONTEXT_HXX + +#include <vcl/EnumContext.hxx> +#include <vector> + +namespace vcl +{ + +class VCL_DLLPUBLIC IContext +{ +protected: + IContext() + { + maContext.push_back( vcl::EnumContext::Context::Context_Any ); + } + +public: + void SetContext(const std::vector<vcl::EnumContext::Context>& aContext) + { + maContext = aContext; + } + + bool HasContext( const vcl::EnumContext::Context eContext ) const + { + auto aFind = std::find(maContext.begin(), maContext.end(), eContext); + if (aFind == maContext.end()) + return false; + return true; + } + + const std::vector< vcl::EnumContext::Context >& GetContext() const + { + return maContext; + } + +private: + std::vector<vcl::EnumContext::Context> maContext; +}; + +} // namespace vcl + +#endif // INCLUDED_VCL_ICONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 02fcaad564e9..eb9d94fdb171 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -19,10 +19,12 @@ #include <vcl/vclmedit.hxx> #include <vcl/window.hxx> #include <vcl/vclptr.hxx> +#include <vcl/IContext.hxx> #include <set> class VCL_DLLPUBLIC VclContainer : public vcl::Window, - public vcl::IPrioritable + public vcl::IPrioritable, + public vcl::IContext { public: VclContainer(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN); diff --git a/include/vcl/notebookbar.hxx b/include/vcl/notebookbar.hxx index 51f32aab6d45..d2a279ffe3ad 100644 --- a/include/vcl/notebookbar.hxx +++ b/include/vcl/notebookbar.hxx @@ -12,8 +12,8 @@ #include <vcl/builder.hxx> #include <vcl/ctrl.hxx> -#include <vcl/tabctrl.hxx> #include <vcl/EnumContext.hxx> +#include <sfx2/notebookbar/NotebookbarContextControl.hxx> #include <com/sun/star/ui/XContextChangeEventListener.hpp> /// This implements Widget Layout-based notebook-like menu bar. @@ -35,7 +35,7 @@ public: const css::uno::Reference<css::ui::XContextChangeEventListener>& getContextChangeEventListener() const { return m_pEventListener; } private: css::uno::Reference<css::ui::XContextChangeEventListener> m_pEventListener; - VclPtr<NotebookbarTabControl> m_pTabControl; + NotebookbarContextControl* m_pContextContainer; }; diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx index a79522a03586..b24e3dacf4e3 100644 --- a/include/vcl/tabctrl.hxx +++ b/include/vcl/tabctrl.hxx @@ -23,6 +23,7 @@ #include <vcl/dllapi.h> #include <vcl/ctrl.hxx> #include <vcl/EnumContext.hxx> +#include <sfx2/notebookbar/NotebookbarContextControl.hxx> struct ImplTabItem; struct ImplTabCtrlData; @@ -196,13 +197,14 @@ public: class NotebookBar; -class VCL_DLLPUBLIC NotebookbarTabControl : public TabControl +class VCL_DLLPUBLIC NotebookbarTabControl : public TabControl, + public NotebookbarContextControl { public: NotebookbarTabControl( vcl::Window* pParent ); - void SetContext( vcl::EnumContext::Context eContext ); - void SetIconClickHdl( Link<NotebookBar*, void> aHdl ); + void SetContext( vcl::EnumContext::Context eContext ) override; + void SetIconClickHdl( Link<NotebookBar*, void> aHdl ) override; virtual sal_uInt16 GetPageId( const Point& rPos ) const override; virtual void SelectTabPage( sal_uInt16 nPageId ) override; diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx index 5a35901c4007..0ee6776cca6f 100644 --- a/include/vcl/tabpage.hxx +++ b/include/vcl/tabpage.hxx @@ -24,19 +24,19 @@ #include <vcl/dllapi.h> #include <vcl/builder.hxx> #include <vcl/window.hxx> +#include <vcl/IContext.hxx> class VCL_DLLPUBLIC TabPage : public vcl::Window , public VclBuilderContainer + , public vcl::IContext { private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplInitSettings(); - std::vector<vcl::EnumContext::Context> maContext; - public: explicit TabPage( vcl::Window* pParent, WinBits nStyle = 0 ); explicit TabPage( vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription ); @@ -59,10 +59,6 @@ public: virtual void SetPosPixel(const Point& rNewPos) override; virtual void SetSizePixel(const Size& rNewSize) override; virtual Size GetOptimalSize() const override; - - void SetContext( const std::vector<vcl::EnumContext::Context>& aContext ); - bool HasContext( const vcl::EnumContext::Context eContext ) const; - const std::vector<vcl::EnumContext::Context>& GetContext() const; }; #endif // INCLUDED_VCL_TABPAGE_HXX |