summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/sidebar/Accessible.cxx2
-rw-r--r--sfx2/source/sidebar/Accessible.hxx67
-rw-r--r--sfx2/source/sidebar/AccessibleTitleBar.cxx6
-rw-r--r--sfx2/source/sidebar/AccessibleTitleBar.hxx47
-rw-r--r--sfx2/source/sidebar/AsynchronousCall.cxx3
-rw-r--r--sfx2/source/sidebar/AsynchronousCall.hxx55
-rw-r--r--sfx2/source/sidebar/Context.cxx3
-rw-r--r--sfx2/source/sidebar/Context.hxx63
-rw-r--r--sfx2/source/sidebar/ContextList.cxx9
-rw-r--r--sfx2/source/sidebar/ContextList.hxx68
-rw-r--r--sfx2/source/sidebar/ControlFactory.cxx4
-rw-r--r--sfx2/source/sidebar/Deck.cxx29
-rw-r--r--sfx2/source/sidebar/Deck.hxx105
-rw-r--r--sfx2/source/sidebar/DeckDescriptor.cxx8
-rw-r--r--sfx2/source/sidebar/DeckDescriptor.hxx53
-rw-r--r--sfx2/source/sidebar/DeckLayouter.cxx8
-rw-r--r--sfx2/source/sidebar/DeckLayouter.hxx57
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.cxx5
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.hxx55
-rw-r--r--sfx2/source/sidebar/DrawHelper.cxx4
-rw-r--r--sfx2/source/sidebar/DrawHelper.hxx51
-rw-r--r--sfx2/source/sidebar/FocusManager.cxx10
-rw-r--r--sfx2/source/sidebar/FocusManager.hxx150
-rw-r--r--sfx2/source/sidebar/MenuButton.cxx6
-rw-r--r--sfx2/source/sidebar/MenuButton.hxx52
-rw-r--r--sfx2/source/sidebar/Paint.cxx2
-rw-r--r--sfx2/source/sidebar/Paint.hxx78
-rw-r--r--sfx2/source/sidebar/Panel.cxx24
-rw-r--r--sfx2/source/sidebar/Panel.hxx79
-rw-r--r--sfx2/source/sidebar/PanelDescriptor.cxx2
-rw-r--r--sfx2/source/sidebar/PanelDescriptor.hxx54
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.cxx9
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.hxx66
-rw-r--r--sfx2/source/sidebar/ResourceManager.cxx48
-rw-r--r--sfx2/source/sidebar/ResourceManager.hxx125
-rw-r--r--sfx2/source/sidebar/Sidebar.cxx8
-rw-r--r--sfx2/source/sidebar/Sidebar.hrc60
-rw-r--r--sfx2/source/sidebar/Sidebar.src2
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx4
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx155
-rw-r--r--sfx2/source/sidebar/SidebarController.hxx257
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx4
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.hxx61
-rw-r--r--sfx2/source/sidebar/SidebarResource.hxx35
-rw-r--r--sfx2/source/sidebar/TabBar.cxx31
-rw-r--r--sfx2/source/sidebar/TabBar.hxx130
-rw-r--r--sfx2/source/sidebar/TabItem.cxx6
-rw-r--r--sfx2/source/sidebar/TabItem.hxx55
-rw-r--r--sfx2/source/sidebar/Theme.cxx4
-rw-r--r--sfx2/source/sidebar/TitleBar.cxx8
-rw-r--r--sfx2/source/sidebar/TitleBar.hxx79
-rw-r--r--sfx2/source/sidebar/ToolBox.hxx53
-rw-r--r--sfx2/source/sidebar/UnoDeck.cxx262
-rw-r--r--sfx2/source/sidebar/UnoDecks.cxx168
-rw-r--r--sfx2/source/sidebar/UnoPanel.cxx271
-rw-r--r--sfx2/source/sidebar/UnoPanels.cxx180
-rw-r--r--sfx2/source/sidebar/UnoSidebar.cxx102
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx15
58 files changed, 1281 insertions, 2076 deletions
diff --git a/sfx2/source/sidebar/Accessible.cxx b/sfx2/source/sidebar/Accessible.cxx
index 7cf157e012f2..10b01dc07c8f 100644
--- a/sfx2/source/sidebar/Accessible.cxx
+++ b/sfx2/source/sidebar/Accessible.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "Accessible.hxx"
+#include <sfx2/sidebar/Accessible.hxx>
using namespace css;
using namespace css::uno;
diff --git a/sfx2/source/sidebar/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 <boost/noncopyable.hpp>
-
-#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
-
-#include <cppuhelper/compbase1.hxx>
-#include <cppuhelper/basemutex.hxx>
-
-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<css::accessibility::XAccessibleContext>& rxContext);
- virtual ~Accessible();
-
- virtual void SAL_CALL disposing() SAL_OVERRIDE;
- // XAccessible
- virtual css::uno::Reference<css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext()
- throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
-private:
- css::uno::Reference<css::accessibility::XAccessibleContext> 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 <sfx2/sidebar/AccessibleTitleBar.hxx>
+#include <sfx2/sidebar/Accessible.hxx>
+#include <sfx2/sidebar/TitleBar.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
diff --git a/sfx2/source/sidebar/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 <toolkit/awt/vclxaccessiblecomponent.hxx>
-#include <com/sun/star/accessibility/XAccessible.hpp>
-
-namespace sfx2 { namespace sidebar {
-
-class TitleBar;
-
-class AccessibleTitleBar
- : public VCLXAccessibleComponent
-{
-public:
- static css::uno::Reference<css::accessibility::XAccessible> 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 <sfx2/sidebar/AsynchronousCall.hxx>
#include <vcl/svapp.hxx>
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 <boost/function.hpp>
-#include <tools/solar.h>
-#include <tools/link.hxx>
-
-struct ImplSVEvent;
-
-namespace sfx2 { namespace sidebar {
-
-/** A simple asynchronous call via Application::PostUserCall.
-*/
-class AsynchronousCall
-{
-public:
- typedef ::boost::function<void()> 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 <sfx2/sidebar/Context.hxx>
+
#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 <rtl/ustring.hxx>
-
-#include <vector>
-
-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 <sfx2/sidebar/ContextList.hxx>
+#include <sfx2/sidebar/Context.hxx>
using ::rtl::OUString;
@@ -85,6 +85,11 @@ void ContextList::AddContextDescription (
maEntries.back().msMenuCommand = rsMenuCommand;
}
+sal_Int32 ContextList::GetCount()
+{
+ return maEntries.size();
+}
+
} } // end of namespace sfx2::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/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 <sal/types.h>
-#include <rtl/ustring.hxx>
-
-#include <vector>
-
-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 <TRUE/> 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<Entry> maEntries;
-
- ::std::vector<Entry>::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 <sfx2/sidebar/ControlFactory.hxx>
-#include "MenuButton.hxx"
-#include "TabItem.hxx"
+#include <sfx2/sidebar/MenuButton.hxx>
+#include <sfx2/sidebar/TabItem.hxx>
#include <sfx2/sidebar/SidebarToolBox.hxx>
#include <vcl/toolbox.hxx>
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index d5dc5d30b965..b2eb225e490b 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -17,14 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "Deck.hxx"
-#include "DeckDescriptor.hxx"
-#include "DeckLayouter.hxx"
-#include "DrawHelper.hxx"
-#include "DeckTitleBar.hxx"
-#include "PanelTitleBar.hxx"
-#include "Paint.hxx"
-#include "Panel.hxx"
+#include <sfx2/sidebar/Deck.hxx>
+#include <sfx2/sidebar/DeckDescriptor.hxx>
+#include <sfx2/sidebar/DeckLayouter.hxx>
+#include <sfx2/sidebar/DrawHelper.hxx>
+#include <sfx2/sidebar/DeckTitleBar.hxx>
+#include <sfx2/sidebar/PanelTitleBar.hxx>
+#include <sfx2/sidebar/Paint.hxx>
+#include <sfx2/sidebar/Panel.hxx>
#include <sfx2/sidebar/Tools.hxx>
#include <sfx2/sidebar/Theme.hxx>
@@ -223,6 +223,19 @@ vcl::Window* Deck::GetPanelParentWindow()
return mpScrollContainer.get();
}
+Panel* Deck::GetPanel(const OUString panelId)
+{
+ for (size_t i = 0; i < maPanels.size(); i++)
+ {
+ if(maPanels[i].get()->GetId() == panelId)
+ {
+ return maPanels[i].get();
+ }
+ }
+ return NULL;
+
+}
+
void Deck::ShowPanel(const Panel& rPanel)
{
if (mpVerticalScrollBar && mpVerticalScrollBar->IsVisible())
diff --git a/sfx2/source/sidebar/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 <vcl/window.hxx>
-#include <vcl/image.hxx>
-#include <com/sun/star/ui/LayoutSize.hpp>
-
-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<void()>& 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<sal_Int32>& rSeparators);
- private:
- std::vector<sal_Int32> maSeparators;
- };
-
-private:
- const OUString msId;
- Image maIcon;
- sal_Int32 mnMinimalWidth;
- SharedPanelContainer maPanels;
- VclPtr<DeckTitleBar> mpTitleBar;
- VclPtr<vcl::Window> mpScrollClipWindow;
- VclPtr<ScrollContainerWindow> mpScrollContainer;
- VclPtr<vcl::Window> mpFiller;
- VclPtr<ScrollBar> 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 <sfx2/sidebar/DeckDescriptor.hxx>
namespace sfx2 { namespace sidebar {
@@ -33,7 +33,8 @@ DeckDescriptor::DeckDescriptor()
maContextList(),
mbIsEnabled(true),
mnOrderIndex(10000), // Default value as defined in Sidebar.xcs
- mbExperimental(false)
+ mbExperimental(false),
+ mpDeck()
{
}
@@ -49,7 +50,8 @@ DeckDescriptor::DeckDescriptor (const DeckDescriptor& rOther)
maContextList(rOther.maContextList),
mbIsEnabled(rOther.mbIsEnabled),
mnOrderIndex(rOther.mnOrderIndex),
- mbExperimental(rOther.mbExperimental)
+ mbExperimental(rOther.mbExperimental),
+ mpDeck(rOther.mpDeck)
{
}
diff --git a/sfx2/source/sidebar/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 <sfx2/sidebar/EnumContext.hxx>
-#include "ContextList.hxx"
-#include <boost/shared_ptr.hpp>
-
-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 <sfx2/sidebar/DeckLayouter.hxx>
#include <sfx2/sidebar/Theme.hxx>
-#include "Panel.hxx"
-#include "PanelTitleBar.hxx"
-#include "Deck.hxx"
+#include <sfx2/sidebar/Panel.hxx>
+#include <sfx2/sidebar/PanelTitleBar.hxx>
+#include <sfx2/sidebar/Deck.hxx>
#include <vcl/window.hxx>
#include <vcl/scrbar.hxx>
diff --git a/sfx2/source/sidebar/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 <tools/gen.hxx>
-
-#include <com/sun/star/ui/LayoutSize.hpp>
-
-#include <vector>
-
-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 <sfx2/sidebar/DeckTitleBar.hxx>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sfxresid.hxx>
-#include "Sidebar.hrc"
+
+#include <sfx2/sidebar/Sidebar.hrc>
#include <vcl/image.hxx>
diff --git a/sfx2/source/sidebar/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<void()>& 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<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
-
-private:
- const sal_uInt16 mnCloserItemIndex;
- const std::function<void()> 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 <sfx2/sidebar/DrawHelper.hxx>
+#include <sfx2/sidebar/Paint.hxx>
#include <vcl/lineinfo.hxx>
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 <vcl/window.hxx>
-
-#include <tools/svborder.hxx>
-
-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 <sfx2/sidebar/FocusManager.hxx>
+#include <sfx2/sidebar/Panel.hxx>
+#include <sfx2/sidebar/DeckTitleBar.hxx>
+#include <sfx2/sidebar/PanelTitleBar.hxx>
#include <sfx2/sidebar/Tools.hxx>
-#include "TitleBar.hxx"
+#include <sfx2/sidebar/TitleBar.hxx>
#include <vcl/button.hxx>
#include <vcl/toolbox.hxx>
#include <toolkit/helper/vclunohelper.hxx>
diff --git a/sfx2/source/sidebar/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 <tools/link.hxx>
-#include <vcl/keycod.hxx>
-
-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<void(const Panel&)>& 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<Button*>& rButtons);
-
-private:
- VclPtr<DeckTitleBar> mpDeckTitleBar;
- std::vector<VclPtr<Panel> > maPanels;
- std::vector<VclPtr<Button> > maButtons;
- const std::function<void(const Panel&)> maShowPanelFunctor;
- bool mbObservingContentControlFocus;
- VclPtr<vcl::Window> mpFirstFocusedContentControl;
- VclPtr<vcl::Window> 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 <sfx2/sidebar/MenuButton.hxx>
-#include "DrawHelper.hxx"
-#include "Paint.hxx"
+#include <sfx2/sidebar/DrawHelper.hxx>
+#include <sfx2/sidebar/Paint.hxx>
#include <sfx2/sidebar/Tools.hxx>
#include <sfx2/sidebar/Theme.hxx>
diff --git a/sfx2/source/sidebar/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 <vcl/button.hxx>
-
-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 <sfx2/sidebar/Paint.hxx>
#include <sfx2/sidebar/Tools.hxx>
#include <com/sun/star/awt/Gradient.hpp>
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 <tools/color.hxx>
-#include <vcl/gradient.hxx>
-#include <vcl/wall.hxx>
-#include <com/sun/star/awt/Gradient.hpp>
-
-#include <boost/variant.hpp>
-
-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 <sfx2/sidebar/Panel.hxx>
+#include <sfx2/sidebar/PanelTitleBar.hxx>
+#include <sfx2/sidebar/PanelDescriptor.hxx>
#include <sfx2/sidebar/Theme.hxx>
-#include "Paint.hxx"
-#include "ResourceManager.hxx"
+#include <sfx2/sidebar/Paint.hxx>
+#include <sfx2/sidebar/ResourceManager.hxx>
+
+#include <sfx2/sidebar/SidebarController.hxx>
+
#ifdef DEBUG
#include <sfx2/sidebar/Tools.hxx>
-#include "Deck.hxx"
+#include <sfx2/sidebar/Deck.hxx>
#endif
#include <tools/svborder.hxx>
@@ -47,7 +50,9 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor,
vcl::Window* pParentWindow,
const bool bIsInitiallyExpanded,
const std::function<void()>& rDeckLayoutTrigger,
- const std::function<Context()>& rContextAccess)
+ const std::function<Context()>& rContextAccess,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame
+ )
: Window(pParentWindow)
, msPanelId(rPanelDescriptor.msId)
, mpTitleBar(VclPtr<PanelTitleBar>::Create(rPanelDescriptor.msTitle, pParentWindow, this))
@@ -57,6 +62,7 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor,
, mbIsExpanded(bIsInitiallyExpanded)
, maDeckLayoutTrigger(rDeckLayoutTrigger)
, maContextAccess(rContextAccess)
+ , mxFrame(rxFrame)
{
#ifdef DEBUG
SetText(OUString("Panel"));
@@ -111,6 +117,8 @@ void Panel::SetUIElement (const Reference<ui::XUIElement>& rxElement)
void Panel::SetExpanded (const bool bIsExpanded)
{
+ SidebarController* pSidebarController= SidebarController::GetSidebarControllerForFrame(mxFrame);
+
if (mbIsExpanded != bIsExpanded)
{
mbIsExpanded = bIsExpanded;
@@ -118,7 +126,7 @@ void Panel::SetExpanded (const bool bIsExpanded)
if (maContextAccess)
{
- ResourceManager::Instance().StorePanelExpansionState(
+ pSidebarController->GetResourceManager()->StorePanelExpansionState(
msPanelId,
bIsExpanded,
maContextAccess());
diff --git a/sfx2/source/sidebar/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 <vcl/window.hxx>
-
-#include <com/sun/star/ui/XUIElement.hpp>
-#include <com/sun/star/ui/XSidebarPanel.hpp>
-
-#include <boost/scoped_ptr.hpp>
-#include <boost/shared_ptr.hpp>
-#include <vector>
-
-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<void()>& rDeckLayoutTrigger,
- const std::function<Context()>& rContextAccess);
- virtual ~Panel();
- virtual void dispose() SAL_OVERRIDE;
-
- PanelTitleBar* GetTitleBar() const;
- bool IsTitleBarOptional() const { return mbIsTitleBarOptional;}
- void SetUIElement (const css::uno::Reference<css::ui::XUIElement>& rxElement);
- css::uno::Reference<css::ui::XSidebarPanel> GetPanelComponent() const { return mxPanelComponent;}
- css::uno::Reference<css::awt::XWindow> 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<PanelTitleBar> mpTitleBar;
- const bool mbIsTitleBarOptional;
- css::uno::Reference<css::ui::XUIElement> mxElement;
- css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
- bool mbIsExpanded;
- const std::function<void()> maDeckLayoutTrigger;
- const std::function<Context()> maContextAccess;
-};
-typedef std::vector<VclPtr<Panel> > 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 <sfx2/sidebar/PanelDescriptor.hxx>
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 <sfx2/sidebar/EnumContext.hxx>
-#include "ContextList.hxx"
-#include <boost/shared_ptr.hpp>
-
-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 <sfx2/sidebar/PanelTitleBar.hxx>
#include <sfx2/sfxresid.hxx>
-#include "Sidebar.hrc"
-#include "Paint.hxx"
-#include "Panel.hxx"
+#include <sfx2/sidebar/Sidebar.hrc>
+
+#include <sfx2/sidebar/Paint.hxx>
+#include <sfx2/sidebar/Panel.hxx>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControllerFactory.hxx>
#include <sfx2/sidebar/Tools.hxx>
diff --git a/sfx2/source/sidebar/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 <com/sun/star/frame/XFrame.hpp>
-#include <boost/function.hpp>
-
-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<css::frame::XFrame>& 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<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
-
-private:
- bool mbIsLeftButtonDown;
- VclPtr<Panel> mpPanel;
- const sal_uInt16 mnMenuItemIndex;
- css::uno::Reference<css::frame::XFrame> 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 <sfx2/sidebar/ResourceManager.hxx>
#include <sfx2/sidebar/Tools.hxx>
#include <unotools/confignode.hxx>
@@ -114,6 +114,51 @@ void ResourceManager::SetIsDeckEnabled(const OUString& rsDeckId, const bool bIsE
}
}
+void ResourceManager::SetDeckToDescriptor(const OUString& rsDeckId, VclPtr<Deck> aDeck)
+{
+ DeckContainer::iterator iDeck;
+ for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+ {
+ if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
+ continue;
+ if (iDeck->msId.equals(rsDeckId))
+ {
+ iDeck->mpDeck = aDeck;
+ return;
+ }
+ }
+}
+
+void ResourceManager::SetDeckOrderIndex(const OUString& rsDeckId, const sal_Int32 orderIndex)
+{
+ DeckContainer::iterator iDeck;
+ for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+ {
+ if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
+ continue;
+ if (iDeck->msId.equals(rsDeckId))
+ {
+ iDeck->mnOrderIndex = orderIndex;
+ return;
+ }
+ }
+}
+
+void ResourceManager::SetPanelOrderIndex(const OUString& rsPanelId, const sal_Int32 orderIndex)
+{
+ PanelContainer::iterator iPanel;
+ for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
+ {
+ if (iPanel->mbExperimental && !maMiscOptions.IsExperimentalMode())
+ continue;
+ if (iPanel->msId.equals(rsPanelId))
+ {
+ iPanel->mnOrderIndex = orderIndex;
+ return;
+ }
+ }
+}
+
const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatchingDecks (
DeckContextDescriptorContainer& rDecks,
const Context& rContext,
@@ -569,6 +614,7 @@ bool ResourceManager::IsDeckEnabled (
// Check if any panel that matches the current context can be
// displayed.
ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
+
ResourceManager::Instance().GetMatchingPanels(aPanelContextDescriptors,
rContext, rsDeckId, rxFrame);
diff --git a/sfx2/source/sidebar/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 <unotools/confignode.hxx>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <set>
-#include <boost/shared_ptr.hpp>
-#include <svtools/miscopt.hxx>
-
-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<DeckContextDescriptor> DeckContextDescriptorContainer;
-
- class PanelContextDescriptor
- {
- public:
- OUString msId;
- OUString msMenuCommand;
- bool mbIsInitiallyVisible;
- bool mbShowForReadOnlyDocuments;
- };
- typedef std::vector<PanelContextDescriptor> PanelContextDescriptorContainer;
-
- const DeckContextDescriptorContainer& GetMatchingDecks(
- DeckContextDescriptorContainer& rDeckDescriptors,
- const Context& rContext,
- const bool bIsDocumentReadOnly,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
-
- const PanelContextDescriptorContainer& GetMatchingPanels(
- PanelContextDescriptorContainer& rPanelDescriptors,
- const Context& rContext,
- const OUString& rsDeckId,
- const css::uno::Reference<css::frame::XFrame>& 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<DeckDescriptor> DeckContainer;
- DeckContainer maDecks;
-
- typedef std::vector<PanelDescriptor> PanelContainer;
- PanelContainer maPanels;
- mutable std::set<rtl::OUString> 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<css::frame::XFrame>& rxFrame);
- static utl::OConfigurationTreeRoot GetLegacyAddonRootNode(const OUString& rsModuleName);
- static void GetToolPanelNodeNames(std::vector<OUString>& rMatchingNames,
- const utl::OConfigurationTreeRoot& aRoot);
- static bool IsDeckEnabled(const OUString& rsDeckId,
- const Context& rContext,
- const css::uno::Reference<css::frame::XFrame>& 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 <sfx2/sidebar/Sidebar.hxx>
-#include "SidebarController.hxx"
-#include "ResourceManager.hxx"
+#include <sfx2/sidebar/SidebarController.hxx>
+#include <sfx2/sidebar/ResourceManager.hxx>
using namespace css;
@@ -30,7 +30,9 @@ void Sidebar::ShowPanel (
const css::uno::Reference<frame::XFrame>& rxFrame)
{
SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
- const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
+
+ const PanelDescriptor* pPanelDescriptor = pController->GetResourceManager()->GetPanelDescriptor(rsPanelId);
+
if (pController!=NULL && pPanelDescriptor != NULL)
{
// This should be a lot more sophisticated:
diff --git a/sfx2/source/sidebar/Sidebar.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 <sfx2/sfx.hrc>
-
-#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 <sfx2/sidebar/Sidebar.hrc>
Resource RID_SIDEBAR_RESOURCE
{
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 0925bf83e4c0..a37d50033cf8 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "TabBar.hxx"
+#include <sfx2/sidebar/TabBar.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/sidebar/SidebarChildWindow.hxx>
-#include "SidebarDockingWindow.hxx"
+#include <sfx2/sidebar/SidebarDockingWindow.hxx>
#include <sfx2/sfxsids.hrc>
#include "helpid.hrc"
#include <sfx2/dockwin.hxx>
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 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 <sfx2/sidebar/SidebarController.hxx>
+#include <sfx2/sidebar/Deck.hxx>
+#include <sfx2/sidebar/DeckTitleBar.hxx>
+#include <sfx2/sidebar/Panel.hxx>
+#include <sfx2/sidebar/PanelTitleBar.hxx>
+#include <sfx2/sidebar/SidebarResource.hxx>
+#include <sfx2/sidebar/TabBar.hxx>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/SidebarChildWindow.hxx>
#include <sfx2/sidebar/Tools.hxx>
-#include "SidebarDockingWindow.hxx"
-#include "Context.hxx"
+#include <sfx2/sidebar/SidebarDockingWindow.hxx>
+#include <sfx2/sidebar/Context.hxx>
+#include <sfx2/sidebar/ContextList.hxx>
+
#include <sfx2/sfxresid.hxx>
#include <sfx2/sfxsids.hrc>
@@ -98,7 +100,8 @@ SidebarController::SidebarController (
mpParentWindow,
rxFrame,
::boost::bind(&SidebarController::OpenThenSwitchToDeck, this, _1),
- ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2))),
+ ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2),
+ this)),
mxFrame(rxFrame),
maCurrentContext(OUString(), OUString()),
maRequestedContext(),
@@ -116,8 +119,12 @@ SidebarController::SidebarController (
mxReadOnlyModeDispatch(),
mbIsDocumentReadOnly(false),
mpSplitWindow(NULL),
- mnWidthOnSplitterButtonDown(0)
+ mnWidthOnSplitterButtonDown(0),
+ mpResourceManager()
{
+ // Decks and panel collections for this sidebar
+ mpResourceManager = std::unique_ptr<ResourceManager>(new ResourceManager());
+
// Listen for context change events.
css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
css::ui::ContextChangeEventMultiplexer::get(
@@ -173,12 +180,33 @@ void SAL_CALL SidebarController::disposing()
{
mpCloseIndicator.disposeAndClear();
+ maFocusManager.Clear();
+ mpTabBar.disposeAndClear();
+
+
+ // clear decks
+ ResourceManager::DeckContextDescriptorContainer aDecks;
+
+ mpResourceManager->GetMatchingDecks (
+ aDecks,
+ GetCurrentContext(),
+ IsDocumentReadOnly(),
+ mxFrame);
+
+ for (ResourceManager::DeckContextDescriptorContainer::const_iterator
+ iDeck(aDecks.begin()), iEnd(aDecks.end());
+ iDeck!=iEnd; ++iDeck)
+ {
+ const DeckDescriptor* deckDesc = mpResourceManager->GetDeckDescriptor(iDeck->msId);
+ VclPtr<Deck> aDeck = deckDesc->mpDeck;
+ if (aDeck)
+ aDeck.disposeAndClear();
+ }
+
SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame));
if (iEntry != maSidebarControllerContainer.end())
maSidebarControllerContainer.erase(iEntry);
- maFocusManager.Clear();
-
css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
css::ui::ContextChangeEventMultiplexer::get(
::comphelper::getProcessComponentContext()));
@@ -200,19 +228,13 @@ void SAL_CALL SidebarController::disposing()
mpParentWindow = NULL;
}
- if (mpCurrentDeck)
- {
- mpCurrentDeck.disposeAndClear();
- }
-
- mpTabBar.disposeAndClear();
-
Theme::GetPropertySet()->removePropertyChangeListener(
OUString(""),
static_cast<css::beans::XPropertyChangeListener*>(this));
maContextChangeUpdate.CancelRequest();
maAsynchronousDeckSwitch.CancelRequest();
+
}
void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
@@ -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<Deck> aDeck = VclPtr<Deck>::Create(
+ *pDeckDescriptor,
+ mpParentWindow,
+ ::boost::bind(&SidebarController::RequestCloseDeck, this));
+
+ mpResourceManager->SetDeckToDescriptor(rDeckId, aDeck);
+
+ }
+
+}
+
+
void SidebarController::SwitchToDeck (
const DeckDescriptor& rDeckDescriptor,
const Context& rContext)
{
+
maFocusManager.Clear();
const bool bForceNewDeck ((mnRequestedForceFlags&SwitchFlag_ForceNewDeck)!=0);
const bool bForceNewPanels ((mnRequestedForceFlags&SwitchFlag_ForceNewPanels)!=0);
+ mnRequestedForceFlags = SwitchFlag_NoForce;
if ( ! msCurrentDeckId.equals(rDeckDescriptor.msId)
|| bForceNewDeck)
{
- // When the deck changes then destroy the deck and all panels
- // and create everything new.
- mpCurrentDeck.disposeAndClear();
+ if (mpCurrentDeck)
+ mpCurrentDeck->Hide();
msCurrentDeckId = rDeckDescriptor.msId;
}
@@ -510,7 +558,8 @@ void SidebarController::SwitchToDeck (
// Determine the panels to display in the deck.
ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
- ResourceManager::Instance().GetMatchingPanels(
+
+ mpResourceManager->GetMatchingPanels(
aPanelContextDescriptors,
rContext,
rDeckDescriptor.msId,
@@ -537,16 +586,10 @@ void SidebarController::SwitchToDeck (
}
// Provide a configuration and Deck object.
- if ( ! mpCurrentDeck)
- {
- mpCurrentDeck.reset(
- VclPtr<Deck>::Create(
- rDeckDescriptor,
- mpParentWindow,
- ::boost::bind(&SidebarController::RequestCloseDeck, this)));
- msCurrentDeckTitle = rDeckDescriptor.msTitle;
- }
+ CreateDeck(rDeckDescriptor.msId);
+ mpCurrentDeck.reset(rDeckDescriptor.mpDeck);
+
if ( ! mpCurrentDeck)
return;
@@ -557,6 +600,7 @@ void SidebarController::SwitchToDeck (
pDebugTitleBar->SetTitle(rDeckDescriptor.msTitle + " (" + maCurrentContext.msContext + ")");
#endif
+
// Update the panel list.
const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size());
SharedPanelContainer aNewPanels;
@@ -608,6 +652,7 @@ void SidebarController::SwitchToDeck (
rContext);
bHasPanelSetChanged = true;
}
+
if (aNewPanels[nWriteIndex] != nullptr)
{
// Depending on the context we have to change the command
@@ -627,6 +672,7 @@ void SidebarController::SwitchToDeck (
// mpCurrentPanels - may miss stuff (?)
aNewPanels.resize(nWriteIndex);
+
SfxSplitWindow* pSplitWindow = GetSplitWindow();
sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor();
WindowAlign eAlign = pSplitWindow ? pSplitWindow->GetAlign() : WINDOWALIGN_RIGHT;
@@ -640,6 +686,7 @@ void SidebarController::SwitchToDeck (
nDeckX = 0;
}
+
// Activate the deck and the new set of panels.
mpCurrentDeck->setPosSizePixel(
nDeckX,
@@ -658,7 +705,8 @@ void SidebarController::SwitchToDeck (
// Tell the focus manager about the new panels and tab bar
// buttons.
maFocusManager.SetDeckTitle(mpCurrentDeck->GetTitleBar());
- maFocusManager.SetPanels(aNewPanels);
+ maFocusManager.SetPanels(mpCurrentDeck->GetPanels());
+
mpTabBar->UpdateFocusManager(maFocusManager);
UpdateTitleBarIcons();
}
@@ -669,7 +717,8 @@ VclPtr<Panel> SidebarController::CreatePanel (
const bool bIsInitiallyExpanded,
const Context& rContext)
{
- const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
+ const PanelDescriptor* pPanelDescriptor = mpResourceManager->GetPanelDescriptor(rsPanelId);
+
if (pPanelDescriptor == NULL)
return NULL;
@@ -679,7 +728,8 @@ VclPtr<Panel> SidebarController::CreatePanel (
pParentWindow,
bIsInitiallyExpanded,
::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
- ::boost::bind(&SidebarController::GetCurrentContext, this));
+ ::boost::bind(&SidebarController::GetCurrentContext, this),
+ mxFrame);
// Create the XUIElement.
Reference<ui::XUIElement> xUIElement (CreateUIElement(
@@ -1110,7 +1160,8 @@ void SidebarController::UpdateTitleBarIcons()
return;
const bool bIsHighContrastModeActive (Theme::IsHighContrastMode());
- const ResourceManager& rResourceManager (ResourceManager::Instance());
+
+ const ResourceManager& rResourceManager = *mpResourceManager;
// Update the deck icon.
const DeckDescriptor* pDeckDescriptor = rResourceManager.GetDeckDescriptor(mpCurrentDeck->GetId());
@@ -1151,6 +1202,28 @@ void SidebarController::ShowPanel (const Panel& rPanel)
mpCurrentDeck->ShowPanel(rPanel);
}
+ResourceManager::DeckContextDescriptorContainer SidebarController::GetMatchingDecks()
+{
+ ResourceManager::DeckContextDescriptorContainer aDecks;
+ mpResourceManager->GetMatchingDecks (aDecks,
+ GetCurrentContext(),
+ IsDocumentReadOnly(),
+ mxFrame);
+ return aDecks;
+}
+
+ResourceManager::PanelContextDescriptorContainer SidebarController::GetMatchingPanels(const ::rtl::OUString& rDeckId)
+{
+ ResourceManager::PanelContextDescriptorContainer aPanels;
+
+ mpResourceManager->GetMatchingPanels(aPanels,
+ GetCurrentContext(),
+ rDeckId,
+ mxFrame);
+ return aPanels;
+}
+
+
} } // end of namespace sfx2::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/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 <sal/config.h>
-
-#include <map>
-
-#include "AsynchronousCall.hxx"
-#include "Context.hxx"
-#include "FocusManager.hxx"
-#include "Panel.hxx"
-#include "ResourceManager.hxx"
-#include "TabBar.hxx"
-
-#include <vcl/menu.hxx>
-
-#include <com/sun/star/awt/XWindowPeer.hpp>
-#include <com/sun/star/beans/XPropertyChangeListener.hpp>
-#include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/ui/XContextChangeEventListener.hpp>
-#include <com/sun/star/ui/XUIElement.hpp>
-#include <com/sun/star/ui/XSidebar.hpp>
-
-#include <boost/noncopyable.hpp>
-#include <boost/optional.hpp>
-#include <cppuhelper/compbase4.hxx>
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/weakref.hxx>
-
-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<css::frame::XFrame>& 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 <NULL/> is returned.
- */
- static SidebarController* GetSidebarControllerForFrame (
- const css::uno::Reference<css::frame::XFrame>& 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::frame::XFrame>,
- css::uno::WeakReference<SidebarController>
- > SidebarControllerContainer;
- static SidebarControllerContainer maSidebarControllerContainer;
-
- VclPtr<Deck> mpCurrentDeck;
- VclPtr<SidebarDockingWindow> mpParentWindow;
- VclPtr<TabBar> mpTabBar;
- css::uno::Reference<css::frame::XFrame> 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<bool> mbIsDeckRequestedOpen;
- ::boost::optional<bool> 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<css::frame::XDispatch> mxReadOnlyModeDispatch;
- bool mbIsDocumentReadOnly;
- VclPtr<SfxSplitWindow> 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<vcl::Window> mpCloseIndicator;
-
- DECL_LINK(WindowEventHandler, VclWindowEvent*);
- /** Make maRequestedContext the current context.
- */
- void UpdateConfigurations();
-
- css::uno::Reference<css::ui::XUIElement> CreateUIElement (
- const css::uno::Reference<css::awt::XWindowPeer>& rxWindow,
- const ::rtl::OUString& rsImplementationURL,
- const bool bWantsCanvas,
- const Context& rContext);
- VclPtr<Panel> CreatePanel (
- const ::rtl::OUString& rsPanelId,
- vcl::Window* pParentWindow,
- const bool bIsInitiallyExpanded,
- const Context& rContext);
- void SwitchToDeck (
- const ::rtl::OUString& rsDeckId);
- void SwitchToDeck (
- const DeckDescriptor& rDeckDescriptor,
- const Context& rContext);
- void ShowPopupMenu (
- const Rectangle& rButtonBox,
- const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
- ::boost::shared_ptr<PopupMenu> CreatePopupMenu (
- const ::std::vector<TabBar::DeckMenuData>& 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 <sfx2/sidebar/SidebarDockingWindow.hxx>
#include <sfx2/sidebar/SidebarChildWindow.hxx>
-#include "SidebarController.hxx"
+#include <sfx2/sidebar/SidebarController.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
diff --git a/sfx2/source/sidebar/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 <sfx2/dockwin.hxx>
-
-#include <rtl/ref.hxx>
-
-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<sfx2::sidebar::SidebarController> 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 <sfx2/sfxresid.hxx>
-#include <tools/rc.hxx>
-
-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 <sfx2/sidebar/TabBar.hxx>
+#include <sfx2/sidebar/TabItem.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
-#include "DeckDescriptor.hxx"
-#include "Paint.hxx"
+#include <sfx2/sidebar/DeckDescriptor.hxx>
+#include <sfx2/sidebar/Paint.hxx>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/Tools.hxx>
-#include "FocusManager.hxx"
+#include <sfx2/sidebar/FocusManager.hxx>
+
+#include <sfx2/sidebar/SidebarController.hxx>
#include <vcl/gradient.hxx>
#include <vcl/image.hxx>
@@ -42,14 +44,18 @@ namespace sfx2 { namespace sidebar {
TabBar::TabBar(vcl::Window* pParentWindow,
const Reference<frame::XFrame>& rxFrame,
const boost::function<void(const OUString&)>& rDeckActivationFunctor,
- const PopupMenuProvider& rPopupMenuProvider)
+ const PopupMenuProvider& rPopupMenuProvider,
+ SidebarController* rParentSidebarController
+ )
: Window(pParentWindow, WB_DIALOGCONTROL),
mxFrame(rxFrame),
mpMenuButton(ControlFactory::CreateMenuButton(this)),
maItems(),
maDeckActivationFunctor(rDeckActivationFunctor),
- maPopupMenuProvider(rPopupMenuProvider)
+ maPopupMenuProvider(rPopupMenuProvider),
+ pParentSidebarController(rParentSidebarController)
{
+
SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu));
@@ -110,7 +116,7 @@ void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDe
for (ResourceManager::DeckContextDescriptorContainer::const_iterator
iDeck(rDecks.begin()); iDeck != rDecks.end(); ++iDeck)
{
- const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(iDeck->msId);
+ const DeckDescriptor* pDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId);
if (pDescriptor == NULL)
{
OSL_ASSERT(pDescriptor!=NULL);
@@ -149,7 +155,8 @@ void TabBar::UpdateButtonIcons()
iItem!=iEnd;
++iItem)
{
- const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
+ const DeckDescriptor* pDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId);
+
if (pDeckDescriptor != NULL)
{
aImage = GetItemImage(*pDeckDescriptor);
@@ -293,7 +300,8 @@ void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
else
{
maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden;
- ResourceManager::Instance().SetIsDeckEnabled(
+
+ pParentSidebarController->GetResourceManager()->SetIsDeckEnabled(
maItems[nIndex].msDeckId,
maItems[nIndex].mbIsHidden);
Layout();
@@ -337,7 +345,8 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked)
for (ItemContainer::const_iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
{
- const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
+ const DeckDescriptor* pDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId);
+
if (pDeckDescriptor != NULL)
{
DeckMenuData aData;
diff --git a/sfx2/source/sidebar/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 <vcl/menu.hxx>
-#include <vcl/window.hxx>
-
-#include <com/sun/star/frame/XFrame.hpp>
-#include <boost/function.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/scoped_ptr.hpp>
-
-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<void(
- const Rectangle&,
- const ::std::vector<DeckMenuData>& rMenuData)> PopupMenuProvider;
- TabBar (
- vcl::Window* pParentWindow,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& 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<css::frame::XFrame> mxFrame;
- VclPtr<CheckBox> mpMenuButton;
- class Item
- {
- public:
- DECL_LINK(HandleClick, Button*);
- VclPtr<RadioButton> mpButton;
- ::rtl::OUString msDeckId;
- ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
- bool mbIsHidden;
- bool mbIsHiddenByDefault;
- };
- typedef ::std::vector<Item> ItemContainer;
- ItemContainer maItems;
- const ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
- sal_Int32 mnMenuSeparatorY;
- PopupMenuProvider maPopupMenuProvider;
-
- VclPtr<RadioButton> CreateTabItem (const DeckDescriptor& rDeckDescriptor);
- Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const;
- void Layout();
- void UpdateButtonIcons();
-
- ::boost::shared_ptr<PopupMenu> 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 <sfx2/sidebar/TabItem.hxx>
-#include "DrawHelper.hxx"
-#include "Paint.hxx"
+#include <sfx2/sidebar/DrawHelper.hxx>
+#include <sfx2/sidebar/Paint.hxx>
#include <sfx2/sidebar/Tools.hxx>
#include <sfx2/sidebar/Theme.hxx>
diff --git a/sfx2/source/sidebar/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 <vcl/button.hxx>
-
-#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 <sfx2/sidebar/Theme.hxx>
-#include "Paint.hxx"
-#include "SidebarResource.hxx"
+#include <sfx2/sidebar/Paint.hxx>
+#include <sfx2/sidebar/SidebarResource.hxx>
#include <sfx2/sidebar/Tools.hxx>
#include <sfx2/app.hxx>
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index 239cf0413131..eb362af32e8f 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "TitleBar.hxx"
-#include "Paint.hxx"
-#include "Accessible.hxx"
-#include "AccessibleTitleBar.hxx"
+#include <sfx2/sidebar/TitleBar.hxx>
+#include <sfx2/sidebar/Paint.hxx>
+#include <sfx2/sidebar/Accessible.hxx>
+#include <sfx2/sidebar/AccessibleTitleBar.hxx>
#include <tools/svborder.hxx>
#include <vcl/gradient.hxx>
diff --git a/sfx2/source/sidebar/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 <vcl/fixed.hxx>
-#include <sfx2/sidebar/SidebarToolBox.hxx>
-
-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<SidebarToolBox> 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<css::accessibility::XAccessible> 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 <vcl/toolbox.hxx>
-
-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 <sfx2/sidebar/UnoDeck.hxx>
+
+#include <sfx2/sidebar/UnoPanels.hxx>
+
+#include <sfx2/sidebar/ResourceManager.hxx>
+#include <sfx2/sidebar/SidebarController.hxx>
+#include <sfx2/sidebar/DeckTitleBar.hxx>
+#include <sfx2/sidebar/Deck.hxx>
+
+#include <vcl/svapp.hxx>
+
+using namespace css;
+using namespace ::sfx2::sidebar;
+
+SfxUnoDeck::SfxUnoDeck(const uno::Reference<frame::XFrame>& rFrame, const OUString& deckId):
+xFrame(rFrame),
+mDeckId(deckId),
+mTitle(deckId)
+{
+
+}
+SidebarController* SfxUnoDeck::getSidebarController()
+{
+ return SidebarController::GetSidebarControllerForFrame(xFrame);
+}
+
+OUString SAL_CALL SfxUnoDeck::getId()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ return mDeckId;
+}
+
+OUString SAL_CALL SfxUnoDeck::getTitle()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+ Deck* pDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck;
+
+ if (!pDeck)
+ {
+ pSidebarController->CreateDeck(mDeckId);
+ pDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck;
+ }
+
+ DeckTitleBar* pTitleBar = pDeck->GetTitleBar();
+ return pTitleBar->GetTitle();
+}
+
+void SAL_CALL SfxUnoDeck::setTitle( const OUString& newTitle )
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+ pSidebarController->CreateDeck(mDeckId);
+
+ Deck* pDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck;
+
+ DeckTitleBar* pTitleBar = pDeck->GetTitleBar();
+ pTitleBar->SetTitle(newTitle);
+}
+
+sal_Bool SAL_CALL SfxUnoDeck::isActive()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+ return pSidebarController->IsDeckVisible(mDeckId);
+}
+
+
+void SAL_CALL SfxUnoDeck::activate( const sal_Bool bActivate )
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+
+ if (bActivate)
+ pSidebarController->SwitchToDeck(mDeckId);
+ else
+ pSidebarController->SwitchToDefaultDeck();
+}
+
+uno::Reference<ui::XPanels> SAL_CALL SfxUnoDeck::getPanels()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Reference<ui::XPanels> panels = new SfxUnoPanels(xFrame, mDeckId);
+ return panels;
+}
+
+sal_Int32 SAL_CALL SfxUnoDeck::getOrderIndex()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mnOrderIndex;
+ return index;
+}
+
+void SAL_CALL SfxUnoDeck::setOrderIndex( const sal_Int32 newOrderIndex )
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, newOrderIndex);
+
+ pSidebarController->NotifyResize();
+}
+
+void SAL_CALL SfxUnoDeck::moveFirst()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::DeckContextDescriptorContainer aDecks = pSidebarController->GetMatchingDecks();
+
+ sal_Int32 minIndex = GetMinOrderIndex(aDecks);
+ sal_Int32 curOrderIndex = getOrderIndex();
+
+ if (curOrderIndex != minIndex) // is deck already in place ?
+ {
+ minIndex -= 1;
+ pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, minIndex);
+ pSidebarController->NotifyResize();
+ }
+}
+
+void SAL_CALL SfxUnoDeck::moveLast()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::DeckContextDescriptorContainer aDecks = pSidebarController->GetMatchingDecks();
+
+ sal_Int32 maxIndex = GetMaxOrderIndex(aDecks);
+ sal_Int32 curOrderIndex = getOrderIndex();
+
+ if (curOrderIndex != maxIndex) // is deck already in place ?
+ {
+ maxIndex += 1;
+ pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, maxIndex);
+ pSidebarController->NotifyResize();
+ }
+}
+
+void SAL_CALL SfxUnoDeck::moveUp()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ // Search for previous deck OrderIndex
+ ResourceManager::DeckContextDescriptorContainer aDecks = pSidebarController->GetMatchingDecks();
+
+ sal_Int32 curOrderIndex = getOrderIndex();
+ sal_Int32 previousIndex = GetMinOrderIndex(aDecks);
+
+ ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck;
+ for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+ {
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+ if( index < curOrderIndex && index > previousIndex)
+ previousIndex = index;
+ }
+
+ if (curOrderIndex != previousIndex) // is deck already in place ?
+ {
+ previousIndex -= 1;
+ pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, previousIndex);
+ pSidebarController->NotifyResize();
+ }
+}
+
+void SAL_CALL SfxUnoDeck::moveDown()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::DeckContextDescriptorContainer aDecks = pSidebarController->GetMatchingDecks();
+
+ // Search for next deck OrderIndex
+ sal_Int32 curOrderIndex = getOrderIndex();
+ sal_Int32 nextIndex = GetMaxOrderIndex(aDecks);
+
+
+ ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck;
+ for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+ {
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+ if( index > curOrderIndex && index < nextIndex)
+ nextIndex = index;
+ }
+
+ if (curOrderIndex != nextIndex) // is deck already in place ?
+ {
+ nextIndex += 1;
+ pSidebarController->GetResourceManager()->SetDeckOrderIndex(mDeckId, nextIndex);
+ pSidebarController->NotifyResize();
+ }
+}
+
+
+sal_Int32 SfxUnoDeck::GetMinOrderIndex(ResourceManager::DeckContextDescriptorContainer aDecks)
+{
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck;
+
+ iDeck = aDecks.begin();
+ sal_Int32 minIndex = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+
+ for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+ {
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+ if(minIndex > index)
+ minIndex = index;
+ }
+ return minIndex;
+}
+
+sal_Int32 SfxUnoDeck::GetMaxOrderIndex(ResourceManager::DeckContextDescriptorContainer aDecks)
+{
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck;
+
+ iDeck = aDecks.begin();
+ sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+
+ for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+ {
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+ if(maxIndex < index)
+ maxIndex = index;
+ }
+ return maxIndex;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/UnoDecks.cxx b/sfx2/source/sidebar/UnoDecks.cxx
new file mode 100644
index 000000000000..e08873301fb5
--- /dev/null
+++ b/sfx2/source/sidebar/UnoDecks.cxx
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <sfx2/sidebar/UnoDecks.hxx>
+#include <sfx2/sidebar/UnoDeck.hxx>
+
+#include <sfx2/sidebar/ResourceManager.hxx>
+#include <sfx2/sidebar/SidebarController.hxx>
+
+#include <vcl/svapp.hxx>
+
+using namespace css;
+using namespace ::sfx2::sidebar;
+
+SfxUnoDecks::SfxUnoDecks(const uno::Reference<frame::XFrame>& rFrame):
+xFrame(rFrame)
+{
+}
+
+SidebarController* SfxUnoDecks::getSidebarController()
+{
+ return SidebarController::GetSidebarControllerForFrame(xFrame);
+}
+
+// XNameAccess
+
+uno::Any SAL_CALL SfxUnoDecks::getByName( const OUString& aName )
+ throw(container::NoSuchElementException,
+ lang::WrappedTargetException,
+ uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Any aRet;
+
+ if (hasByName(aName))
+ {
+ uno::Reference<ui::XDeck> xDeck = new SfxUnoDeck(xFrame, aName);
+ aRet <<= xDeck;
+ }
+ else
+ throw container::NoSuchElementException();
+
+ return aRet;
+}
+
+
+uno::Sequence< OUString > SAL_CALL SfxUnoDecks::getElementNames()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::DeckContextDescriptorContainer aDecks;
+ css::uno::Sequence< OUString > deckList(aDecks.size());
+
+ if (pSidebarController)
+ {
+ pSidebarController->GetResourceManager()->GetMatchingDecks (
+ aDecks,
+ pSidebarController->GetCurrentContext(),
+ pSidebarController->IsDocumentReadOnly(),
+ xFrame);
+
+ deckList.realloc(aDecks.size());
+
+ long n = 0;
+
+ for (ResourceManager::DeckContextDescriptorContainer::const_iterator
+ iDeck(aDecks.begin()), iEnd(aDecks.end());
+ iDeck!=iEnd; ++iDeck)
+ {
+ deckList[n] = iDeck->msId;
+ n++;
+ }
+ }
+
+ return deckList;
+
+}
+
+sal_Bool SAL_CALL SfxUnoDecks::hasByName( const OUString& aName )
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+
+ sal_Bool bFound = false;
+
+ if (pSidebarController)
+ {
+ ResourceManager::DeckContextDescriptorContainer aDecks;
+
+ pSidebarController->GetResourceManager()->GetMatchingDecks (
+ aDecks,
+ pSidebarController->GetCurrentContext(),
+ pSidebarController->IsDocumentReadOnly(),
+ xFrame);
+
+ for (ResourceManager::DeckContextDescriptorContainer::const_iterator
+ iDeck(aDecks.begin()), iEnd(aDecks.end());
+ iDeck!=iEnd && !bFound; ++iDeck)
+ {
+ if (iDeck->msId == aName)
+ bFound = true;
+ }
+ }
+
+ return bFound;
+
+}
+
+// XIndexAccess
+
+sal_Int32 SAL_CALL SfxUnoDecks::getCount() throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Sequence< OUString > decks = getElementNames();
+ return decks.getLength();
+}
+
+uno::Any SAL_CALL SfxUnoDecks::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException,
+ uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+
+ uno::Sequence< OUString > decks = getElementNames();
+
+ if (Index > decks.getLength()-1 || Index < 0)
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Reference<ui::XDeck> xDeck = new SfxUnoDeck(xFrame, decks[Index]);
+ aRet <<= xDeck;
+ return aRet;
+
+}
+
+// XElementAccess
+uno::Type SAL_CALL SfxUnoDecks::getElementType()
+ throw(::com::sun::star::uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ return uno::Type();
+}
+
+sal_Bool SAL_CALL SfxUnoDecks::hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Sequence< OUString > decks = getElementNames();
+ return decks.hasElements();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/sfx2/source/sidebar/UnoPanel.cxx b/sfx2/source/sidebar/UnoPanel.cxx
new file mode 100644
index 000000000000..e52bb27ec5c4
--- /dev/null
+++ b/sfx2/source/sidebar/UnoPanel.cxx
@@ -0,0 +1,271 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <sfx2/sidebar/UnoPanel.hxx>
+
+#include <sfx2/sidebar/ResourceManager.hxx>
+#include <sfx2/sidebar/SidebarController.hxx>
+
+#include <sfx2/sidebar/PanelTitleBar.hxx>
+#include <sfx2/sidebar/Panel.hxx>
+#include <sfx2/sidebar/Deck.hxx>
+
+#include <vcl/svapp.hxx>
+
+using namespace css;
+using namespace ::sfx2::sidebar;
+
+SfxUnoPanel::SfxUnoPanel(const uno::Reference<frame::XFrame>& rFrame, const OUString& panelId, const OUString& deckId):
+xFrame(rFrame),
+mPanelId(panelId),
+mDeckId(deckId),
+mpDeck(),
+mpPanel()
+{
+ SidebarController* pSidebarController = getSidebarController();
+
+ mpDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck;
+ mpPanel = mpDeck->GetPanel(mPanelId);
+}
+SidebarController* SfxUnoPanel::getSidebarController()
+{
+ return SidebarController::GetSidebarControllerForFrame(xFrame);
+}
+
+OUString SAL_CALL SfxUnoPanel::getId()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ return mPanelId;
+}
+
+OUString SAL_CALL SfxUnoPanel::getTitle()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ PanelTitleBar* pTitleBar = mpPanel->GetTitleBar();
+ return pTitleBar->GetTitle();
+}
+
+void SAL_CALL SfxUnoPanel::setTitle( const OUString& newTitle )
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ PanelTitleBar* pTitleBar = mpPanel->GetTitleBar();
+ pTitleBar->SetTitle(newTitle);
+}
+
+sal_Bool SAL_CALL SfxUnoPanel::isExpanded()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ return mpPanel->IsExpanded();
+}
+
+
+void SAL_CALL SfxUnoPanel::expand( const sal_Bool bCollapseOther )
+ throw(uno::RuntimeException, std::exception)
+{
+
+ SolarMutexGuard aGuard;
+
+ mpPanel->SetExpanded(true);
+
+ if (bCollapseOther)
+ {
+ Panel* aPanel;
+
+ SharedPanelContainer maPanels = mpDeck->GetPanels();
+ for ( SharedPanelContainer::iterator iPanel(maPanels.begin()), iEnd(maPanels.end());
+ iPanel!=iEnd; ++iPanel)
+ {
+ aPanel = *iPanel;
+
+ if (! aPanel->HasIdPredicate(mPanelId))
+ aPanel->SetExpanded(false);
+ }
+ }
+
+}
+
+void SAL_CALL SfxUnoPanel::collapse()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ mpPanel->SetExpanded(false);
+}
+
+uno::Reference<awt::XWindow> SAL_CALL SfxUnoPanel::getDialog()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ return mpPanel->GetElementWindow();
+}
+
+
+sal_Int32 SAL_CALL SfxUnoPanel::getOrderIndex()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(mPanelId)->mnOrderIndex;
+ return index;
+}
+
+void SAL_CALL SfxUnoPanel::setOrderIndex( const sal_Int32 newOrderIndex )
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, newOrderIndex);
+
+ pSidebarController->NotifyResize();
+}
+
+void SAL_CALL SfxUnoPanel::moveFirst()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::PanelContextDescriptorContainer aPanels = pSidebarController->GetMatchingPanels(mDeckId);
+
+ sal_Int32 curOrderIndex = getOrderIndex();
+ sal_Int32 minIndex = GetMinOrderIndex(aPanels);
+
+ if (curOrderIndex != minIndex) // is current panel already in place ?
+ {
+ minIndex -= 1;
+ pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, minIndex);
+ pSidebarController->NotifyResize();
+ }
+}
+
+void SAL_CALL SfxUnoPanel::moveLast()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::PanelContextDescriptorContainer aPanels = pSidebarController->GetMatchingPanels(mDeckId);
+
+ sal_Int32 curOrderIndex = getOrderIndex();
+ sal_Int32 maxIndex = GetMaxOrderIndex(aPanels);
+
+ if (curOrderIndex != maxIndex) // is current panel already in place ?
+ {
+ maxIndex += 1;
+ pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, maxIndex);
+ pSidebarController->NotifyResize();
+ }
+}
+
+void SAL_CALL SfxUnoPanel::moveUp()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ // Search for previous panel OrderIndex
+ ResourceManager::PanelContextDescriptorContainer aPanels = pSidebarController->GetMatchingPanels(mDeckId);
+
+ sal_Int32 curOrderIndex = getOrderIndex();
+ sal_Int32 previousIndex = GetMinOrderIndex(aPanels);
+
+ ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel;
+ for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+ {
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+ if( index < curOrderIndex && index > previousIndex)
+ previousIndex = index;
+ }
+
+ if (curOrderIndex != previousIndex) // is current panel already in place ?
+ {
+ previousIndex -= 1;
+ pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, previousIndex);
+ pSidebarController->NotifyResize();
+ }
+}
+
+void SAL_CALL SfxUnoPanel::moveDown()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::PanelContextDescriptorContainer aPanels = pSidebarController->GetMatchingPanels(mDeckId);
+
+ // Search for next panel OrderIndex
+ sal_Int32 curOrderIndex = getOrderIndex();
+ sal_Int32 nextIndex = GetMaxOrderIndex(aPanels);
+
+ ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel;
+ for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+ {
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+ if( index > curOrderIndex && index < nextIndex)
+ nextIndex = index;
+ }
+
+ if (curOrderIndex != nextIndex) // is current panel already in place ?
+ {
+ nextIndex += 1;
+ pSidebarController->GetResourceManager()->SetPanelOrderIndex(mPanelId, nextIndex);
+ pSidebarController->NotifyResize();
+ }
+}
+
+sal_Int32 SfxUnoPanel::GetMinOrderIndex(ResourceManager::PanelContextDescriptorContainer aPanels)
+{
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::PanelContextDescriptorContainer::iterator iPanel;
+
+ iPanel = aPanels.begin();
+ sal_Int32 minIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+
+ for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+ {
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+ if(minIndex > index)
+ minIndex = index;
+ }
+ return minIndex;
+}
+
+sal_Int32 SfxUnoPanel::GetMaxOrderIndex(ResourceManager::PanelContextDescriptorContainer aPanels)
+{
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::PanelContextDescriptorContainer::iterator iPanel;
+
+ iPanel = aPanels.begin();
+ sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+
+ for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+ {
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+ if(maxIndex < index)
+ maxIndex = index;
+ }
+ return maxIndex;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/UnoPanels.cxx b/sfx2/source/sidebar/UnoPanels.cxx
new file mode 100644
index 000000000000..8075667377b7
--- /dev/null
+++ b/sfx2/source/sidebar/UnoPanels.cxx
@@ -0,0 +1,180 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <sfx2/sidebar/UnoPanels.hxx>
+
+#include <sfx2/sidebar/ResourceManager.hxx>
+#include <sfx2/sidebar/SidebarController.hxx>
+
+#include <sfx2/sidebar/UnoDecks.hxx>
+
+#include <com/sun/star/ui/XPanel.hpp>
+#include <sfx2/sidebar/UnoPanel.hxx>
+
+#include <vcl/svapp.hxx>
+
+using namespace css;
+using namespace ::sfx2::sidebar;
+
+SfxUnoPanels::SfxUnoPanels(const uno::Reference<frame::XFrame>& rFrame, const OUString& deckId):
+xFrame(rFrame),
+mDeckId(deckId)
+{
+}
+
+SidebarController* SfxUnoPanels::getSidebarController()
+{
+ return SidebarController::GetSidebarControllerForFrame(xFrame);
+}
+
+OUString SAL_CALL SfxUnoPanels::getDeckId()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ return mDeckId;
+}
+
+// XNameAccess
+
+uno::Any SAL_CALL SfxUnoPanels::getByName( const OUString& aName )
+ throw(container::NoSuchElementException,
+ lang::WrappedTargetException,
+ uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Any aRet;
+
+ if (hasByName(aName))
+ {
+ uno::Reference<ui::XPanel> xPanel = new SfxUnoPanel(xFrame, aName, mDeckId);
+ aRet <<= xPanel;
+ }
+ else
+ throw container::NoSuchElementException();
+
+ return aRet;
+}
+
+
+uno::Sequence< OUString > SAL_CALL SfxUnoPanels::getElementNames()
+ throw(uno::RuntimeException, std::exception)
+{
+
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+
+ ResourceManager::PanelContextDescriptorContainer aPanels;
+ uno::Sequence< OUString > panelList(aPanels.size());
+
+ if (pSidebarController)
+ {
+ pSidebarController->GetResourceManager()->GetMatchingPanels(aPanels,
+ pSidebarController->GetCurrentContext(),
+ mDeckId,
+ xFrame);
+
+ panelList.realloc(aPanels.size());
+
+ long n = 0;
+
+ for (ResourceManager::PanelContextDescriptorContainer::const_iterator
+ iPanel(aPanels.begin()), iEnd(aPanels.end());
+ iPanel!=iEnd; ++iPanel)
+ {
+ panelList[n] = iPanel->msId;
+ n++;
+ }
+ }
+
+ return panelList;
+
+}
+
+sal_Bool SAL_CALL SfxUnoPanels::hasByName( const OUString& aName )
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+
+ if (pSidebarController)
+ {
+ ResourceManager::PanelContextDescriptorContainer aPanels;
+
+ pSidebarController->GetResourceManager()->GetMatchingPanels(aPanels,
+ pSidebarController->GetCurrentContext(),
+ mDeckId,
+ xFrame);
+
+ for (ResourceManager::PanelContextDescriptorContainer::const_iterator
+ iPanel(aPanels.begin()), iEnd(aPanels.end());
+ iPanel!=iEnd; ++iPanel)
+ {
+ if (iPanel->msId == aName)
+ return true;
+ }
+ }
+
+ // nothing found
+ return false;
+
+}
+
+// XIndexAccess
+
+sal_Int32 SAL_CALL SfxUnoPanels::getCount() throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Sequence< OUString > panels = getElementNames();
+ return panels.getLength();
+}
+
+uno::Any SAL_CALL SfxUnoPanels::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException,
+ uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Any aRet;
+
+ uno::Sequence< OUString > panels = getElementNames();
+
+ if (Index > panels.getLength()-1 || Index < 0)
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Reference<ui::XPanel> xPanel = new SfxUnoPanel(xFrame, panels[Index], mDeckId);
+ aRet <<= xPanel;
+ return aRet;
+
+}
+
+// XElementAccess
+uno::Type SAL_CALL SfxUnoPanels::getElementType()
+ throw(::com::sun::star::uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ return uno::Type();
+}
+
+sal_Bool SAL_CALL SfxUnoPanels::hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Sequence< OUString > panels = getElementNames();
+ return panels.hasElements();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/UnoSidebar.cxx b/sfx2/source/sidebar/UnoSidebar.cxx
new file mode 100644
index 000000000000..28de260f5a50
--- /dev/null
+++ b/sfx2/source/sidebar/UnoSidebar.cxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <sfx2/sidebar/UnoSidebar.hxx>
+#include <sfx2/sidebar/Tools.hxx>
+
+#include <sfx2/sidebar/ResourceManager.hxx>
+
+#include <sfx2/sidebar/UnoDecks.hxx>
+
+#include <com/sun/star/frame/XDispatch.hpp>
+
+#include <vcl/svapp.hxx>
+
+
+using namespace css;
+using namespace ::sfx2::sidebar;
+
+using ::com::sun::star::uno::RuntimeException;
+
+SfxUnoSidebar::SfxUnoSidebar(const uno::Reference<frame::XFrame>& rFrame):
+xFrame(rFrame)
+{
+}
+
+SidebarController* SfxUnoSidebar::getSidebarController()
+{
+ return SidebarController::GetSidebarControllerForFrame(xFrame);
+}
+
+void SAL_CALL SfxUnoSidebar::showDecks ( const sal_Bool bVisible )
+ throw (uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+
+ if (pSidebarController)
+ {
+ if (bVisible)
+ pSidebarController->RequestOpenDeck();
+ else
+ pSidebarController->RequestCloseDeck();
+ }
+}
+
+void SAL_CALL SfxUnoSidebar::setVisible ( const sal_Bool bVisible )
+ throw (uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+
+ if ( (bVisible && !pSidebarController) || (!bVisible && pSidebarController) )
+ {
+ const util::URL aURL (Tools::GetURL(".uno:Sidebar"));
+ uno::Reference<frame::XDispatch> mxDispatch (Tools::GetDispatch(xFrame, aURL));
+ if (mxDispatch.is())
+ mxDispatch->dispatch(aURL, uno::Sequence<beans::PropertyValue>());
+ }
+
+}
+
+sal_Bool SAL_CALL SfxUnoSidebar::isVisible()
+ throw (uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ SidebarController* pSidebarController = getSidebarController();
+
+ return pSidebarController != NULL;
+}
+
+uno::Reference<frame::XFrame> SAL_CALL SfxUnoSidebar::getFrame()
+ throw (uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ if (! xFrame.is() )
+ throw uno::RuntimeException();
+
+ return xFrame;
+}
+
+uno::Reference<ui::XDecks> SAL_CALL SfxUnoSidebar::getDecks()
+ throw (uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+
+ uno::Reference<ui::XDecks> decks = new SfxUnoDecks(xFrame);
+ return decks;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index d1c872bc17b3..8ad68d4a7db8 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -80,6 +80,9 @@
#include <unordered_map>
+#include <com/sun/star/ui/XSidebarProvider.hpp>
+#include <sfx2/sidebar/UnoSidebar.hxx>
+
#define TIMEOUT_START_RESCHEDULE 10L /* 10th s */
using namespace ::com::sun::star;
@@ -102,6 +105,8 @@ using ::com::sun::star::frame::XFrameActionListener;
using ::com::sun::star::util::XCloseListener;
using ::com::sun::star::task::XStatusIndicator;
using ::com::sun::star::frame::XTitle;
+using ::com::sun::star::ui::XSidebarProvider;
+
struct GroupIDToCommandGroup
{
@@ -540,6 +545,16 @@ SfxViewFrame& SfxBaseController::GetViewFrame_Impl() const
}
+Reference<XSidebarProvider> SAL_CALL SfxBaseController::getSidebar() throw (RuntimeException, std::exception)
+{
+ SfxViewFrame& rViewFrame = GetViewFrame_Impl();
+ SfxFrame& rFrame = rViewFrame.GetFrame();
+
+ Reference<XSidebarProvider> rSidebar = new SfxUnoSidebar(rFrame.GetFrameInterface());
+ return rSidebar;
+}
+
+
// SfxBaseController -> XController2 -> XController