diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2020-08-20 12:07:24 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2020-08-20 16:42:52 +0200 |
commit | 37892578e97ea0f0c948116d639797060ac5f21f (patch) | |
tree | 10b36935e960d4a8620bcd8c5147cccc5c3635c1 /framework/inc | |
parent | 445cf499666f21c2d480ce1df9ce6004b9450b64 (diff) |
Base addon toolbars on the regular ToolBarManager
ToolBarManager already supported addon buttons because of the
toolbar merging feature. Besides the cleanup, this gives access to
addon devs to all toolbar features like aliases or style buttons.
Change-Id: I7adf830ac71c7f5354a924d60a531d8001e37571
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101071
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework/inc')
-rw-r--r-- | framework/inc/uielement/addonstoolbarmanager.hxx | 64 | ||||
-rw-r--r-- | framework/inc/uielement/addonstoolbarwrapper.hxx | 1 | ||||
-rw-r--r-- | framework/inc/uielement/toolbarmanager.hxx | 12 |
3 files changed, 5 insertions, 72 deletions
diff --git a/framework/inc/uielement/addonstoolbarmanager.hxx b/framework/inc/uielement/addonstoolbarmanager.hxx deleted file mode 100644 index d13c3f14b58a..000000000000 --- a/framework/inc/uielement/addonstoolbarmanager.hxx +++ /dev/null @@ -1,64 +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_FRAMEWORK_INC_UIELEMENT_ADDONSTOOLBARMANAGER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_ADDONSTOOLBARMANAGER_HXX - -#include <uielement/toolbarmanager.hxx> - -#include <com/sun/star/frame/XFrame.hpp> - -#include <rtl/ustring.hxx> - -class ToolBox; - -namespace framework -{ - -class AddonsToolBarManager final : public ToolBarManager -{ - public: - AddonsToolBarManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext, - const css::uno::Reference< css::frame::XFrame >& rFrame, - const OUString& rResourceName, - ToolBox* pToolBar ); - virtual ~AddonsToolBarManager() override; - - // XComponent - void SAL_CALL dispose() override; - - virtual void RefreshImages() override; - using ToolBarManager::FillToolbar; - void FillToolbar( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rAddonToolbar ); - - private: - DECL_LINK(Click, ToolBox *, void); - DECL_LINK(DoubleClick, ToolBox *, void); - DECL_LINK(Select, ToolBox *, void); - DECL_LINK(StateChanged, StateChangedType const *, void ); - DECL_LINK(DataChanged, DataChangedEvent const *, void ); - - virtual bool MenuItemAllowed( sal_uInt16 ) const override; -}; - -} - -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_ADDONSTOOLBARMANAGER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/addonstoolbarwrapper.hxx b/framework/inc/uielement/addonstoolbarwrapper.hxx index 6d6fee13f4c4..2970ce6d13fa 100644 --- a/framework/inc/uielement/addonstoolbarwrapper.hxx +++ b/framework/inc/uielement/addonstoolbarwrapper.hxx @@ -28,7 +28,6 @@ namespace framework { -class AddonsToolBarManager; class AddonsToolBarWrapper final : public UIElementWrapperBase { public: diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 8f3eb4c2b2eb..d77ae16312aa 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -57,7 +57,7 @@ typedef ::cppu::WeakImplHelper< css::ui::XUIConfigurationListener > ToolbarManager_Base; -class ToolBarManager : public ToolbarManager_Base +class ToolBarManager final : public ToolbarManager_Base { public: ToolBarManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext, @@ -85,8 +85,9 @@ class ToolBarManager : public ToolbarManager_Base void SAL_CALL removeEventListener( const css::uno::Reference< XEventListener >& xListener ) override; void CheckAndUpdateImages(); - virtual void RefreshImages(); + void RequestImages(); void FillToolbar( const css::uno::Reference< css::container::XIndexAccess >& rToolBarData ); + void FillAddonToolbar( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rAddonToolbar ); void FillOverflowToolbar( ToolBox const * pParent ); void notifyRegisteredControllers( const OUString& aUIElementName, const OUString& aCommand ); void Destroy(); @@ -107,7 +108,7 @@ class ToolBarManager : public ToolbarManager_Base css::uno::Reference< css::awt::XWindow > xWindow; }; - protected: + private: DECL_LINK(Click, ToolBox *, void); DECL_LINK(DropdownClick, ToolBox *, void); DECL_LINK(DoubleClick, ToolBox *, void); @@ -123,8 +124,6 @@ class ToolBarManager : public ToolbarManager_Base DECL_LINK( OverflowEventListener, VclWindowEvent&, void ); DECL_STATIC_LINK( ToolBarManager, ExecuteHdl_Impl, void*, void ); - virtual bool MenuItemAllowed( sal_uInt16 ) const; - void AddCustomizeMenuItems(ToolBox const * pToolBar); void InitImageManager(); void RemoveControllers(); @@ -134,7 +133,7 @@ class ToolBarManager : public ToolbarManager_Base void UpdateController( const css::uno::Reference< css::frame::XToolbarController >& xController); //end void AddFrameActionListener(); - void RequestImages(); + void RefreshImages(); ToolBoxItemBits ConvertStyleToToolboxItemBits( sal_Int32 nStyle ); css::uno::Reference< css::frame::XModel > GetModelFromFrame() const; bool IsPluginMode() const; @@ -142,7 +141,6 @@ class ToolBarManager : public ToolbarManager_Base void setToolBarImage(const Image& _aImage,const CommandToInfoMap::const_iterator& _pIter); void impl_elementChanged(bool _bRemove,const css::ui::ConfigurationEvent& Event ); - protected: typedef std::unordered_map< sal_uInt16, css::uno::Reference< css::frame::XStatusListener > > ToolBarControllerMap; typedef ::std::vector< css::uno::Reference< css::frame::XSubToolbarController > > SubToolBarControllerVector; typedef std::unordered_map<OUString, SubToolBarControllerVector> SubToolBarToSubToolBarControllerMap; |