diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2016-06-17 23:54:00 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-06-27 17:51:56 +0000 |
commit | 1df394503f1e62b091453c95c05a212892ae8d58 (patch) | |
tree | 4767346ce348cc498df09985b6fa431a45f255d3 /include | |
parent | 0c80b4dfd27109def7a5bdc34c3fcc5499db6c0d (diff) |
GSoC notebookbar: switching tabs depending on context
+ sfx2::sidebar::EnumContext moved to the vcl module
+ TabPage contains vector with context values
+ vcl builder reads control's contexts from the "class" mark
+ ContextTabControl shows tabs depending on context
Change-Id: I661b0d3f35d46ace2a2e8eb1d374148f0c60017d
Reviewed-on: https://gerrit.libreoffice.org/26447
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/notebookbar/SfxNotebookBar.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/sidebar/DeckDescriptor.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/sidebar/IContextChangeReceiver.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/sidebar/PanelDescriptor.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/sidebar/SidebarPanelBase.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/sidebar/TabBar.hxx | 1 | ||||
-rw-r--r-- | include/svx/ParaLineSpacingPopup.hxx | 2 | ||||
-rw-r--r-- | include/svx/ParaSpacingControl.hxx | 1 | ||||
-rw-r--r-- | include/svx/sidebar/ContextChangeEventMultiplexer.hxx | 6 | ||||
-rw-r--r-- | include/svx/sidebar/SelectionAnalyzer.hxx | 10 | ||||
-rw-r--r-- | include/svx/sidebar/SelectionChangeHandler.hxx | 6 | ||||
-rw-r--r-- | include/vcl/EnumContext.hxx (renamed from include/sfx2/sidebar/EnumContext.hxx) | 16 | ||||
-rw-r--r-- | include/vcl/builder.hxx | 4 | ||||
-rw-r--r-- | include/vcl/contexttabctrl.hxx | 39 | ||||
-rw-r--r-- | include/vcl/notebookbar.hxx | 20 | ||||
-rw-r--r-- | include/vcl/tabctrl.hxx | 2 | ||||
-rw-r--r-- | include/vcl/tabpage.hxx | 6 |
17 files changed, 98 insertions, 27 deletions
diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx b/include/sfx2/notebookbar/SfxNotebookBar.hxx index 156d6168f16b..1b79c78ece09 100644 --- a/include/sfx2/notebookbar/SfxNotebookBar.hxx +++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx @@ -29,6 +29,8 @@ public: static void StateMethod(SystemWindow* pSysWindow, const css::uno::Reference<css::frame::XFrame> xFrame, const OUString& rUIFile); + + static void RemoveListeners(SystemWindow* pSysWindow); }; } // namespace sfx2 diff --git a/include/sfx2/sidebar/DeckDescriptor.hxx b/include/sfx2/sidebar/DeckDescriptor.hxx index 8c1b9efb764c..a26256288b61 100644 --- a/include/sfx2/sidebar/DeckDescriptor.hxx +++ b/include/sfx2/sidebar/DeckDescriptor.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECKDESCRIPTOR_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_DECKDESCRIPTOR_HXX -#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/EnumContext.hxx> #include "ContextList.hxx" #include <sfx2/sidebar/Deck.hxx> diff --git a/include/sfx2/sidebar/IContextChangeReceiver.hxx b/include/sfx2/sidebar/IContextChangeReceiver.hxx index ea5c24a61af1..b8f65128fff5 100644 --- a/include/sfx2/sidebar/IContextChangeReceiver.hxx +++ b/include/sfx2/sidebar/IContextChangeReceiver.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SIDEBAR_ICONTEXTCHANGERECEIVER_HXX #define INCLUDED_SFX2_SIDEBAR_ICONTEXTCHANGERECEIVER_HXX -#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/EnumContext.hxx> #include <sfx2/dllapi.h> @@ -31,7 +31,7 @@ class SFX2_DLLPUBLIC IContextChangeReceiver public: virtual ~IContextChangeReceiver (); - virtual void HandleContextChange (const EnumContext& rContext) = 0; + virtual void HandleContextChange (const vcl::EnumContext& rContext) = 0; }; } } // end of namespace ::sd::sidebar diff --git a/include/sfx2/sidebar/PanelDescriptor.hxx b/include/sfx2/sidebar/PanelDescriptor.hxx index 2e1abb2d445e..f62076e12bd0 100644 --- a/include/sfx2/sidebar/PanelDescriptor.hxx +++ b/include/sfx2/sidebar/PanelDescriptor.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_PANELDESCRIPTOR_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_PANELDESCRIPTOR_HXX -#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/EnumContext.hxx> #include <sfx2/sidebar/ContextList.hxx> namespace sfx2 { namespace sidebar { diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx index 41e15348299a..606d65c335ef 100644 --- a/include/sfx2/sidebar/SidebarPanelBase.hxx +++ b/include/sfx2/sidebar/SidebarPanelBase.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SIDEBAR_SIDEBARPANELBASE_HXX #define INCLUDED_SFX2_SIDEBAR_SIDEBARPANELBASE_HXX -#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/EnumContext.hxx> #include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <cppuhelper/compbase5.hxx> diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx index 5a8c0cdeca39..a805a94cd42a 100644 --- a/include/sfx2/sidebar/TabBar.hxx +++ b/include/sfx2/sidebar/TabBar.hxx @@ -19,6 +19,7 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX +#include <sfx2//dllapi.h> #include "DeckDescriptor.hxx" #include <sfx2/sidebar/ResourceManager.hxx> diff --git a/include/svx/ParaLineSpacingPopup.hxx b/include/svx/ParaLineSpacingPopup.hxx index 19bbfd47eb66..c9f761c91beb 100644 --- a/include/svx/ParaLineSpacingPopup.hxx +++ b/include/svx/ParaLineSpacingPopup.hxx @@ -20,7 +20,7 @@ #define INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARALINESPACINGPOPUP_HXX #include <editeng/lspcitem.hxx> -#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/EnumContext.hxx> #include <sfx2/tbxctrl.hxx> #include <svl/poolitem.hxx> #include <svx/svxdllapi.h> diff --git a/include/svx/ParaSpacingControl.hxx b/include/svx/ParaSpacingControl.hxx index 03e7cf9dfe39..b4e287c2370f 100644 --- a/include/svx/ParaSpacingControl.hxx +++ b/include/svx/ParaSpacingControl.hxx @@ -25,7 +25,6 @@ #include <com/sun/star/ui/XContextChangeEventListener.hpp> #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> #include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp> -#include <sfx2/sidebar/EnumContext.hxx> namespace svx { diff --git a/include/svx/sidebar/ContextChangeEventMultiplexer.hxx b/include/svx/sidebar/ContextChangeEventMultiplexer.hxx index d5cb3916f84f..9b94e9067faa 100644 --- a/include/svx/sidebar/ContextChangeEventMultiplexer.hxx +++ b/include/svx/sidebar/ContextChangeEventMultiplexer.hxx @@ -20,7 +20,7 @@ #define INCLUDED_SVX_SIDEBAR_CONTEXTCHANGEEVENTMULTIPLEXER_HXX #include <svx/svxdllapi.h> -#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/EnumContext.hxx> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -41,7 +41,7 @@ public: */ static void NotifyContextChange ( const css::uno::Reference<css::frame::XController>& rxController, - const ::sfx2::sidebar::EnumContext::Context eContext); + const vcl::EnumContext::Context eContext); /** Notify the activation of a context. @param pViewShell @@ -53,7 +53,7 @@ public: */ static void NotifyContextChange ( SfxViewShell* pViewShell, - const ::sfx2::sidebar::EnumContext::Context eContext); + const vcl::EnumContext::Context eContext); private: static ::rtl::OUString GetModuleName ( diff --git a/include/svx/sidebar/SelectionAnalyzer.hxx b/include/svx/sidebar/SelectionAnalyzer.hxx index 62c411624f2e..e80f5db6c0be 100644 --- a/include/svx/sidebar/SelectionAnalyzer.hxx +++ b/include/svx/sidebar/SelectionAnalyzer.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SVX_SIDEBAR_SELECTIONANALYZER_HXX #define INCLUDED_SVX_SIDEBAR_SELECTIONANALYZER_HXX -#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/EnumContext.hxx> #include <svx/svxdllapi.h> class SdrMarkList; @@ -36,7 +36,7 @@ namespace svx { namespace sidebar { class SVX_DLLPUBLIC SelectionAnalyzer { public: - static sfx2::sidebar::EnumContext::Context GetContextForSelection_SC ( + static vcl::EnumContext::Context GetContextForSelection_SC ( const SdrMarkList& rMarkList); enum ViewType @@ -47,14 +47,14 @@ public: VT_Notes, VT_Outline }; - static sfx2::sidebar::EnumContext::Context GetContextForSelection_SD ( + static vcl::EnumContext::Context GetContextForSelection_SD ( const SdrMarkList& rMarkList, const ViewType eViewType); private: - static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SC ( + static vcl::EnumContext::Context GetContextForObjectId_SC ( const sal_uInt16 nObjectId); - static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SD ( + static vcl::EnumContext::Context GetContextForObjectId_SD ( const sal_uInt16 nObjectId, const ViewType eViewType); static sal_uInt32 GetInventorTypeFromMark ( diff --git a/include/svx/sidebar/SelectionChangeHandler.hxx b/include/svx/sidebar/SelectionChangeHandler.hxx index 841ab32b546f..38d72ab2cca4 100644 --- a/include/svx/sidebar/SelectionChangeHandler.hxx +++ b/include/svx/sidebar/SelectionChangeHandler.hxx @@ -20,7 +20,7 @@ #define INCLUDED_SVX_SIDEBAR_SELECTIONCHANGEHANDLER_HXX #include <svx/svxdllapi.h> -#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/EnumContext.hxx> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/view/XSelectionChangeListener.hpp> @@ -50,7 +50,7 @@ public: SelectionChangeHandler ( const std::function<rtl::OUString ()>& rSelectionChangeCallback, const css::uno::Reference<css::frame::XController>& rxController, - const sfx2::sidebar::EnumContext::Context eDefaultContext); + const vcl::EnumContext::Context eDefaultContext); virtual ~SelectionChangeHandler(); virtual void SAL_CALL selectionChanged (const css::lang::EventObject& rEvent) @@ -71,7 +71,7 @@ private: const std::function<rtl::OUString ()> maSelectionChangeCallback; css::uno::Reference<css::frame::XController> mxController; - const sfx2::sidebar::EnumContext::Context meDefaultContext; + const vcl::EnumContext::Context meDefaultContext; bool mbIsConnected; }; diff --git a/include/sfx2/sidebar/EnumContext.hxx b/include/vcl/EnumContext.hxx index 2dfa5a251d8a..cb48266d168c 100644 --- a/include/sfx2/sidebar/EnumContext.hxx +++ b/include/vcl/EnumContext.hxx @@ -16,19 +16,19 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SFX2_SIDEBAR_ENUMCONTEXT_HXX -#define INCLUDED_SFX2_SIDEBAR_ENUMCONTEXT_HXX +#ifndef INCLUDED_VCL_ENUMCONTEXT_HXX +#define INCLUDED_VCL_ENUMCONTEXT_HXX -#include <sfx2/dllapi.h> +#include <vcl/dllapi.h> #include <rtl/ustring.hxx> #include <vector> -namespace sfx2 { namespace sidebar { +namespace vcl { -class SFX2_DLLPUBLIC EnumContext +class VCL_DLLPUBLIC EnumContext { public: enum Application @@ -157,10 +157,10 @@ private: }; -#define CombinedEnumContext(a,e) ((static_cast<sal_uInt16>(::sfx2::sidebar::EnumContext::a)<<16)\ - | static_cast<sal_uInt16>(::sfx2::sidebar::EnumContext::e)) +#define CombinedEnumContext(a,e) ((static_cast<sal_uInt16>(::vcl::EnumContext::a)<<16)\ + | static_cast<sal_uInt16>(::vcl::EnumContext::e)) -} } // end of namespace sfx2::sidebar +} // end of namespace vcl #endif diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 8c50feeb2831..353d818cde49 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -18,6 +18,8 @@ #include <vcl/dllapi.h> #include <vcl/window.hxx> #include <vcl/vclptr.hxx> +#include <tools/wintypes.hxx> +#include <vcl/EnumContext.hxx> #include <memory> #include <map> @@ -349,6 +351,8 @@ private: void handleChild(vcl::Window *pParent, xmlreader::XmlReader &reader); VclPtr<vcl::Window> handleObject(vcl::Window *pParent, xmlreader::XmlReader &reader); void handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader); + std::vector<vcl::EnumContext::Context> handleStyle(xmlreader::XmlReader &reader); + vcl::EnumContext::Context getContext(xmlreader::XmlReader &reader); void applyPackingProperty(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader); void collectProperty(xmlreader::XmlReader &reader, const OString &rID, stringmap &rVec); static void collectPangoAttribute(xmlreader::XmlReader &reader, stringmap &rMap); diff --git a/include/vcl/contexttabctrl.hxx b/include/vcl/contexttabctrl.hxx new file mode 100644 index 000000000000..452d9f30190b --- /dev/null +++ b/include/vcl/contexttabctrl.hxx @@ -0,0 +1,39 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_CONTEXTTABCTRL_HXX +#define INCLUDED_VCL_CONTEXTTABCTRL_HXX + +#include <vcl/EnumContext.hxx> +#include <vcl/tabctrl.hxx> + +class VCL_DLLPUBLIC ContextTabControl : public TabControl +{ +public: + ContextTabControl( vcl::Window* pParent, WinBits nStyle = WB_STDTABCONTROL ); + + void SetContext( vcl::EnumContext::Context eContext ); + +private: + vcl::EnumContext::Context eLastContext; +}; + +#endif // INCLUDED_VCL_TABCTRL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/notebookbar.hxx b/include/vcl/notebookbar.hxx index 9dd7e9f5b708..37fa7ee3dc36 100644 --- a/include/vcl/notebookbar.hxx +++ b/include/vcl/notebookbar.hxx @@ -12,9 +12,13 @@ #include <vcl/builder.hxx> #include <vcl/ctrl.hxx> +#include <vcl/contexttabctrl.hxx> +#include <com/sun/star/ui/XContextChangeEventListener.hpp> +#include <vcl/EnumContext.hxx> /// This implements Widget Layout-based notebook-like menu bar. -class NotebookBar : public Control, public VclBuilderContainer +class NotebookBar : public Control, public VclBuilderContainer, + public css::ui::XContextChangeEventListener { public: NotebookBar(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame); @@ -25,6 +29,20 @@ public: virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) SAL_OVERRIDE; virtual void StateChanged(StateChangedType nType) override; + + // XContextChangeEventListener + virtual void SAL_CALL notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent) + throw (css::uno::RuntimeException, std::exception) override; + + virtual ::css::uno::Any SAL_CALL queryInterface(const ::css::uno::Type& aType) + throw (::css::uno::RuntimeException, ::std::exception) override; + virtual void SAL_CALL acquire() throw () override; + virtual void SAL_CALL release() throw () override; + virtual void SAL_CALL disposing(const ::css::lang::EventObject&) + throw (::css::uno::RuntimeException, ::std::exception) override; + +private: + VclPtr<ContextTabControl> m_pTabControl; }; #endif // INCLUDED_VCL_NOTEBOOKBAR_HXX diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx index 4b3e0e83d7fd..410cb2be8f44 100644 --- a/include/vcl/tabctrl.hxx +++ b/include/vcl/tabctrl.hxx @@ -56,6 +56,7 @@ private: bool mbRestoreHelpId; bool mbSmallInvalidate; bool mbLayoutDirty; + bool mbHideDisabledTabs; Link<TabControl*,void> maActivateHdl; Link<TabControl*,bool> maDeactivateHdl; @@ -125,6 +126,7 @@ public: void RemovePage( sal_uInt16 nPageId ); void Clear(); void EnablePage( sal_uInt16 nPageId, bool bEnable = true ); + void HideDisabledTabs(bool bHide = true); sal_uInt16 GetPagePos( sal_uInt16 nPageId ) const; sal_uInt16 GetPageCount() const; diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx index b1c16e0d5560..5a35901c4007 100644 --- a/include/vcl/tabpage.hxx +++ b/include/vcl/tabpage.hxx @@ -35,6 +35,8 @@ private: 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 ); @@ -57,6 +59,10 @@ 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 |