diff options
Diffstat (limited to 'sfx2/inc/sidebar')
-rw-r--r-- | sfx2/inc/sidebar/Accessible.hxx | 60 | ||||
-rw-r--r-- | sfx2/inc/sidebar/AccessibleTitleBar.hxx | 44 | ||||
-rw-r--r-- | sfx2/inc/sidebar/ContextChangeBroadcaster.hxx | 67 | ||||
-rw-r--r-- | sfx2/inc/sidebar/ContextList.hxx | 66 | ||||
-rw-r--r-- | sfx2/inc/sidebar/ControlFactory.hxx | 51 | ||||
-rw-r--r-- | sfx2/inc/sidebar/ControllerFactory.hxx | 71 | ||||
-rw-r--r-- | sfx2/inc/sidebar/DeckDescriptor.hxx | 53 | ||||
-rw-r--r-- | sfx2/inc/sidebar/DeckLayouter.hxx | 48 | ||||
-rw-r--r-- | sfx2/inc/sidebar/DeckTitleBar.hxx | 52 | ||||
-rw-r--r-- | sfx2/inc/sidebar/DrawHelper.hxx | 47 | ||||
-rw-r--r-- | sfx2/inc/sidebar/MenuButton.hxx | 45 | ||||
-rw-r--r-- | sfx2/inc/sidebar/Paint.hxx | 73 | ||||
-rw-r--r-- | sfx2/inc/sidebar/PanelDescriptor.hxx | 50 | ||||
-rw-r--r-- | sfx2/inc/sidebar/PanelTitleBar.hxx | 62 | ||||
-rw-r--r-- | sfx2/inc/sidebar/TabItem.hxx | 46 | ||||
-rw-r--r-- | sfx2/inc/sidebar/TitleBar.hxx | 76 | ||||
-rw-r--r-- | sfx2/inc/sidebar/Tools.hxx | 63 | ||||
-rw-r--r-- | sfx2/inc/sidebar/UnoDeck.hxx | 62 | ||||
-rw-r--r-- | sfx2/inc/sidebar/UnoDecks.hxx | 54 | ||||
-rw-r--r-- | sfx2/inc/sidebar/UnoPanel.hxx | 69 | ||||
-rw-r--r-- | sfx2/inc/sidebar/UnoPanels.hxx | 57 | ||||
-rw-r--r-- | sfx2/inc/sidebar/UnoSidebar.hxx | 54 |
22 files changed, 1270 insertions, 0 deletions
diff --git a/sfx2/inc/sidebar/Accessible.hxx b/sfx2/inc/sidebar/Accessible.hxx new file mode 100644 index 000000000..3f3d351ed --- /dev/null +++ b/sfx2/inc/sidebar/Accessible.hxx @@ -0,0 +1,60 @@ +/* -*- 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 . + */ +#pragma once + +#include <com/sun/star/accessibility/XAccessible.hpp> + +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> + +namespace com::sun::star::accessibility { class XAccessibleContext; } + +typedef cppu::WeakComponentImplHelper < + css::accessibility::XAccessible + > AccessibleInterfaceBase; + +namespace sfx2::sidebar { + + +/** Simple implementation of the XAccessible interface. + Its getAccessibleContext() method returns a context object given + to its constructor. +*/ +class Accessible final + : private ::cppu::BaseMutex, + public AccessibleInterfaceBase +{ +public: + explicit Accessible ( + const css::uno::Reference<css::accessibility::XAccessibleContext>& rxContext); + virtual ~Accessible() override; + Accessible(const Accessible&) = delete; + Accessible& operator=( const Accessible& ) = delete; + + virtual void SAL_CALL disposing() override; + // XAccessible + virtual css::uno::Reference<css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override; + +private: + css::uno::Reference<css::accessibility::XAccessibleContext> mxContext; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/AccessibleTitleBar.hxx b/sfx2/inc/sidebar/AccessibleTitleBar.hxx new file mode 100644 index 000000000..f2105dabb --- /dev/null +++ b/sfx2/inc/sidebar/AccessibleTitleBar.hxx @@ -0,0 +1,44 @@ +/* -*- 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 . + */ +#pragma once + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +namespace com::sun::star::accessibility { class XAccessible; } + +namespace sfx2::sidebar { + +class TitleBar; + +class AccessibleTitleBar final + : public VCLXAccessibleComponent +{ +public: + static css::uno::Reference<css::accessibility::XAccessible> Create (TitleBar& rTitleBar); + +private: + virtual void FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet) override; + + explicit AccessibleTitleBar (VCLXWindow* pWindow); + virtual ~AccessibleTitleBar() override; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/ContextChangeBroadcaster.hxx b/sfx2/inc/sidebar/ContextChangeBroadcaster.hxx new file mode 100644 index 000000000..49770da76 --- /dev/null +++ b/sfx2/inc/sidebar/ContextChangeBroadcaster.hxx @@ -0,0 +1,67 @@ +/* -*- 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_INC_SIDEBAR_CONTEXTCHANGEBROADCASTER_HXX +#define INCLUDED_SFX2_INC_SIDEBAR_CONTEXTCHANGEBROADCASTER_HXX + +#include <com/sun/star/frame/XFrame.hpp> + + +namespace sfx2::sidebar { + + +/** This class is a helper for broadcasting context changes that are + tied to shells being activated or deactivated. +*/ +class ContextChangeBroadcaster +{ +public: + ContextChangeBroadcaster(); + ~ContextChangeBroadcaster(); + + void Initialize (const OUString& rsContextName); + + void Activate (const css::uno::Reference<css::frame::XFrame>& rxFrame); + void Deactivate (const css::uno::Reference<css::frame::XFrame>& rxFrame); + + /** Enable or disable the broadcaster. + @param bIsEnabled + The new value of the "enabled" state. + @return + The old value of the "enabled" state is returned. + */ + bool SetBroadcasterEnabled (const bool bIsEnabled); + +private: + OUString msContextName; + bool mbIsBroadcasterEnabled; + + void BroadcastContextChange ( + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const OUString& rsModuleName, + const OUString& rsContextName); + static OUString GetModuleName ( + const css::uno::Reference<css::frame::XFrame>& rxFrame); +}; + + +} // end of namespace ::sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/ContextList.hxx b/sfx2/inc/sidebar/ContextList.hxx new file mode 100644 index 000000000..b3ecafa53 --- /dev/null +++ b/sfx2/inc/sidebar/ContextList.hxx @@ -0,0 +1,66 @@ +/* -*- 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 . + */ +#pragma once + +#include <sfx2/sidebar/Context.hxx> +#include <rtl/ustring.hxx> + +#include <vector> + +namespace sfx2::sidebar { + +/** Per context data for deck and panel descriptors. +*/ +class ContextList +{ +public: + ContextList(); + + class Entry + { + public: + Context maContext; + bool mbIsInitiallyVisible; + 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 OUString& rsMenuCommand); + + void ToggleVisibilityForContext( const Context& rContext,const bool bIsInitiallyVisible ); + const ::std::vector<Entry>& GetEntries() const {return maEntries;}; + +private: + ::std::vector<Entry> maEntries; + + ::std::vector<Entry>::const_iterator FindBestMatch (const Context& rContext) const; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/ControlFactory.hxx b/sfx2/inc/sidebar/ControlFactory.hxx new file mode 100644 index 000000000..15ae45ef4 --- /dev/null +++ b/sfx2/inc/sidebar/ControlFactory.hxx @@ -0,0 +1,51 @@ +/* -*- 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_SIDEBAR_CONTROLFACTORY_HXX +#define INCLUDED_SFX2_SIDEBAR_CONTROLFACTORY_HXX + +#include <sfx2/dllapi.h> +#include <vcl/vclptr.hxx> + +class CheckBox; +class RadioButton; +namespace vcl { class Window; } + +namespace sfx2::sidebar { + +/** Factory for controls used in sidebar panels. + The reason to use this factory instead of creating the controls + directly is that this way the sidebar has a little more control + over look and feel of its controls. +*/ +class ControlFactory +{ +public: + /** Create the menu button for the task bar. + */ + static VclPtr<CheckBox> CreateMenuButton (vcl::Window* pParentWindow); + + static VclPtr<RadioButton> CreateTabItem (vcl::Window* pParentWindow); +}; + + +} // end of namespace sfx2::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/ControllerFactory.hxx b/sfx2/inc/sidebar/ControllerFactory.hxx new file mode 100644 index 000000000..dbf609775 --- /dev/null +++ b/sfx2/inc/sidebar/ControllerFactory.hxx @@ -0,0 +1,71 @@ +/* -*- 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 . + */ +#pragma once + +#include <sfx2/dllapi.h> +#include <com/sun/star/uno/Reference.hxx> + +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::frame { class XController; } +namespace com::sun::star::frame { class XFrame; } +namespace com::sun::star::frame { class XToolbarController; } + +class ToolBox; + +namespace weld { + class Builder; + class Toolbar; +} + +namespace sfx2::sidebar { + +/** Convenience class for the easy creation of toolbox controllers. +*/ +class ControllerFactory +{ +public: + static css::uno::Reference<css::frame::XToolbarController> CreateToolBoxController( + ToolBox* pToolBox, + const sal_uInt16 nItemId, + const OUString& rsCommandName, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const css::uno::Reference<css::frame::XController>& rxController, + const css::uno::Reference<css::awt::XWindow>& rxParentWindow, + const sal_Int32 nItemWidth, bool bSideBar); + + static css::uno::Reference<css::frame::XToolbarController> CreateToolBoxController( + weld::Toolbar& rToolbar, + weld::Builder& rBuilder, + const OUString& rsCommandName, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + bool bSideBar); + +private: + static css::uno::Reference<css::frame::XToolbarController> CreateToolBarController( + const css::uno::Reference<css::awt::XWindow>& rToolbar, + const OUString& rsCommandName, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const css::uno::Reference<css::frame::XController>& rxController, + const sal_Int32 nWidth, bool bSideBar); +}; + + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/DeckDescriptor.hxx b/sfx2/inc/sidebar/DeckDescriptor.hxx new file mode 100644 index 000000000..f1195cd0b --- /dev/null +++ b/sfx2/inc/sidebar/DeckDescriptor.hxx @@ -0,0 +1,53 @@ +/* -*- 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 . + */ +#pragma once + +#include <sidebar/ContextList.hxx> + +#include <sfx2/sidebar/Deck.hxx> + +namespace sfx2::sidebar { + +class DeckDescriptor +{ +public: + OUString msTitle; + OUString msId; + OUString msIconURL; + OUString msHighContrastIconURL; + OUString msTitleBarIconURL; + OUString msHighContrastTitleBarIconURL; + OUString msHelpText; + ContextList maContextList; + bool mbIsEnabled; + sal_Int32 mnOrderIndex; + bool mbExperimental; + + OUString msNodeName; // some impress deck nodes names are different from their Id + + VclPtr<Deck> mpDeck; + + DeckDescriptor(); + DeckDescriptor (const DeckDescriptor& rOther); + ~DeckDescriptor(); +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/DeckLayouter.hxx b/sfx2/inc/sidebar/DeckLayouter.hxx new file mode 100644 index 000000000..b84496cd6 --- /dev/null +++ b/sfx2/inc/sidebar/DeckLayouter.hxx @@ -0,0 +1,48 @@ +/* -*- 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 . + */ +#pragma once + +#include <sfx2/sidebar/Panel.hxx> + +class ScrollBar; +namespace vcl { class Window; } +namespace tools { class Rectangle; } + +namespace sfx2::sidebar { + +/** Helper for layouting the direct and indirect children of a + deck like title bars, panels, and scroll bars. +*/ +namespace DeckLayouter +{ + void LayoutDeck ( + const tools::Rectangle& rContentArea, + sal_Int32& rMinimalWidth, + sal_Int32& rMinimalHeight, + SharedPanelContainer& rPanels, + vcl::Window& pDeckTitleBar, + vcl::Window& pScrollClipWindow, + vcl::Window& pScrollContainer, + vcl::Window& pFiller, + ScrollBar& pVerticalScrollBar); +} + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/DeckTitleBar.hxx b/sfx2/inc/sidebar/DeckTitleBar.hxx new file mode 100644 index 000000000..86a71c76a --- /dev/null +++ b/sfx2/inc/sidebar/DeckTitleBar.hxx @@ -0,0 +1,52 @@ +/* -*- 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 . + */ +#pragma once + +#include <sidebar/TitleBar.hxx> + +namespace sfx2::sidebar { + +class DeckTitleBar final : public TitleBar +{ +public: + DeckTitleBar(const OUString& rsTitle, + vcl::Window* pParentWindow, + const std::function<void()>& rCloserAction); + + void SetCloserVisible(const bool bIsCloserVisible); + static tools::Rectangle GetDragArea(); + + virtual void DataChanged(const DataChangedEvent& rEvent) override; + virtual void MouseMove(const MouseEvent& rMouseEvent) override; + +private: + virtual tools::Rectangle GetTitleArea(const tools::Rectangle& rTitleBarBox) override; + virtual void PaintDecoration(vcl::RenderContext& rRenderContext) override; + virtual sidebar::Paint GetBackgroundPaint() override; + virtual void HandleToolBoxItemClick(const sal_uInt16 nItemIndex) override; + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + + static const sal_uInt16 mnCloserItemIndex = 1; + const std::function<void()> maCloserAction; + bool mbIsCloserVisible; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/DrawHelper.hxx b/sfx2/inc/sidebar/DrawHelper.hxx new file mode 100644 index 000000000..a657ac041 --- /dev/null +++ b/sfx2/inc/sidebar/DrawHelper.hxx @@ -0,0 +1,47 @@ +/* -*- 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 . + */ +#pragma once + +#include <vcl/outdev.hxx> + +class Color; +class SvBorder; + +namespace sfx2::sidebar { + +class Paint; + +/** Some convenience functions for painting backgrounds and borders. +*/ +class DrawHelper +{ +public: + static void DrawBorder(vcl::RenderContext& rRenderContext, const tools::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 tools::Rectangle& rBox, const sal_Int32 nCornerRadius, + const Color& rBorderColor, const Paint& rFillPaint); +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/MenuButton.hxx b/sfx2/inc/sidebar/MenuButton.hxx new file mode 100644 index 000000000..a244a3439 --- /dev/null +++ b/sfx2/inc/sidebar/MenuButton.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ +#pragma once + +#include <vcl/button.hxx> + +namespace sfx2::sidebar { + +class MenuButton final + : public CheckBox +{ +public: + MenuButton (vcl::Window* pParentWindow); + + virtual void Paint (vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rUpdateArea) override; + virtual void MouseMove (const MouseEvent& rEvent) override; + virtual void MouseButtonDown (const MouseEvent& rMouseEvent) override; + virtual void MouseButtonUp (const MouseEvent& rMouseEvent) override; + +protected: + using CheckBox::FillLayoutData; + +private: + bool mbIsLeftButtonDown; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/Paint.hxx b/sfx2/inc/sidebar/Paint.hxx new file mode 100644 index 000000000..ea2af1d5e --- /dev/null +++ b/sfx2/inc/sidebar/Paint.hxx @@ -0,0 +1,73 @@ +/* -*- 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 . + */ +#pragma once + +#include <vcl/gradient.hxx> +#include <vcl/wall.hxx> + +#include <boost/variant.hpp> + +namespace sfx2::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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/PanelDescriptor.hxx b/sfx2/inc/sidebar/PanelDescriptor.hxx new file mode 100644 index 000000000..be85911ac --- /dev/null +++ b/sfx2/inc/sidebar/PanelDescriptor.hxx @@ -0,0 +1,50 @@ +/* -*- 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 . + */ +#pragma once + +#include <sidebar/ContextList.hxx> + +namespace sfx2::sidebar { + +class PanelDescriptor +{ +public: + OUString msTitle; + bool mbIsTitleBarOptional; + OUString msId; + OUString msDeckId; + OUString msTitleBarIconURL; + OUString msHighContrastTitleBarIconURL; + ContextList maContextList; + OUString msImplementationURL; + sal_Int32 mnOrderIndex; + bool mbShowForReadOnlyDocuments; + bool mbWantsCanvas; + bool mbExperimental; + + OUString msNodeName; // some impress panel nodes names are different from their Id + + PanelDescriptor(); + PanelDescriptor (const PanelDescriptor& rPanelDescriptor); + ~PanelDescriptor(); +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/PanelTitleBar.hxx b/sfx2/inc/sidebar/PanelTitleBar.hxx new file mode 100644 index 000000000..b060124b9 --- /dev/null +++ b/sfx2/inc/sidebar/PanelTitleBar.hxx @@ -0,0 +1,62 @@ +/* -*- 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 . + */ +#pragma once + +#include <sidebar/TitleBar.hxx> + +namespace com::sun::star::frame { class XController; } +namespace com::sun::star::frame { class XFrame; } + +namespace sfx2::sidebar { + +class Panel; + +class PanelTitleBar final + : public TitleBar +{ +public: + PanelTitleBar(const OUString& rsTitle, vcl::Window* pParentWindow, Panel* pPanel); + virtual ~PanelTitleBar() override; + virtual void dispose() override; + + void SetMoreOptionsCommand(const OUString& rsCommandName, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const css::uno::Reference<css::frame::XController>& rxController); + + virtual void DataChanged(const DataChangedEvent& rEvent) override; + virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override; + virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override; + +private: + virtual tools::Rectangle GetTitleArea(const tools::Rectangle& rTitleBarBox) override; + virtual void PaintDecoration(vcl::RenderContext& rRenderContext) override; + virtual sidebar::Paint GetBackgroundPaint() override; + virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex) override; + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + + bool mbIsLeftButtonDown; + VclPtr<Panel> mpPanel; + static const sal_uInt16 mnMenuItemIndex = 1; + css::uno::Reference<css::frame::XFrame> mxFrame; + OUString msMoreOptionsCommand; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/TabItem.hxx b/sfx2/inc/sidebar/TabItem.hxx new file mode 100644 index 000000000..44e5cf6b5 --- /dev/null +++ b/sfx2/inc/sidebar/TabItem.hxx @@ -0,0 +1,46 @@ +/* -*- 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 . + */ +#pragma once + +#include <vcl/button.hxx> + +namespace vcl { class Window; } + +namespace sfx2::sidebar { + +/** A single button in the tab bar. +*/ +class TabItem final + : public RadioButton +{ +public: + TabItem (vcl::Window* pParentWindow); + + virtual void Paint (vcl::RenderContext& rRenderContext, const tools::Rectangle& rUpdateArea) override; + virtual void MouseMove (const MouseEvent& rEvent) override; + virtual void MouseButtonDown (const MouseEvent& rMouseEvent) override; + virtual void MouseButtonUp (const MouseEvent& rMouseEvent) override; + +private: + bool mbIsLeftButtonDown; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/TitleBar.hxx b/sfx2/inc/sidebar/TitleBar.hxx new file mode 100644 index 000000000..69c182825 --- /dev/null +++ b/sfx2/inc/sidebar/TitleBar.hxx @@ -0,0 +1,76 @@ +/* -*- 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 . + */ +#pragma once + +#include <sidebar/Paint.hxx> + +#include <sfx2/sidebar/SidebarToolBox.hxx> + +namespace sfx2::sidebar { + +class TitleBar : public vcl::Window +{ +public: + TitleBar (const OUString& rsTitle, + vcl::Window* pParentWindow, + const sidebar::Paint& rInitialBackgroundPaint); + virtual ~TitleBar() override; + virtual void dispose() override; + + void SetTitle (const OUString& rsTitle); + const OUString& GetTitle() const {return msTitle; } + + void SetIcon (const Image& rIcon); + + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rUpdateArea) override; + virtual void DataChanged (const DataChangedEvent& rEvent) override; + virtual void setPosSizePixel (long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) override; + + ToolBox& GetToolBox() + { + return *maToolBox; + } + const ToolBox& GetToolBox() const + { + return *maToolBox; + } + +protected: + VclPtr<SidebarToolBox> maToolBox; + OUString msTitle; + + virtual tools::Rectangle GetTitleArea (const tools::Rectangle& rTitleBarBox) = 0; + virtual void PaintDecoration (vcl::RenderContext& rRenderContext) = 0; + void PaintFocus(vcl::RenderContext& rRenderContext, const tools::Rectangle& rFocusBox); + virtual sidebar::Paint GetBackgroundPaint() = 0; + virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex); + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + +private: + Image maIcon; + sidebar::Paint maBackgroundPaint; + + void PaintTitle(vcl::RenderContext& rRenderContext, const tools::Rectangle& rTitleBox); + DECL_LINK(SelectionHandler, ToolBox*, void); +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/Tools.hxx b/sfx2/inc/sidebar/Tools.hxx new file mode 100644 index 000000000..97611a7a6 --- /dev/null +++ b/sfx2/inc/sidebar/Tools.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * 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 . + */ +#pragma once + +#include <vcl/image.hxx> +#include <vcl/gradient.hxx> + +#include <sfx2/dllapi.h> + +#include <com/sun/star/awt/Gradient.hpp> +#include <com/sun/star/util/URL.hpp> + +namespace com::sun::star::frame { class XController; } +namespace com::sun::star::frame { class XDispatch; } +namespace com::sun::star::frame { class XFrame; } + + +namespace sfx2::sidebar { + +class Tools +{ +public: + static Image GetImage ( + const OUString& rsImageURL, + const OUString& rsHighContrastImageURL, + const css::uno::Reference<css::frame::XFrame>& rxFrame); + + static Image GetImage ( + const OUString& rsURL, + const css::uno::Reference<css::frame::XFrame>& rxFrame); + + static css::awt::Gradient VclToAwtGradient (const Gradient& rGradient); + static Gradient AwtToVclGradient (const css::awt::Gradient& rGradient); + + static css::util::URL GetURL (const OUString& rsCommand); + static css::uno::Reference<css::frame::XDispatch> GetDispatch ( + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const css::util::URL& rURL); + + static OUString GetModuleName ( + const css::uno::Reference<css::frame::XController>& rxFrame); +}; + + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/UnoDeck.hxx b/sfx2/inc/sidebar/UnoDeck.hxx new file mode 100644 index 000000000..88497c03a --- /dev/null +++ b/sfx2/inc/sidebar/UnoDeck.hxx @@ -0,0 +1,62 @@ +/* -*- 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/. + * + */ + +#pragma once + + +#include <com/sun/star/ui/XDeck.hpp> + +#include <cppuhelper/implbase.hxx> + +#include <sfx2/sidebar/ResourceManager.hxx> + +namespace com::sun::star::frame { class XFrame; } +namespace com::sun::star::ui { class XPanels; } +namespace sfx2::sidebar { class SidebarController; } + +/** get the decks +*/ +class SfxUnoDeck final : public cppu::WeakImplHelper<css::ui::XDeck> +{ + +public: + + SfxUnoDeck(const css::uno::Reference<css::frame::XFrame>& , const OUString&); + + virtual OUString SAL_CALL getId() override; + + virtual OUString SAL_CALL getTitle() override; + virtual void SAL_CALL setTitle( const OUString& newTitle ) override; + + virtual sal_Bool SAL_CALL isActive() override; + virtual void SAL_CALL activate( const sal_Bool bActivate ) override; + + virtual css::uno::Reference<css::ui::XPanels> SAL_CALL getPanels() override; + + virtual sal_Int32 SAL_CALL getOrderIndex() override; + virtual void SAL_CALL setOrderIndex( const sal_Int32 newOrderIndex ) override; + virtual void SAL_CALL moveFirst() override; + virtual void SAL_CALL moveLast() override; + virtual void SAL_CALL moveUp() override; + virtual void SAL_CALL moveDown() override; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + + const OUString mDeckId; + + sal_Int32 GetMaxOrderIndex(sfx2::sidebar::ResourceManager::DeckContextDescriptorContainer aDecks); + sal_Int32 GetMinOrderIndex(sfx2::sidebar::ResourceManager::DeckContextDescriptorContainer aDecks); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/UnoDecks.hxx b/sfx2/inc/sidebar/UnoDecks.hxx new file mode 100644 index 000000000..95ce0be62 --- /dev/null +++ b/sfx2/inc/sidebar/UnoDecks.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <com/sun/star/ui/XDecks.hpp> + +#include <cppuhelper/implbase.hxx> + +namespace com::sun::star::frame { class XFrame; } +namespace sfx2::sidebar { class SidebarController; } + +/** get the decks +*/ +class SfxUnoDecks final : public cppu::WeakImplHelper<css::ui::XDecks> +{ + +public: + + SfxUnoDecks(const css::uno::Reference<css::frame::XFrame>&); + +// XNameAccess + + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + +// XIndexAccess + + virtual sal_Int32 SAL_CALL getCount() override; + + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + +// XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/UnoPanel.hxx b/sfx2/inc/sidebar/UnoPanel.hxx new file mode 100644 index 000000000..50d9aba2c --- /dev/null +++ b/sfx2/inc/sidebar/UnoPanel.hxx @@ -0,0 +1,69 @@ +/* -*- 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/. + * + */ + +#pragma once + +#include <com/sun/star/ui/XPanel.hpp> + + +#include <cppuhelper/implbase.hxx> + +#include <sfx2/sidebar/Panel.hxx> +#include <sfx2/sidebar/Deck.hxx> +#include <sfx2/sidebar/ResourceManager.hxx> + +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::frame { class XFrame; } +namespace sfx2::sidebar { class SidebarController; } + + +/** get the Panel +*/ +class SfxUnoPanel final : public cppu::WeakImplHelper<css::ui::XPanel> +{ + +public: + + SfxUnoPanel(const css::uno::Reference<css::frame::XFrame>& , const OUString&, const OUString&); + + virtual OUString SAL_CALL getId() override; + + virtual OUString SAL_CALL getTitle() override; + virtual void SAL_CALL setTitle( const OUString& newTitle ) override; + + virtual sal_Bool SAL_CALL isExpanded() override; + virtual void SAL_CALL expand( const sal_Bool bCollapseOther ) override; + virtual void SAL_CALL collapse( ) override; + + virtual sal_Int32 SAL_CALL getOrderIndex() override; + virtual void SAL_CALL setOrderIndex( const sal_Int32 newOrderIndex ) override; + virtual void SAL_CALL moveFirst() override; + virtual void SAL_CALL moveLast() override; + virtual void SAL_CALL moveUp() override; + virtual void SAL_CALL moveDown() override; + + virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getDialog() override; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + + const OUString mPanelId; + const OUString mDeckId; + + VclPtr<sfx2::sidebar::Deck> mpDeck; + VclPtr<sfx2::sidebar::Panel> mpPanel; + + sal_Int32 GetMaxOrderIndex(sfx2::sidebar::ResourceManager::PanelContextDescriptorContainer aPanels); + sal_Int32 GetMinOrderIndex(sfx2::sidebar::ResourceManager::PanelContextDescriptorContainer aPanels); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/UnoPanels.hxx b/sfx2/inc/sidebar/UnoPanels.hxx new file mode 100644 index 000000000..487043dee --- /dev/null +++ b/sfx2/inc/sidebar/UnoPanels.hxx @@ -0,0 +1,57 @@ +/* -*- 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/. + */ +#pragma once + + +#include <com/sun/star/ui/XPanels.hpp> + +#include <cppuhelper/implbase.hxx> + +namespace com::sun::star::frame { class XFrame; } +namespace sfx2::sidebar { class SidebarController; } + +/** get the decks +*/ +class SfxUnoPanels final : public cppu::WeakImplHelper<css::ui::XPanels> +{ + +public: + + SfxUnoPanels(const css::uno::Reference<css::frame::XFrame>& , const OUString&); + +// XPanels + virtual OUString SAL_CALL getDeckId() override; + +// XNameAccess + + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + +// XIndexAccess + + virtual sal_Int32 SAL_CALL getCount() override; + + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + +// XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + const OUString& mDeckId; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/UnoSidebar.hxx b/sfx2/inc/sidebar/UnoSidebar.hxx new file mode 100644 index 000000000..20ffa22b1 --- /dev/null +++ b/sfx2/inc/sidebar/UnoSidebar.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef INCLUDED_SFX2_SIDEBAR_SIDEBAR_HXX +#define INCLUDED_SFX2_SIDEBAR_SIDEBAR_HXX + +#include <com/sun/star/ui/XSidebarProvider.hpp> + +#include <cppuhelper/implbase.hxx> + +namespace com::sun::star::frame { class XFrame; } +namespace com::sun::star::ui { class XDecks; } +namespace com::sun::star::ui { class XSidebar; } +namespace sfx2::sidebar { class SidebarController; } + +/** get the sidebar for a given frame +*/ +class SfxUnoSidebar final : public cppu::WeakImplHelper<css::ui::XSidebarProvider> +{ + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + +public: + + SfxUnoSidebar(const css::uno::Reference<css::frame::XFrame>&); + + virtual void SAL_CALL showDecks (const sal_Bool bVisible) override; + + + virtual void SAL_CALL setVisible (const sal_Bool bVisible) override; + + virtual sal_Bool SAL_CALL isVisible() override; + + virtual css::uno::Reference<css::frame::XFrame> SAL_CALL getFrame() override; + + virtual css::uno::Reference<css::ui::XDecks> SAL_CALL getDecks() override; + + virtual css::uno::Reference<css::ui::XSidebar> SAL_CALL getSidebar() override; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |