diff options
Diffstat (limited to 'sfx2/inc/sidebar')
-rw-r--r-- | sfx2/inc/sidebar/ContextChangeBroadcaster.hxx | 67 | ||||
-rw-r--r-- | sfx2/inc/sidebar/ContextList.hxx | 66 | ||||
-rw-r--r-- | sfx2/inc/sidebar/ControllerFactory.hxx | 72 | ||||
-rw-r--r-- | sfx2/inc/sidebar/DeckDescriptor.hxx | 53 | ||||
-rw-r--r-- | sfx2/inc/sidebar/DeckLayouter.hxx | 47 | ||||
-rw-r--r-- | sfx2/inc/sidebar/DeckTitleBar.hxx | 57 | ||||
-rw-r--r-- | sfx2/inc/sidebar/PanelDescriptor.hxx | 51 | ||||
-rw-r--r-- | sfx2/inc/sidebar/PanelTitleBar.hxx | 69 | ||||
-rw-r--r-- | sfx2/inc/sidebar/SidebarToolBox.hxx | 82 | ||||
-rw-r--r-- | sfx2/inc/sidebar/TitleBar.hxx | 70 | ||||
-rw-r--r-- | sfx2/inc/sidebar/Tools.hxx | 56 | ||||
-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 |
16 files changed, 986 insertions, 0 deletions
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/ControllerFactory.hxx b/sfx2/inc/sidebar/ControllerFactory.hxx new file mode 100644 index 000000000..8d45a2e3b --- /dev/null +++ b/sfx2/inc/sidebar/ControllerFactory.hxx @@ -0,0 +1,72 @@ +/* -*- 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/uno/Reference.hxx> +#include <vcl/toolbox.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 ToolBoxItemId 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, + const css::uno::Reference<css::frame::XController>& rxController, + 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..5381b4ea2 --- /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..a40868f45 --- /dev/null +++ b/sfx2/inc/sidebar/DeckLayouter.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 <sfx2/sidebar/Panel.hxx> + +namespace tools { class Rectangle; } + +namespace sfx2::sidebar { + +class DeckTitleBar; +class SidebarDockingWindow; + +/** Helper for layouting the direct and indirect children of a + deck like title bars, panels, and scroll bars. +*/ +namespace DeckLayouter +{ + void LayoutDeck ( + const SidebarDockingWindow* pDockingWindow, + const tools::Rectangle& rContentArea, + sal_Int32& rMinimalWidth, + sal_Int32& rMinimalHeight, + SharedPanelContainer& rPanels, + DeckTitleBar& pDeckTitleBar, + weld::ScrolledWindow& 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..7ed23a8bf --- /dev/null +++ b/sfx2/inc/sidebar/DeckTitleBar.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/. + * + * 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> +#include <vcl/customweld.hxx> + +namespace sfx2::sidebar +{ +class Deck; +class GripWidget; + +class DeckTitleBar final : public TitleBar +{ +public: + DeckTitleBar(const OUString& rsTitle, weld::Builder& rBuilder, + const std::function<void()>& rCloserAction); + virtual ~DeckTitleBar() override; + + virtual void SetTitle(const OUString& rsTitle) override; + virtual OUString GetTitle() const override; + + void SetCloserVisible(const bool bIsCloserVisible); + tools::Rectangle GetDragArea() const; + + virtual void DataChanged() override; + +private: + virtual void HandleToolBoxItemClick() override; + + std::unique_ptr<GripWidget> mxGripWidget; + std::unique_ptr<weld::CustomWeld> mxGripWeld; + std::unique_ptr<weld::Label> mxLabel; + + 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/PanelDescriptor.hxx b/sfx2/inc/sidebar/PanelDescriptor.hxx new file mode 100644 index 000000000..1033379f7 --- /dev/null +++ b/sfx2/inc/sidebar/PanelDescriptor.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 . + */ +#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 mbWantsAWT; + 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..308a0c8f9 --- /dev/null +++ b/sfx2/inc/sidebar/PanelTitleBar.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/. + * + * 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> +#include <com/sun/star/frame/XToolbarController.hpp> + +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, weld::Builder& rBuilder, Panel* pPanel); + virtual ~PanelTitleBar() override; + + virtual void SetTitle (const OUString& rsTitle) override; + virtual OUString GetTitle() const override; + + void SetMoreOptionsCommand(const OUString& rsCommandName, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const css::uno::Reference<css::frame::XController>& rxController); + + void UpdateExpandedState(); + + weld::Expander& GetExpander() + { + return *mxExpander; + } + + const OUString& GetMoreOptionsCommand() const { return msMoreOptionsCommand; } + +private: + virtual void HandleToolBoxItemClick() override; + + DECL_LINK(ExpandHdl, weld::Expander&, void); + + std::unique_ptr<weld::Expander> mxExpander; + + css::uno::Reference<css::frame::XToolbarController> mxController; + + Panel* mpPanel; + OString msIdent; + OUString msMoreOptionsCommand; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/SidebarToolBox.hxx b/sfx2/inc/sidebar/SidebarToolBox.hxx new file mode 100644 index 000000000..acae7475e --- /dev/null +++ b/sfx2/inc/sidebar/SidebarToolBox.hxx @@ -0,0 +1,82 @@ +/* -*- 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_SIDEBARTOOLBOX_HXX +#define INCLUDED_SFX2_SIDEBAR_SIDEBARTOOLBOX_HXX + +#include <vcl/builder.hxx> +#include <vcl/toolbox.hxx> +#include <map> + +namespace com::sun::star::frame { class XToolbarController; } + +namespace sfx2::sidebar { + +/** The sidebar tool box has two responsibilities: + 1. Coordinated location, size, and other states with its parent + background window. + 2. Create and handle tool bar controller for its items. +*/ +class SidebarToolBox : public ToolBox +{ +public: + SidebarToolBox(vcl::Window* pParentWindow); + virtual ~SidebarToolBox() override; + virtual void dispose() override; + + virtual ToolBoxButtonSize GetDefaultButtonSize() const; + + using ToolBox::InsertItem; + virtual void InsertItem(const OUString& rCommand, + const css::uno::Reference<css::frame::XFrame>& rFrame, + ToolBoxItemBits nBits, + const Size& rRequestedSize, + ImplToolItems::size_type nPos = APPEND) override; + + virtual bool EventNotify(NotifyEvent& rEvent) override; + virtual void KeyInput( const KeyEvent& rKEvt ) override; + + void InitToolBox(VclBuilder::stringmap& rMap); + +protected: + typedef std::map<ToolBoxItemId, css::uno::Reference<css::frame::XToolbarController>> ControllerContainer; + ControllerContainer maControllers; + bool mbAreHandlersRegistered; + bool mbUseDefaultButtonSize; + bool mbSideBar; + + DECL_LINK(DropDownClickHandler, ToolBox*, void); + DECL_LINK(ClickHandler, ToolBox*, void); + DECL_LINK(DoubleClickHandler, ToolBox*, void); + DECL_LINK(SelectHandler, ToolBox*, void); + DECL_LINK(ChangedIconSizeHandler, LinkParamNone*, void ); + + css::uno::Reference<css::frame::XToolbarController> GetControllerForItemId(const ToolBoxItemId nItemId) const; + + void CreateController(const ToolBoxItemId nItemId, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const sal_Int32 nItemWidth, bool bSideBar); + void RegisterHandlers(); +}; + + +} // end of namespace sfx2::sidebar + +#endif + +/* 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..1f589508d --- /dev/null +++ b/sfx2/inc/sidebar/TitleBar.hxx @@ -0,0 +1,70 @@ +/* -*- 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/Theme.hxx> +#include <vcl/weld.hxx> + +namespace sfx2::sidebar { + +class TitleBar +{ +public: + TitleBar(weld::Builder& rBuilder, Theme::ThemeItem eThemeItem); + virtual ~TitleBar(); + + virtual void SetTitle (const OUString& rsTitle) = 0; + virtual OUString GetTitle() const = 0; + + virtual void DataChanged(); + + void Show(bool bShow); + bool GetVisible() const; + + Size get_preferred_size() const; + + void SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon); + + weld::Toolbar& GetToolBox() + { + return *mxToolBox; + } + const weld::Toolbar& GetToolBox() const + { + return *mxToolBox; + } + +protected: + weld::Builder& mrBuilder; + std::unique_ptr<weld::Box> mxTitlebar; + std::unique_ptr<weld::Image> mxAddonImage; + std::unique_ptr<weld::Toolbar> mxToolBox; + Theme::ThemeItem meThemeItem; + + virtual void HandleToolBoxItemClick() = 0; + + DECL_LINK(SelectionHandler, const OString&, void); + +private: + void SetBackground(); +}; + +} // 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..fb3dc54b4 --- /dev/null +++ b/sfx2/inc/sidebar/Tools.hxx @@ -0,0 +1,56 @@ +/* -*- 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 <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 css::uno::Reference<css::graphic::XGraphic> GetImage( + const OUString& rsImageURL, + const OUString& rsHighContrastImageURL, + const css::uno::Reference<css::frame::XFrame>& rxFrame); + + static css::uno::Reference<css::graphic::XGraphic> GetImage( + const OUString& rsURL, + const css::uno::Reference<css::frame::XFrame>& rxFrame); + + 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..42c975c44 --- /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(const sfx2::sidebar::ResourceManager::DeckContextDescriptorContainer& rDecks); + sal_Int32 GetMinOrderIndex(const sfx2::sidebar::ResourceManager::DeckContextDescriptorContainer& rDecks); + +}; + +/* 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..4e148befd --- /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; + std::weak_ptr<sfx2::sidebar::Panel> mxPanel; + + sal_Int32 GetMaxOrderIndex(const sfx2::sidebar::ResourceManager::PanelContextDescriptorContainer& rPanels); + sal_Int32 GetMinOrderIndex(const sfx2::sidebar::ResourceManager::PanelContextDescriptorContainer& rPanels); +}; + +/* 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: */ |