From 1751a6d706e2ebe4027932a853df3facd1b91486 Mon Sep 17 00:00:00 2001 From: Laurent Godard Date: Thu, 30 Apr 2015 16:56:14 +0200 Subject: new uno sidebar api tdf#91806 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the entry point is SfxBaseController::getSidebar() the Decks and panels are now per SidebarController and not global anymore ' macro example Sub testSidebarApi controller = thisComponent.currentcontroller frameIni = thisComponent.currentcontroller.frame sidebar = thisComponent.currentcontroller.getSidebar() sidebar.setVisible(true) frame = sidebar.getFrame() decks = sidebar.getdecks() c = decks.count h = decks.hasElements() e = decks.getElementNames() a = decks.hasByName("MyDeck") deck = decks.getByName("MyDeck") deck.activate(true) t = deck.getTitle() deck.setTitle("new deck title") deck.moveFirst() deck.moveLast() deck.moveUp() deck.moveDown() index = deck.getOrderIndex() panels = deck.getPanels() ep = panels.getElementnames() ap = panels.hasByName("aPanelName") panel = panels.getByName("aPanelName") panel.setTitle("new panel title") panel.collapse() panel.expand(true) ' expand and collapse other index = panel.getOrderIndex() panel.moveLast() panel.moveFirst() panel.moveDown() panel.moveUp() End Sub Change-Id: I7a4b953f2277dea483bb296ba6ead35de7205ace Reviewed-on: https://gerrit.libreoffice.org/15856 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl Tested-by: Tomaž Vajngerl (cherry picked from commit a64999511ae654131d997eec9a3d78478cfc1c75) --- sfx2/source/sidebar/Accessible.cxx | 2 +- sfx2/source/sidebar/Accessible.hxx | 67 ------- sfx2/source/sidebar/AccessibleTitleBar.cxx | 6 +- sfx2/source/sidebar/AccessibleTitleBar.hxx | 47 ----- sfx2/source/sidebar/AsynchronousCall.cxx | 3 +- sfx2/source/sidebar/AsynchronousCall.hxx | 55 ------ sfx2/source/sidebar/Context.cxx | 3 +- sfx2/source/sidebar/Context.hxx | 63 ------- sfx2/source/sidebar/ContextList.cxx | 9 +- sfx2/source/sidebar/ContextList.hxx | 68 ------- sfx2/source/sidebar/ControlFactory.cxx | 4 +- sfx2/source/sidebar/Deck.cxx | 29 ++- sfx2/source/sidebar/Deck.hxx | 105 ----------- sfx2/source/sidebar/DeckDescriptor.cxx | 8 +- sfx2/source/sidebar/DeckDescriptor.hxx | 53 ------ sfx2/source/sidebar/DeckLayouter.cxx | 8 +- sfx2/source/sidebar/DeckLayouter.hxx | 57 ------ sfx2/source/sidebar/DeckTitleBar.cxx | 5 +- sfx2/source/sidebar/DeckTitleBar.hxx | 55 ------ sfx2/source/sidebar/DrawHelper.cxx | 4 +- sfx2/source/sidebar/DrawHelper.hxx | 51 ----- sfx2/source/sidebar/FocusManager.cxx | 10 +- sfx2/source/sidebar/FocusManager.hxx | 150 --------------- sfx2/source/sidebar/MenuButton.cxx | 6 +- sfx2/source/sidebar/MenuButton.hxx | 52 ----- sfx2/source/sidebar/Paint.cxx | 2 +- sfx2/source/sidebar/Paint.hxx | 78 -------- sfx2/source/sidebar/Panel.cxx | 24 ++- sfx2/source/sidebar/Panel.hxx | 79 -------- sfx2/source/sidebar/PanelDescriptor.cxx | 2 +- sfx2/source/sidebar/PanelDescriptor.hxx | 54 ------ sfx2/source/sidebar/PanelTitleBar.cxx | 9 +- sfx2/source/sidebar/PanelTitleBar.hxx | 66 ------- sfx2/source/sidebar/ResourceManager.cxx | 48 ++++- sfx2/source/sidebar/ResourceManager.hxx | 125 ------------ sfx2/source/sidebar/Sidebar.cxx | 8 +- sfx2/source/sidebar/Sidebar.hrc | 60 ------ sfx2/source/sidebar/Sidebar.src | 2 +- sfx2/source/sidebar/SidebarChildWindow.cxx | 4 +- sfx2/source/sidebar/SidebarController.cxx | 155 +++++++++++---- sfx2/source/sidebar/SidebarController.hxx | 257 ------------------------- sfx2/source/sidebar/SidebarDockingWindow.cxx | 4 +- sfx2/source/sidebar/SidebarDockingWindow.hxx | 61 ------ sfx2/source/sidebar/SidebarResource.hxx | 35 ---- sfx2/source/sidebar/TabBar.cxx | 31 +-- sfx2/source/sidebar/TabBar.hxx | 130 ------------- sfx2/source/sidebar/TabItem.cxx | 6 +- sfx2/source/sidebar/TabItem.hxx | 55 ------ sfx2/source/sidebar/Theme.cxx | 4 +- sfx2/source/sidebar/TitleBar.cxx | 8 +- sfx2/source/sidebar/TitleBar.hxx | 79 -------- sfx2/source/sidebar/ToolBox.hxx | 53 ------ sfx2/source/sidebar/UnoDeck.cxx | 262 ++++++++++++++++++++++++++ sfx2/source/sidebar/UnoDecks.cxx | 168 +++++++++++++++++ sfx2/source/sidebar/UnoPanel.cxx | 271 +++++++++++++++++++++++++++ sfx2/source/sidebar/UnoPanels.cxx | 180 ++++++++++++++++++ sfx2/source/sidebar/UnoSidebar.cxx | 102 ++++++++++ sfx2/source/view/sfxbasecontroller.cxx | 15 ++ 58 files changed, 1281 insertions(+), 2076 deletions(-) delete mode 100644 sfx2/source/sidebar/Accessible.hxx delete mode 100644 sfx2/source/sidebar/AccessibleTitleBar.hxx delete mode 100644 sfx2/source/sidebar/AsynchronousCall.hxx delete mode 100644 sfx2/source/sidebar/Context.hxx delete mode 100644 sfx2/source/sidebar/ContextList.hxx delete mode 100644 sfx2/source/sidebar/Deck.hxx delete mode 100644 sfx2/source/sidebar/DeckDescriptor.hxx delete mode 100644 sfx2/source/sidebar/DeckLayouter.hxx delete mode 100644 sfx2/source/sidebar/DeckTitleBar.hxx delete mode 100644 sfx2/source/sidebar/DrawHelper.hxx delete mode 100644 sfx2/source/sidebar/FocusManager.hxx delete mode 100644 sfx2/source/sidebar/MenuButton.hxx delete mode 100644 sfx2/source/sidebar/Paint.hxx delete mode 100644 sfx2/source/sidebar/Panel.hxx delete mode 100644 sfx2/source/sidebar/PanelDescriptor.hxx delete mode 100644 sfx2/source/sidebar/PanelTitleBar.hxx delete mode 100644 sfx2/source/sidebar/ResourceManager.hxx delete mode 100644 sfx2/source/sidebar/Sidebar.hrc delete mode 100644 sfx2/source/sidebar/SidebarController.hxx delete mode 100644 sfx2/source/sidebar/SidebarDockingWindow.hxx delete mode 100644 sfx2/source/sidebar/SidebarResource.hxx delete mode 100644 sfx2/source/sidebar/TabBar.hxx delete mode 100644 sfx2/source/sidebar/TabItem.hxx delete mode 100644 sfx2/source/sidebar/TitleBar.hxx delete mode 100644 sfx2/source/sidebar/ToolBox.hxx create mode 100644 sfx2/source/sidebar/UnoDeck.cxx create mode 100644 sfx2/source/sidebar/UnoDecks.cxx create mode 100644 sfx2/source/sidebar/UnoPanel.cxx create mode 100644 sfx2/source/sidebar/UnoPanels.cxx create mode 100644 sfx2/source/sidebar/UnoSidebar.cxx (limited to 'sfx2/source') 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 using namespace css; using namespace css::uno; diff --git a/sfx2/source/sidebar/Accessible.hxx b/sfx2/source/sidebar/Accessible.hxx deleted file mode 100644 index 6f786f00663a..000000000000 --- a/sfx2/source/sidebar/Accessible.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_ACCESSIBLE_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_ACCESSIBLE_HXX - -#include - -#include -#include - -#include -#include - -namespace -{ - typedef ::cppu::WeakComponentImplHelper1 < - css::accessibility::XAccessible - > AccessibleInterfaceBase; -} - -namespace sfx2 { namespace sidebar { - - -/** Simple implementation of the XAccessible interface. - Its getAccessibleContext() method returns a context object given - to its constructor. -*/ -class Accessible - : private ::boost::noncopyable, - private ::cppu::BaseMutex, - public AccessibleInterfaceBase -{ -public: - explicit Accessible ( - const css::uno::Reference& rxContext); - virtual ~Accessible(); - - virtual void SAL_CALL disposing() SAL_OVERRIDE; - // XAccessible - virtual css::uno::Reference SAL_CALL getAccessibleContext() - throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - -private: - css::uno::Reference mxContext; -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 +#include +#include #include diff --git a/sfx2/source/sidebar/AccessibleTitleBar.hxx b/sfx2/source/sidebar/AccessibleTitleBar.hxx deleted file mode 100644 index 49e68e74265a..000000000000 --- a/sfx2/source/sidebar/AccessibleTitleBar.hxx +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_ACCESSIBLETITLEBAR_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_ACCESSIBLETITLEBAR_HXX - -#include -#include - -namespace sfx2 { namespace sidebar { - -class TitleBar; - -class AccessibleTitleBar - : public VCLXAccessibleComponent -{ -public: - static css::uno::Reference Create (TitleBar& rTitleBar); - -protected: - virtual void FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet) SAL_OVERRIDE; - -private: - explicit AccessibleTitleBar (VCLXWindow* pWindow); - virtual ~AccessibleTitleBar(); -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 #include namespace sfx2 { namespace sidebar { diff --git a/sfx2/source/sidebar/AsynchronousCall.hxx b/sfx2/source/sidebar/AsynchronousCall.hxx deleted file mode 100644 index 338505c83e4b..000000000000 --- a/sfx2/source/sidebar/AsynchronousCall.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_ASYNCHRONOUSCALL_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_ASYNCHRONOUSCALL_HXX - -#include -#include -#include - -struct ImplSVEvent; - -namespace sfx2 { namespace sidebar { - -/** A simple asynchronous call via Application::PostUserCall. -*/ -class AsynchronousCall -{ -public: - typedef ::boost::function Action; - - AsynchronousCall(); - AsynchronousCall (const Action& rAction); - ~AsynchronousCall(); - - void RequestCall(); - void CancelRequest(); - -private: - Action maAction; - ImplSVEvent * mnCallId; - - DECL_LINK(HandleUserCall, void*); -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 + #define AnyApplicationName "any" #define AnyContextName "any" diff --git a/sfx2/source/sidebar/Context.hxx b/sfx2/source/sidebar/Context.hxx deleted file mode 100644 index b9430baedfb3..000000000000 --- a/sfx2/source/sidebar/Context.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_CONTEXT_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_CONTEXT_HXX - -#include - -#include - -namespace sfx2 { namespace sidebar { - -class Context -{ -public: - ::rtl::OUString msApplication; - ::rtl::OUString msContext; - - Context(); - Context ( - const ::rtl::OUString& rsApplication, - const ::rtl::OUString& rsContext); - - /** When two contexts are matched against each other then - application or context name may have the wildcard value 'any'. - In order to prefer matches without wildcards over matches with - wildcards we introduce a integer evaluation for matches. - */ - const static sal_Int32 NoMatch; - const static sal_Int32 OptimalMatch; - const static sal_Int32 ApplicationWildcardMatch; - const static sal_Int32 ContextWildcardMatch; - - /** Return the numeric value that describes how good the match - between two contexts is. - Smaller values represent better matches. - */ - sal_Int32 EvaluateMatch (const Context& rOther) const; - - bool operator== (const Context& rOther) const; - bool operator!= (const Context& rOther) const; -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 +#include 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/ContextList.hxx b/sfx2/source/sidebar/ContextList.hxx deleted file mode 100644 index 98860078de93..000000000000 --- a/sfx2/source/sidebar/ContextList.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_CONTEXTLIST_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_CONTEXTLIST_HXX - -#include "Context.hxx" -#include -#include - -#include - -namespace sfx2 { namespace sidebar { - -/** Per context data for deck and panel descriptors. -*/ -class ContextList -{ -public: - ContextList(); - ~ContextList(); - - class Entry - { - public: - Context maContext; - bool mbIsInitiallyVisible; - ::rtl::OUString msMenuCommand; - }; - - /** Return when the given context matches any of the stored contexts. - */ - const Entry* GetMatch ( - const Context& rContext) const; - Entry* GetMatch ( - const Context& rContext); - - void AddContextDescription ( - const Context& rContext, - const bool bIsInitiallyVisible, - const ::rtl::OUString& rsMenuCommand); - -private: - ::std::vector maEntries; - - ::std::vector::const_iterator FindBestMatch (const Context& rContext) const; -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* 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 -#include "MenuButton.hxx" -#include "TabItem.hxx" +#include +#include #include #include 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 +#include +#include +#include +#include +#include +#include +#include #include #include @@ -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/Deck.hxx b/sfx2/source/sidebar/Deck.hxx deleted file mode 100644 index 9efaadc94fed..000000000000 --- a/sfx2/source/sidebar/Deck.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECK_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_DECK_HXX - -#include "Panel.hxx" - -#include -#include -#include - -class ScrollBar; - -namespace sfx2 { namespace sidebar { - -class DeckDescriptor; -class DeckTitleBar; - -/** This is the parent window of the panels. - It displays the deck title. -*/ -class Deck : public vcl::Window -{ -public: - Deck(const DeckDescriptor& rDeckDescriptor, - vcl::Window* pParentWindow, - const std::function& rCloserAction); - virtual ~Deck(); - virtual void dispose() SAL_OVERRIDE; - - const OUString& GetId() const - { - return msId; - } - DeckTitleBar* GetTitleBar() const; - Rectangle GetContentArea() const; - void ResetPanels (const SharedPanelContainer& rPanels); - const SharedPanelContainer& GetPanels() const - { - return maPanels; - } - void RequestLayout(); - vcl::Window* GetPanelParentWindow(); - - /** Try to make the panel completely visible. - When the whole panel does not fit then make its top visible - and it off at the bottom. - */ - void ShowPanel (const Panel& rPanel); - - virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; - virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE; - virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE; - virtual bool Notify(NotifyEvent& rEvent) SAL_OVERRIDE; - - static void PrintWindowSubTree (vcl::Window* pRoot, int nIndentation); - - sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; } - - class ScrollContainerWindow : public vcl::Window - { - public: - ScrollContainerWindow(vcl::Window* pParentWindow); - virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE; - void SetSeparators(const ::std::vector& rSeparators); - private: - std::vector maSeparators; - }; - -private: - const OUString msId; - Image maIcon; - sal_Int32 mnMinimalWidth; - SharedPanelContainer maPanels; - VclPtr mpTitleBar; - VclPtr mpScrollClipWindow; - VclPtr mpScrollContainer; - VclPtr mpFiller; - VclPtr mpVerticalScrollBar; - - DECL_LINK(HandleVerticalScrollBarChange,void*); - bool ProcessWheelEvent(CommandEvent* pCommandEvent); -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 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/DeckDescriptor.hxx b/sfx2/source/sidebar/DeckDescriptor.hxx deleted file mode 100644 index 77f811e77bf7..000000000000 --- a/sfx2/source/sidebar/DeckDescriptor.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECKDESCRIPTOR_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_DECKDESCRIPTOR_HXX - -#include -#include "ContextList.hxx" -#include - -namespace sfx2 { namespace sidebar { - -class DeckDescriptor -{ -public: - OUString msTitle; - OUString msId; - OUString msIconURL; - OUString msHighContrastIconURL; - OUString msTitleBarIconURL; - OUString msHighContrastTitleBarIconURL; - OUString msHelpURL; - OUString msHelpText; - ContextList maContextList; - bool mbIsEnabled; - sal_Int32 mnOrderIndex; - bool mbExperimental; - - DeckDescriptor(); - DeckDescriptor (const DeckDescriptor& rOther); - ~DeckDescriptor(); -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 #include -#include "Panel.hxx" -#include "PanelTitleBar.hxx" -#include "Deck.hxx" +#include +#include +#include #include #include diff --git a/sfx2/source/sidebar/DeckLayouter.hxx b/sfx2/source/sidebar/DeckLayouter.hxx deleted file mode 100644 index 965fb5614247..000000000000 --- a/sfx2/source/sidebar/DeckLayouter.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECKLAYOUTER_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_DECKLAYOUTER_HXX - -#include "Panel.hxx" - -#include - -#include - -#include - -class ScrollBar; -namespace vcl { class Window; } - -namespace sfx2 { namespace sidebar { - -class Panel; - -/** Helper for layouting the direct and indirect children of a - deck like title bars, panels, and scroll bars. -*/ -namespace DeckLayouter -{ - void LayoutDeck ( - const Rectangle& rContentArea, - sal_Int32& rMinimalWidth, - SharedPanelContainer& rPanels, - vcl::Window& pDeckTitleBar, - vcl::Window& pScrollClipWindow, - vcl::Window& pScrollContainer, - vcl::Window& pFiller, - ScrollBar& pVerticalScrollBar); -} - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 #include #include -#include "Sidebar.hrc" + +#include #include diff --git a/sfx2/source/sidebar/DeckTitleBar.hxx b/sfx2/source/sidebar/DeckTitleBar.hxx deleted file mode 100644 index bd47883dccc9..000000000000 --- a/sfx2/source/sidebar/DeckTitleBar.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECKTITLEBAR_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_DECKTITLEBAR_HXX - -#include "TitleBar.hxx" - -namespace sfx2 { namespace sidebar { - -class DeckTitleBar : public TitleBar -{ -public: - DeckTitleBar(const OUString& rsTitle, - vcl::Window* pParentWindow, - const std::function& rCloserAction); - - void SetCloserVisible(const bool bIsCloserVisible); - - virtual void DataChanged(const DataChangedEvent& rEvent) SAL_OVERRIDE; - -protected: - virtual Rectangle GetTitleArea(const Rectangle& rTitleBarBox) SAL_OVERRIDE; - virtual void PaintDecoration(vcl::RenderContext& rRenderContext, const Rectangle& rTitleBarBox) SAL_OVERRIDE; - virtual sidebar::Paint GetBackgroundPaint() SAL_OVERRIDE; - virtual Color GetTextColor() SAL_OVERRIDE; - virtual void HandleToolBoxItemClick(const sal_uInt16 nItemIndex) SAL_OVERRIDE; - virtual css::uno::Reference CreateAccessible() SAL_OVERRIDE; - -private: - const sal_uInt16 mnCloserItemIndex; - const std::function maCloserAction; - bool mbIsCloserVisible; -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 +#include #include diff --git a/sfx2/source/sidebar/DrawHelper.hxx b/sfx2/source/sidebar/DrawHelper.hxx deleted file mode 100644 index 97bdb0c04530..000000000000 --- a/sfx2/source/sidebar/DrawHelper.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DRAWHELPER_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_DRAWHELPER_HXX - -#include - -#include - -class Color; - -namespace sfx2 { namespace sidebar { - -class Paint; - -/** Some convenience functions for painting backgrounds and borders. -*/ -class DrawHelper -{ -public: - static void DrawBorder(vcl::RenderContext& rRenderContext, const Rectangle& rBox, const SvBorder& rBorderSize, - const Paint& rHorizontalPaint, const Paint& rVerticalPaint); - static void DrawHorizontalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nLeft, const sal_Int32 nRight, - const sal_Int32 nY, const sal_Int32 nHeight, const Paint& rPaint); - static void DrawVerticalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nTop, const sal_Int32 nBottom, - const sal_Int32 nX, const sal_Int32 nWidth, const Paint& rPaint); - static void DrawRoundedRectangle(vcl::RenderContext& rRenderContext, const Rectangle& rBox, const sal_Int32 nCornerRadius, - const Color& rBorderColor, const Paint& rFillPaint); -}; - -}} // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 +#include +#include +#include #include -#include "TitleBar.hxx" +#include #include #include #include diff --git a/sfx2/source/sidebar/FocusManager.hxx b/sfx2/source/sidebar/FocusManager.hxx deleted file mode 100644 index f93f9e82c368..000000000000 --- a/sfx2/source/sidebar/FocusManager.hxx +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_FOCUSMANAGER_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_FOCUSMANAGER_HXX - -#include "Panel.hxx" -#include -#include - -class Button; -class VclSimpleEvent; - -namespace sfx2 { namespace sidebar { - -class DeckTitleBar; - -/** Concentrate all focus handling in this class. - - There is one ring of windows that accept the input focus which are - cycled through with the arrow keys: - - the closer in the deck title (present only when docked) - - the panel title bars - - the tab bar items - - When the focus is in a panel title then focus travels over - - the panel title - - the panel closer - - the panel content - - Once the focus is in the panel content then focus cycles through - all controls inside the panel but not back to the title bar of - the panel. Escape places the focus back in the panel title. -*/ -class FocusManager -{ -public: - FocusManager(const std::function& rShowPanelFunctor); - ~FocusManager(); - - /** Forget all panels and buttons. Remove all window listeners. - */ - void Clear(); - - /** Transfer the focus into the sidebar tree of windows. This is - typically called from the SidebarChildWindow as result of - pressing the F6 key. - */ - void GrabFocus(); - - void SetDeckTitle(DeckTitleBar* pDeckTitleBar); - void SetPanels(const SharedPanelContainer& rPanels); - void SetButtons(const ::std::vector& rButtons); - -private: - VclPtr mpDeckTitleBar; - std::vector > maPanels; - std::vector > maButtons; - const std::function maShowPanelFunctor; - bool mbObservingContentControlFocus; - VclPtr mpFirstFocusedContentControl; - VclPtr mpLastFocusedWindow; - - enum PanelComponent - { - PC_DeckTitle, - PC_DeckToolBox, - PC_PanelTitle, - PC_PanelToolBox, - PC_PanelContent, - PC_TabBar, - PC_None - }; - class FocusLocation - { - public: - PanelComponent meComponent; - sal_Int32 mnIndex; - FocusLocation(const PanelComponent eComponent, const sal_Int32 nIndex); - }; - - /** Listen for key events for panels and buttons. - */ - DECL_LINK(WindowEventListener, VclSimpleEvent*); - DECL_LINK(ChildEventListener, VclSimpleEvent*); - - void ClearPanels(); - void ClearButtons(); - - /** Let the focus manager listen for window events for the given - window. - */ - void RegisterWindow(vcl::Window& rWindow); - void UnregisterWindow(vcl::Window& rWindow); - - /** Remove the window from the panel or the button container. - */ - void RemoveWindow(vcl::Window& rWindow); - - void FocusDeckTitle(); - bool IsDeckTitleVisible() const; - bool IsPanelTitleVisible(const sal_Int32 nPanelIndex) const; - - /** Set the focus to the title bar of the panel or, if the - title bar is not visible, directly to the panel. - @param nPanelIndex - Index of the panel to focus. - @param bFallbackToDeckTitle - When the panel title bar is not visible then The fallback - bias defines whether to focus the deck (true) or the panel - content (false) will be focused instead. - */ - void FocusPanel(const sal_Int32 nPanelIndex, - const bool bFallbackToDeckTitle); - - void FocusPanelContent(const sal_Int32 nPanelIndex); - void FocusButton(const sal_Int32 nButtonIndex); - void ClickButton(const sal_Int32 nButtonIndex); - bool MoveFocusInsidePanel(const FocusLocation& rLocation, - const sal_Int32 nDirection); - bool MoveFocusInsideDeckTitle(const FocusLocation& rLocation, - const sal_Int32 nDirection); - - void HandleKeyEvent(const vcl::KeyCode& rKeyCode, - const vcl::Window& rWindow); - - FocusLocation GetFocusLocation(const vcl::Window& rWindow) const; - -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 -#include "DrawHelper.hxx" -#include "Paint.hxx" +#include +#include #include #include diff --git a/sfx2/source/sidebar/MenuButton.hxx b/sfx2/source/sidebar/MenuButton.hxx deleted file mode 100644 index d725fb71c01d..000000000000 --- a/sfx2/source/sidebar/MenuButton.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_MENUBUTTON_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_MENUBUTTON_HXX - -#include - -namespace sfx2 { namespace sidebar { - -class MenuButton - : public CheckBox -{ -public: - MenuButton (vcl::Window* pParentWindow); - - virtual void Paint (vcl::RenderContext& /*rRenderContext*/, const Rectangle& rUpdateArea) SAL_OVERRIDE; - virtual void MouseMove (const MouseEvent& rEvent) SAL_OVERRIDE; - virtual void MouseButtonDown (const MouseEvent& rMouseEvent) SAL_OVERRIDE; - virtual void MouseButtonUp (const MouseEvent& rMouseEvent) SAL_OVERRIDE; - -protected: - using CheckBox::FillLayoutData; - -private: - bool mbIsLeftButtonDown; - enum PaintType { - PT_Native, - PT_Theme - } mePaintType; -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 #include #include diff --git a/sfx2/source/sidebar/Paint.hxx b/sfx2/source/sidebar/Paint.hxx deleted file mode 100644 index 91b36f093bf8..000000000000 --- a/sfx2/source/sidebar/Paint.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_PAINT_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_PAINT_HXX - -#include -#include -#include -#include - -#include - -namespace sfx2 { namespace sidebar { - -/** Abstraction of different ways to fill outlines. - Can be - - none (empty: outline is not filled) - - singular color - - gradient -*/ -class Paint -{ -public: - enum Type - { - NoPaint, - ColorPaint, - GradientPaint - }; - - // Create a Paint object for an Any that may contain a color, a - // awt::Gradient, or nothing. - static Paint Create (const css::uno::Any& rValue); - - // Create paint with type NoPaint. - explicit Paint(); - - // Create a Paint object for the given color. - explicit Paint (const Color& rColor); - - // Create a Paint object for the given gradient. - explicit Paint (const Gradient& rGradient); - - Type GetType() const { return meType;} - const Color& GetColor() const; - const Gradient& GetGradient() const; - - Wallpaper GetWallpaper() const; - -private: - Type meType; - ::boost::variant< - Color, - Gradient - > maValue; -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 +#include +#include #include -#include "Paint.hxx" -#include "ResourceManager.hxx" +#include +#include + +#include + #ifdef DEBUG #include -#include "Deck.hxx" +#include #endif #include @@ -47,7 +50,9 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor, vcl::Window* pParentWindow, const bool bIsInitiallyExpanded, const std::function& rDeckLayoutTrigger, - const std::function& rContextAccess) + const std::function& rContextAccess, + const css::uno::Reference& rxFrame + ) : Window(pParentWindow) , msPanelId(rPanelDescriptor.msId) , mpTitleBar(VclPtr::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& 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/Panel.hxx b/sfx2/source/sidebar/Panel.hxx deleted file mode 100644 index 52e6e49018cf..000000000000 --- a/sfx2/source/sidebar/Panel.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_PANEL_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_PANEL_HXX - -#include "Context.hxx" -#include - -#include -#include - -#include -#include -#include - -namespace sfx2 { namespace sidebar { - -class PanelDescriptor; -class TitleBar; -class PanelTitleBar; - -class Panel : public vcl::Window -{ -public: - Panel(const PanelDescriptor& rPanelDescriptor, vcl::Window* pParentWindow, - const bool bIsInitiallyExpanded, const std::function& rDeckLayoutTrigger, - const std::function& rContextAccess); - virtual ~Panel(); - virtual void dispose() SAL_OVERRIDE; - - PanelTitleBar* GetTitleBar() const; - bool IsTitleBarOptional() const { return mbIsTitleBarOptional;} - void SetUIElement (const css::uno::Reference& rxElement); - css::uno::Reference GetPanelComponent() const { return mxPanelComponent;} - css::uno::Reference GetElementWindow(); - void SetExpanded (const bool bIsExpanded); - bool IsExpanded() const { return mbIsExpanded;} - bool HasIdPredicate (const OUString& rsId) const; - const OUString& GetId() const { return msPanelId;} - - virtual void Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE; - virtual void Resize() SAL_OVERRIDE; - virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE; - virtual void Activate() SAL_OVERRIDE; - virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; - -private: - const OUString msPanelId; - VclPtr mpTitleBar; - const bool mbIsTitleBarOptional; - css::uno::Reference mxElement; - css::uno::Reference mxPanelComponent; - bool mbIsExpanded; - const std::function maDeckLayoutTrigger; - const std::function maContextAccess; -}; -typedef std::vector > SharedPanelContainer; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 namespace sfx2 { namespace sidebar { diff --git a/sfx2/source/sidebar/PanelDescriptor.hxx b/sfx2/source/sidebar/PanelDescriptor.hxx deleted file mode 100644 index f67a12805471..000000000000 --- a/sfx2/source/sidebar/PanelDescriptor.hxx +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_PANELDESCRIPTOR_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_PANELDESCRIPTOR_HXX - -#include -#include "ContextList.hxx" -#include - -namespace sfx2 { namespace sidebar { - -class PanelDescriptor -{ -public: - OUString msTitle; - bool mbIsTitleBarOptional; - OUString msId; - OUString msDeckId; - OUString msTitleBarIconURL; - OUString msHighContrastTitleBarIconURL; - OUString msHelpURL; - ContextList maContextList; - OUString msImplementationURL; - sal_Int32 mnOrderIndex; - bool mbShowForReadOnlyDocuments; - bool mbWantsCanvas; - bool mbExperimental; - - PanelDescriptor(); - PanelDescriptor (const PanelDescriptor& rPanelDescriptor); - ~PanelDescriptor(); -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 #include -#include "Sidebar.hrc" -#include "Paint.hxx" -#include "Panel.hxx" +#include + +#include +#include #include #include #include diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/sfx2/source/sidebar/PanelTitleBar.hxx deleted file mode 100644 index 8c0f7e8849f5..000000000000 --- a/sfx2/source/sidebar/PanelTitleBar.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_PANELTITLEBAR_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_PANELTITLEBAR_HXX - -#include "TitleBar.hxx" - -#include -#include - -namespace sfx2 { namespace sidebar { - -class Panel; - -class PanelTitleBar - : public TitleBar -{ -public: - PanelTitleBar(const OUString& rsTitle, vcl::Window* pParentWindow, Panel* pPanel); - virtual ~PanelTitleBar(); - virtual void dispose() SAL_OVERRIDE; - - void SetMoreOptionsCommand(const OUString& rsCommandName, - const css::uno::Reference& rxFrame); - - virtual void DataChanged(const DataChangedEvent& rEvent) SAL_OVERRIDE; - virtual void MouseButtonDown(const MouseEvent& rMouseEvent) SAL_OVERRIDE; - virtual void MouseButtonUp(const MouseEvent& rMouseEvent) SAL_OVERRIDE; - -protected: - virtual Rectangle GetTitleArea(const Rectangle& rTitleBarBox) SAL_OVERRIDE; - virtual void PaintDecoration(vcl::RenderContext& rRenderContext, const Rectangle& rTitleBarBox) SAL_OVERRIDE; - virtual sidebar::Paint GetBackgroundPaint() SAL_OVERRIDE; - virtual Color GetTextColor() SAL_OVERRIDE; - virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex) SAL_OVERRIDE; - virtual css::uno::Reference CreateAccessible() SAL_OVERRIDE; - -private: - bool mbIsLeftButtonDown; - VclPtr mpPanel; - const sal_uInt16 mnMenuItemIndex; - css::uno::Reference mxFrame; - OUString msMoreOptionsCommand; -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 78fe32af6de0..fa53c831b1e5 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 #include #include @@ -114,6 +114,51 @@ void ResourceManager::SetIsDeckEnabled(const OUString& rsDeckId, const bool bIsE } } +void ResourceManager::SetDeckToDescriptor(const OUString& rsDeckId, VclPtr 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/ResourceManager.hxx b/sfx2/source/sidebar/ResourceManager.hxx deleted file mode 100644 index 9151760d00e4..000000000000 --- a/sfx2/source/sidebar/ResourceManager.hxx +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_RESOURCEMANAGER_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_RESOURCEMANAGER_HXX - -#include "DeckDescriptor.hxx" -#include "PanelDescriptor.hxx" -#include "Context.hxx" -#include -#include -#include -#include -#include - -namespace sfx2 { namespace sidebar { - -class Context; -class ContextList; - -/** Read the content of the Sidebar.xcu file and provide access - methods so that the sidebar can easily decide which content panels - to display for a certain context. -*/ -class ResourceManager -{ -public: - static ResourceManager& Instance(); - - const DeckDescriptor* GetDeckDescriptor(const OUString& rsDeckId) const; - const PanelDescriptor* GetPanelDescriptor(const OUString& rsPanelId) const; - - /** Excluded or include a deck from being displayed in the tab - bar. - Note that this value is not persistent. - The flag can not be set directly at a DeckDescriptor object - because the ResourceManager gives access to them only - read-only. - */ - void SetIsDeckEnabled(const OUString& rsDeckId, const bool bIsEnabled); - - class DeckContextDescriptor - { - public: - OUString msId; - bool mbIsEnabled; - }; - typedef std::vector DeckContextDescriptorContainer; - - class PanelContextDescriptor - { - public: - OUString msId; - OUString msMenuCommand; - bool mbIsInitiallyVisible; - bool mbShowForReadOnlyDocuments; - }; - typedef std::vector PanelContextDescriptorContainer; - - const DeckContextDescriptorContainer& GetMatchingDecks( - DeckContextDescriptorContainer& rDeckDescriptors, - const Context& rContext, - const bool bIsDocumentReadOnly, - const css::uno::Reference& rxFrame); - - const PanelContextDescriptorContainer& GetMatchingPanels( - PanelContextDescriptorContainer& rPanelDescriptors, - const Context& rContext, - const OUString& rsDeckId, - const css::uno::Reference& rxFrame); - - /** Remember the expansions state per panel and context. - This is not persistent past application end. - */ - void StorePanelExpansionState(const OUString& rsPanelId, - const bool bExpansionState, - const Context& rContext); - -private: - ResourceManager(); - ~ResourceManager(); - - typedef std::vector DeckContainer; - DeckContainer maDecks; - - typedef std::vector PanelContainer; - PanelContainer maPanels; - mutable std::set maProcessedApplications; - - SvtMiscOptions maMiscOptions; - - void ReadDeckList(); - void ReadPanelList(); - static void ReadContextList(const utl::OConfigurationNode& rNode, - ContextList& rContextList, - const OUString& rsDefaultMenuCommand); - void ReadLegacyAddons(const css::uno::Reference& rxFrame); - static utl::OConfigurationTreeRoot GetLegacyAddonRootNode(const OUString& rsModuleName); - static void GetToolPanelNodeNames(std::vector& rMatchingNames, - const utl::OConfigurationTreeRoot& aRoot); - static bool IsDeckEnabled(const OUString& rsDeckId, - const Context& rContext, - const css::uno::Reference& rxFrame); -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 -#include "SidebarController.hxx" -#include "ResourceManager.hxx" +#include +#include using namespace css; @@ -30,7 +30,9 @@ void Sidebar::ShowPanel ( const css::uno::Reference& 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.hrc b/sfx2/source/sidebar/Sidebar.hrc deleted file mode 100644 index 8f62aecbc91d..000000000000 --- a/sfx2/source/sidebar/Sidebar.hrc +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include - -#define RID_SIDEBAR_RESOURCE (RID_SFX_SIDEBAR_START + 0) - -#define IMAGE_SIDEBAR_PLUS 1 -#define IMAGE_SIDEBAR_MINUS 3 -#define IMAGE_SIDEBAR_GRIP 5 -#define IMAGE_SIDEBAR_MENU 7 -#define IMAGE_SIDEBAR_DETAIL_DIALOG 9 -#define IMAGE_SIDEBAR_TOOLBOX_SEPARATOR 11 -#define IMAGE_SIDEBAR_DECK_3D_LARGE 20 -#define IMAGE_SIDEBAR_DECK_3D_SMALL 22 -#define IMAGE_SIDEBAR_DECK_ANIMATION_LARGE 30 -#define IMAGE_SIDEBAR_DECK_ANIMATION_SMALL 32 -#define IMAGE_SIDEBAR_DECK_COLORS_LARGE 40 -#define IMAGE_SIDEBAR_DECK_COLORS_SMALL 42 -#define IMAGE_SIDEBAR_DECK_EYEDROPPER_LARGE 50 -#define IMAGE_SIDEBAR_DECK_EYEDROPPER_SMALL 52 -#define IMAGE_SIDEBAR_DECK_GALLERY_LARGE 60 -#define IMAGE_SIDEBAR_DECK_GALLERY_SMALL 62 -#define IMAGE_SIDEBAR_DECK_IMGANIM_LARGE 70 -#define IMAGE_SIDEBAR_DECK_IMGANIM_SMALL 72 -#define IMAGE_SIDEBAR_DECK_NAVIGATOR_LARGE 80 -#define IMAGE_SIDEBAR_DECK_NAVIGATOR_SMALL 82 -#define IMAGE_SIDEBAR_PROPERTIES_DECK_LARGE 90 -#define IMAGE_SIDEBAR_PROPERTIES_DECK_SMALL 92 -#define IMAGE_SIDEBAR_DECK_STYLE_LARGE 100 -#define IMAGE_SIDEBAR_DECK_STYLE_SMALL 102 -#define IMAGE_SIDEBAR_DECK_TEMPLATE_LARGE 110 -#define IMAGE_SIDEBAR_DECK_TEMPLATE_SMALL 112 -#define IMAGE_SIDEBAR_DECK_TRANSITION_LARGE 120 -#define IMAGE_SIDEBAR_DECK_TRANSITION_SMALL 122 -#define IMAGE_SIDEBAR_DECK_FUNCTIONS_LARGE 130 -#define IMAGE_SIDEBAR_DECK_FUNCTIONS_SMALL 132 -#define STRING_CUSTOMIZATION 200 -#define STRING_RESTORE 201 -#define STRING_HIDE_SIDEBAR 202 - -#define SFX_STR_SIDEBAR_MORE_OPTIONS (RID_SFX_SIDEBAR_START + 1) -#define SFX_STR_SIDEBAR_CLOSE_DECK (RID_SFX_SIDEBAR_START + 2) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 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 #include #include -#include "SidebarDockingWindow.hxx" +#include #include #include "helpid.hrc" #include diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 46d8e7abd3bb..89a781af1793 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 +#include +#include +#include +#include +#include +#include #include #include #include -#include "SidebarDockingWindow.hxx" -#include "Context.hxx" +#include +#include +#include + #include #include @@ -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(new ResourceManager()); + // Listen for context change events. css::uno::Reference 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 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 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(this)); maContextChangeUpdate.CancelRequest(); maAsynchronousDeckSwitch.CancelRequest(); + } void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) @@ -398,7 +420,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, @@ -440,8 +463,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 aDeck = VclPtr::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::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 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 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 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/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx deleted file mode 100644 index 5fb8466b1fbc..000000000000 --- a/sfx2/source/sidebar/SidebarController.hxx +++ /dev/null @@ -1,257 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_SIDEBARCONTROLLER_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_SIDEBARCONTROLLER_HXX - -#include - -#include - -#include "AsynchronousCall.hxx" -#include "Context.hxx" -#include "FocusManager.hxx" -#include "Panel.hxx" -#include "ResourceManager.hxx" -#include "TabBar.hxx" - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace -{ - typedef ::cppu::WeakComponentImplHelper4 < - css::ui::XContextChangeEventListener, - css::beans::XPropertyChangeListener, - css::ui::XSidebar, - css::frame::XStatusListener - > SidebarControllerInterfaceBase; -} - -class SfxSplitWindow; -class FixedBitmap; - -namespace sfx2 { namespace sidebar { - -class ContentPanelDescriptor; -class Deck; -class DeckDescriptor; -class SidebarDockingWindow; -class TabBar; -class TabBarConfiguration; - -class SidebarController - : private ::boost::noncopyable, - private ::cppu::BaseMutex, - public SidebarControllerInterfaceBase -{ -public: - SidebarController( - SidebarDockingWindow* pParentWindow, - const css::uno::Reference& rxFrame); - virtual ~SidebarController(); - - /** Return the SidebarController object that is associated with - the given XFrame. - @return - When there is no SidebarController object for the given - XFrame then is returned. - */ - static SidebarController* GetSidebarControllerForFrame ( - const css::uno::Reference& rxFrame); - - // ui::XContextChangeEventListener - virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) - throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - // XEventListener - virtual void SAL_CALL disposing (const css::lang::EventObject& rEventObject) - throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - // beans::XPropertyChangeListener - virtual void SAL_CALL propertyChange (const css::beans::PropertyChangeEvent& rEvent) - throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - // frame::XStatusListener - virtual void SAL_CALL statusChanged (const css::frame::FeatureStateEvent& rEvent) - throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - // ui::XSidebar - virtual void SAL_CALL requestLayout() - throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - void NotifyResize(); - - /** In some situations it is necessary to force an update of the - current deck and its panels. One reason is a change of the - view scale. Some panels can handle this only when - constructed. In this case we have to a context change and - also force that all panels are destroyed and created new. - */ - const static sal_Int32 SwitchFlag_NoForce = 0x00; - const static sal_Int32 SwitchFlag_ForceSwitch = 0x01; - const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02; - const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02; - - void OpenThenSwitchToDeck ( - const ::rtl::OUString& rsDeckId); - - /** Show only the tab bar, not the deck. - */ - void RequestCloseDeck(); - - /** Open the deck area and restore the parent window to its old width. - */ - void RequestOpenDeck(); - - /** Returns true when the given deck is the currently visible deck - */ - bool IsDeckVisible (const ::rtl::OUString& rsDeckId); - - FocusManager& GetFocusManager() { return maFocusManager;} - -private: - typedef ::std::map< - const css::uno::Reference, - css::uno::WeakReference - > SidebarControllerContainer; - static SidebarControllerContainer maSidebarControllerContainer; - - VclPtr mpCurrentDeck; - VclPtr mpParentWindow; - VclPtr mpTabBar; - css::uno::Reference mxFrame; - Context maCurrentContext; - Context maRequestedContext; - /// Use a combination of SwitchFlag_* as value. - sal_Int32 mnRequestedForceFlags; - ::rtl::OUString msCurrentDeckId; - ::rtl::OUString msCurrentDeckTitle; - AsynchronousCall maPropertyChangeForwarder; - AsynchronousCall maContextChangeUpdate; - AsynchronousCall maAsynchronousDeckSwitch; - - /** Two flags control whether the deck is displayed or if only the - tab bar remains visible. - The mbIsDeckOpen flag stores the current state while - mbIsDeckRequestedOpen stores how this state should be. User - actions like clicking on the deck closer affect the - mbIsDeckRequestedOpen. Normally both flags have the same - value. A document being read-only can prevent the deck from opening. - */ - ::boost::optional mbIsDeckRequestedOpen; - ::boost::optional mbIsDeckOpen; - bool mbCanDeckBeOpened; - - /** Before the deck is closed the sidebar width is saved into this variable, - so that it can be restored when the deck is reopended. - */ - sal_Int32 mnSavedSidebarWidth; - FocusManager maFocusManager; - css::uno::Reference mxReadOnlyModeDispatch; - bool mbIsDocumentReadOnly; - VclPtr mpSplitWindow; - /** When the user moves the splitter then we remember the - width at that time. - */ - sal_Int32 mnWidthOnSplitterButtonDown; - /** Control that is temporarily used as replacement for the deck - to indicate that when the current mouse drag operation ends, the - sidebar will only show the tab bar. - */ - VclPtr mpCloseIndicator; - - DECL_LINK(WindowEventHandler, VclWindowEvent*); - /** Make maRequestedContext the current context. - */ - void UpdateConfigurations(); - - css::uno::Reference CreateUIElement ( - const css::uno::Reference& rxWindow, - const ::rtl::OUString& rsImplementationURL, - const bool bWantsCanvas, - const Context& rContext); - VclPtr 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); - void ShowPopupMenu ( - const Rectangle& rButtonBox, - const ::std::vector& rMenuData) const; - ::boost::shared_ptr CreatePopupMenu ( - const ::std::vector& rMenuData) const; - DECL_LINK(OnMenuItemSelected, Menu*); - void BroadcastPropertyChange(); - - /** The close of the deck changes the width of the child window. - That is only possible if there is no other docking window docked above or below the sidebar. - Return whether the width of the child window can be modified. - */ - bool CanModifyChildWindowWidth(); - - /** Set the child window container to a new width. - Return the old width. - */ - sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth); - - /** Update the icons displayed in the title bars of the deck and - the panels. This is called once when a deck is created and - every time when a data change event is processed. - */ - void UpdateTitleBarIcons(); - - void UpdateDeckOpenState(); - void RestrictWidth (sal_Int32 nWidth); - SfxSplitWindow* GetSplitWindow(); - void ProcessNewWidth (const sal_Int32 nNewWidth); - void UpdateCloseIndicator (const bool bIsIndicatorVisible); - - /** Typically called when a panel is focused via keyboard. - Tries to scroll the deck up or down to make the given panel - completely visible. - */ - void ShowPanel (const Panel& rPanel); - - Context GetCurrentContext() const { return maCurrentContext;} - - virtual void SAL_CALL disposing() SAL_OVERRIDE; -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* 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 #include -#include "SidebarController.hxx" +#include #include #include diff --git a/sfx2/source/sidebar/SidebarDockingWindow.hxx b/sfx2/source/sidebar/SidebarDockingWindow.hxx deleted file mode 100644 index defbb17315e2..000000000000 --- a/sfx2/source/sidebar/SidebarDockingWindow.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_SIDEBARDOCKINGWINDOW_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_SIDEBARDOCKINGWINDOW_HXX - -#include - -#include - -namespace sfx2 { namespace sidebar { - -class SidebarChildWindow; - -class SidebarController; - -class SidebarDockingWindow : public SfxDockingWindow -{ -public: - SidebarDockingWindow(SfxBindings* pBindings, SidebarChildWindow& rChildWindow, - vcl::Window* pParent, WinBits nBits); - virtual ~SidebarDockingWindow(); - virtual void dispose() SAL_OVERRIDE; - - virtual bool Close() SAL_OVERRIDE; - -protected: - // Window overridables - virtual void GetFocus() SAL_OVERRIDE; - - virtual SfxChildAlignment CheckAlignment ( - SfxChildAlignment eCurrentAlignment, - SfxChildAlignment eRequestedAlignment) SAL_OVERRIDE; - -private: - ::rtl::Reference mpSidebarController; - - void DoDispose(); -}; - -} } // end of namespace sfx2::sidebar - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/SidebarResource.hxx b/sfx2/source/sidebar/SidebarResource.hxx deleted file mode 100644 index 3a6363a49b0d..000000000000 --- a/sfx2/source/sidebar/SidebarResource.hxx +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_SIDEBARRESOURCE_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_SIDEBARRESOURCE_HXX - -#include "Sidebar.hrc" -#include -#include - -class SidebarResource : public Resource -{ -public: - SidebarResource() : Resource(SfxResId(RID_SIDEBAR_RESOURCE)){} - ~SidebarResource() { FreeResource(); } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 +#include #include -#include "DeckDescriptor.hxx" -#include "Paint.hxx" +#include +#include #include #include -#include "FocusManager.hxx" +#include + +#include #include #include @@ -42,14 +44,18 @@ namespace sfx2 { namespace sidebar { TabBar::TabBar(vcl::Window* pParentWindow, const Reference& rxFrame, const boost::function& 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/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx deleted file mode 100644 index 37089f873d56..000000000000 --- a/sfx2/source/sidebar/TabBar.hxx +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX - -#include "DeckDescriptor.hxx" -#include "ResourceManager.hxx" - -#include -#include - -#include -#include -#include -#include - -class Button; -class CheckBox; -class RadioButton; - -namespace sfx2 { namespace sidebar { - -class FocusManager; -class TabBarConfiguration; -class TabItem; - -/** The tab bar is the container for the individual tabs. -*/ -class TabBar - : public vcl::Window -{ -public: - /** DeckMenuData has entries for display name, deck id, and a flag: - - isCurrentDeck for the deck selection data - - isEnabled for the show/hide menu - */ - class DeckMenuData - { - public: - ::rtl::OUString msDisplayName; - ::rtl::OUString msDeckId; - bool mbIsCurrentDeck; - bool mbIsActive; - bool mbIsEnabled; - }; - typedef ::boost::function& rMenuData)> PopupMenuProvider; - TabBar ( - vcl::Window* pParentWindow, - const css::uno::Reference& rxFrame, - const ::boost::function& rDeckActivationFunctor, - const PopupMenuProvider& rPopupMenuProvider); - virtual ~TabBar(); - virtual void dispose() SAL_OVERRIDE; - - virtual void Paint (vcl::RenderContext& /*rRenderContext*/, const Rectangle& rUpdateArea) SAL_OVERRIDE; - virtual void DataChanged (const DataChangedEvent& rDataChangedEvent) SAL_OVERRIDE; - virtual bool Notify (NotifyEvent& rEvent) SAL_OVERRIDE; - - static sal_Int32 GetDefaultWidth(); - - void SetDecks ( - const ResourceManager::DeckContextDescriptorContainer& rDecks); - void HighlightDeck (const ::rtl::OUString& rsDeckId); - void RemoveDeckHighlight (); - void AddPopupMenuEntries ( - PopupMenu& rMenu, - const sal_Int32 nFirstIndex); - void AddCustomizationMenuEntries ( - PopupMenu& rMenu, - const sal_Int32 nFirstIndex); - const ::rtl::OUString GetDeckIdForIndex (const sal_Int32 nIndex) const; - void ToggleHideFlag (const sal_Int32 nIndex); - void RestoreHideFlags(); - - void UpdateFocusManager (FocusManager& rFocusManager); - -private: - css::uno::Reference mxFrame; - VclPtr mpMenuButton; - class Item - { - public: - DECL_LINK(HandleClick, Button*); - VclPtr mpButton; - ::rtl::OUString msDeckId; - ::boost::function maDeckActivationFunctor; - bool mbIsHidden; - bool mbIsHiddenByDefault; - }; - typedef ::std::vector ItemContainer; - ItemContainer maItems; - const ::boost::function maDeckActivationFunctor; - sal_Int32 mnMenuSeparatorY; - PopupMenuProvider maPopupMenuProvider; - - VclPtr CreateTabItem (const DeckDescriptor& rDeckDescriptor); - Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const; - void Layout(); - void UpdateButtonIcons(); - - ::boost::shared_ptr CreatePopupMenu() const; - void ShowPopupMenu() const; - DECL_LINK(OnToolboxClicked, void*); - -}; - - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 -#include "DrawHelper.hxx" -#include "Paint.hxx" +#include +#include #include #include diff --git a/sfx2/source/sidebar/TabItem.hxx b/sfx2/source/sidebar/TabItem.hxx deleted file mode 100644 index f63e4e2ea3cb..000000000000 --- a/sfx2/source/sidebar/TabItem.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_TABITEM_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_TABITEM_HXX - -#include - -#include "DeckDescriptor.hxx" - -namespace vcl { class Window; } - -namespace sfx2 { namespace sidebar { - -/** A single button in the tab bar. -*/ -class TabItem - : public ImageRadioButton -{ -public: - TabItem (vcl::Window* pParentWindow); - - virtual void Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE; - virtual void MouseMove (const MouseEvent& rEvent) SAL_OVERRIDE; - virtual void MouseButtonDown (const MouseEvent& rMouseEvent) SAL_OVERRIDE; - virtual void MouseButtonUp (const MouseEvent& rMouseEvent) SAL_OVERRIDE; - -private: - bool mbIsLeftButtonDown; - enum PaintType { - PT_Native, - PT_Theme - } mePaintType; -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 -#include "Paint.hxx" -#include "SidebarResource.hxx" +#include +#include #include #include 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 +#include +#include +#include #include #include diff --git a/sfx2/source/sidebar/TitleBar.hxx b/sfx2/source/sidebar/TitleBar.hxx deleted file mode 100644 index b0bc5d813816..000000000000 --- a/sfx2/source/sidebar/TitleBar.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_TITLEBAR_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_TITLEBAR_HXX - -#include "Paint.hxx" - -#include -#include - -namespace sfx2 { namespace sidebar { - -class TitleBar : public vcl::Window -{ -public: - TitleBar (const OUString& rsTitle, - vcl::Window* pParentWindow, - const sidebar::Paint& rInitialBackgroundPaint); - virtual ~TitleBar(); - virtual void dispose() SAL_OVERRIDE; - - void SetTitle (const ::rtl::OUString& rsTitle); - void SetIcon (const Image& rIcon); - - virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; - virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE; - virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE; - virtual void setPosSizePixel (long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) SAL_OVERRIDE; - - ToolBox& GetToolBox() - { - return *maToolBox.get(); - } - const ToolBox& GetToolBox() const - { - return *maToolBox.get(); - } - -protected: - VclPtr maToolBox; - OUString msTitle; - - virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0; - virtual void PaintDecoration (vcl::RenderContext& rRenderContext, const Rectangle& rTitleBarBox) = 0; - void PaintFocus(vcl::RenderContext& rRenderContext, const Rectangle& rFocusBox); - virtual sidebar::Paint GetBackgroundPaint() = 0; - virtual Color GetTextColor() = 0; - virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex); - virtual css::uno::Reference CreateAccessible() SAL_OVERRIDE; - -private: - Image maIcon; - sidebar::Paint maBackgroundPaint; - - void PaintTitle(vcl::RenderContext& rRenderContext, const Rectangle& rTitleBox); - DECL_LINK_TYPED(SelectionHandler, ToolBox*, void); -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/ToolBox.hxx b/sfx2/source/sidebar/ToolBox.hxx deleted file mode 100644 index 834d7cb2b7a0..000000000000 --- a/sfx2/source/sidebar/ToolBox.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_TOOLBOX_HXX -#define INCLUDED_SFX2_SOURCE_SIDEBAR_TOOLBOX_HXX - -#include - -namespace sfx2 { namespace sidebar { - -class ToolBox - : public ::ToolBox -{ -public: - MenuButton (vcl::Window* pParentWindow); - virtual ~MenuButton(); - - virtual void Paint (const Rectangle& rUpdateArea); - virtual void MouseMove (const MouseEvent& rEvent); - virtual void MouseButtonDown (const MouseEvent& rMouseEvent); - virtual void MouseButtonUp (const MouseEvent& rMouseEvent); - -protected: - using CheckBox::FillLayoutData; - -private: - bool mbIsLeftButtonDown; - enum PaintType { - PT_Native, - PT_Theme - } mePaintType; -}; - -} } // end of namespace sfx2::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 + +#include + +#include +#include +#include +#include + +#include + +using namespace css; +using namespace ::sfx2::sidebar; + +SfxUnoDeck::SfxUnoDeck(const uno::Reference& 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 SAL_CALL SfxUnoDeck::getPanels() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Reference 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 +#include + +#include +#include + +#include + +using namespace css; +using namespace ::sfx2::sidebar; + +SfxUnoDecks::SfxUnoDecks(const uno::Reference& 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 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 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 + +#include +#include + +#include +#include +#include + +#include + +using namespace css; +using namespace ::sfx2::sidebar; + +SfxUnoPanel::SfxUnoPanel(const uno::Reference& 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 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 + +#include +#include + +#include + +#include +#include + +#include + +using namespace css; +using namespace ::sfx2::sidebar; + +SfxUnoPanels::SfxUnoPanels(const uno::Reference& 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 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 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 +#include + +#include + +#include + +#include + +#include + + +using namespace css; +using namespace ::sfx2::sidebar; + +using ::com::sun::star::uno::RuntimeException; + +SfxUnoSidebar::SfxUnoSidebar(const uno::Reference& 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 mxDispatch (Tools::GetDispatch(xFrame, aURL)); + if (mxDispatch.is()) + mxDispatch->dispatch(aURL, uno::Sequence()); + } + +} + +sal_Bool SAL_CALL SfxUnoSidebar::isVisible() + throw (uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + SidebarController* pSidebarController = getSidebarController(); + + return pSidebarController != NULL; +} + +uno::Reference SAL_CALL SfxUnoSidebar::getFrame() + throw (uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + if (! xFrame.is() ) + throw uno::RuntimeException(); + + return xFrame; +} + +uno::Reference SAL_CALL SfxUnoSidebar::getDecks() + throw (uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + uno::Reference 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 d1c872bc17b3..8ad68d4a7db8 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -80,6 +80,9 @@ #include +#include +#include + #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 SAL_CALL SfxBaseController::getSidebar() throw (RuntimeException, std::exception) +{ + SfxViewFrame& rViewFrame = GetViewFrame_Impl(); + SfxFrame& rFrame = rViewFrame.GetFrame(); + + Reference rSidebar = new SfxUnoSidebar(rFrame.GetFrameInterface()); + return rSidebar; +} + + // SfxBaseController -> XController2 -> XController -- cgit v1.2.3