diff options
75 files changed, 2087 insertions, 157 deletions
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 405bb91d2864..42bd37ffe5aa 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -45,6 +45,10 @@ #include "UITools.hxx" #include "commontypes.hxx" +#include <com/sun/star/ui/XSidebarProvider.hpp> +#include <sfx2/sidebar/UnoSidebar.hxx> + + #include <vcl/waitobj.hxx> #include <svl/urihelper.hxx> #include "datasourceconnector.hxx" @@ -72,6 +76,7 @@ using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::task; using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::ui; using namespace ::dbtools; using namespace ::comphelper; @@ -367,6 +372,11 @@ Reference< XWindow > SAL_CALL OGenericUnoController::getComponentWindow() throw return VCLUnoHelper::GetInterface( getView() ); } +Reference<XSidebarProvider> SAL_CALL OGenericUnoController::getSidebar() throw (RuntimeException, std::exception) +{ + return NULL; +} + OUString SAL_CALL OGenericUnoController::getViewControllerName() throw (::com::sun::star::uno::RuntimeException, std::exception) { return OUString( "Default" ); diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx index 07a9decc97ca..f1953218ef15 100644 --- a/include/dbaccess/genericcontroller.hxx +++ b/include/dbaccess/genericcontroller.hxx @@ -61,6 +61,8 @@ #include <sfx2/userinputinterception.hxx> #include <vcl/vclptr.hxx> +#include <com/sun/star/ui/XSidebarProvider.hpp> + namespace dbtools { class SQLExceptionInfo; @@ -465,6 +467,9 @@ namespace dbaui virtual OUString SAL_CALL getViewControllerName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCreationArguments() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XSidebarProvider > SAL_CALL getSidebar() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + // ::com::sun::star::frame::XController virtual void SAL_CALL attachFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; diff --git a/include/sfx2/sfxbasecontroller.hxx b/include/sfx2/sfxbasecontroller.hxx index 0f77a44f0833..d387d80485ed 100644 --- a/include/sfx2/sfxbasecontroller.hxx +++ b/include/sfx2/sfxbasecontroller.hxx @@ -48,6 +48,8 @@ #include <tools/link.hxx> #include <vcl/button.hxx> +#include <com/sun/star/ui/XSidebarProvider.hpp> + #include <sfx2/viewsh.hxx> #include <sfx2/sfxuno.hxx> @@ -101,6 +103,8 @@ public: virtual OUString SAL_CALL getViewControllerName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCreationArguments() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual css::uno::Reference< css::ui::XSidebarProvider > SAL_CALL getSidebar() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // XController diff --git a/sfx2/source/sidebar/Accessible.hxx b/include/sfx2/sidebar/Accessible.hxx index 6f786f00663a..6f786f00663a 100644 --- a/sfx2/source/sidebar/Accessible.hxx +++ b/include/sfx2/sidebar/Accessible.hxx diff --git a/sfx2/source/sidebar/AccessibleTitleBar.hxx b/include/sfx2/sidebar/AccessibleTitleBar.hxx index 49e68e74265a..49e68e74265a 100644 --- a/sfx2/source/sidebar/AccessibleTitleBar.hxx +++ b/include/sfx2/sidebar/AccessibleTitleBar.hxx diff --git a/sfx2/source/sidebar/AsynchronousCall.hxx b/include/sfx2/sidebar/AsynchronousCall.hxx index 338505c83e4b..338505c83e4b 100644 --- a/sfx2/source/sidebar/AsynchronousCall.hxx +++ b/include/sfx2/sidebar/AsynchronousCall.hxx diff --git a/sfx2/source/sidebar/Context.hxx b/include/sfx2/sidebar/Context.hxx index b9430baedfb3..b9430baedfb3 100644 --- a/sfx2/source/sidebar/Context.hxx +++ b/include/sfx2/sidebar/Context.hxx diff --git a/sfx2/source/sidebar/ContextList.hxx b/include/sfx2/sidebar/ContextList.hxx index 98860078de93..5171072fa942 100644 --- a/sfx2/source/sidebar/ContextList.hxx +++ b/include/sfx2/sidebar/ContextList.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_CONTEXTLIST_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_CONTEXTLIST_HXX -#include "Context.hxx" +#include <sfx2/sidebar/Context.hxx> #include <sal/types.h> #include <rtl/ustring.hxx> @@ -55,6 +55,8 @@ public: const bool bIsInitiallyVisible, const ::rtl::OUString& rsMenuCommand); + sal_Int32 GetCount(); + private: ::std::vector<Entry> maEntries; diff --git a/sfx2/source/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx index 9efaadc94fed..edd735c3cc0e 100644 --- a/sfx2/source/sidebar/Deck.hxx +++ b/include/sfx2/sidebar/Deck.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECK_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_DECK_HXX -#include "Panel.hxx" +#include <sfx2/sidebar/Panel.hxx> #include <vcl/window.hxx> #include <vcl/image.hxx> @@ -44,17 +44,15 @@ public: virtual ~Deck(); virtual void dispose() SAL_OVERRIDE; - const OUString& GetId() const - { - return msId; - } + const OUString& GetId() const { return msId; } + DeckTitleBar* GetTitleBar() const; Rectangle GetContentArea() const; void ResetPanels (const SharedPanelContainer& rPanels); - const SharedPanelContainer& GetPanels() const - { - return maPanels; - } + const SharedPanelContainer& GetPanels() const { return maPanels; } + + Panel* GetPanel(OUString panelId); + void RequestLayout(); vcl::Window* GetPanelParentWindow(); diff --git a/sfx2/source/sidebar/DeckDescriptor.hxx b/include/sfx2/sidebar/DeckDescriptor.hxx index 77f811e77bf7..a0980c6bde78 100644 --- a/sfx2/source/sidebar/DeckDescriptor.hxx +++ b/include/sfx2/sidebar/DeckDescriptor.hxx @@ -23,6 +23,8 @@ #include "ContextList.hxx" #include <boost/shared_ptr.hpp> +#include <sfx2/sidebar/Deck.hxx> + namespace sfx2 { namespace sidebar { class DeckDescriptor @@ -41,6 +43,8 @@ public: sal_Int32 mnOrderIndex; bool mbExperimental; + VclPtr<Deck> mpDeck; + DeckDescriptor(); DeckDescriptor (const DeckDescriptor& rOther); ~DeckDescriptor(); diff --git a/sfx2/source/sidebar/DeckLayouter.hxx b/include/sfx2/sidebar/DeckLayouter.hxx index 965fb5614247..8b3b24810aba 100644 --- a/sfx2/source/sidebar/DeckLayouter.hxx +++ b/include/sfx2/sidebar/DeckLayouter.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECKLAYOUTER_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_DECKLAYOUTER_HXX -#include "Panel.hxx" +#include <sfx2/sidebar/Panel.hxx> #include <tools/gen.hxx> diff --git a/sfx2/source/sidebar/DeckTitleBar.hxx b/include/sfx2/sidebar/DeckTitleBar.hxx index bd47883dccc9..3b42958f459e 100644 --- a/sfx2/source/sidebar/DeckTitleBar.hxx +++ b/include/sfx2/sidebar/DeckTitleBar.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECKTITLEBAR_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_DECKTITLEBAR_HXX -#include "TitleBar.hxx" +#include <sfx2/sidebar/TitleBar.hxx> namespace sfx2 { namespace sidebar { diff --git a/sfx2/source/sidebar/DrawHelper.hxx b/include/sfx2/sidebar/DrawHelper.hxx index 97bdb0c04530..97bdb0c04530 100644 --- a/sfx2/source/sidebar/DrawHelper.hxx +++ b/include/sfx2/sidebar/DrawHelper.hxx diff --git a/sfx2/source/sidebar/FocusManager.hxx b/include/sfx2/sidebar/FocusManager.hxx index f93f9e82c368..f93f9e82c368 100644 --- a/sfx2/source/sidebar/FocusManager.hxx +++ b/include/sfx2/sidebar/FocusManager.hxx diff --git a/sfx2/source/sidebar/MenuButton.hxx b/include/sfx2/sidebar/MenuButton.hxx index d725fb71c01d..d725fb71c01d 100644 --- a/sfx2/source/sidebar/MenuButton.hxx +++ b/include/sfx2/sidebar/MenuButton.hxx diff --git a/sfx2/source/sidebar/Paint.hxx b/include/sfx2/sidebar/Paint.hxx index 91b36f093bf8..91b36f093bf8 100644 --- a/sfx2/source/sidebar/Paint.hxx +++ b/include/sfx2/sidebar/Paint.hxx diff --git a/sfx2/source/sidebar/Panel.hxx b/include/sfx2/sidebar/Panel.hxx index 52e6e49018cf..b42dbc9779f0 100644 --- a/sfx2/source/sidebar/Panel.hxx +++ b/include/sfx2/sidebar/Panel.hxx @@ -19,11 +19,13 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_PANEL_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_PANEL_HXX -#include "Context.hxx" +#include <sfx2/sidebar/Context.hxx> + #include <vcl/window.hxx> #include <com/sun/star/ui/XUIElement.hpp> #include <com/sun/star/ui/XSidebarPanel.hpp> +#include <com/sun/star/frame/XFrame.hpp> #include <boost/scoped_ptr.hpp> #include <boost/shared_ptr.hpp> @@ -40,7 +42,9 @@ class Panel : public vcl::Window public: Panel(const PanelDescriptor& rPanelDescriptor, vcl::Window* pParentWindow, const bool bIsInitiallyExpanded, const std::function<void()>& rDeckLayoutTrigger, - const std::function<Context()>& rContextAccess); + const std::function<Context()>& rContextAccess, + const css::uno::Reference<css::frame::XFrame>& rxFrame); + virtual ~Panel(); virtual void dispose() SAL_OVERRIDE; @@ -69,6 +73,9 @@ private: bool mbIsExpanded; const std::function<void()> maDeckLayoutTrigger; const std::function<Context()> maContextAccess; + + const css::uno::Reference<css::frame::XFrame>& mxFrame; + }; typedef std::vector<VclPtr<Panel> > SharedPanelContainer; diff --git a/sfx2/source/sidebar/PanelDescriptor.hxx b/include/sfx2/sidebar/PanelDescriptor.hxx index f67a12805471..fa490b9ec0f0 100644 --- a/sfx2/source/sidebar/PanelDescriptor.hxx +++ b/include/sfx2/sidebar/PanelDescriptor.hxx @@ -20,7 +20,7 @@ #define INCLUDED_SFX2_SOURCE_SIDEBAR_PANELDESCRIPTOR_HXX #include <sfx2/sidebar/EnumContext.hxx> -#include "ContextList.hxx" +#include <sfx2/sidebar/ContextList.hxx> #include <boost/shared_ptr.hpp> namespace sfx2 { namespace sidebar { diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/include/sfx2/sidebar/PanelTitleBar.hxx index 8c0f7e8849f5..c08140244fb8 100644 --- a/sfx2/source/sidebar/PanelTitleBar.hxx +++ b/include/sfx2/sidebar/PanelTitleBar.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_PANELTITLEBAR_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_PANELTITLEBAR_HXX -#include "TitleBar.hxx" +#include <sfx2/sidebar/TitleBar.hxx> #include <com/sun/star/frame/XFrame.hpp> #include <boost/function.hpp> diff --git a/sfx2/source/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx index 9151760d00e4..4e6247d5c645 100644 --- a/sfx2/source/sidebar/ResourceManager.hxx +++ b/include/sfx2/sidebar/ResourceManager.hxx @@ -21,7 +21,7 @@ #include "DeckDescriptor.hxx" #include "PanelDescriptor.hxx" -#include "Context.hxx" +#include <sfx2/sidebar/Context.hxx> #include <unotools/confignode.hxx> #include <com/sun/star/frame/XFrame.hpp> #include <set> @@ -40,6 +40,10 @@ class ContextList; class ResourceManager { public: + + ResourceManager(); + ~ResourceManager(); + static ResourceManager& Instance(); const DeckDescriptor* GetDeckDescriptor(const OUString& rsDeckId) const; @@ -54,6 +58,13 @@ public: */ void SetIsDeckEnabled(const OUString& rsDeckId, const bool bIsEnabled); + void SetDeckToDescriptor(const OUString& rsDeckId, VclPtr<Deck> aDeck); + + void SetDeckOrderIndex(const OUString& rsDeckId, const sal_Int32 orderIndex); + + void SetPanelOrderIndex(const OUString& rsPanelId, const sal_Int32 orderIndex); + + class DeckContextDescriptor { public: @@ -92,8 +103,7 @@ public: const Context& rContext); private: - ResourceManager(); - ~ResourceManager(); + typedef std::vector<DeckDescriptor> DeckContainer; DeckContainer maDecks; diff --git a/sfx2/source/sidebar/Sidebar.hrc b/include/sfx2/sidebar/Sidebar.hrc index 8f62aecbc91d..8f62aecbc91d 100644 --- a/sfx2/source/sidebar/Sidebar.hrc +++ b/include/sfx2/sidebar/Sidebar.hrc diff --git a/sfx2/source/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index 5fb8466b1fbc..0e1fe0e09559 100644 --- a/sfx2/source/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -23,12 +23,12 @@ #include <map> -#include "AsynchronousCall.hxx" -#include "Context.hxx" -#include "FocusManager.hxx" -#include "Panel.hxx" -#include "ResourceManager.hxx" -#include "TabBar.hxx" +#include <sfx2/sidebar/AsynchronousCall.hxx> +#include <sfx2/sidebar/Context.hxx> +#include <sfx2/sidebar/FocusManager.hxx> +#include <sfx2/sidebar/Panel.hxx> +#include <sfx2/sidebar/ResourceManager.hxx> +#include <sfx2/sidebar/TabBar.hxx> #include <vcl/menu.hxx> @@ -45,6 +45,8 @@ #include <cppuhelper/basemutex.hxx> #include <cppuhelper/weakref.hxx> + + namespace { typedef ::cppu::WeakComponentImplHelper4 < @@ -137,6 +139,21 @@ public: FocusManager& GetFocusManager() { return maFocusManager;} + ResourceManager* GetResourceManager() { return mpResourceManager.get();} + + // std::unique_ptr<ResourceManager> GetResourceManager() { return mpResourceManager;} + + Context GetCurrentContext() const { return maCurrentContext;} + bool IsDocumentReadOnly (void) const { return mbIsDocumentReadOnly;} + + void SwitchToDeck ( const ::rtl::OUString& rsDeckId); + void SwitchToDefaultDeck(); + + void CreateDeck(const ::rtl::OUString& rDeckId); + + ResourceManager::DeckContextDescriptorContainer GetMatchingDecks(); + ResourceManager::PanelContextDescriptorContainer GetMatchingPanels( const ::rtl::OUString& rDeckId); + private: typedef ::std::map< const css::uno::Reference<css::frame::XFrame>, @@ -198,13 +215,13 @@ private: const ::rtl::OUString& rsImplementationURL, const bool bWantsCanvas, const Context& rContext); + VclPtr<Panel> CreatePanel ( const ::rtl::OUString& rsPanelId, vcl::Window* pParentWindow, const bool bIsInitiallyExpanded, const Context& rContext); - void SwitchToDeck ( - const ::rtl::OUString& rsDeckId); + void SwitchToDeck ( const DeckDescriptor& rDeckDescriptor, const Context& rContext); @@ -245,9 +262,10 @@ private: */ void ShowPanel (const Panel& rPanel); - Context GetCurrentContext() const { return maCurrentContext;} - virtual void SAL_CALL disposing() SAL_OVERRIDE; + + std::unique_ptr<ResourceManager> mpResourceManager; + }; } } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/SidebarDockingWindow.hxx b/include/sfx2/sidebar/SidebarDockingWindow.hxx index defbb17315e2..defbb17315e2 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.hxx +++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx diff --git a/sfx2/source/sidebar/SidebarResource.hxx b/include/sfx2/sidebar/SidebarResource.hxx index 3a6363a49b0d..78ce96b2b4ea 100644 --- a/sfx2/source/sidebar/SidebarResource.hxx +++ b/include/sfx2/sidebar/SidebarResource.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_SIDEBARRESOURCE_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_SIDEBARRESOURCE_HXX -#include "Sidebar.hrc" +#include <sfx2/sidebar/Sidebar.hrc> #include <sfx2/sfxresid.hxx> #include <tools/rc.hxx> diff --git a/sfx2/source/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx index 37089f873d56..1fe2a27a9085 100644 --- a/sfx2/source/sidebar/TabBar.hxx +++ b/include/sfx2/sidebar/TabBar.hxx @@ -20,7 +20,8 @@ #define INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX #include "DeckDescriptor.hxx" -#include "ResourceManager.hxx" +#include <sfx2/sidebar/ResourceManager.hxx> + #include <vcl/menu.hxx> #include <vcl/window.hxx> @@ -39,6 +40,7 @@ namespace sfx2 { namespace sidebar { class FocusManager; class TabBarConfiguration; class TabItem; +class SidebarController; /** The tab bar is the container for the individual tabs. */ @@ -66,7 +68,9 @@ public: vcl::Window* pParentWindow, const css::uno::Reference<css::frame::XFrame>& rxFrame, const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor, - const PopupMenuProvider& rPopupMenuProvider); + const PopupMenuProvider& rPopupMenuProvider, + SidebarController* rParentSidebarController); + virtual ~TabBar(); virtual void dispose() SAL_OVERRIDE; @@ -120,6 +124,8 @@ private: void ShowPopupMenu() const; DECL_LINK(OnToolboxClicked, void*); + SidebarController* pParentSidebarController; + }; diff --git a/sfx2/source/sidebar/TabItem.hxx b/include/sfx2/sidebar/TabItem.hxx index f63e4e2ea3cb..c5eaabb858c1 100644 --- a/sfx2/source/sidebar/TabItem.hxx +++ b/include/sfx2/sidebar/TabItem.hxx @@ -21,7 +21,7 @@ #include <vcl/button.hxx> -#include "DeckDescriptor.hxx" +#include <sfx2/sidebar/DeckDescriptor.hxx> namespace vcl { class Window; } diff --git a/sfx2/source/sidebar/TitleBar.hxx b/include/sfx2/sidebar/TitleBar.hxx index b0bc5d813816..9a4d343cf067 100644 --- a/sfx2/source/sidebar/TitleBar.hxx +++ b/include/sfx2/sidebar/TitleBar.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_TITLEBAR_HXX #define INCLUDED_SFX2_SOURCE_SIDEBAR_TITLEBAR_HXX -#include "Paint.hxx" +#include <sfx2/sidebar/Paint.hxx> #include <vcl/fixed.hxx> #include <sfx2/sidebar/SidebarToolBox.hxx> @@ -35,7 +35,9 @@ public: virtual ~TitleBar(); virtual void dispose() SAL_OVERRIDE; - void SetTitle (const ::rtl::OUString& rsTitle); + void SetTitle (const OUString& rsTitle); + const OUString GetTitle() {return msTitle; } + void SetIcon (const Image& rIcon); virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; diff --git a/sfx2/source/sidebar/ToolBox.hxx b/include/sfx2/sidebar/ToolBox.hxx index 834d7cb2b7a0..834d7cb2b7a0 100644 --- a/sfx2/source/sidebar/ToolBox.hxx +++ b/include/sfx2/sidebar/ToolBox.hxx diff --git a/include/sfx2/sidebar/UnoDeck.hxx b/include/sfx2/sidebar/UnoDeck.hxx new file mode 100644 index 000000000000..1d9fcc2096b4 --- /dev/null +++ b/include/sfx2/sidebar/UnoDeck.hxx @@ -0,0 +1,79 @@ +/* -*- 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_SIDEBAR_UNODECK_HXX +#define INCLUDED_SFX2_SIDEBAR_UNODECK_HXX + + +#include <com/sun/star/ui/XDeck.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/ui/XPanels.hpp> + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/weakref.hxx> + +#include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/ResourceManager.hxx> + +/** get the decks +*/ +class SfxUnoDeck : public ::cppu::WeakImplHelper1< css::ui::XDeck > +{ + +public: + + SfxUnoDeck(const css::uno::Reference<css::frame::XFrame>& , const OUString&); + virtual ~SfxUnoDeck() {}; + + virtual OUString SAL_CALL getId() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual OUString SAL_CALL getTitle() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setTitle( const OUString& newTitle ) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual sal_Bool SAL_CALL isActive() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL activate( const sal_Bool bActivate ) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual css::uno::Reference<css::ui::XPanels> SAL_CALL getPanels() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual sal_Int32 SAL_CALL getOrderIndex() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setOrderIndex( const sal_Int32 newOrderIndex ) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL moveFirst() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL moveLast() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL moveUp() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL moveDown() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + + const OUString mDeckId; + const OUString mTitle; + + sal_Int32 GetMaxOrderIndex(sfx2::sidebar::ResourceManager::DeckContextDescriptorContainer aDecks); + sal_Int32 GetMinOrderIndex(sfx2::sidebar::ResourceManager::DeckContextDescriptorContainer aDecks); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sidebar/UnoDecks.hxx b/include/sfx2/sidebar/UnoDecks.hxx new file mode 100644 index 000000000000..5e0089935dd6 --- /dev/null +++ b/include/sfx2/sidebar/UnoDecks.hxx @@ -0,0 +1,75 @@ +/* -*- 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_SIDEBAR_DECKS_HXX +#define INCLUDED_SFX2_SIDEBAR_DECKS_HXX + + +#include <com/sun/star/ui/XDecks.hpp> + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/weakref.hxx> + +#include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/ResourceManager.hxx> + +/** get the decks +*/ +class SfxUnoDecks : public ::cppu::WeakImplHelper1< css::ui::XDecks > +{ + +public: + + SfxUnoDecks(const css::uno::Reference<css::frame::XFrame>&); + virtual ~SfxUnoDecks() {}; + +// XNameAccess + + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) + throw(css::container::NoSuchElementException, + css::lang::WrappedTargetException, + css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +// XIndexAccess + + virtual sal_Int32 SAL_CALL getCount() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(css::lang::IndexOutOfBoundsException, + css::lang::WrappedTargetException, + css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +// XElementAccess + virtual css::uno::Type SAL_CALL getElementType() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL hasElements() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/include/sfx2/sidebar/UnoPanel.hxx b/include/sfx2/sidebar/UnoPanel.hxx new file mode 100644 index 000000000000..051a00d8d5a0 --- /dev/null +++ b/include/sfx2/sidebar/UnoPanel.hxx @@ -0,0 +1,86 @@ +/* -*- 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_SIDEBAR_UNOPANEL_HXX +#define INCLUDED_SFX2_SIDEBAR_UNOPANEL_HXX + +#include <com/sun/star/ui/XPanel.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/awt/XWindow.hpp> + + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/weakref.hxx> + +#include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/Panel.hxx> +#include <sfx2/sidebar/Deck.hxx> +#include <sfx2/sidebar/ResourceManager.hxx> + + +/** get the Panel +*/ +class SfxUnoPanel : public ::cppu::WeakImplHelper1< css::ui::XPanel > +{ + +public: + + SfxUnoPanel(const css::uno::Reference<css::frame::XFrame>& , const OUString&, const OUString&); + virtual ~SfxUnoPanel() {}; + + virtual OUString SAL_CALL getId() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual OUString SAL_CALL getTitle() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setTitle( const OUString& newTitle ) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual sal_Bool SAL_CALL isExpanded() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL expand( const sal_Bool bCollapseOther ) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL collapse( ) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual sal_Int32 SAL_CALL getOrderIndex() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setOrderIndex( const sal_Int32 newOrderIndex ) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL moveFirst() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL moveLast() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL moveUp() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL moveDown() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getDialog() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + + const OUString mPanelId; + const OUString mDeckId; + + sfx2::sidebar::Deck* mpDeck; + sfx2::sidebar::Panel* mpPanel; + + sal_Int32 GetMaxOrderIndex(sfx2::sidebar::ResourceManager::PanelContextDescriptorContainer aPanels); + sal_Int32 GetMinOrderIndex(sfx2::sidebar::ResourceManager::PanelContextDescriptorContainer aPanels); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sidebar/UnoPanels.hxx b/include/sfx2/sidebar/UnoPanels.hxx new file mode 100644 index 000000000000..679163347e46 --- /dev/null +++ b/include/sfx2/sidebar/UnoPanels.hxx @@ -0,0 +1,78 @@ +/* -*- 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_SIDEBAR_PANELS_HXX +#define INCLUDED_SFX2_SIDEBAR_PANELS_HXX + + +#include <com/sun/star/ui/XPanels.hpp> + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/weakref.hxx> + +#include <sfx2/sidebar/SidebarController.hxx> + +/** get the decks +*/ +class SfxUnoPanels : public ::cppu::WeakImplHelper1< css::ui::XPanels > +{ + +public: + + SfxUnoPanels(const css::uno::Reference<css::frame::XFrame>& , const OUString&); + virtual ~SfxUnoPanels() {}; + +// XPanels + virtual OUString SAL_CALL getDeckId() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +// XNameAccess + + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) + throw(css::container::NoSuchElementException, + css::lang::WrappedTargetException, + css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +// XIndexAccess + + virtual sal_Int32 SAL_CALL getCount() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(css::lang::IndexOutOfBoundsException, + css::lang::WrappedTargetException, + css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +// XElementAccess + virtual css::uno::Type SAL_CALL getElementType() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL hasElements() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + const OUString& mDeckId; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sidebar/UnoSidebar.hxx b/include/sfx2/sidebar/UnoSidebar.hxx new file mode 100644 index 000000000000..6c154c0840a5 --- /dev/null +++ b/include/sfx2/sidebar/UnoSidebar.hxx @@ -0,0 +1,63 @@ +/* -*- 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_SIDEBAR_SIDEBAR_HXX +#define INCLUDED_SFX2_SIDEBAR_SIDEBAR_HXX + +#include <sfx2/dllapi.h> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/ui/XSidebarProvider.hpp> + +#include <com/sun/star/awt/XWindow2.hpp> + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/weakref.hxx> + +#include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/SidebarDockingWindow.hxx> + +#include <sfx2/sidebar/UnoDecks.hxx> +#include <com/sun/star/ui/XDecks.hpp> + +/** get the sidebar for a given frame +*/ +class SfxUnoSidebar : public ::cppu::WeakImplHelper1< css::ui::XSidebarProvider > +{ + +private : + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + +public: + + SfxUnoSidebar(const css::uno::Reference<css::frame::XFrame>&); + + virtual void SAL_CALL showDecks (const sal_Bool bVisible) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + + virtual void SAL_CALL setVisible (const sal_Bool bVisible) + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual sal_Bool SAL_CALL isVisible() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual css::uno::Reference<css::frame::XFrame> SAL_CALL getFrame() + throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + + virtual css::uno::Reference<css::ui::XDecks> SAL_CALL getDecks() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 97f4f3e3321c..fd1b03a58118 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -4020,6 +4020,11 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/ui,\ XModuleUIConfigurationManagerSupplier \ XSidebar \ XSidebarPanel \ + XPanel \ + XPanels \ + XDeck \ + XDecks \ + XSidebarProvider \ XStatusbarItem \ XToolPanel \ XUIConfiguration \ diff --git a/offapi/com/sun/star/frame/XController2.idl b/offapi/com/sun/star/frame/XController2.idl index bd4eaba16482..400b7aea68da 100644 --- a/offapi/com/sun/star/frame/XController2.idl +++ b/offapi/com/sun/star/frame/XController2.idl @@ -23,6 +23,7 @@ #include <com/sun/star/frame/XController.idl> #include <com/sun/star/awt/XWindow.idl> #include <com/sun/star/beans/PropertyValue.idl> +#include <com/sun/star/ui/XSidebarProvider.idl> module com { module sun { module star { module frame { @@ -60,6 +61,10 @@ interface XController2 : XController */ [readonly, attribute] sequence< ::com::sun::star::beans::PropertyValue > CreationArguments; + + /** get the sidebar if exists + */ + ::com::sun::star::ui::XSidebarProvider getSidebar(); }; diff --git a/offapi/com/sun/star/ui/XDeck.idl b/offapi/com/sun/star/ui/XDeck.idl new file mode 100644 index 000000000000..53b739703587 --- /dev/null +++ b/offapi/com/sun/star/ui/XDeck.idl @@ -0,0 +1,90 @@ +/* -*- 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 __com_sun_star_ui_XDeck_idl__ +#define __com_sun_star_ui_XDeck_idl__ + +#include <com/sun/star/ui/XPanels.idl> + + + module com { module sun { module star { module ui { + +/** provides access to Desk */ + +interface XDeck + +{ + /** The deck identifier + */ + string getId(); + + /** Get the deck title string + */ + string getTitle(); + + /** Set the deck title string + + @param newTitle + The new title string + */ + void setTitle( [in] string newTitle ); + + /** Is the deck the active one + */ + boolean isActive(); + + /** Activate the deck and isplays its content + + @param bActivate + The requested state for the deck + <ul> + <li>TRUE sets the deck as the active one</li> + <li>FALSE hide the deck and defaults to the first deck of the sidebar</li> + </ul> + */ + void activate( [in] boolean bActivate ); + + /** Get the ordering index of the deck button in sidebar + */ + long getOrderIndex(); + + /** Set the ordering index of the deck button in sidebar + + @param newOrderIndex + The new position + */ + void setOrderIndex( [in] long newOrderIndex ); + + /** Move deck button at first position in sidebar + */ + void moveFirst(); + + /** Move deck button at last position in sidebar + */ + void moveLast(); + + /** Move deck one step up in the sidebar + */ + void moveUp(); + + /** Move deck one step down in the sidebar + */ + void moveDown(); + + /** Panels collection attached to the deck + */ + com::sun::star::ui::XPanels getPanels(); +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/offapi/com/sun/star/ui/XDecks.idl b/offapi/com/sun/star/ui/XDecks.idl new file mode 100644 index 000000000000..ba7c3a7f3107 --- /dev/null +++ b/offapi/com/sun/star/ui/XDecks.idl @@ -0,0 +1,32 @@ +/* -*- 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 __com_sun_star_ui_XDecks_idl__ +#define __com_sun_star_ui_XDecks_idl__ + +#include <com/sun/star/container/XIndexAccess.idl> +#include <com/sun/star/container/XNameAccess.idl> + + module com { module sun { module star { module ui { + +/** provides access to Desks of a Sidebar.*/ + +interface XDecks + +{ + interface com::sun::star::container::XIndexAccess; + interface com::sun::star::container::XNameAccess; +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/offapi/com/sun/star/ui/XPanel.idl b/offapi/com/sun/star/ui/XPanel.idl new file mode 100644 index 000000000000..0070d2356cca --- /dev/null +++ b/offapi/com/sun/star/ui/XPanel.idl @@ -0,0 +1,92 @@ +/* -*- 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 __com_sun_star_ui_XPanel_idl__ +#define __com_sun_star_ui_XPanel_idl__ + +#include <com/sun/star/ui/XPanel.idl> +#include <com/sun/star/awt/XWindow.idl> + + + module com { module sun { module star { module ui { + +/** provides access to Desk */ + +interface XPanel + +{ + /** The panel identifier + */ + string getId(); + + /** Get the panel title string + */ + string getTitle(); + + /** Set the panel title string + + @param newTitle + The new title string + */ + void setTitle( [in] string newTitle ); + + /** Is the panel expanded + */ + boolean isExpanded(); + + /** Collapse the panel to only show its title bar + */ + void collapse (); + + /** Expand and display the panel + + @param bCollapseOther + <ul> + <li>TRUE collapse all other panels of the deck</li> + <li>FALSE do not change other panels state</li> + </ul> + */ + void expand ( [in] boolean bCollapseOther ); + + /** Get the ordering index of the panel in the deck + */ + long getOrderIndex(); + + /** Set the ordering index of the panel in the deck + */ + void setOrderIndex( [in] long newOrderIndex ); + + /** Move panel as first item of the deck + */ + void moveFirst(); + + /** Move panel as last item of the deck + **/ + void moveLast(); + + /** Move panel one step up in the deck + */ + void moveUp(); + + /** Move the panel one step down in the deck + */ + void moveDown(); + + /** Get the panel dialog element + */ + com::sun::star::awt::XWindow getDialog(); + +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/offapi/com/sun/star/ui/XPanels.idl b/offapi/com/sun/star/ui/XPanels.idl new file mode 100644 index 000000000000..a2aa85103e46 --- /dev/null +++ b/offapi/com/sun/star/ui/XPanels.idl @@ -0,0 +1,34 @@ +/* -*- 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 __com_sun_star_ui_XPanels_idl__ +#define __com_sun_star_ui_XPanels_idl__ + +#include <com/sun/star/container/XIndexAccess.idl> +#include <com/sun/star/container/XNameAccess.idl> + + module com { module sun { module star { module ui { + +/** provides access to Panels of a Deck.*/ + +interface XPanels + +{ + interface com::sun::star::container::XIndexAccess; + interface com::sun::star::container::XNameAccess; + + string getDeckId(); +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/offapi/com/sun/star/ui/XSidebarProvider.idl b/offapi/com/sun/star/ui/XSidebarProvider.idl new file mode 100644 index 000000000000..370925ec8084 --- /dev/null +++ b/offapi/com/sun/star/ui/XSidebarProvider.idl @@ -0,0 +1,61 @@ +/* -*- 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 __com_sun_star_ui_XSidebarProvider_idl__ +#define __com_sun_star_ui_XSidebarProvider_idl__ + +#include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/frame/XFrame.idl> +#include <com/sun/star/awt/XWindow2.idl> + +#include <com/sun/star/ui/XDecks.idl> + + +module com { module sun { module star { module ui { + +/** Interface of the sidebar +*/ +interface XSidebarProvider: com::sun::star::uno::XInterface +{ + /** Display the sidebar + + @param bVisible + the requested visible state + */ + void setVisible ( [in] boolean bVisible); + + /** Is the sidebar visible + */ + boolean isVisible(); + + /** Get the XFrame owner + */ + com::sun::star::frame::XFrame getFrame(); + + /* Decks collection attached to the sidebar + */ + com::sun::star::ui::XDecks getDecks(); + + /** Decks container visibility + + @param bVisible + the requested visible state + <ul> + <li>FALSE collapses the deck container horizontally. Then Only shows the deck TabBar selector</li> + <li>TRUE expands the deck container and show active Deck content</li> + </ul> + */ + void showDecks([in] boolean bVisible); +} ; + +} ; } ; } ; } ; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 0a1100e1f51a..5db89dd2444b 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -283,6 +283,11 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/sidebar/TitleBar \ sfx2/source/sidebar/Theme \ sfx2/source/sidebar/Tools \ + sfx2/source/sidebar/UnoPanel \ + sfx2/source/sidebar/UnoPanels \ + sfx2/source/sidebar/UnoDeck \ + sfx2/source/sidebar/UnoDecks \ + sfx2/source/sidebar/UnoSidebar \ sfx2/source/statbar/stbitem \ sfx2/source/toolbox/imgmgr \ sfx2/source/toolbox/tbxitem \ diff --git a/sfx2/source/sidebar/Accessible.cxx b/sfx2/source/sidebar/Accessible.cxx index 7cf157e012f2..10b01dc07c8f 100644 --- a/sfx2/source/sidebar/Accessible.cxx +++ b/sfx2/source/sidebar/Accessible.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "Accessible.hxx" +#include <sfx2/sidebar/Accessible.hxx> using namespace css; using namespace css::uno; diff --git a/sfx2/source/sidebar/AccessibleTitleBar.cxx b/sfx2/source/sidebar/AccessibleTitleBar.cxx index 5405837c3046..0d2597ba9659 100644 --- a/sfx2/source/sidebar/AccessibleTitleBar.cxx +++ b/sfx2/source/sidebar/AccessibleTitleBar.cxx @@ -17,9 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "AccessibleTitleBar.hxx" -#include "Accessible.hxx" -#include "TitleBar.hxx" +#include <sfx2/sidebar/AccessibleTitleBar.hxx> +#include <sfx2/sidebar/Accessible.hxx> +#include <sfx2/sidebar/TitleBar.hxx> #include <com/sun/star/accessibility/AccessibleStateType.hpp> diff --git a/sfx2/source/sidebar/AsynchronousCall.cxx b/sfx2/source/sidebar/AsynchronousCall.cxx index a4080fdffc01..f9ebe18624a9 100644 --- a/sfx2/source/sidebar/AsynchronousCall.cxx +++ b/sfx2/source/sidebar/AsynchronousCall.cxx @@ -16,7 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "AsynchronousCall.hxx" + +#include <sfx2/sidebar/AsynchronousCall.hxx> #include <vcl/svapp.hxx> namespace sfx2 { namespace sidebar { diff --git a/sfx2/source/sidebar/Context.cxx b/sfx2/source/sidebar/Context.cxx index 27d35dd48817..3a7ce010b24c 100644 --- a/sfx2/source/sidebar/Context.cxx +++ b/sfx2/source/sidebar/Context.cxx @@ -16,7 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "Context.hxx" +#include <sfx2/sidebar/Context.hxx> + #define AnyApplicationName "any" #define AnyContextName "any" diff --git a/sfx2/source/sidebar/ContextList.cxx b/sfx2/source/sidebar/ContextList.cxx index a64b43a8f5af..20cdcbc8806b 100644 --- a/sfx2/source/sidebar/ContextList.cxx +++ b/sfx2/source/sidebar/ContextList.cxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "ContextList.hxx" -#include "Context.hxx" +#include <sfx2/sidebar/ContextList.hxx> +#include <sfx2/sidebar/Context.hxx> using ::rtl::OUString; @@ -85,6 +85,11 @@ void ContextList::AddContextDescription ( maEntries.back().msMenuCommand = rsMenuCommand; } +sal_Int32 ContextList::GetCount() +{ + return maEntries.size(); +} + } } // end of namespace sfx2::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/ControlFactory.cxx b/sfx2/source/sidebar/ControlFactory.cxx index 1376f9ee9961..96bd62aefc2d 100644 --- a/sfx2/source/sidebar/ControlFactory.cxx +++ b/sfx2/source/sidebar/ControlFactory.cxx @@ -18,8 +18,8 @@ */ #include <sfx2/sidebar/ControlFactory.hxx> -#include "MenuButton.hxx" -#include "TabItem.hxx" +#include <sfx2/sidebar/MenuButton.hxx> +#include <sfx2/sidebar/TabItem.hxx> #include <sfx2/sidebar/SidebarToolBox.hxx> #include <vcl/toolbox.hxx> diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index d5dc5d30b965..b2eb225e490b 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -17,14 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "Deck.hxx" -#include "DeckDescriptor.hxx" -#include "DeckLayouter.hxx" -#include "DrawHelper.hxx" -#include "DeckTitleBar.hxx" -#include "PanelTitleBar.hxx" -#include "Paint.hxx" -#include "Panel.hxx" +#include <sfx2/sidebar/Deck.hxx> +#include <sfx2/sidebar/DeckDescriptor.hxx> +#include <sfx2/sidebar/DeckLayouter.hxx> +#include <sfx2/sidebar/DrawHelper.hxx> +#include <sfx2/sidebar/DeckTitleBar.hxx> +#include <sfx2/sidebar/PanelTitleBar.hxx> +#include <sfx2/sidebar/Paint.hxx> +#include <sfx2/sidebar/Panel.hxx> #include <sfx2/sidebar/Tools.hxx> #include <sfx2/sidebar/Theme.hxx> @@ -223,6 +223,19 @@ vcl::Window* Deck::GetPanelParentWindow() return mpScrollContainer.get(); } +Panel* Deck::GetPanel(const OUString panelId) +{ + for (size_t i = 0; i < maPanels.size(); i++) + { + if(maPanels[i].get()->GetId() == panelId) + { + return maPanels[i].get(); + } + } + return NULL; + +} + void Deck::ShowPanel(const Panel& rPanel) { if (mpVerticalScrollBar && mpVerticalScrollBar->IsVisible()) diff --git a/sfx2/source/sidebar/DeckDescriptor.cxx b/sfx2/source/sidebar/DeckDescriptor.cxx index 2f431e525315..fd4f6400fe4f 100644 --- a/sfx2/source/sidebar/DeckDescriptor.cxx +++ b/sfx2/source/sidebar/DeckDescriptor.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "DeckDescriptor.hxx" +#include <sfx2/sidebar/DeckDescriptor.hxx> namespace sfx2 { namespace sidebar { @@ -33,7 +33,8 @@ DeckDescriptor::DeckDescriptor() maContextList(), mbIsEnabled(true), mnOrderIndex(10000), // Default value as defined in Sidebar.xcs - mbExperimental(false) + mbExperimental(false), + mpDeck() { } @@ -49,7 +50,8 @@ DeckDescriptor::DeckDescriptor (const DeckDescriptor& rOther) maContextList(rOther.maContextList), mbIsEnabled(rOther.mbIsEnabled), mnOrderIndex(rOther.mnOrderIndex), - mbExperimental(rOther.mbExperimental) + mbExperimental(rOther.mbExperimental), + mpDeck(rOther.mpDeck) { } diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx index 3a2edfc2aef5..896edd862ffc 100644 --- a/sfx2/source/sidebar/DeckLayouter.cxx +++ b/sfx2/source/sidebar/DeckLayouter.cxx @@ -17,11 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "DeckLayouter.hxx" +#include <sfx2/sidebar/DeckLayouter.hxx> #include <sfx2/sidebar/Theme.hxx> -#include "Panel.hxx" -#include "PanelTitleBar.hxx" -#include "Deck.hxx" +#include <sfx2/sidebar/Panel.hxx> +#include <sfx2/sidebar/PanelTitleBar.hxx> +#include <sfx2/sidebar/Deck.hxx> #include <vcl/window.hxx> #include <vcl/scrbar.hxx> diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx index 41c8fcf78569..a55fef62e719 100644 --- a/sfx2/source/sidebar/DeckTitleBar.cxx +++ b/sfx2/source/sidebar/DeckTitleBar.cxx @@ -17,10 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "DeckTitleBar.hxx" +#include <sfx2/sidebar/DeckTitleBar.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sfxresid.hxx> -#include "Sidebar.hrc" + +#include <sfx2/sidebar/Sidebar.hrc> #include <vcl/image.hxx> diff --git a/sfx2/source/sidebar/DrawHelper.cxx b/sfx2/source/sidebar/DrawHelper.cxx index 66ac2f727421..7297fc244b23 100644 --- a/sfx2/source/sidebar/DrawHelper.cxx +++ b/sfx2/source/sidebar/DrawHelper.cxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "DrawHelper.hxx" -#include "Paint.hxx" +#include <sfx2/sidebar/DrawHelper.hxx> +#include <sfx2/sidebar/Paint.hxx> #include <vcl/lineinfo.hxx> diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx index 16452fe3a4da..fbb326f05694 100644 --- a/sfx2/source/sidebar/FocusManager.cxx +++ b/sfx2/source/sidebar/FocusManager.cxx @@ -17,12 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "FocusManager.hxx" -#include "Panel.hxx" -#include "DeckTitleBar.hxx" -#include "PanelTitleBar.hxx" +#include <sfx2/sidebar/FocusManager.hxx> +#include <sfx2/sidebar/Panel.hxx> +#include <sfx2/sidebar/DeckTitleBar.hxx> +#include <sfx2/sidebar/PanelTitleBar.hxx> #include <sfx2/sidebar/Tools.hxx> -#include "TitleBar.hxx" +#include <sfx2/sidebar/TitleBar.hxx> #include <vcl/button.hxx> #include <vcl/toolbox.hxx> #include <toolkit/helper/vclunohelper.hxx> diff --git a/sfx2/source/sidebar/MenuButton.cxx b/sfx2/source/sidebar/MenuButton.cxx index 47e5971e64e6..428cdafac4bb 100644 --- a/sfx2/source/sidebar/MenuButton.cxx +++ b/sfx2/source/sidebar/MenuButton.cxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "MenuButton.hxx" +#include <sfx2/sidebar/MenuButton.hxx> -#include "DrawHelper.hxx" -#include "Paint.hxx" +#include <sfx2/sidebar/DrawHelper.hxx> +#include <sfx2/sidebar/Paint.hxx> #include <sfx2/sidebar/Tools.hxx> #include <sfx2/sidebar/Theme.hxx> diff --git a/sfx2/source/sidebar/Paint.cxx b/sfx2/source/sidebar/Paint.cxx index caa371d2acf6..414d0b51608c 100644 --- a/sfx2/source/sidebar/Paint.cxx +++ b/sfx2/source/sidebar/Paint.cxx @@ -16,7 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "Paint.hxx" +#include <sfx2/sidebar/Paint.hxx> #include <sfx2/sidebar/Tools.hxx> #include <com/sun/star/awt/Gradient.hpp> diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx index 7ea2689bb205..e67d9d901ebf 100644 --- a/sfx2/source/sidebar/Panel.cxx +++ b/sfx2/source/sidebar/Panel.cxx @@ -17,16 +17,19 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "Panel.hxx" -#include "PanelTitleBar.hxx" -#include "PanelDescriptor.hxx" +#include <sfx2/sidebar/Panel.hxx> +#include <sfx2/sidebar/PanelTitleBar.hxx> +#include <sfx2/sidebar/PanelDescriptor.hxx> #include <sfx2/sidebar/Theme.hxx> -#include "Paint.hxx" -#include "ResourceManager.hxx" +#include <sfx2/sidebar/Paint.hxx> +#include <sfx2/sidebar/ResourceManager.hxx> + +#include <sfx2/sidebar/SidebarController.hxx> + #ifdef DEBUG #include <sfx2/sidebar/Tools.hxx> -#include "Deck.hxx" +#include <sfx2/sidebar/Deck.hxx> #endif #include <tools/svborder.hxx> @@ -47,7 +50,9 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor, vcl::Window* pParentWindow, const bool bIsInitiallyExpanded, const std::function<void()>& rDeckLayoutTrigger, - const std::function<Context()>& rContextAccess) + const std::function<Context()>& rContextAccess, + const css::uno::Reference<css::frame::XFrame>& rxFrame + ) : Window(pParentWindow) , msPanelId(rPanelDescriptor.msId) , mpTitleBar(VclPtr<PanelTitleBar>::Create(rPanelDescriptor.msTitle, pParentWindow, this)) @@ -57,6 +62,7 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor, , mbIsExpanded(bIsInitiallyExpanded) , maDeckLayoutTrigger(rDeckLayoutTrigger) , maContextAccess(rContextAccess) + , mxFrame(rxFrame) { #ifdef DEBUG SetText(OUString("Panel")); @@ -111,6 +117,8 @@ void Panel::SetUIElement (const Reference<ui::XUIElement>& rxElement) void Panel::SetExpanded (const bool bIsExpanded) { + SidebarController* pSidebarController= SidebarController::GetSidebarControllerForFrame(mxFrame); + if (mbIsExpanded != bIsExpanded) { mbIsExpanded = bIsExpanded; @@ -118,7 +126,7 @@ void Panel::SetExpanded (const bool bIsExpanded) if (maContextAccess) { - ResourceManager::Instance().StorePanelExpansionState( + pSidebarController->GetResourceManager()->StorePanelExpansionState( msPanelId, bIsExpanded, maContextAccess()); diff --git a/sfx2/source/sidebar/PanelDescriptor.cxx b/sfx2/source/sidebar/PanelDescriptor.cxx index c88f21b48294..43426171e925 100644 --- a/sfx2/source/sidebar/PanelDescriptor.cxx +++ b/sfx2/source/sidebar/PanelDescriptor.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "PanelDescriptor.hxx" +#include <sfx2/sidebar/PanelDescriptor.hxx> namespace sfx2 { namespace sidebar { diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx index eda513bd9691..fd6c06ee3376 100644 --- a/sfx2/source/sidebar/PanelTitleBar.cxx +++ b/sfx2/source/sidebar/PanelTitleBar.cxx @@ -17,12 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "PanelTitleBar.hxx" +#include <sfx2/sidebar/PanelTitleBar.hxx> #include <sfx2/sfxresid.hxx> -#include "Sidebar.hrc" -#include "Paint.hxx" -#include "Panel.hxx" +#include <sfx2/sidebar/Sidebar.hrc> + +#include <sfx2/sidebar/Paint.hxx> +#include <sfx2/sidebar/Panel.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/ControllerFactory.hxx> #include <sfx2/sidebar/Tools.hxx> diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 1535675ba973..79b24329a31e 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "ResourceManager.hxx" +#include <sfx2/sidebar/ResourceManager.hxx> #include <sfx2/sidebar/Tools.hxx> #include <unotools/confignode.hxx> @@ -114,6 +114,51 @@ void ResourceManager::SetIsDeckEnabled(const OUString& rsDeckId, const bool bIsE } } +void ResourceManager::SetDeckToDescriptor(const OUString& rsDeckId, VclPtr<Deck> aDeck) +{ + DeckContainer::iterator iDeck; + for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck) + { + if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode()) + continue; + if (iDeck->msId.equals(rsDeckId)) + { + iDeck->mpDeck = aDeck; + return; + } + } +} + +void ResourceManager::SetDeckOrderIndex(const OUString& rsDeckId, const sal_Int32 orderIndex) +{ + DeckContainer::iterator iDeck; + for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck) + { + if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode()) + continue; + if (iDeck->msId.equals(rsDeckId)) + { + iDeck->mnOrderIndex = orderIndex; + return; + } + } +} + +void ResourceManager::SetPanelOrderIndex(const OUString& rsPanelId, const sal_Int32 orderIndex) +{ + PanelContainer::iterator iPanel; + for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel) + { + if (iPanel->mbExperimental && !maMiscOptions.IsExperimentalMode()) + continue; + if (iPanel->msId.equals(rsPanelId)) + { + iPanel->mnOrderIndex = orderIndex; + return; + } + } +} + const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatchingDecks ( DeckContextDescriptorContainer& rDecks, const Context& rContext, @@ -569,6 +614,7 @@ bool ResourceManager::IsDeckEnabled ( // Check if any panel that matches the current context can be // displayed. ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors; + ResourceManager::Instance().GetMatchingPanels(aPanelContextDescriptors, rContext, rsDeckId, rxFrame); diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx index a74004846755..112ffc787dab 100644 --- a/sfx2/source/sidebar/Sidebar.cxx +++ b/sfx2/source/sidebar/Sidebar.cxx @@ -18,8 +18,8 @@ */ #include <sfx2/sidebar/Sidebar.hxx> -#include "SidebarController.hxx" -#include "ResourceManager.hxx" +#include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/ResourceManager.hxx> using namespace css; @@ -30,7 +30,9 @@ void Sidebar::ShowPanel ( const css::uno::Reference<frame::XFrame>& rxFrame) { SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame); - const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId); + + const PanelDescriptor* pPanelDescriptor = pController->GetResourceManager()->GetPanelDescriptor(rsPanelId); + if (pController!=NULL && pPanelDescriptor != NULL) { // This should be a lot more sophisticated: diff --git a/sfx2/source/sidebar/Sidebar.src b/sfx2/source/sidebar/Sidebar.src index a929dc501ef7..534bebd02815 100644 --- a/sfx2/source/sidebar/Sidebar.src +++ b/sfx2/source/sidebar/Sidebar.src @@ -16,7 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "Sidebar.hrc" +#include <sfx2/sidebar/Sidebar.hrc> Resource RID_SIDEBAR_RESOURCE { diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx index 0925bf83e4c0..a37d50033cf8 100644 --- a/sfx2/source/sidebar/SidebarChildWindow.cxx +++ b/sfx2/source/sidebar/SidebarChildWindow.cxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "TabBar.hxx" +#include <sfx2/sidebar/TabBar.hxx> #include <sfx2/bindings.hxx> #include <sfx2/sidebar/SidebarChildWindow.hxx> -#include "SidebarDockingWindow.hxx" +#include <sfx2/sidebar/SidebarDockingWindow.hxx> #include <sfx2/sfxsids.hrc> #include "helpid.hrc" #include <sfx2/dockwin.hxx> diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 918b5ac9b191..c81927ef13d2 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -16,18 +16,20 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "SidebarController.hxx" -#include "Deck.hxx" -#include "DeckTitleBar.hxx" -#include "Panel.hxx" -#include "PanelTitleBar.hxx" -#include "SidebarResource.hxx" -#include "TabBar.hxx" +#include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/Deck.hxx> +#include <sfx2/sidebar/DeckTitleBar.hxx> +#include <sfx2/sidebar/Panel.hxx> +#include <sfx2/sidebar/PanelTitleBar.hxx> +#include <sfx2/sidebar/SidebarResource.hxx> +#include <sfx2/sidebar/TabBar.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/SidebarChildWindow.hxx> #include <sfx2/sidebar/Tools.hxx> -#include "SidebarDockingWindow.hxx" -#include "Context.hxx" +#include <sfx2/sidebar/SidebarDockingWindow.hxx> +#include <sfx2/sidebar/Context.hxx> +#include <sfx2/sidebar/ContextList.hxx> + #include <sfx2/sfxresid.hxx> #include <sfx2/sfxsids.hrc> @@ -98,7 +100,8 @@ SidebarController::SidebarController ( mpParentWindow, rxFrame, ::boost::bind(&SidebarController::OpenThenSwitchToDeck, this, _1), - ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2))), + ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2), + this)), mxFrame(rxFrame), maCurrentContext(OUString(), OUString()), maRequestedContext(), @@ -116,8 +119,12 @@ SidebarController::SidebarController ( mxReadOnlyModeDispatch(), mbIsDocumentReadOnly(false), mpSplitWindow(NULL), - mnWidthOnSplitterButtonDown(0) + mnWidthOnSplitterButtonDown(0), + mpResourceManager() { + // Decks and panel collections for this sidebar + mpResourceManager = std::unique_ptr<ResourceManager>(new ResourceManager()); + // Listen for context change events. css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( css::ui::ContextChangeEventMultiplexer::get( @@ -173,12 +180,33 @@ void SAL_CALL SidebarController::disposing() { mpCloseIndicator.disposeAndClear(); + maFocusManager.Clear(); + mpTabBar.disposeAndClear(); + + + // clear decks + ResourceManager::DeckContextDescriptorContainer aDecks; + + mpResourceManager->GetMatchingDecks ( + aDecks, + GetCurrentContext(), + IsDocumentReadOnly(), + mxFrame); + + for (ResourceManager::DeckContextDescriptorContainer::const_iterator + iDeck(aDecks.begin()), iEnd(aDecks.end()); + iDeck!=iEnd; ++iDeck) + { + const DeckDescriptor* deckDesc = mpResourceManager->GetDeckDescriptor(iDeck->msId); + VclPtr<Deck> aDeck = deckDesc->mpDeck; + if (aDeck) + aDeck.disposeAndClear(); + } + SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame)); if (iEntry != maSidebarControllerContainer.end()) maSidebarControllerContainer.erase(iEntry); - maFocusManager.Clear(); - css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( css::ui::ContextChangeEventMultiplexer::get( ::comphelper::getProcessComponentContext())); @@ -200,19 +228,13 @@ void SAL_CALL SidebarController::disposing() mpParentWindow = NULL; } - if (mpCurrentDeck) - { - mpCurrentDeck.disposeAndClear(); - } - - mpTabBar.disposeAndClear(); - Theme::GetPropertySet()->removePropertyChangeListener( OUString(""), static_cast<css::beans::XPropertyChangeListener*>(this)); maContextChangeUpdate.CancelRequest(); maAsynchronousDeckSwitch.CancelRequest(); + } void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) @@ -397,7 +419,8 @@ void SidebarController::UpdateConfigurations() // Find the set of decks that could be displayed for the new context. ResourceManager::DeckContextDescriptorContainer aDecks; - ResourceManager::Instance().GetMatchingDecks ( + + mpResourceManager->GetMatchingDecks ( aDecks, maCurrentContext, mbIsDocumentReadOnly, @@ -439,8 +462,7 @@ void SidebarController::UpdateConfigurations() // with the deck. mpTabBar->HighlightDeck(sNewDeckId); - const DeckDescriptor* pDescriptor = - ResourceManager::Instance().GetDeckDescriptor(sNewDeckId); + const DeckDescriptor* pDescriptor = mpResourceManager->GetDeckDescriptor(sNewDeckId); if (pDescriptor) { @@ -475,6 +497,11 @@ void SidebarController::OpenThenSwitchToDeck ( mpTabBar->HighlightDeck(rsDeckId); } +void SidebarController::SwitchToDefaultDeck() +{ + SwitchToDeck(gsDefaultDeckId); +} + void SidebarController::SwitchToDeck ( const ::rtl::OUString& rsDeckId) { @@ -482,27 +509,48 @@ void SidebarController::SwitchToDeck ( || ! mbIsDeckOpen || mnRequestedForceFlags!=SwitchFlag_NoForce) { - const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(rsDeckId); + const DeckDescriptor* pDeckDescriptor = mpResourceManager->GetDeckDescriptor(rsDeckId); + if (pDeckDescriptor != NULL) SwitchToDeck(*pDeckDescriptor, maCurrentContext); } } + +void SidebarController::CreateDeck(const ::rtl::OUString& rDeckId) +{ + const DeckDescriptor* pDeckDescriptor = mpResourceManager->GetDeckDescriptor(rDeckId); + + if (pDeckDescriptor->mpDeck.get()==nullptr) + { + VclPtr<Deck> aDeck = VclPtr<Deck>::Create( + *pDeckDescriptor, + mpParentWindow, + ::boost::bind(&SidebarController::RequestCloseDeck, this)); + + mpResourceManager->SetDeckToDescriptor(rDeckId, aDeck); + + } + +} + + void SidebarController::SwitchToDeck ( const DeckDescriptor& rDeckDescriptor, const Context& rContext) { + maFocusManager.Clear(); const bool bForceNewDeck ((mnRequestedForceFlags&SwitchFlag_ForceNewDeck)!=0); const bool bForceNewPanels ((mnRequestedForceFlags&SwitchFlag_ForceNewPanels)!=0); + mnRequestedForceFlags = SwitchFlag_NoForce; if ( ! msCurrentDeckId.equals(rDeckDescriptor.msId) || bForceNewDeck) { - // When the deck changes then destroy the deck and all panels - // and create everything new. - mpCurrentDeck.disposeAndClear(); + if (mpCurrentDeck) + mpCurrentDeck->Hide(); msCurrentDeckId = rDeckDescriptor.msId; } @@ -510,7 +558,8 @@ void SidebarController::SwitchToDeck ( // Determine the panels to display in the deck. ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors; - ResourceManager::Instance().GetMatchingPanels( + + mpResourceManager->GetMatchingPanels( aPanelContextDescriptors, rContext, rDeckDescriptor.msId, @@ -537,16 +586,10 @@ void SidebarController::SwitchToDeck ( } // Provide a configuration and Deck object. - if ( ! mpCurrentDeck) - { - mpCurrentDeck.reset( - VclPtr<Deck>::Create( - rDeckDescriptor, - mpParentWindow, - ::boost::bind(&SidebarController::RequestCloseDeck, this))); - msCurrentDeckTitle = rDeckDescriptor.msTitle; - } + CreateDeck(rDeckDescriptor.msId); + mpCurrentDeck.reset(rDeckDescriptor.mpDeck); + if ( ! mpCurrentDeck) return; @@ -557,6 +600,7 @@ void SidebarController::SwitchToDeck ( pDebugTitleBar->SetTitle(rDeckDescriptor.msTitle + " (" + maCurrentContext.msContext + ")"); #endif + // Update the panel list. const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size()); SharedPanelContainer aNewPanels; @@ -608,6 +652,7 @@ void SidebarController::SwitchToDeck ( rContext); bHasPanelSetChanged = true; } + if (aNewPanels[nWriteIndex] != nullptr) { // Depending on the context we have to change the command @@ -627,6 +672,7 @@ void SidebarController::SwitchToDeck ( // mpCurrentPanels - may miss stuff (?) aNewPanels.resize(nWriteIndex); + SfxSplitWindow* pSplitWindow = GetSplitWindow(); sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor(); WindowAlign eAlign = pSplitWindow ? pSplitWindow->GetAlign() : WINDOWALIGN_RIGHT; @@ -640,6 +686,7 @@ void SidebarController::SwitchToDeck ( nDeckX = 0; } + // Activate the deck and the new set of panels. mpCurrentDeck->setPosSizePixel( nDeckX, @@ -658,7 +705,8 @@ void SidebarController::SwitchToDeck ( // Tell the focus manager about the new panels and tab bar // buttons. maFocusManager.SetDeckTitle(mpCurrentDeck->GetTitleBar()); - maFocusManager.SetPanels(aNewPanels); + maFocusManager.SetPanels(mpCurrentDeck->GetPanels()); + mpTabBar->UpdateFocusManager(maFocusManager); UpdateTitleBarIcons(); } @@ -669,7 +717,8 @@ VclPtr<Panel> SidebarController::CreatePanel ( const bool bIsInitiallyExpanded, const Context& rContext) { - const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId); + const PanelDescriptor* pPanelDescriptor = mpResourceManager->GetPanelDescriptor(rsPanelId); + if (pPanelDescriptor == NULL) return NULL; @@ -679,7 +728,8 @@ VclPtr<Panel> SidebarController::CreatePanel ( pParentWindow, bIsInitiallyExpanded, ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()), - ::boost::bind(&SidebarController::GetCurrentContext, this)); + ::boost::bind(&SidebarController::GetCurrentContext, this), + mxFrame); // Create the XUIElement. Reference<ui::XUIElement> xUIElement (CreateUIElement( @@ -1110,7 +1160,8 @@ void SidebarController::UpdateTitleBarIcons() return; const bool bIsHighContrastModeActive (Theme::IsHighContrastMode()); - const ResourceManager& rResourceManager (ResourceManager::Instance()); + + const ResourceManager& rResourceManager = *mpResourceManager; // Update the deck icon. const DeckDescriptor* pDeckDescriptor = rResourceManager.GetDeckDescriptor(mpCurrentDeck->GetId()); @@ -1151,6 +1202,28 @@ void SidebarController::ShowPanel (const Panel& rPanel) mpCurrentDeck->ShowPanel(rPanel); } +ResourceManager::DeckContextDescriptorContainer SidebarController::GetMatchingDecks() +{ + ResourceManager::DeckContextDescriptorContainer aDecks; + mpResourceManager->GetMatchingDecks (aDecks, + GetCurrentContext(), + IsDocumentReadOnly(), + mxFrame); + return aDecks; +} + +ResourceManager::PanelContextDescriptorContainer SidebarController::GetMatchingPanels(const ::rtl::OUString& rDeckId) +{ + ResourceManager::PanelContextDescriptorContainer aPanels; + + mpResourceManager->GetMatchingPanels(aPanels, + GetCurrentContext(), + rDeckId, + mxFrame); + return aPanels; +} + + } } // end of namespace sfx2::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 2cc2ae76843d..c32566e282ac 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -16,9 +16,9 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "SidebarDockingWindow.hxx" +#include <sfx2/sidebar/SidebarDockingWindow.hxx> #include <sfx2/sidebar/SidebarChildWindow.hxx> -#include "SidebarController.hxx" +#include <sfx2/sidebar/SidebarController.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index bc2fe28761b1..4733898ada0a 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -17,14 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "TabBar.hxx" -#include "TabItem.hxx" +#include <sfx2/sidebar/TabBar.hxx> +#include <sfx2/sidebar/TabItem.hxx> #include <sfx2/sidebar/ControlFactory.hxx> -#include "DeckDescriptor.hxx" -#include "Paint.hxx" +#include <sfx2/sidebar/DeckDescriptor.hxx> +#include <sfx2/sidebar/Paint.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/Tools.hxx> -#include "FocusManager.hxx" +#include <sfx2/sidebar/FocusManager.hxx> + +#include <sfx2/sidebar/SidebarController.hxx> #include <vcl/gradient.hxx> #include <vcl/image.hxx> @@ -42,14 +44,18 @@ namespace sfx2 { namespace sidebar { TabBar::TabBar(vcl::Window* pParentWindow, const Reference<frame::XFrame>& rxFrame, const boost::function<void(const OUString&)>& rDeckActivationFunctor, - const PopupMenuProvider& rPopupMenuProvider) + const PopupMenuProvider& rPopupMenuProvider, + SidebarController* rParentSidebarController + ) : Window(pParentWindow, WB_DIALOGCONTROL), mxFrame(rxFrame), mpMenuButton(ControlFactory::CreateMenuButton(this)), maItems(), maDeckActivationFunctor(rDeckActivationFunctor), - maPopupMenuProvider(rPopupMenuProvider) + maPopupMenuProvider(rPopupMenuProvider), + pParentSidebarController(rParentSidebarController) { + SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper()); mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu)); @@ -110,7 +116,7 @@ void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDe for (ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck(rDecks.begin()); iDeck != rDecks.end(); ++iDeck) { - const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(iDeck->msId); + const DeckDescriptor* pDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId); if (pDescriptor == NULL) { OSL_ASSERT(pDescriptor!=NULL); @@ -149,7 +155,8 @@ void TabBar::UpdateButtonIcons() iItem!=iEnd; ++iItem) { - const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId); + const DeckDescriptor* pDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId); + if (pDeckDescriptor != NULL) { aImage = GetItemImage(*pDeckDescriptor); @@ -293,7 +300,8 @@ void TabBar::ToggleHideFlag (const sal_Int32 nIndex) else { maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden; - ResourceManager::Instance().SetIsDeckEnabled( + + pParentSidebarController->GetResourceManager()->SetIsDeckEnabled( maItems[nIndex].msDeckId, maItems[nIndex].mbIsHidden); Layout(); @@ -337,7 +345,8 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked) for (ItemContainer::const_iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem) { - const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId); + const DeckDescriptor* pDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId); + if (pDeckDescriptor != NULL) { DeckMenuData aData; diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx index d053f323dc35..8042528df52e 100644 --- a/sfx2/source/sidebar/TabItem.cxx +++ b/sfx2/source/sidebar/TabItem.cxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "TabItem.hxx" +#include <sfx2/sidebar/TabItem.hxx> -#include "DrawHelper.hxx" -#include "Paint.hxx" +#include <sfx2/sidebar/DrawHelper.hxx> +#include <sfx2/sidebar/Paint.hxx> #include <sfx2/sidebar/Tools.hxx> #include <sfx2/sidebar/Theme.hxx> diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx index df469123cb1d..50f0bb914e35 100644 --- a/sfx2/source/sidebar/Theme.cxx +++ b/sfx2/source/sidebar/Theme.cxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include <sfx2/sidebar/Theme.hxx> -#include "Paint.hxx" -#include "SidebarResource.hxx" +#include <sfx2/sidebar/Paint.hxx> +#include <sfx2/sidebar/SidebarResource.hxx> #include <sfx2/sidebar/Tools.hxx> #include <sfx2/app.hxx> diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx index 239cf0413131..eb362af32e8f 100644 --- a/sfx2/source/sidebar/TitleBar.cxx +++ b/sfx2/source/sidebar/TitleBar.cxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "TitleBar.hxx" -#include "Paint.hxx" -#include "Accessible.hxx" -#include "AccessibleTitleBar.hxx" +#include <sfx2/sidebar/TitleBar.hxx> +#include <sfx2/sidebar/Paint.hxx> +#include <sfx2/sidebar/Accessible.hxx> +#include <sfx2/sidebar/AccessibleTitleBar.hxx> #include <tools/svborder.hxx> #include <vcl/gradient.hxx> diff --git a/sfx2/source/sidebar/UnoDeck.cxx b/sfx2/source/sidebar/UnoDeck.cxx new file mode 100644 index 000000000000..b90b2668f7e8 --- /dev/null +++ b/sfx2/source/sidebar/UnoDeck.cxx @@ -0,0 +1,262 @@ +/* -*- 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/sidebar/UnoDeck.hxx> + +#include <sfx2/sidebar/UnoPanels.hxx> + +#include <sfx2/sidebar/ResourceManager.hxx> +#include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/DeckTitleBar.hxx> +#include <sfx2/sidebar/Deck.hxx> + +#include <vcl/svapp.hxx> + +using namespace css; +using namespace ::sfx2::sidebar; + +SfxUnoDeck::SfxUnoDeck(const uno::Reference<frame::XFrame>& rFrame, const OUString& deckId): +xFrame(rFrame), +mDeckId(deckId), +mTitle(deckId) +{ + +} +SidebarController* SfxUnoDeck::getSidebarController() +{ + return SidebarController::GetSidebarControllerForFrame(xFrame); +} + +OUString SAL_CALL SfxUnoDeck::getId() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + return mDeckId; +} + +OUString SAL_CALL SfxUnoDeck::getTitle() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + Deck* pDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck; + + if (!pDeck) + { + pSidebarController->CreateDeck(mDeckId); + pDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck; + } + + DeckTitleBar* pTitleBar = pDeck->GetTitleBar(); + return pTitleBar->GetTitle(); +} + +void SAL_CALL SfxUnoDeck::setTitle( const OUString& newTitle ) + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + pSidebarController->CreateDeck(mDeckId); + + Deck* pDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck; + + DeckTitleBar* pTitleBar = pDeck->GetTitleBar(); + pTitleBar->SetTitle(newTitle); +} + +sal_Bool SAL_CALL SfxUnoDeck::isActive() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + return pSidebarController->IsDeckVisible(mDeckId); +} + + +void SAL_CALL SfxUnoDeck::activate( const sal_Bool bActivate ) + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + + if (bActivate) + pSidebarController->SwitchToDeck(mDeckId); + else + pSidebarController->SwitchToDefaultDeck(); +} + +uno::Reference<ui::XPanels> SAL_CALL SfxUnoDeck::getPanels() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Reference<ui::XPanels> panels = new SfxUnoPanels(xFrame, mDeckId); + return panels; +} + +sal_Int32 SAL_CALL SfxUnoDeck::getOrderIndex() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mnOrderIndex; + return index; +} + +void SAL_CALL SfxUnoDeck::setOrderIndex( const sal_Int32 newOrderIndex ) + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, newOrderIndex); + + pSidebarController->NotifyResize(); +} + +void SAL_CALL SfxUnoDeck::moveFirst() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::DeckContextDescriptorContainer aDecks = pSidebarController->GetMatchingDecks(); + + sal_Int32 minIndex = GetMinOrderIndex(aDecks); + sal_Int32 curOrderIndex = getOrderIndex(); + + if (curOrderIndex != minIndex) // is deck already in place ? + { + minIndex -= 1; + pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, minIndex); + pSidebarController->NotifyResize(); + } +} + +void SAL_CALL SfxUnoDeck::moveLast() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::DeckContextDescriptorContainer aDecks = pSidebarController->GetMatchingDecks(); + + sal_Int32 maxIndex = GetMaxOrderIndex(aDecks); + sal_Int32 curOrderIndex = getOrderIndex(); + + if (curOrderIndex != maxIndex) // is deck already in place ? + { + maxIndex += 1; + pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, maxIndex); + pSidebarController->NotifyResize(); + } +} + +void SAL_CALL SfxUnoDeck::moveUp() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + // Search for previous deck OrderIndex + ResourceManager::DeckContextDescriptorContainer aDecks = pSidebarController->GetMatchingDecks(); + + sal_Int32 curOrderIndex = getOrderIndex(); + sal_Int32 previousIndex = GetMinOrderIndex(aDecks); + + ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck; + for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck) + { + sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex; + if( index < curOrderIndex && index > previousIndex) + previousIndex = index; + } + + if (curOrderIndex != previousIndex) // is deck already in place ? + { + previousIndex -= 1; + pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, previousIndex); + pSidebarController->NotifyResize(); + } +} + +void SAL_CALL SfxUnoDeck::moveDown() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::DeckContextDescriptorContainer aDecks = pSidebarController->GetMatchingDecks(); + + // Search for next deck OrderIndex + sal_Int32 curOrderIndex = getOrderIndex(); + sal_Int32 nextIndex = GetMaxOrderIndex(aDecks); + + + ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck; + for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck) + { + sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex; + if( index > curOrderIndex && index < nextIndex) + nextIndex = index; + } + + if (curOrderIndex != nextIndex) // is deck already in place ? + { + nextIndex += 1; + pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, nextIndex); + pSidebarController->NotifyResize(); + } +} + + +sal_Int32 SfxUnoDeck::GetMinOrderIndex(ResourceManager::DeckContextDescriptorContainer aDecks) +{ + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck; + + iDeck = aDecks.begin(); + sal_Int32 minIndex = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex; + + for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck) + { + sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex; + if(minIndex > index) + minIndex = index; + } + return minIndex; +} + +sal_Int32 SfxUnoDeck::GetMaxOrderIndex(ResourceManager::DeckContextDescriptorContainer aDecks) +{ + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck; + + iDeck = aDecks.begin(); + sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex; + + for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck) + { + sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex; + if(maxIndex < index) + maxIndex = index; + } + return maxIndex; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/UnoDecks.cxx b/sfx2/source/sidebar/UnoDecks.cxx new file mode 100644 index 000000000000..e08873301fb5 --- /dev/null +++ b/sfx2/source/sidebar/UnoDecks.cxx @@ -0,0 +1,168 @@ +/* -*- 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/sidebar/UnoDecks.hxx> +#include <sfx2/sidebar/UnoDeck.hxx> + +#include <sfx2/sidebar/ResourceManager.hxx> +#include <sfx2/sidebar/SidebarController.hxx> + +#include <vcl/svapp.hxx> + +using namespace css; +using namespace ::sfx2::sidebar; + +SfxUnoDecks::SfxUnoDecks(const uno::Reference<frame::XFrame>& rFrame): +xFrame(rFrame) +{ +} + +SidebarController* SfxUnoDecks::getSidebarController() +{ + return SidebarController::GetSidebarControllerForFrame(xFrame); +} + +// XNameAccess + +uno::Any SAL_CALL SfxUnoDecks::getByName( const OUString& aName ) + throw(container::NoSuchElementException, + lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Any aRet; + + if (hasByName(aName)) + { + uno::Reference<ui::XDeck> xDeck = new SfxUnoDeck(xFrame, aName); + aRet <<= xDeck; + } + else + throw container::NoSuchElementException(); + + return aRet; +} + + +uno::Sequence< OUString > SAL_CALL SfxUnoDecks::getElementNames() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::DeckContextDescriptorContainer aDecks; + css::uno::Sequence< OUString > deckList(aDecks.size()); + + if (pSidebarController) + { + pSidebarController->GetResourceManager()->GetMatchingDecks ( + aDecks, + pSidebarController->GetCurrentContext(), + pSidebarController->IsDocumentReadOnly(), + xFrame); + + deckList.realloc(aDecks.size()); + + long n = 0; + + for (ResourceManager::DeckContextDescriptorContainer::const_iterator + iDeck(aDecks.begin()), iEnd(aDecks.end()); + iDeck!=iEnd; ++iDeck) + { + deckList[n] = iDeck->msId; + n++; + } + } + + return deckList; + +} + +sal_Bool SAL_CALL SfxUnoDecks::hasByName( const OUString& aName ) + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + + sal_Bool bFound = false; + + if (pSidebarController) + { + ResourceManager::DeckContextDescriptorContainer aDecks; + + pSidebarController->GetResourceManager()->GetMatchingDecks ( + aDecks, + pSidebarController->GetCurrentContext(), + pSidebarController->IsDocumentReadOnly(), + xFrame); + + for (ResourceManager::DeckContextDescriptorContainer::const_iterator + iDeck(aDecks.begin()), iEnd(aDecks.end()); + iDeck!=iEnd && !bFound; ++iDeck) + { + if (iDeck->msId == aName) + bFound = true; + } + } + + return bFound; + +} + +// XIndexAccess + +sal_Int32 SAL_CALL SfxUnoDecks::getCount() throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Sequence< OUString > decks = getElementNames(); + return decks.getLength(); +} + +uno::Any SAL_CALL SfxUnoDecks::getByIndex( sal_Int32 Index ) + throw(lang::IndexOutOfBoundsException, + lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + uno::Any aRet; + + uno::Sequence< OUString > decks = getElementNames(); + + if (Index > decks.getLength()-1 || Index < 0) + throw lang::IndexOutOfBoundsException(); + + uno::Reference<ui::XDeck> xDeck = new SfxUnoDeck(xFrame, decks[Index]); + aRet <<= xDeck; + return aRet; + +} + +// XElementAccess +uno::Type SAL_CALL SfxUnoDecks::getElementType() + throw(::com::sun::star::uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + return uno::Type(); +} + +sal_Bool SAL_CALL SfxUnoDecks::hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Sequence< OUString > decks = getElementNames(); + return decks.hasElements(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/sfx2/source/sidebar/UnoPanel.cxx b/sfx2/source/sidebar/UnoPanel.cxx new file mode 100644 index 000000000000..e52bb27ec5c4 --- /dev/null +++ b/sfx2/source/sidebar/UnoPanel.cxx @@ -0,0 +1,271 @@ +/* -*- 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/sidebar/UnoPanel.hxx> + +#include <sfx2/sidebar/ResourceManager.hxx> +#include <sfx2/sidebar/SidebarController.hxx> + +#include <sfx2/sidebar/PanelTitleBar.hxx> +#include <sfx2/sidebar/Panel.hxx> +#include <sfx2/sidebar/Deck.hxx> + +#include <vcl/svapp.hxx> + +using namespace css; +using namespace ::sfx2::sidebar; + +SfxUnoPanel::SfxUnoPanel(const uno::Reference<frame::XFrame>& rFrame, const OUString& panelId, const OUString& deckId): +xFrame(rFrame), +mPanelId(panelId), +mDeckId(deckId), +mpDeck(), +mpPanel() +{ + SidebarController* pSidebarController = getSidebarController(); + + mpDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck; + mpPanel = mpDeck->GetPanel(mPanelId); +} +SidebarController* SfxUnoPanel::getSidebarController() +{ + return SidebarController::GetSidebarControllerForFrame(xFrame); +} + +OUString SAL_CALL SfxUnoPanel::getId() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + return mPanelId; +} + +OUString SAL_CALL SfxUnoPanel::getTitle() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + PanelTitleBar* pTitleBar = mpPanel->GetTitleBar(); + return pTitleBar->GetTitle(); +} + +void SAL_CALL SfxUnoPanel::setTitle( const OUString& newTitle ) + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + PanelTitleBar* pTitleBar = mpPanel->GetTitleBar(); + pTitleBar->SetTitle(newTitle); +} + +sal_Bool SAL_CALL SfxUnoPanel::isExpanded() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + return mpPanel->IsExpanded(); +} + + +void SAL_CALL SfxUnoPanel::expand( const sal_Bool bCollapseOther ) + throw(uno::RuntimeException, std::exception) +{ + + SolarMutexGuard aGuard; + + mpPanel->SetExpanded(true); + + if (bCollapseOther) + { + Panel* aPanel; + + SharedPanelContainer maPanels = mpDeck->GetPanels(); + for ( SharedPanelContainer::iterator iPanel(maPanels.begin()), iEnd(maPanels.end()); + iPanel!=iEnd; ++iPanel) + { + aPanel = *iPanel; + + if (! aPanel->HasIdPredicate(mPanelId)) + aPanel->SetExpanded(false); + } + } + +} + +void SAL_CALL SfxUnoPanel::collapse() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + mpPanel->SetExpanded(false); +} + +uno::Reference<awt::XWindow> SAL_CALL SfxUnoPanel::getDialog() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + return mpPanel->GetElementWindow(); +} + + +sal_Int32 SAL_CALL SfxUnoPanel::getOrderIndex() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(mPanelId)->mnOrderIndex; + return index; +} + +void SAL_CALL SfxUnoPanel::setOrderIndex( const sal_Int32 newOrderIndex ) + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, newOrderIndex); + + pSidebarController->NotifyResize(); +} + +void SAL_CALL SfxUnoPanel::moveFirst() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::PanelContextDescriptorContainer aPanels = pSidebarController->GetMatchingPanels(mDeckId); + + sal_Int32 curOrderIndex = getOrderIndex(); + sal_Int32 minIndex = GetMinOrderIndex(aPanels); + + if (curOrderIndex != minIndex) // is current panel already in place ? + { + minIndex -= 1; + pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, minIndex); + pSidebarController->NotifyResize(); + } +} + +void SAL_CALL SfxUnoPanel::moveLast() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::PanelContextDescriptorContainer aPanels = pSidebarController->GetMatchingPanels(mDeckId); + + sal_Int32 curOrderIndex = getOrderIndex(); + sal_Int32 maxIndex = GetMaxOrderIndex(aPanels); + + if (curOrderIndex != maxIndex) // is current panel already in place ? + { + maxIndex += 1; + pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, maxIndex); + pSidebarController->NotifyResize(); + } +} + +void SAL_CALL SfxUnoPanel::moveUp() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + // Search for previous panel OrderIndex + ResourceManager::PanelContextDescriptorContainer aPanels = pSidebarController->GetMatchingPanels(mDeckId); + + sal_Int32 curOrderIndex = getOrderIndex(); + sal_Int32 previousIndex = GetMinOrderIndex(aPanels); + + ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel; + for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel) + { + sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex; + if( index < curOrderIndex && index > previousIndex) + previousIndex = index; + } + + if (curOrderIndex != previousIndex) // is current panel already in place ? + { + previousIndex -= 1; + pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, previousIndex); + pSidebarController->NotifyResize(); + } +} + +void SAL_CALL SfxUnoPanel::moveDown() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::PanelContextDescriptorContainer aPanels = pSidebarController->GetMatchingPanels(mDeckId); + + // Search for next panel OrderIndex + sal_Int32 curOrderIndex = getOrderIndex(); + sal_Int32 nextIndex = GetMaxOrderIndex(aPanels); + + ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel; + for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel) + { + sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex; + if( index > curOrderIndex && index < nextIndex) + nextIndex = index; + } + + if (curOrderIndex != nextIndex) // is current panel already in place ? + { + nextIndex += 1; + pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, nextIndex); + pSidebarController->NotifyResize(); + } +} + +sal_Int32 SfxUnoPanel::GetMinOrderIndex(ResourceManager::PanelContextDescriptorContainer aPanels) +{ + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::PanelContextDescriptorContainer::iterator iPanel; + + iPanel = aPanels.begin(); + sal_Int32 minIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex; + + for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel) + { + sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex; + if(minIndex > index) + minIndex = index; + } + return minIndex; +} + +sal_Int32 SfxUnoPanel::GetMaxOrderIndex(ResourceManager::PanelContextDescriptorContainer aPanels) +{ + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::PanelContextDescriptorContainer::iterator iPanel; + + iPanel = aPanels.begin(); + sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex; + + for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel) + { + sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex; + if(maxIndex < index) + maxIndex = index; + } + return maxIndex; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/UnoPanels.cxx b/sfx2/source/sidebar/UnoPanels.cxx new file mode 100644 index 000000000000..8075667377b7 --- /dev/null +++ b/sfx2/source/sidebar/UnoPanels.cxx @@ -0,0 +1,180 @@ +/* -*- 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/sidebar/UnoPanels.hxx> + +#include <sfx2/sidebar/ResourceManager.hxx> +#include <sfx2/sidebar/SidebarController.hxx> + +#include <sfx2/sidebar/UnoDecks.hxx> + +#include <com/sun/star/ui/XPanel.hpp> +#include <sfx2/sidebar/UnoPanel.hxx> + +#include <vcl/svapp.hxx> + +using namespace css; +using namespace ::sfx2::sidebar; + +SfxUnoPanels::SfxUnoPanels(const uno::Reference<frame::XFrame>& rFrame, const OUString& deckId): +xFrame(rFrame), +mDeckId(deckId) +{ +} + +SidebarController* SfxUnoPanels::getSidebarController() +{ + return SidebarController::GetSidebarControllerForFrame(xFrame); +} + +OUString SAL_CALL SfxUnoPanels::getDeckId() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + return mDeckId; +} + +// XNameAccess + +uno::Any SAL_CALL SfxUnoPanels::getByName( const OUString& aName ) + throw(container::NoSuchElementException, + lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Any aRet; + + if (hasByName(aName)) + { + uno::Reference<ui::XPanel> xPanel = new SfxUnoPanel(xFrame, aName, mDeckId); + aRet <<= xPanel; + } + else + throw container::NoSuchElementException(); + + return aRet; +} + + +uno::Sequence< OUString > SAL_CALL SfxUnoPanels::getElementNames() + throw(uno::RuntimeException, std::exception) +{ + + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + + ResourceManager::PanelContextDescriptorContainer aPanels; + uno::Sequence< OUString > panelList(aPanels.size()); + + if (pSidebarController) + { + pSidebarController->GetResourceManager()->GetMatchingPanels(aPanels, + pSidebarController->GetCurrentContext(), + mDeckId, + xFrame); + + panelList.realloc(aPanels.size()); + + long n = 0; + + for (ResourceManager::PanelContextDescriptorContainer::const_iterator + iPanel(aPanels.begin()), iEnd(aPanels.end()); + iPanel!=iEnd; ++iPanel) + { + panelList[n] = iPanel->msId; + n++; + } + } + + return panelList; + +} + +sal_Bool SAL_CALL SfxUnoPanels::hasByName( const OUString& aName ) + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + + if (pSidebarController) + { + ResourceManager::PanelContextDescriptorContainer aPanels; + + pSidebarController->GetResourceManager()->GetMatchingPanels(aPanels, + pSidebarController->GetCurrentContext(), + mDeckId, + xFrame); + + for (ResourceManager::PanelContextDescriptorContainer::const_iterator + iPanel(aPanels.begin()), iEnd(aPanels.end()); + iPanel!=iEnd; ++iPanel) + { + if (iPanel->msId == aName) + return true; + } + } + + // nothing found + return false; + +} + +// XIndexAccess + +sal_Int32 SAL_CALL SfxUnoPanels::getCount() throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Sequence< OUString > panels = getElementNames(); + return panels.getLength(); +} + +uno::Any SAL_CALL SfxUnoPanels::getByIndex( sal_Int32 Index ) + throw(lang::IndexOutOfBoundsException, + lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Any aRet; + + uno::Sequence< OUString > panels = getElementNames(); + + if (Index > panels.getLength()-1 || Index < 0) + throw lang::IndexOutOfBoundsException(); + + uno::Reference<ui::XPanel> xPanel = new SfxUnoPanel(xFrame, panels[Index], mDeckId); + aRet <<= xPanel; + return aRet; + +} + +// XElementAccess +uno::Type SAL_CALL SfxUnoPanels::getElementType() + throw(::com::sun::star::uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + return uno::Type(); +} + +sal_Bool SAL_CALL SfxUnoPanels::hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Sequence< OUString > panels = getElementNames(); + return panels.hasElements(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/UnoSidebar.cxx b/sfx2/source/sidebar/UnoSidebar.cxx new file mode 100644 index 000000000000..28de260f5a50 --- /dev/null +++ b/sfx2/source/sidebar/UnoSidebar.cxx @@ -0,0 +1,102 @@ +/* -*- 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/sidebar/UnoSidebar.hxx> +#include <sfx2/sidebar/Tools.hxx> + +#include <sfx2/sidebar/ResourceManager.hxx> + +#include <sfx2/sidebar/UnoDecks.hxx> + +#include <com/sun/star/frame/XDispatch.hpp> + +#include <vcl/svapp.hxx> + + +using namespace css; +using namespace ::sfx2::sidebar; + +using ::com::sun::star::uno::RuntimeException; + +SfxUnoSidebar::SfxUnoSidebar(const uno::Reference<frame::XFrame>& rFrame): +xFrame(rFrame) +{ +} + +SidebarController* SfxUnoSidebar::getSidebarController() +{ + return SidebarController::GetSidebarControllerForFrame(xFrame); +} + +void SAL_CALL SfxUnoSidebar::showDecks ( const sal_Bool bVisible ) + throw (uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + + if (pSidebarController) + { + if (bVisible) + pSidebarController->RequestOpenDeck(); + else + pSidebarController->RequestCloseDeck(); + } +} + +void SAL_CALL SfxUnoSidebar::setVisible ( const sal_Bool bVisible ) + throw (uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + + if ( (bVisible && !pSidebarController) || (!bVisible && pSidebarController) ) + { + const util::URL aURL (Tools::GetURL(".uno:Sidebar")); + uno::Reference<frame::XDispatch> mxDispatch (Tools::GetDispatch(xFrame, aURL)); + if (mxDispatch.is()) + mxDispatch->dispatch(aURL, uno::Sequence<beans::PropertyValue>()); + } + +} + +sal_Bool SAL_CALL SfxUnoSidebar::isVisible() + throw (uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + + return pSidebarController != NULL; +} + +uno::Reference<frame::XFrame> SAL_CALL SfxUnoSidebar::getFrame() + throw (uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + if (! xFrame.is() ) + throw uno::RuntimeException(); + + return xFrame; +} + +uno::Reference<ui::XDecks> SAL_CALL SfxUnoSidebar::getDecks() + throw (uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Reference<ui::XDecks> decks = new SfxUnoDecks(xFrame); + return decks; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 2bcac22259bb..1ab147bc669e 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -80,6 +80,9 @@ #include <unordered_map> +#include <com/sun/star/ui/XSidebarProvider.hpp> +#include <sfx2/sidebar/UnoSidebar.hxx> + #define TIMEOUT_START_RESCHEDULE 10L /* 10th s */ using namespace ::com::sun::star; @@ -102,6 +105,8 @@ using ::com::sun::star::frame::XFrameActionListener; using ::com::sun::star::util::XCloseListener; using ::com::sun::star::task::XStatusIndicator; using ::com::sun::star::frame::XTitle; +using ::com::sun::star::ui::XSidebarProvider; + struct GroupIDToCommandGroup { @@ -540,6 +545,16 @@ SfxViewFrame& SfxBaseController::GetViewFrame_Impl() const } +Reference<XSidebarProvider> SAL_CALL SfxBaseController::getSidebar() throw (RuntimeException, std::exception) +{ + SfxViewFrame& rViewFrame = GetViewFrame_Impl(); + SfxFrame& rFrame = rViewFrame.GetFrame(); + + Reference<XSidebarProvider> rSidebar = new SfxUnoSidebar(rFrame.GetFrameInterface()); + return rSidebar; +} + + // SfxBaseController -> XController2 -> XController diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 9754f33e1f5a..b1f0eb815727 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2830,7 +2830,6 @@ void Window::SetActivateMode( ActivateModeFlags nMode ) void Window::setPosSizePixel( long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags ) { - bool bHasValidSize = !mpWindowImpl->mbDefSize; if ( nFlags & PosSizeFlags::Pos ) |