From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- .../inc/uielement/FixedImageToolbarController.hxx | 57 ++++++ .../inc/uielement/FixedTextToolbarController.hxx | 55 ++++++ framework/inc/uielement/addonstoolbarmanager.hxx | 64 +++++++ framework/inc/uielement/addonstoolbarwrapper.hxx | 61 ++++++ .../inc/uielement/buttontoolbarcontroller.hxx | 97 ++++++++++ .../inc/uielement/comboboxtoolbarcontroller.hxx | 67 +++++++ framework/inc/uielement/commandinfo.hxx | 47 +++++ .../inc/uielement/complextoolbarcontroller.hxx | 102 ++++++++++ framework/inc/uielement/constitemcontainer.hxx | 102 ++++++++++ .../inc/uielement/dropdownboxtoolbarcontroller.hxx | 66 +++++++ framework/inc/uielement/edittoolbarcontroller.hxx | 67 +++++++ framework/inc/uielement/fontmenucontroller.hxx | 71 +++++++ framework/inc/uielement/fontsizemenucontroller.hxx | 76 ++++++++ framework/inc/uielement/footermenucontroller.hxx | 49 +++++ .../inc/uielement/genericstatusbarcontroller.hxx | 60 ++++++ .../inc/uielement/generictoolbarcontroller.hxx | 93 +++++++++ framework/inc/uielement/headermenucontroller.hxx | 66 +++++++ .../inc/uielement/imagebuttontoolbarcontroller.hxx | 57 ++++++ framework/inc/uielement/itemcontainer.hxx | 84 +++++++++ .../inc/uielement/langselectionmenucontroller.hxx | 92 +++++++++ framework/inc/uielement/macrosmenucontroller.hxx | 61 ++++++ framework/inc/uielement/menubarmanager.hxx | 210 +++++++++++++++++++++ framework/inc/uielement/menubarmerger.hxx | 110 +++++++++++ framework/inc/uielement/menubarwrapper.hxx | 85 +++++++++ framework/inc/uielement/newmenucontroller.hxx | 92 +++++++++ framework/inc/uielement/progressbarwrapper.hxx | 85 +++++++++ framework/inc/uielement/rootitemcontainer.hxx | 129 +++++++++++++ .../inc/uielement/spinfieldtoolbarcontroller.hxx | 83 ++++++++ framework/inc/uielement/statusbar.hxx | 55 ++++++ framework/inc/uielement/statusbaritem.hxx | 81 ++++++++ framework/inc/uielement/statusbarmanager.hxx | 106 +++++++++++ framework/inc/uielement/statusbarmerger.hxx | 74 ++++++++ framework/inc/uielement/statusbarwrapper.hxx | 59 ++++++ .../uielement/statusindicatorinterfacewrapper.hxx | 56 ++++++ framework/inc/uielement/styletoolbarcontroller.hxx | 81 ++++++++ .../uielement/togglebuttontoolbarcontroller.hxx | 79 ++++++++ framework/inc/uielement/toolbarmanager.hxx | 184 ++++++++++++++++++ framework/inc/uielement/toolbarmerger.hxx | 140 ++++++++++++++ .../inc/uielement/toolbarmodemenucontroller.hxx | 78 ++++++++ framework/inc/uielement/toolbarsmenucontroller.hxx | 97 ++++++++++ framework/inc/uielement/toolbarwrapper.hxx | 79 ++++++++ framework/inc/uielement/uicommanddescription.hxx | 94 +++++++++ framework/inc/uielement/uielement.hxx | 108 +++++++++++ framework/inc/uielement/uielementtypenames.hxx | 33 ++++ 44 files changed, 3692 insertions(+) create mode 100644 framework/inc/uielement/FixedImageToolbarController.hxx create mode 100644 framework/inc/uielement/FixedTextToolbarController.hxx create mode 100644 framework/inc/uielement/addonstoolbarmanager.hxx create mode 100644 framework/inc/uielement/addonstoolbarwrapper.hxx create mode 100644 framework/inc/uielement/buttontoolbarcontroller.hxx create mode 100644 framework/inc/uielement/comboboxtoolbarcontroller.hxx create mode 100644 framework/inc/uielement/commandinfo.hxx create mode 100644 framework/inc/uielement/complextoolbarcontroller.hxx create mode 100644 framework/inc/uielement/constitemcontainer.hxx create mode 100644 framework/inc/uielement/dropdownboxtoolbarcontroller.hxx create mode 100644 framework/inc/uielement/edittoolbarcontroller.hxx create mode 100644 framework/inc/uielement/fontmenucontroller.hxx create mode 100644 framework/inc/uielement/fontsizemenucontroller.hxx create mode 100644 framework/inc/uielement/footermenucontroller.hxx create mode 100644 framework/inc/uielement/genericstatusbarcontroller.hxx create mode 100644 framework/inc/uielement/generictoolbarcontroller.hxx create mode 100644 framework/inc/uielement/headermenucontroller.hxx create mode 100644 framework/inc/uielement/imagebuttontoolbarcontroller.hxx create mode 100644 framework/inc/uielement/itemcontainer.hxx create mode 100644 framework/inc/uielement/langselectionmenucontroller.hxx create mode 100644 framework/inc/uielement/macrosmenucontroller.hxx create mode 100644 framework/inc/uielement/menubarmanager.hxx create mode 100644 framework/inc/uielement/menubarmerger.hxx create mode 100644 framework/inc/uielement/menubarwrapper.hxx create mode 100644 framework/inc/uielement/newmenucontroller.hxx create mode 100644 framework/inc/uielement/progressbarwrapper.hxx create mode 100644 framework/inc/uielement/rootitemcontainer.hxx create mode 100644 framework/inc/uielement/spinfieldtoolbarcontroller.hxx create mode 100644 framework/inc/uielement/statusbar.hxx create mode 100644 framework/inc/uielement/statusbaritem.hxx create mode 100644 framework/inc/uielement/statusbarmanager.hxx create mode 100644 framework/inc/uielement/statusbarmerger.hxx create mode 100644 framework/inc/uielement/statusbarwrapper.hxx create mode 100644 framework/inc/uielement/statusindicatorinterfacewrapper.hxx create mode 100644 framework/inc/uielement/styletoolbarcontroller.hxx create mode 100644 framework/inc/uielement/togglebuttontoolbarcontroller.hxx create mode 100644 framework/inc/uielement/toolbarmanager.hxx create mode 100644 framework/inc/uielement/toolbarmerger.hxx create mode 100644 framework/inc/uielement/toolbarmodemenucontroller.hxx create mode 100644 framework/inc/uielement/toolbarsmenucontroller.hxx create mode 100644 framework/inc/uielement/toolbarwrapper.hxx create mode 100644 framework/inc/uielement/uicommanddescription.hxx create mode 100644 framework/inc/uielement/uielement.hxx create mode 100644 framework/inc/uielement/uielementtypenames.hxx (limited to 'framework/inc/uielement') diff --git a/framework/inc/uielement/FixedImageToolbarController.hxx b/framework/inc/uielement/FixedImageToolbarController.hxx new file mode 100644 index 000000000..2f10503e5 --- /dev/null +++ b/framework/inc/uielement/FixedImageToolbarController.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 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDIMAGETOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDIMAGETOOLBARCONTROLLER_HXX + +#include + +#include +#include + +class ToolBox; +class FixedImage; + +namespace framework +{ +class FixedImageToolbarController final : public ComplexToolbarController +{ +public: + FixedImageToolbarController(const css::uno::Reference& rxContext, + const css::uno::Reference& rFrame, + ToolBox* pToolBar, sal_uInt16 nID, const OUString& aCommand); + + // XComponent + virtual void SAL_CALL dispose() override; + + void CheckAndUpdateImages(); + +private: + virtual void executeControlCommand(const css::frame::ControlCommand& rControlCommand) override; + + DECL_LINK(MiscOptionsChanged, LinkParamNone*, void); + + VclPtr m_pFixedImageControl; + sal_Int16 m_eSymbolSize; +}; +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDIMAGETOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/FixedTextToolbarController.hxx b/framework/inc/uielement/FixedTextToolbarController.hxx new file mode 100644 index 000000000..299bb8098 --- /dev/null +++ b/framework/inc/uielement/FixedTextToolbarController.hxx @@ -0,0 +1,55 @@ +/* -*- 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_FIXEDTEXTTOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDTEXTTOOLBARCONTROLLER_HXX + +#include +#include + +#include +#include + +class ToolBox; +class FixedText; + +namespace framework +{ +class FixedTextToolbarController final : public ComplexToolbarController +{ +public: + FixedTextToolbarController(const css::uno::Reference& rxContext, + const css::uno::Reference& rFrame, + ToolBox* pToolBar, sal_uInt16 nID, const OUString& aCommand); + + // XComponent + virtual void SAL_CALL dispose() override; + +private: + virtual void executeControlCommand(const css::frame::ControlCommand& rControlCommand) override; + virtual css::uno::Sequence + getExecuteArgs(sal_Int16 KeyModifier) const override; + + VclPtr m_pFixedTextControl; +}; +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDTEXTTOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/addonstoolbarmanager.hxx b/framework/inc/uielement/addonstoolbarmanager.hxx new file mode 100644 index 000000000..d13c3f14b --- /dev/null +++ b/framework/inc/uielement/addonstoolbarmanager.hxx @@ -0,0 +1,64 @@ +/* -*- 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 + +#include + +#include + +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 new file mode 100644 index 000000000..6d6fee13f --- /dev/null +++ b/framework/inc/uielement/addonstoolbarwrapper.hxx @@ -0,0 +1,61 @@ +/* -*- 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_ADDONSTOOLBARWRAPPER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX + +#include + +#include +#include + +namespace framework +{ + +class AddonsToolBarManager; +class AddonsToolBarWrapper final : public UIElementWrapperBase +{ + public: + AddonsToolBarWrapper( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~AddonsToolBarWrapper() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XUIElement + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getRealInterface() override; + + // cf. ToolbarLayoutManager + void populateImages(); + + private: + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::lang::XComponent > m_xToolBarManager; + css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > m_aConfigData; + bool m_bCreatedImages; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/buttontoolbarcontroller.hxx b/framework/inc/uielement/buttontoolbarcontroller.hxx new file mode 100644 index 000000000..989c95203 --- /dev/null +++ b/framework/inc/uielement/buttontoolbarcontroller.hxx @@ -0,0 +1,97 @@ +/* -*- 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_BUTTONTOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +class ToolBox; + +namespace framework +{ + +class ButtonToolbarController final : public css::frame::XStatusListener, + public css::frame::XToolbarController, + public css::lang::XInitialization, + public css::util::XUpdatable, + public css::lang::XComponent, + public ::cppu::BaseMutex, + public ::cppu::OWeakObject +{ + public: + ButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + ToolBox* pToolBar, + const OUString& aCommand ); + virtual ~ButtonToolbarController() override; + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire() throw () override; + virtual void SAL_CALL release() throw () override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XUpdatable + virtual void SAL_CALL update() override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override; + virtual void SAL_CALL click() override; + virtual void SAL_CALL doubleClick() override; + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override; + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) override; + + private: + bool m_bInitialized : 1, + m_bDisposed : 1; + OUString m_aCommandURL; + css::uno::Reference< css::frame::XFrame > m_xFrame; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + VclPtr m_pToolbar; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/comboboxtoolbarcontroller.hxx b/framework/inc/uielement/comboboxtoolbarcontroller.hxx new file mode 100644 index 000000000..df14769ca --- /dev/null +++ b/framework/inc/uielement/comboboxtoolbarcontroller.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_FRAMEWORK_INC_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX + +#include + +#include + +#include + +namespace framework +{ + +class ComboBoxControl; + +class ComboboxToolbarController final : public ComplexToolbarController + +{ + public: + ComboboxToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + sal_Int32 nWidth, + const OUString& aCommand ); + virtual ~ComboboxToolbarController() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // called from ComboBoxControl + void Select(); + void Modify(); + void GetFocus(); + void LoseFocus(); + void Activate(); + + private: + virtual void executeControlCommand( const css::frame::ControlCommand& rControlCommand ) override; + virtual css::uno::Sequence< css::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const override; + + VclPtr m_pComboBox; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/commandinfo.hxx b/framework/inc/uielement/commandinfo.hxx new file mode 100644 index 000000000..b2c7c3e88 --- /dev/null +++ b/framework/inc/uielement/commandinfo.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 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_COMMANDINFO_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_COMMANDINFO_HXX + +#include + +#include +#include + +namespace framework +{ + +struct CommandInfo +{ + CommandInfo() : nId( 0 ), + nImageInfo( 0 ) {} + + sal_uInt16 nId; + ::std::vector< sal_uInt16 > aIds; + sal_Int16 nImageInfo; +}; + +typedef std::unordered_map CommandToInfoMap; + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_COMMANDINFO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/complextoolbarcontroller.hxx b/framework/inc/uielement/complextoolbarcontroller.hxx new file mode 100644 index 000000000..5c5bf8499 --- /dev/null +++ b/framework/inc/uielement/complextoolbarcontroller.hxx @@ -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/. + * + * 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_COMPLEXTOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX + +#include +#include +#include +#include +#include + +#include +#include +#include + +class ToolBox; +namespace vcl { class Window; } + +namespace framework +{ + +class ComplexToolbarController : public svt::ToolboxController + +{ + public: + ComplexToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + const OUString& aCommand ); + virtual ~ComplexToolbarController() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + DECL_STATIC_LINK( ComplexToolbarController, ExecuteHdl_Impl, void*, void ); + DECL_STATIC_LINK( ComplexToolbarController, Notify_Impl, void*, void); + + struct ExecuteInfo + { + css::uno::Reference< css::frame::XDispatch > xDispatch; + css::util::URL aTargetURL; + css::uno::Sequence< css::beans::PropertyValue > aArgs; + }; + + struct NotifyInfo + { + OUString aEventName; + css::uno::Reference< css::frame::XControlNotificationListener > xNotifyListener; + css::util::URL aSourceURL; + css::uno::Sequence< css::beans::NamedValue > aInfoSeq; + }; + + protected: + static sal_Int32 getFontSizePixel( const vcl::Window* pWindow ); + css::uno::Reference< css::frame::XDispatch > getDispatchFromCommand( const OUString& aCommand ) const; + void addNotifyInfo( const OUString& aEventName, + const css::uno::Reference< css::frame::XDispatch >& xDispatch, + const css::uno::Sequence< css::beans::NamedValue >& rInfo ); + + virtual void executeControlCommand( const css::frame::ControlCommand& rControlCommand ) = 0; + virtual css::uno::Sequence< css::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + const css::util::URL& getInitializedURL(); + void notifyFocusGet(); + void notifyFocusLost(); + void notifyTextChanged( const OUString& aText ); + + VclPtr m_xToolbar; + sal_uInt16 m_nID; + bool m_bMadeInvisible; + mutable css::util::URL m_aURL; + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/constitemcontainer.hxx b/framework/inc/uielement/constitemcontainer.hxx new file mode 100644 index 000000000..43f10597c --- /dev/null +++ b/framework/inc/uielement/constitemcontainer.hxx @@ -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/. + * + * 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_CONSTITEMCONTAINER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_CONSTITEMCONTAINER_HXX + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +namespace framework +{ + +class RootItemContainer; +class ItemContainer; +class UNLESS_MERGELIBS(FWI_DLLPUBLIC) ConstItemContainer final : public ::cppu::WeakImplHelper< + css::container::XIndexAccess, + css::lang::XUnoTunnel , + css::beans::XFastPropertySet, + css::beans::XPropertySet > +{ + friend class RootItemContainer; + friend class ItemContainer; + + public: + ConstItemContainer(); + ConstItemContainer( const ItemContainer& rtemContainer ); + ConstItemContainer( const css::uno::Reference< css::container::XIndexAccess >& rSourceContainer, bool bFastCopy = false ); + virtual ~ConstItemContainer() override; + + // XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() throw(); + sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) 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 + { + return cppu::UnoType>::get(); + } + + virtual sal_Bool SAL_CALL hasElements() override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XFastPropertySet + virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle ) override; + + private: + ::cppu::IPropertyArrayHelper& getInfoHelper(); + css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); + + void copyItemContainer( const std::vector< css::uno::Sequence< css::beans::PropertyValue > >& rSourceVector ); + css::uno::Reference< css::container::XIndexAccess > deepCopyContainer( const css::uno::Reference< css::container::XIndexAccess >& rSubContainer ); + + std::vector< css::uno::Sequence< css::beans::PropertyValue > > m_aItemVector; + OUString m_aUIName; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_CONSTITEMCONTAINER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx new file mode 100644 index 000000000..eb95c142c --- /dev/null +++ b/framework/inc/uielement/dropdownboxtoolbarcontroller.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 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX + +#include + +#include +#include + +class ToolBox; + +namespace framework +{ + +class ListBoxControl; + +class DropdownToolbarController final : public ComplexToolbarController + +{ + public: + DropdownToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + sal_Int32 nWidth, + const OUString& aCommand ); + virtual ~DropdownToolbarController() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // called from ListBoxControl + void Select(); + void GetFocus(); + void LoseFocus(); + + private: + virtual void executeControlCommand( const css::frame::ControlCommand& rControlCommand ) override; + virtual css::uno::Sequence< css::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const override; + + VclPtr m_pListBoxControl; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/edittoolbarcontroller.hxx b/framework/inc/uielement/edittoolbarcontroller.hxx new file mode 100644 index 000000000..193af5920 --- /dev/null +++ b/framework/inc/uielement/edittoolbarcontroller.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_FRAMEWORK_INC_UIELEMENT_EDITTOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_EDITTOOLBARCONTROLLER_HXX + +#include + +#include +#include + +class ToolBox; + +namespace framework +{ + +class EditControl; + +class EditToolbarController final : public ComplexToolbarController + +{ + public: + EditToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + sal_Int32 nWidth, + const OUString& aCommand ); + virtual ~EditToolbarController() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // called from EditControl + void Modify(); + void GetFocus(); + void LoseFocus(); + void Activate(); + + private: + virtual void executeControlCommand( const css::frame::ControlCommand& rControlCommand ) override; + virtual css::uno::Sequence< css::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const override; + + VclPtr m_pEditControl; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_EDITTOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/fontmenucontroller.hxx b/framework/inc/uielement/fontmenucontroller.hxx new file mode 100644 index 000000000..ef8231f18 --- /dev/null +++ b/framework/inc/uielement/fontmenucontroller.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 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTMENUCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTMENUCONTROLLER_HXX + +#include + +#include +#include + +#include +#include + +namespace framework +{ + class FontMenuController final : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + FontMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~FontMenuController() override; + + // XServiceInfo + DECLARE_XSERVICEINFO_NOFACTORY + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XMenuListener + virtual void SAL_CALL itemActivated( const css::awt::MenuEvent& rEvent ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + private: + virtual void impl_setPopupMenu() override; + void fillPopupMenu( const css::uno::Sequence< OUString >& rFontNameSeq, css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); + + OUString m_aFontFamilyName; + css::uno::Reference< css::frame::XDispatch > m_xFontListDispatch; + }; +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTMENUCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/fontsizemenucontroller.hxx b/framework/inc/uielement/fontsizemenucontroller.hxx new file mode 100644 index 000000000..36a960099 --- /dev/null +++ b/framework/inc/uielement/fontsizemenucontroller.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 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX + +#include + +#include +#include +#include +#include + +#include +#include + +#include + +namespace framework +{ + class FontSizeMenuController final : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + FontSizeMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~FontSizeMenuController() override; + + // XServiceInfo + DECLARE_XSERVICEINFO_NOFACTORY + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + private: + virtual void impl_setPopupMenu() override; + void setCurHeight( long nHeight, css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); + void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); + OUString retrievePrinterName( css::uno::Reference< css::frame::XFrame > const & rFrame ); + + std::unique_ptr m_pHeightArray; + css::awt::FontDescriptor m_aFontDescriptor; + css::frame::status::FontHeight m_aFontHeight; + css::uno::Reference< css::frame::XDispatch > m_xCurrentFontDispatch; + }; +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/footermenucontroller.hxx b/framework/inc/uielement/footermenucontroller.hxx new file mode 100644 index 000000000..732524a5e --- /dev/null +++ b/framework/inc/uielement/footermenucontroller.hxx @@ -0,0 +1,49 @@ +/* -*- 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_FOOTERMENUCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_FOOTERMENUCONTROLLER_HXX + +#include + +namespace framework +{ + class FooterMenuController final : public HeaderMenuController + { + public: + FooterMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~FooterMenuController() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName ( ) override; + virtual sal_Bool SAL_CALL supportsService ( const OUString& sServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames ( ) override; + /* Helper for XServiceInfo */ + static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames( ); + static OUString impl_getStaticImplementationName ( ); + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + }; +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_FOOTERMENUCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/genericstatusbarcontroller.hxx b/framework/inc/uielement/genericstatusbarcontroller.hxx new file mode 100644 index 000000000..95521d2a2 --- /dev/null +++ b/framework/inc/uielement/genericstatusbarcontroller.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 . + */ +#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_GENERICSTATUSBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_GENERICSTATUSBARCONTROLLER_HXX + +#include + +#include + +namespace framework +{ + +struct AddonStatusbarItemData; + +class GenericStatusbarController final : public svt::StatusbarController +{ + public: + GenericStatusbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + const css::uno::Reference< css::ui::XStatusbarItem >& rxItem, + AddonStatusbarItemData *pItemData ); + virtual ~GenericStatusbarController() override; + + // XComponent + virtual void SAL_CALL dispose() override; + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + virtual void SAL_CALL paint( const css::uno::Reference< css::awt::XGraphics >& xGraphics, + const css::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nStyle ) override; + + private: + bool m_bEnabled; + bool m_bOwnerDraw; + AddonStatusbarItemData* m_pItemData; + css::uno::Reference< css::graphic::XGraphic > m_xGraphic; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/generictoolbarcontroller.hxx b/framework/inc/uielement/generictoolbarcontroller.hxx new file mode 100644 index 000000000..eac6e8276 --- /dev/null +++ b/framework/inc/uielement/generictoolbarcontroller.hxx @@ -0,0 +1,93 @@ +/* -*- 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_GENERICTOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX + +#include +#include + +#include +#include +#include + +class PopupMenu; +class ToolBox; + +namespace framework +{ + +class GenericToolbarController final : public svt::ToolboxController +{ + public: + GenericToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + const OUString& aCommand ); + virtual ~GenericToolbarController() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + DECL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, void*, void ); + + struct ExecuteInfo + { + css::uno::Reference< css::frame::XDispatch > xDispatch; + css::util::URL aTargetURL; + css::uno::Sequence< css::beans::PropertyValue > aArgs; + }; + + private: + VclPtr m_xToolbar; + sal_uInt16 m_nID; + bool m_bEnumCommand : 1, + m_bMadeInvisible : 1; + OUString m_aEnumCommand; +}; + +class MenuToolbarController final : public svt::ToolboxController +{ + css::uno::Reference< css::container::XIndexAccess > m_xMenuDesc; + VclPtr pMenu; + css::uno::Reference< css::lang::XComponent > m_xMenuManager; + +public: + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& ) override {} + // XComponent + virtual void SAL_CALL dispose() override; + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArgs ) override; + // XToolbarController + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/headermenucontroller.hxx b/framework/inc/uielement/headermenucontroller.hxx new file mode 100644 index 000000000..b92cb9755 --- /dev/null +++ b/framework/inc/uielement/headermenucontroller.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 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_HEADERMENUCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_HEADERMENUCONTROLLER_HXX + +#include + +#include +#include + +#include + +namespace framework +{ + class HeaderMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + HeaderMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext, bool _bFooter = false ); + virtual ~HeaderMenuController() override; + + // XServiceInfo + DECLARE_XSERVICEINFO_NOFACTORY + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + private: + void fillPopupMenu( const css::uno::Reference< css::frame::XModel >& rModel, css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); + + css::uno::Reference< css::frame::XModel > m_xModel; + bool m_bFooter; + }; +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_HEADERMENUCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx new file mode 100644 index 000000000..9b6250597 --- /dev/null +++ b/framework/inc/uielement/imagebuttontoolbarcontroller.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 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX + +#include + +#include +#include + +class ToolBox; + +namespace framework +{ + +class ImageButtonToolbarController final : public ComplexToolbarController + +{ + public: + ImageButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + const OUString& aCommand ); + virtual ~ImageButtonToolbarController() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + private: + virtual void executeControlCommand( const css::frame::ControlCommand& rControlCommand ) override; + + bool ReadImageFromURL( bool bBigImage, const OUString& aImageURL, Image& aImage ); +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/itemcontainer.hxx b/framework/inc/uielement/itemcontainer.hxx new file mode 100644 index 000000000..d22fc9a09 --- /dev/null +++ b/framework/inc/uielement/itemcontainer.hxx @@ -0,0 +1,84 @@ +/* -*- 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_ITEMCONTAINER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_ITEMCONTAINER_HXX + +#include + +#include +#include + +#include + +#include +#include + +namespace framework +{ +class ConstItemContainer; +class ItemContainer final : public ::cppu::WeakImplHelper< css::container::XIndexContainer> +{ + friend class ConstItemContainer; + + public: + ItemContainer( const ShareableMutex& ); + ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex ); + ItemContainer( const css::uno::Reference< css::container::XIndexAccess >& rItemAccessContainer, const ShareableMutex& rMutex ); + virtual ~ItemContainer() override; + + // XInterface, XTypeProvider + + // XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() throw(); + + // XIndexContainer + virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; + + virtual void SAL_CALL removeByIndex( sal_Int32 Index ) override; + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) 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 + { + return cppu::UnoType>::get(); + } + + virtual sal_Bool SAL_CALL hasElements() override; + + private: + void copyItemContainer( const std::vector< css::uno::Sequence< css::beans::PropertyValue > >& rSourceVector, const ShareableMutex& rMutex ); + css::uno::Reference< css::container::XIndexAccess > deepCopyContainer( const css::uno::Reference< css::container::XIndexAccess >& rSubContainer, const ShareableMutex& rMutex ); + + mutable ShareableMutex m_aShareMutex; + std::vector< css::uno::Sequence< css::beans::PropertyValue > > m_aItemVector; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_ITEMCONTAINER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/langselectionmenucontroller.hxx b/framework/inc/uielement/langselectionmenucontroller.hxx new file mode 100644 index 000000000..080e98e32 --- /dev/null +++ b/framework/inc/uielement/langselectionmenucontroller.hxx @@ -0,0 +1,92 @@ +/* -*- 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_LANGSELECTIONMENUCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_LANGSELECTIONMENUCONTROLLER_HXX + +#include + +#include +#include + +#include +#include + +#include + +namespace framework +{ + class LanguageSelectionMenuController final : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + LanguageSelectionMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~LanguageSelectionMenuController() override; + + // XServiceInfo + DECLARE_XSERVICEINFO_NOFACTORY + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + private: + virtual void impl_setPopupMenu() override; + enum Mode + { + MODE_SetLanguageSelectionMenu, + MODE_SetLanguageParagraphMenu, + MODE_SetLanguageAllTextMenu + }; + + bool m_bShowMenu; + OUString m_aLangStatusCommandURL; + css::uno::Reference< css::frame::XDispatch > m_xLanguageDispatch; + OUString m_aMenuCommandURL_Lang; + css::uno::Reference< css::frame::XDispatch > m_xMenuDispatch_Lang; + OUString m_aMenuCommandURL_Font; + css::uno::Reference< css::frame::XDispatch > m_xMenuDispatch_Font; + OUString m_aMenuCommandURL_CharDlgForParagraph; + css::uno::Reference< css::frame::XDispatch > m_xMenuDispatch_CharDlgForParagraph; + OUString m_aCurLang; + SvtScriptType m_nScriptType; + OUString m_aKeyboardLang; + OUString m_aGuessedTextLang; + LanguageGuessingHelper m_aLangGuessHelper; + + void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu, const Mode rMode ); + }; +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_LANGSELECTIONMENUCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/macrosmenucontroller.hxx b/framework/inc/uielement/macrosmenucontroller.hxx new file mode 100644 index 000000000..c5fbd18f6 --- /dev/null +++ b/framework/inc/uielement/macrosmenucontroller.hxx @@ -0,0 +1,61 @@ +/* -*- 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_MACROSMENUCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_MACROSMENUCONTROLLER_HXX + +#include +#include +#include +#include + +namespace framework +{ + class MacrosMenuController final : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + css::uno::Reference< css::uno::XComponentContext > m_xContext; + + public: + MacrosMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~MacrosMenuController() override; + + // XServiceInfo + DECLARE_XSERVICEINFO_NOFACTORY + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + private: + void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); + void addScriptItems( PopupMenu* pPopupMenu, sal_uInt16 startItemId ); + }; +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_MACROSMENUCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx new file mode 100644 index 000000000..4fa42c8e8 --- /dev/null +++ b/framework/inc/uielement/menubarmanager.hxx @@ -0,0 +1,210 @@ +/* -*- 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_MENUBARMANAGER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMANAGER_HXX + +/** Attention: stl headers must(!) be included at first. Otherwise it can make trouble + with solaris headers ... +*/ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace framework +{ + +struct PopupControllerEntry +{ + css::uno::WeakReference< css::frame::XDispatchProvider > m_xDispatchProvider; +}; + +typedef std::unordered_map< OUString, PopupControllerEntry > PopupControllerCache; + +class MenuBarManager final : + protected cppu::BaseMutex, + public cppu::WeakComponentImplHelper< + css::frame::XStatusListener, + css::frame::XFrameActionListener, + css::ui::XUIConfigurationListener, + css::awt::XSystemDependentMenuPeer> +{ + MenuBarManager( + const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + const css::uno::Reference< css::util::XURLTransformer >& _xURLTransformer, + Menu* pAddonMenu, + bool popup); + + public: + MenuBarManager( + const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + const css::uno::Reference< css::util::XURLTransformer >& _xURLTransformer, + const css::uno::Reference< css::frame::XDispatchProvider >& rDispatchProvider, + const OUString& aModuleIdentifier, + Menu* pMenu, + bool bDelete, + bool bHasMenuBar = true ); + + virtual ~MenuBarManager() override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XFrameActionListener + virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& Action ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const css::ui::ConfigurationEvent& Event ) override; + virtual void SAL_CALL elementRemoved( const css::ui::ConfigurationEvent& Event ) override; + virtual void SAL_CALL elementReplaced( const css::ui::ConfigurationEvent& Event ) override; + + // XSystemDependentMenuPeer + virtual css::uno::Any SAL_CALL getMenuHandle( const css::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) override; + + DECL_LINK( Select, Menu *, bool ); + + Menu* GetMenuBar() const { return m_pVCLMenu; } + + // Configuration methods + static void FillMenuWithConfiguration( sal_uInt16& nId, Menu* pMenu, + const OUString& rModuleIdentifier, + const css::uno::Reference< css::container::XIndexAccess >& rItemContainer, + const css::uno::Reference< css::util::XURLTransformer >& rTransformer ); + static void FillMenu( sal_uInt16& nId, + Menu* pMenu, + const OUString& rModuleIdentifier, + const css::uno::Reference< css::container::XIndexAccess >& rItemContainer, + const css::uno::Reference< css::frame::XDispatchProvider >& rDispatchProvider ); + + void FillMenuManager( Menu* pMenu, + const css::uno::Reference< css::frame::XFrame >& rFrame, + const css::uno::Reference< css::frame::XDispatchProvider >& rDispatchProvider, + const OUString& rModuleIdentifier, + bool bDelete ); + void SetItemContainer( const css::uno::Reference< css::container::XIndexAccess >& rItemContainer ); + void GetPopupController( PopupControllerCache& rPopupController ); + + private: + DECL_LINK( Activate, Menu *, bool ); + DECL_LINK( Deactivate, Menu *, bool ); + DECL_LINK( AsyncSettingsHdl, Timer *, void ); + + void SAL_CALL disposing() override; + void RemoveListener(); + void RequestImages(); + void RetrieveImageManagers(); + static bool MustBeHidden( PopupMenu* pPopupMenu, const css::uno::Reference< css::util::XURLTransformer >& rTransformer ); + OUString RetrieveLabelFromCommand(const OUString& rCmdURL); + + void Destroy(); + + struct MenuItemHandler + { + MenuItemHandler( sal_uInt16 aItemId, + css::uno::Reference< css::frame::XStatusListener > const & xManager, + css::uno::Reference< css::frame::XDispatch > const & rDispatch ) : + nItemId( aItemId ), + bMadeInvisible ( false ), + xSubMenuManager( xManager ), + xMenuItemDispatch( rDispatch ) {} + + sal_uInt16 nItemId; + bool bMadeInvisible; + OUString aTargetFrame; + OUString aMenuItemURL; + OUString aParsedItemURL; + css::uno::Reference< css::frame::XStatusListener > xSubMenuManager; + css::uno::Reference< css::frame::XDispatch > xMenuItemDispatch; + css::uno::Reference< css::frame::XPopupMenuController > xPopupMenuController; + css::uno::Reference< css::awt::XPopupMenu > xPopupMenu; + vcl::KeyCode aKeyCode; + }; + + void RetrieveShortcuts( std::vector< std::unique_ptr >& aMenuShortCuts ); + static void UpdateSpecialWindowMenu( Menu* pMenu, const css::uno::Reference< css::uno::XComponentContext >& xContext ); + static void FillMenuImages( css::uno::Reference< css::frame::XFrame > const & xFrame, Menu* _pMenu, bool bShowMenuImages ); + static void impl_RetrieveShortcutsFromConfiguration( const css::uno::Reference< css::ui::XAcceleratorConfiguration >& rAccelCfg, + const css::uno::Sequence< OUString >& rCommands, + std::vector< std::unique_ptr >& aMenuShortCuts ); + static void MergeAddonMenus( Menu* pMenuBar, const MergeMenuInstructionContainer&, const OUString& aModuleIdentifier ); + + MenuItemHandler* GetMenuItemHandler( sal_uInt16 nItemId ); + bool CreatePopupMenuController( MenuItemHandler* pMenuItemHandler ); + void AddMenu(MenuBarManager* pSubMenuManager,const OUString& _sItemCommand,sal_uInt16 _nItemId); + sal_uInt16 FillItemCommand(OUString& _rItemCommand, Menu* _pMenu,sal_uInt16 _nIndex) const; + void Init(const css::uno::Reference< css::frame::XFrame >& rFrame,Menu* pAddonMenu,bool _bHandlePopUp); + void SetHdl(); + + bool m_bDeleteMenu; + bool m_bActive; + bool m_bIsBookmarkMenu; + bool m_bShowMenuImages; + bool m_bRetrieveImages; + bool m_bAcceleratorCfg; + bool m_bModuleIdentified; + bool m_bHasMenuBar; + OUString m_aMenuItemCommand; + OUString m_aModuleIdentifier; + VclPtr m_pVCLMenu; + css::uno::Reference< css::frame::XFrame > m_xFrame; + css::uno::Reference< css::frame::XUIControllerFactory > m_xPopupMenuControllerFactory; + ::std::vector< std::unique_ptr > m_aMenuItemHandlerVector; + css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchProvider; + css::uno::Reference< css::ui::XImageManager > m_xDocImageManager; + css::uno::Reference< css::ui::XImageManager > m_xModuleImageManager; + css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager; + css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; + css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + css::uno::Reference< css::container::XIndexAccess > m_xDeferedItemContainer; + OUString m_sIconTheme; + Timer m_aAsyncSettingsTimer; +}; + +} // namespace + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/menubarmerger.hxx b/framework/inc/uielement/menubarmerger.hxx new file mode 100644 index 000000000..139c40efc --- /dev/null +++ b/framework/inc/uielement/menubarmerger.hxx @@ -0,0 +1,110 @@ +/* -*- 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_MENUBARMERGER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMERGER_HXX + +#include + +#include +#include +#include + +namespace framework +{ + +struct AddonMenuItem; +typedef ::std::vector< AddonMenuItem > AddonMenuContainer; + +struct AddonMenuItem +{ + OUString aTitle; + OUString aURL; + OUString aContext; + AddonMenuContainer aSubMenu; +}; + +enum RPResultInfo +{ + RP_OK, + RP_POPUPMENU_NOT_FOUND, + RP_MENUITEM_NOT_FOUND, + RP_MENUITEM_INSTEAD_OF_POPUPMENU_FOUND +}; + +struct ReferencePathInfo +{ + VclPtr pPopupMenu; + sal_uInt16 nPos; + sal_Int32 nLevel; + RPResultInfo eResult; +}; + +namespace MenuBarMerger +{ + bool IsCorrectContext( const OUString& aContext, const OUString& aModuleIdentifier ); + + void RetrieveReferencePath( const OUString&, + std::vector< OUString >& aReferencePath ); + ReferencePathInfo FindReferencePath( const std::vector< OUString >& aReferencePath, Menu* pMenu ); + sal_uInt16 FindMenuItem( const OUString& rCmd, + Menu const * pMenu ); + void GetMenuEntry( const css::uno::Sequence< css::beans::PropertyValue >& rAddonMenuEntry, + AddonMenuItem& aAddonMenu ); + void GetSubMenu( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rSubMenuEntries, + AddonMenuContainer& rSubMenu ); + bool ProcessMergeOperation( Menu* pMenu, + sal_uInt16 nPos, + sal_uInt16& rItemId, + const OUString& rMergeCommand, + const OUString& rMergeCommandParameter, + const OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + bool ProcessFallbackOperation( const ReferencePathInfo& aRefPathInfo, + sal_uInt16& rItemId, + const OUString& rMergeCommand, + const OUString& rMergeFallback, + const ::std::vector< OUString >& rReferencePath, + const OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + bool MergeMenuItems( Menu* pMenu, + sal_uInt16 nPos, + sal_uInt16 nModIndex, + sal_uInt16& rItemId, + const OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + bool ReplaceMenuItem( Menu* pMenu, + sal_uInt16 nPos, + sal_uInt16& rItemId, + const OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + bool RemoveMenuItems( Menu* pMenu, + sal_uInt16 nPos, + const OUString& rMergeCommandParameter ); + bool CreateSubMenu( Menu* pSubMenu, + sal_uInt16& nItemId, + const OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonSubMenu ); +} + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMERGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/menubarwrapper.hxx b/framework/inc/uielement/menubarwrapper.hxx new file mode 100644 index 000000000..58ec21f83 --- /dev/null +++ b/framework/inc/uielement/menubarwrapper.hxx @@ -0,0 +1,85 @@ +/* -*- 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_MENUBARWRAPPER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARWRAPPER_HXX + +#include +#include +#include +#include + +#include +#include + +namespace framework +{ + +class MenuBarWrapper final : public UIConfigElementWrapperBase, + public css::container::XNameAccess + +{ + public: + MenuBarWrapper( + const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~MenuBarWrapper() override; + + // XInterface, XTypeProvider + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + MenuBarManager* GetMenuBarManager() const { return static_cast< MenuBarManager* >( m_xMenuBarManager.get() ); } + + // XComponent + virtual void SAL_CALL dispose() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XUIElement + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getRealInterface() override; + + // XUIElementSettings + virtual void SAL_CALL updateSettings( ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() 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; + + private: + virtual void impl_fillNewData() override; + void fillPopupControllerCache(); + + bool m_bRefreshPopupControllerCache : 1; + css::uno::Reference< css::lang::XComponent > m_xMenuBarManager; + PopupControllerCache m_aPopupControllerCache; + css::uno::Reference< css::uno::XComponentContext > m_xContext; +}; + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARWRAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/newmenucontroller.hxx b/framework/inc/uielement/newmenucontroller.hxx new file mode 100644 index 000000000..96060e07f --- /dev/null +++ b/framework/inc/uielement/newmenucontroller.hxx @@ -0,0 +1,92 @@ +/* -*- 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_NEWMENUCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_NEWMENUCONTROLLER_HXX + +#include + +#include +#include + +#include +#include +#include + +namespace framework +{ + class NewMenuController final : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + NewMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~NewMenuController() override; + + // XServiceInfo + DECLARE_XSERVICEINFO_NOFACTORY + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XMenuListener + virtual void SAL_CALL itemSelected( const css::awt::MenuEvent& rEvent ) override; + virtual void SAL_CALL itemActivated( const css::awt::MenuEvent& rEvent ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + private: + virtual void impl_setPopupMenu() override; + + void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); + void retrieveShortcutsFromConfiguration( const css::uno::Reference< css::ui::XAcceleratorConfiguration >& rAccelCfg, + const css::uno::Sequence< OUString >& rCommands, + std::vector< vcl::KeyCode >& aMenuShortCuts ); + void setAccelerators( PopupMenu* pPopupMenu ); + void determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const vcl::KeyCode& rKeyCode ); + void setMenuImages( PopupMenu* pPopupMenu, bool bSetImages ); + + private: + // members + bool m_bShowImages : 1, + m_bNewMenu : 1, + m_bModuleIdentified : 1, + m_bAcceleratorCfg : 1; + OUString m_aIconTheme; + OUString m_aTargetFrame; + OUString m_aModuleIdentifier; + OUString m_aEmptyDocURL; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager; + css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; + css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager; + }; +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_NEWMENUCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/progressbarwrapper.hxx b/framework/inc/uielement/progressbarwrapper.hxx new file mode 100644 index 000000000..78dad538f --- /dev/null +++ b/framework/inc/uielement/progressbarwrapper.hxx @@ -0,0 +1,85 @@ +/* -*- 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_PROGRESSBARWRAPPER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_PROGRESSBARWRAPPER_HXX + +#include + +#include + +#include + +namespace framework{ + +class ProgressBarWrapper final : public UIElementWrapperBase +{ + public: + + // constructor / destructor + + ProgressBarWrapper(); + virtual ~ProgressBarWrapper() override; + + // public interfaces + void setStatusBar( const css::uno::Reference< css::awt::XWindow >& rStatusBar, bool bOwnsInstance = false ); + css::uno::Reference< css::awt::XWindow > getStatusBar() const; + + // wrapped methods of css::task::XStatusIndicator + /// @throws css::uno::RuntimeException + void start( const OUString& Text, ::sal_Int32 Range ); + /// @throws css::uno::RuntimeException + void end(); + /// @throws css::uno::RuntimeException + void setText( const OUString& Text ); + /// @throws css::uno::RuntimeException + void setValue( ::sal_Int32 Value ); + /// @throws css::uno::RuntimeException + void reset(); + + // UNO interfaces + // XComponent + virtual void SAL_CALL dispose() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XUpdatable + virtual void SAL_CALL update() override; + + // XUIElement + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getRealInterface() override; + + // variables + // (should be private everyway!) + + private: + css::uno::Reference< css::awt::XWindow > m_xStatusBar; // Reference to our status bar XWindow + css::uno::WeakReference< css::uno::XInterface > m_xProgressBarIfacWrapper; + bool m_bOwnsInstance; // Indicator that we are owner of the XWindow + sal_Int32 m_nRange; + sal_Int32 m_nValue; + OUString m_aText; +}; // class ProgressBarWrapper + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_PROGRESSBARWRAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/rootitemcontainer.hxx b/framework/inc/uielement/rootitemcontainer.hxx new file mode 100644 index 000000000..a71282b99 --- /dev/null +++ b/framework/inc/uielement/rootitemcontainer.hxx @@ -0,0 +1,129 @@ +/* -*- 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_ROOTITEMCONTAINER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_ROOTITEMCONTAINER_HXX + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +namespace framework +{ +class ConstItemContainer; + +typedef ::cppu::WeakImplHelper< + css::container::XIndexContainer, + css::lang::XSingleComponentFactory, + css::lang::XUnoTunnel > RootItemContainer_BASE; + +class RootItemContainer final : private cppu::BaseMutex, + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , + public RootItemContainer_BASE +{ + friend class ConstItemContainer; + + public: + FWI_DLLPUBLIC RootItemContainer(); + FWI_DLLPUBLIC RootItemContainer( const css::uno::Reference< css::container::XIndexAccess >& rItemAccessContainer ); + virtual FWI_DLLPUBLIC ~RootItemContainer() override; + + // XInterface + virtual void SAL_CALL acquire() throw () override + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () override + { OWeakObject::release(); } + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& type) override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XUnoTunnel + static FWI_DLLPUBLIC const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() throw(); + sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) override; + + // XIndexContainer + virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; + + virtual void SAL_CALL removeByIndex( sal_Int32 Index ) override; + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) 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 + { + return cppu::UnoType>::get(); + } + + virtual sal_Bool SAL_CALL hasElements() override; + + // XSingleComponentFactory + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithContext( const css::uno::Reference< css::uno::XComponentContext >& Context ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const css::uno::Sequence< css::uno::Any >& Arguments, const css::uno::Reference< css::uno::XComponentContext >& Context ) override; + + private: + // OPropertySetHelper + virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue , + css::uno::Any& aOldValue , + sal_Int32 nHandle , + const css::uno::Any& aValue ) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const css::uno::Any& aValue ) override; + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue( css::uno::Any& aValue , + sal_Int32 nHandle ) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; + + static css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); + + RootItemContainer& operator=( const RootItemContainer& ) = delete; + RootItemContainer( const RootItemContainer& ) = delete; + + css::uno::Reference< css::container::XIndexAccess > deepCopyContainer( const css::uno::Reference< css::container::XIndexAccess >& rSubContainer ); + + mutable ShareableMutex m_aShareMutex; + std::vector< css::uno::Sequence< css::beans::PropertyValue > > m_aItemVector; + OUString m_aUIName; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_ROOTITEMCONTAINER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx new file mode 100644 index 000000000..8445110b8 --- /dev/null +++ b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx @@ -0,0 +1,83 @@ +/* -*- 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_SPINFIELDTOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX + +#include + +#include +#include +#include + +class ToolBox; + +namespace framework +{ + +class SpinfieldControl; + +class SpinfieldToolbarController final : public ComplexToolbarController + +{ + public: + SpinfieldToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + sal_Int32 nWidth, + const OUString& aCommand ); + virtual ~SpinfieldToolbarController() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // called from SpinfieldControl + void Up(); + void Down(); + void First(); + void Last(); + void Modify(); + void GetFocus(); + void LoseFocus(); + bool PreNotify( NotifyEvent const & rNEvt ); + + private: + virtual void executeControlCommand( const css::frame::ControlCommand& rControlCommand ) override; + virtual css::uno::Sequence< css::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const override; + + bool impl_getValue( const css::uno::Any& rAny, sal_Int32& nValue, double& fValue, bool& bFloat ); + OUString impl_formatOutputString( double fValue ); + + bool m_bFloat, + m_bMaxSet, + m_bMinSet; + double m_nMax; + double m_nMin; + double m_nValue; + double m_nStep; + VclPtr m_pSpinfieldControl; + OUString m_aOutFormat; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusbar.hxx b/framework/inc/uielement/statusbar.hxx new file mode 100644 index 000000000..fec07a45b --- /dev/null +++ b/framework/inc/uielement/statusbar.hxx @@ -0,0 +1,55 @@ +/* -*- 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_STATUSBAR_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBAR_HXX + +#include + +#include + +namespace framework +{ + +class FrameworkStatusBar : public StatusBar +{ + public: + + FrameworkStatusBar( vcl::Window* pParent, + WinBits nWinBits ); + + void SetStatusBarManager( StatusBarManager* pStatusBarManager ); + + virtual void StateChanged( StateChangedType nType ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual void UserDraw(const UserDrawEvent& rUDEvt) override; + virtual void Command( const CommandEvent &rEvt ) override; + virtual void MouseMove( const MouseEvent& rMEvt ) override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + + private: + StatusBarManager* m_pMgr; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusbaritem.hxx b/framework/inc/uielement/statusbaritem.hxx new file mode 100644 index 000000000..7dd3ed672 --- /dev/null +++ b/framework/inc/uielement/statusbaritem.hxx @@ -0,0 +1,81 @@ +/* -*- 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_STATUSBARITEM_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARITEM_HXX + +#include +#include +#include +#include + +class StatusBar; + +namespace framework +{ + +struct AddonStatusbarItemData; + +typedef cppu::WeakComponentImplHelper< css::ui::XStatusbarItem > StatusbarItem_Base; + +class StatusbarItem final : protected cppu::BaseMutex, + public StatusbarItem_Base +{ +public: + explicit StatusbarItem( + StatusBar *pStatusBar, + sal_uInt16 nId, + const OUString& aCommand ); + virtual ~StatusbarItem() override; + + void SAL_CALL disposing() override; + + // css::ui::XStatusbarItem Attributes + virtual OUString SAL_CALL getCommand() override; + virtual ::sal_uInt16 SAL_CALL getItemId() override; + virtual ::sal_uInt32 SAL_CALL getWidth() override; + virtual ::sal_uInt16 SAL_CALL getStyle() override; + virtual ::sal_Int32 SAL_CALL getOffset() override; + virtual css::awt::Rectangle SAL_CALL getItemRect() override; + virtual OUString SAL_CALL getText() override; + virtual void SAL_CALL setText( const OUString& rText ) override; + virtual OUString SAL_CALL getHelpText() override; + virtual void SAL_CALL setHelpText( const OUString& rHelpText ) override; + virtual OUString SAL_CALL getQuickHelpText() override; + virtual void SAL_CALL setQuickHelpText( const OUString& rQuickHelpText ) override; + virtual OUString SAL_CALL getAccessibleName() override; + virtual void SAL_CALL setAccessibleName( const OUString& rAccessibleName ) override; + virtual sal_Bool SAL_CALL getVisible() override; + virtual void SAL_CALL setVisible( sal_Bool bVisible ) override; + + // css::ui::XStatusbarItem Methods + virtual void SAL_CALL repaint( ) override; + +private: + VclPtr m_pStatusBar; + sal_uInt16 m_nId; + sal_uInt16 m_nStyle; + OUString m_aCommand; + +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx new file mode 100644 index 000000000..5fc341ae1 --- /dev/null +++ b/framework/inc/uielement/statusbarmanager.hxx @@ -0,0 +1,106 @@ +/* -*- 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_STATUSBARMANAGER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMANAGER_HXX + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace framework +{ + +class FrameworkStatusBar; +class StatusBarManager final: public ::cppu::WeakImplHelper< + css::frame::XFrameActionListener, + css::lang::XComponent, + css::ui::XUIConfigurationListener > + +{ + friend class FrameworkStatusBar; + + public: + StatusBarManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + StatusBar* pStatusBar ); + virtual ~StatusBarManager() override; + + StatusBar* GetStatusBar() const; + + // XFrameActionListener + virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& Action ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const css::ui::ConfigurationEvent& Event ) override; + virtual void SAL_CALL elementRemoved( const css::ui::ConfigurationEvent& Event ) override; + virtual void SAL_CALL elementReplaced( const css::ui::ConfigurationEvent& Event ) override; + + // XComponent + void SAL_CALL dispose() override; + void SAL_CALL addEventListener( const css::uno::Reference< XEventListener >& xListener ) override; + void SAL_CALL removeEventListener( const css::uno::Reference< XEventListener >& xListener ) override; + + void FillStatusBar( const css::uno::Reference< css::container::XIndexAccess >& rStatusBarData ); + + private: + void DataChanged( const DataChangedEvent& rDCEvt ); + void UserDraw( const UserDrawEvent& rUDEvt ); + void Command( const CommandEvent& rEvt ); + void MouseMove( const MouseEvent& rMEvt ); + void MouseButtonDown( const MouseEvent& rMEvt ); + void MouseButtonUp( const MouseEvent& rMEvt ); + DECL_LINK(Click, StatusBar*, void); + DECL_LINK(DoubleClick, StatusBar*, void); + + void RemoveControllers(); + void CreateControllers(); + void UpdateControllers(); + void MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL css::frame::XStatusbarController::*_pMethod )(const css::awt::MouseEvent&)); + + typedef std::map< sal_uInt16, css::uno::Reference< css::frame::XStatusbarController > > StatusBarControllerMap; + + bool m_bDisposed : 1, + m_bFrameActionRegistered : 1, + m_bUpdateControllers : 1; + VclPtr m_pStatusBar; + css::uno::Reference< css::frame::XFrame > m_xFrame; + StatusBarControllerMap m_aControllerMap; + osl::Mutex m_mutex; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::frame::XUIControllerFactory > m_xStatusbarControllerFactory; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusbarmerger.hxx b/framework/inc/uielement/statusbarmerger.hxx new file mode 100644 index 000000000..73aa7fd47 --- /dev/null +++ b/framework/inc/uielement/statusbarmerger.hxx @@ -0,0 +1,74 @@ +/* -*- 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_STATUSBARMERGER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMERGER_HXX + +#include +#include +#include +#include + +namespace framework +{ + +struct AddonStatusbarItemData +{ + OUString aLabel; +}; + +struct AddonStatusbarItem +{ + OUString aCommandURL; + OUString aLabel; + OUString aContext; + StatusBarItemBits nItemBits; + sal_Int16 nWidth; +}; + +typedef ::std::vector< AddonStatusbarItem > AddonStatusbarItemContainer; + +namespace StatusbarMerger +{ + bool IsCorrectContext( const OUString& aContext ); + + bool ConvertSeqSeqToVector( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rSequence, + AddonStatusbarItemContainer& rContainer ); + + sal_uInt16 FindReferencePos( StatusBar* pStatusbar, + const OUString& rReferencePoint ); + + bool ProcessMergeOperation( StatusBar* pStatusbar, + sal_uInt16 nPos, + sal_uInt16& rItemId, + const OUString& rMergeCommand, + const OUString& rMergeCommandParameter, + const AddonStatusbarItemContainer& rItems ); + + bool ProcessMergeFallback( StatusBar* pStatusbar, + sal_uInt16& rItemId, + const OUString& rMergeCommand, + const OUString& rMergeFallback, + const AddonStatusbarItemContainer& rItems ); +} + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusbarwrapper.hxx b/framework/inc/uielement/statusbarwrapper.hxx new file mode 100644 index 000000000..c8f0e53e1 --- /dev/null +++ b/framework/inc/uielement/statusbarwrapper.hxx @@ -0,0 +1,59 @@ +/* -*- 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_STATUSBARWRAPPER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARWRAPPER_HXX + +#include + +#include +#include + +namespace framework +{ + +class StatusBarWrapper final : public UIConfigElementWrapperBase +{ + public: + StatusBarWrapper( + const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~StatusBarWrapper() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XUIElement + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getRealInterface() override; + + // XUIElementSettings + virtual void SAL_CALL updateSettings() override; + + private: + css::uno::Reference< css::lang::XComponent > m_xStatusBarManager; + css::uno::Reference< css::uno::XComponentContext > m_xContext; +}; + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARWRAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusindicatorinterfacewrapper.hxx b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx new file mode 100644 index 000000000..c9913de0d --- /dev/null +++ b/framework/inc/uielement/statusindicatorinterfacewrapper.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 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX + +#include +#include + +#include +#include +#include + +namespace framework +{ + +class StatusIndicatorInterfaceWrapper final : public ::cppu::WeakImplHelper< css::task::XStatusIndicator> +{ + public: + StatusIndicatorInterfaceWrapper( const css::uno::Reference< css::lang::XComponent >& rStatusIndicatorImpl ); + virtual ~StatusIndicatorInterfaceWrapper() override; + + // XStatusIndicator + + virtual void SAL_CALL start ( const OUString& sText , + sal_Int32 nRange ) override; + virtual void SAL_CALL end ( ) override; + virtual void SAL_CALL reset ( ) override; + virtual void SAL_CALL setText ( const OUString& sText ) override; + virtual void SAL_CALL setValue( sal_Int32 nValue ) override; + + private: + css::uno::WeakReference< css::lang::XComponent > m_xStatusIndicatorImpl; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/styletoolbarcontroller.hxx b/framework/inc/uielement/styletoolbarcontroller.hxx new file mode 100644 index 000000000..e6d596905 --- /dev/null +++ b/framework/inc/uielement/styletoolbarcontroller.hxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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_FRAMEWORK_INC_UIELEMENT_STYLETOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STYLETOOLBARCONTROLLER_HXX + +#include +#include + +namespace framework { + +/** + * A dispatcher that serves as a proxy for style commands with arguments + * i.e. .uno:StyleApply?... in order to provide useful status updates to + * generic UI elements such as toolbars or menubar. It listens to special + * status commands, and computes a boolean status out of them. Then it + * forwards that boolean status to the listener, as if it was the status + * of the original command. + * + * Note that the implementation is minimal: Although the UI element appears + * to be the owner of the dispatcher, it's still responsible, as usual, to + * call removeStatusListener same amount of times as addStatusListener, + * otherwise the dispatcher might not be destructed. In addition this + * implementation might hold a hard reference on the owner, and it's the + * responsibility of the owner to destroy the dispatcher first, in order + * to break the cycle. + */ +class StyleDispatcher final : public cppu::WeakImplHelper< css::frame::XDispatch, css::frame::XStatusListener > +{ +public: + StyleDispatcher( const css::uno::Reference< css::frame::XFrame >& rFrame, + const css::uno::Reference< css::util::XURLTransformer >& rUrlTransformer, + const css::util::URL& rURL ); + + // XDispatch + void SAL_CALL dispatch( const css::util::URL& rURL, const css::uno::Sequence< css::beans::PropertyValue >& rArguments ) override; + void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& rListener, const css::util::URL& rURL ) override; + void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& rListener, const css::util::URL& rURL ) override; + + // XStatusListener + void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; + + // XEventListener + void SAL_CALL disposing( const css::lang::EventObject& rSource ) override; + +private: + OUString m_aStyleName, m_aCommand, m_aStatusCommand; + css::uno::Reference< css::util::XURLTransformer > m_xUrlTransformer; + css::uno::Reference< css::frame::XDispatchProvider > m_xFrame; + css::uno::Reference< css::frame::XDispatch > m_xStatusDispatch; + css::uno::Reference< css::frame::XStatusListener > m_xOwner; +}; + +class StyleToolbarController final : public svt::ToolboxController +{ +public: + StyleToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + const OUString& rCommand ); + + // XUpdatable + void SAL_CALL update() override; + + // XStatusListener + void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; + + // XComponent + void SAL_CALL dispose() override; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx new file mode 100644 index 000000000..9e667da83 --- /dev/null +++ b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx @@ -0,0 +1,79 @@ +/* -*- 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_TOGGLEBUTTONTOOLBARCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX + +#include + +#include +#include + +class Menu; +class ToolBox; + +namespace framework +{ + +class ToggleButtonToolbarController final : public ComplexToolbarController + +{ + public: + class DropdownMenuItem + { + public: + OUString mLabel; + OUString mTipHelpText; + }; + + enum class Style + { + DropDownButton, + ToggleDropDownButton + }; + + ToggleButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + Style eStyle, + const OUString& aCommand ); + virtual ~ToggleButtonToolbarController() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // XToolbarController + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override; + + private: + virtual void executeControlCommand( const css::frame::ControlCommand& rControlCommand ) override; + virtual css::uno::Sequence< css::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const override; + + DECL_LINK( MenuSelectHdl, Menu *, bool); + + OUString m_aCurrentSelection; + std::vector< DropdownMenuItem > m_aDropdownMenuList; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx new file mode 100644 index 000000000..8f3eb4c2b --- /dev/null +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -0,0 +1,184 @@ +/* -*- 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_TOOLBARMANAGER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMANAGER_HXX + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +class PopupMenu; +class ToolBox; +class Menu; + +namespace framework +{ + +typedef ::cppu::WeakImplHelper< + css::frame::XFrameActionListener, + css::lang::XComponent, + css::ui::XUIConfigurationListener + > ToolbarManager_Base; + +class ToolBarManager : public ToolbarManager_Base +{ + public: + ToolBarManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::frame::XFrame >& rFrame, + const OUString& rResourceName, + ToolBox* pToolBar ); + virtual ~ToolBarManager() override; + + ToolBox* GetToolBar() const; + + // XFrameActionListener + virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& Action ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const css::ui::ConfigurationEvent& Event ) override; + virtual void SAL_CALL elementRemoved( const css::ui::ConfigurationEvent& Event ) override; + virtual void SAL_CALL elementReplaced( const css::ui::ConfigurationEvent& Event ) override; + + // XComponent + void SAL_CALL dispose() override; + void SAL_CALL addEventListener( const css::uno::Reference< XEventListener >& xListener ) override; + void SAL_CALL removeEventListener( const css::uno::Reference< XEventListener >& xListener ) override; + + void CheckAndUpdateImages(); + virtual void RefreshImages(); + void FillToolbar( const css::uno::Reference< css::container::XIndexAccess >& rToolBarData ); + void FillOverflowToolbar( ToolBox const * pParent ); + void notifyRegisteredControllers( const OUString& aUIElementName, const OUString& aCommand ); + void Destroy(); + + enum ExecuteCommand + { + EXEC_CMD_CLOSETOOLBAR, + EXEC_CMD_UNDOCKTOOLBAR, + EXEC_CMD_DOCKTOOLBAR, + EXEC_CMD_DOCKALLTOOLBARS + }; + + struct ExecuteInfo + { + OUString aToolbarResName; + ExecuteCommand nCmd; + css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; + css::uno::Reference< css::awt::XWindow > xWindow; + }; + + protected: + DECL_LINK(Click, ToolBox *, void); + DECL_LINK(DropdownClick, ToolBox *, void); + DECL_LINK(DoubleClick, ToolBox *, void); + DECL_LINK(Select, ToolBox *, void); + DECL_LINK( StateChanged, StateChangedType const *, void ); + DECL_LINK( DataChanged, DataChangedEvent const *, void ); + DECL_LINK( MiscOptionsChanged, LinkParamNone*, void ); + + DECL_LINK( MenuButton, ToolBox *, void ); + DECL_LINK( MenuPreExecute, ToolBox *, void ); + DECL_LINK( MenuSelect, Menu *, bool ); + DECL_LINK(AsyncUpdateControllersHdl, Timer *, void); + 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(); + void CreateControllers(); + void UpdateControllers(); + //for update controller via Support Visible + void UpdateController( const css::uno::Reference< css::frame::XToolbarController >& xController); + //end + void AddFrameActionListener(); + void RequestImages(); + ToolBoxItemBits ConvertStyleToToolboxItemBits( sal_Int32 nStyle ); + css::uno::Reference< css::frame::XModel > GetModelFromFrame() const; + bool IsPluginMode() const; + void HandleClick(void ( SAL_CALL css::frame::XToolbarController::*_pClick )( )); + 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 SubToolBarToSubToolBarControllerMap; + + bool m_bDisposed : 1, + m_bAddedToTaskPaneList : 1, + m_bFrameActionRegistered : 1, + m_bUpdateControllers : 1; + + sal_Int16 m_eSymbolSize; + + VclPtr m_pToolBar; + + OUString m_aModuleIdentifier; + OUString m_aResourceName; + + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + css::uno::Reference< css::frame::XFrame > m_xFrame; + ToolBarControllerMap m_aControllerMap; + osl::Mutex m_mutex; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::frame::XUIControllerFactory > m_xToolbarControllerFactory; + css::uno::Reference< css::ui::XImageManager > m_xModuleImageManager; + css::uno::Reference< css::ui::XImageManager > m_xDocImageManager; + + CommandToInfoMap m_aCommandMap; + SubToolBarToSubToolBarControllerMap m_aSubToolBarControllerMap; + Timer m_aAsyncUpdateControllersTimer; + OUString m_sIconTheme; + + rtl::Reference< ToolBarManager > m_aOverflowManager; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx new file mode 100644 index 000000000..95ca6cc01 --- /dev/null +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -0,0 +1,140 @@ +/* -*- 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_TOOLBARMERGER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMERGER_HXX + +#include + +#include +#include + +#include +#include +#include + +namespace framework +{ + +struct AddonsParams +{ + OUString aImageId; + OUString aControlType; + sal_uInt16 nWidth; +}; + +struct AddonToolbarItem +{ + OUString aCommandURL; + OUString aLabel; + OUString aImageIdentifier; + OUString aTarget; + OUString aContext; + OUString aControlType; + sal_uInt16 nWidth; +}; + +typedef ::std::vector< AddonToolbarItem > AddonToolbarItemContainer; + +struct ReferenceToolbarPathInfo +{ + ToolBox::ImplToolItems::size_type nPos; + bool bResult; +}; + +class ToolBarMerger +{ + public: + static bool IsCorrectContext( const OUString& aContext, const OUString& aModuleIdentifier ); + + static void ConvertSeqSeqToVector( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rSequence, + AddonToolbarItemContainer& rContainer ); + + static void ConvertSequenceToValues( const css::uno::Sequence< css::beans::PropertyValue >& rSequence, + OUString& rCommandURL, + OUString& rLabel, + OUString& rImageIdentifier, + OUString& rTarget, + OUString& rContext, + OUString& rControlType, + sal_uInt16& rWidth ); + + static ReferenceToolbarPathInfo FindReferencePoint( const ToolBox* pToolbar, + const OUString& rReferencePoint ); + + static bool ProcessMergeOperation( ToolBox* pToolbar, + ToolBox::ImplToolItems::size_type nPos, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const OUString& rModuleIdentifier, + const OUString& rMergeCommand, + const OUString& rMergeCommandParameter, + const AddonToolbarItemContainer& rItems ); + + static bool ProcessMergeFallback( ToolBox* pToolbar, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const OUString& rModuleIdentifier, + const OUString& rMergeCommand, + const OUString& rMergeFallback, + const AddonToolbarItemContainer& rItems ); + + static void MergeItems( ToolBox* pToolbar, + ToolBox::ImplToolItems::size_type nPos, + sal_uInt16 nModIndex, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const OUString& rModuleIdentifier, + const AddonToolbarItemContainer& rAddonToolbarItems ); + + static void ReplaceItem( ToolBox* pToolbar, + ToolBox::ImplToolItems::size_type nPos, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const OUString& rModuleIdentifier, + const AddonToolbarItemContainer& rAddonToolbarItems ); + + static void RemoveItems( ToolBox* pToolbar, + ToolBox::ImplToolItems::size_type nPos, + const OUString& rMergeCommandParameter ); + + static ::cppu::OWeakObject* CreateController( + const css::uno::Reference< css::uno::XComponentContext > & rxContext, + const css::uno::Reference< css::frame::XFrame > & xFrame, + ToolBox* pToolbar, + const OUString& rCommandURL, + sal_uInt16 nId, + sal_uInt16 nWidth, + const OUString& rControlType ); + + static void CreateToolbarItem( ToolBox* pToolbox, + ToolBox::ImplToolItems::size_type nPos, + sal_uInt16 nItemId, + const AddonToolbarItem& rAddonToolbarItem ); + + private: + ToolBarMerger( const ToolBarMerger& ) = delete; + ToolBarMerger& operator=( const ToolBarMerger& ) = delete; +}; + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMERGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/toolbarmodemenucontroller.hxx b/framework/inc/uielement/toolbarmodemenucontroller.hxx new file mode 100644 index 000000000..28ec1de1c --- /dev/null +++ b/framework/inc/uielement/toolbarmodemenucontroller.hxx @@ -0,0 +1,78 @@ +/* -*- 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_TOOLBARMODEMENUCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMODEMENUCONTROLLER_HXX + +#include + +#include +#include + +#include + +namespace framework +{ + class ToolbarModeMenuController final : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + ToolbarModeMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~ToolbarModeMenuController() override; + + // XServiceInfo + DECLARE_XSERVICEINFO_NOFACTORY + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + + // XPopupMenuController + virtual void SAL_CALL setPopupMenu( const css::uno::Reference< css::awt::XPopupMenu >& PopupMenu ) override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XMenuListener + virtual void SAL_CALL itemSelected( const css::awt::MenuEvent& rEvent ) override; + virtual void SAL_CALL itemActivated( const css::awt::MenuEvent& rEvent ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + struct ExecuteInfo + { + css::uno::Reference< css::frame::XDispatch > xDispatch; + css::util::URL aTargetURL; + css::uno::Sequence< css::beans::PropertyValue > aArgs; + }; + + DECL_STATIC_LINK( ToolbarModeMenuController, ExecuteHdl_Impl, void*, void ); + + private: + void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); + + css::uno::Reference< css::uno::XComponentContext > m_xContext; + }; +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMODEMENUCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/toolbarsmenucontroller.hxx b/framework/inc/uielement/toolbarsmenucontroller.hxx new file mode 100644 index 000000000..3d128f52e --- /dev/null +++ b/framework/inc/uielement/toolbarsmenucontroller.hxx @@ -0,0 +1,97 @@ +/* -*- 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_TOOLBARSMENUCONTROLLER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +namespace framework +{ + class ToolbarsMenuController final : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + ToolbarsMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~ToolbarsMenuController() override; + + // XServiceInfo + DECLARE_XSERVICEINFO_NOFACTORY + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + + // XPopupMenuController + virtual void SAL_CALL setPopupMenu( const css::uno::Reference< css::awt::XPopupMenu >& PopupMenu ) override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XMenuListener + virtual void SAL_CALL itemSelected( const css::awt::MenuEvent& rEvent ) override; + virtual void SAL_CALL itemActivated( const css::awt::MenuEvent& rEvent ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + struct ExecuteInfo + { + css::uno::Reference< css::frame::XDispatch > xDispatch; + css::util::URL aTargetURL; + css::uno::Sequence< css::beans::PropertyValue > aArgs; + }; + + DECL_STATIC_LINK( ToolbarsMenuController, ExecuteHdl_Impl, void*, void ); + + private: + void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); + css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > getLayoutManagerToolbars( const css::uno::Reference< css::frame::XLayoutManager >& rLayoutManager ); + css::uno::Reference< css::frame::XDispatch > getDispatchFromCommandURL( const OUString& rCommandURL ); + void addCommand( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu, const OUString& rCommandURL, const OUString& aLabel ); + + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::container::XNameAccess > m_xPersistentWindowState; + css::uno::Reference< css::ui::XUIConfigurationManager > m_xModuleCfgMgr; + css::uno::Reference< css::ui::XUIConfigurationManager > m_xDocCfgMgr; + bool m_bResetActive; + std::vector< OUString > m_aCommandVector; + IntlWrapper m_aIntlWrapper; + }; +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/toolbarwrapper.hxx b/framework/inc/uielement/toolbarwrapper.hxx new file mode 100644 index 000000000..60d5759f6 --- /dev/null +++ b/framework/inc/uielement/toolbarwrapper.hxx @@ -0,0 +1,79 @@ +/* -*- 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_TOOLBARWRAPPER_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARWRAPPER_HXX + +#include + +#include +#include +#include + +namespace framework +{ + +class ToolBarManager; +class ToolBarWrapper final : public css::ui::XUIFunctionListener, + public UIConfigElementWrapperBase +{ + public: + ToolBarWrapper( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~ToolBarWrapper() override; + + // XInterface + virtual void SAL_CALL acquire() throw() override; + virtual void SAL_CALL release() throw() override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XUIElement + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getRealInterface() override; + + // XUpdatable + virtual void SAL_CALL update() override; + + // XUIElementSettings + virtual void SAL_CALL updateSettings() override; + + // XUIFunctionListener + virtual void SAL_CALL functionExecute( const OUString& aUIElementName, const OUString& aCommand ) override; + + // XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) override; + + private: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& aValue ) override; + virtual void impl_fillNewData() override; + + css::uno::Reference< css::lang::XComponent > m_xToolBarManager; + css::uno::Reference< css::uno::XComponentContext > m_xContext; +}; + +} + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARWRAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/uicommanddescription.hxx b/framework/inc/uielement/uicommanddescription.hxx new file mode 100644 index 000000000..6886224ce --- /dev/null +++ b/framework/inc/uielement/uicommanddescription.hxx @@ -0,0 +1,94 @@ +/* -*- 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 +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace framework +{ +typedef ::cppu::WeakComponentImplHelper< css::lang::XServiceInfo, + css::container::XNameAccess > UICommandDescription_BASE; + +class UICommandDescription : private cppu::BaseMutex, + public UICommandDescription_BASE +{ + public: + UICommandDescription( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UICommandDescription() override; + + virtual OUString SAL_CALL getImplementationName() override + { + return "com.sun.star.comp.framework.UICommandDescription"; + } + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override + { + return cppu::supportsService(this, ServiceName); + } + + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override + { + css::uno::Sequence< OUString > aSeq { "com.sun.star.frame.UICommandDescription" }; + return aSeq; + } + +private: + // 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; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + +public: + typedef std::unordered_map< OUString, + OUString > ModuleToCommandFileMap; + + typedef std::unordered_map< OUString, + css::uno::Reference< css::container::XNameAccess > > UICommandsHashMap; + + protected: + UICommandDescription( const css::uno::Reference< css::uno::XComponentContext>& rxContext, bool ); + void impl_fillElements(const char* _pName); + + OUString m_aPrivateResourceURL; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + ModuleToCommandFileMap m_aModuleToCommandFileMap; + UICommandsHashMap m_aUICommandsHashMap; + css::uno::Reference< css::container::XNameAccess > m_xGenericUICommands; + css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager; +}; + +} // namespace framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/uielement.hxx b/framework/inc/uielement/uielement.hxx new file mode 100644 index 000000000..9e63b1c0f --- /dev/null +++ b/framework/inc/uielement/uielement.hxx @@ -0,0 +1,108 @@ +/* -*- 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_UIELEMENT_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_UIELEMENT_HXX + +#include +#include +#include +#include + +#include +#include + +namespace framework +{ + +struct DockedData +{ + DockedData() : m_aPos( SAL_MAX_INT32, SAL_MAX_INT32 ), + m_nDockedArea( css::ui::DockingArea_DOCKINGAREA_TOP ), + m_bLocked( false ) {} + + css::awt::Point m_aPos; + css::ui::DockingArea m_nDockedArea; + bool m_bLocked; +}; + +struct FloatingData +{ + FloatingData() : m_aPos( SAL_MAX_INT32, SAL_MAX_INT32 ), + m_nLines( 1 ), + m_bIsHorizontal( true ) {} + + css::awt::Point m_aPos; + css::awt::Size m_aSize; + ToolBox::ImplToolItems::size_type m_nLines; + bool m_bIsHorizontal; +}; + +struct UIElement +{ + UIElement() : m_bFloating( false ), + m_bVisible( true ), + m_bUserActive( false ), + m_bMasterHide( false ), + m_bContextSensitive( false ), + m_bNoClose( false ), + m_bStateRead( false ), + m_nStyle( ButtonType::SYMBOLONLY ) + {} + + UIElement( const OUString& rName, + const OUString& rType, + const css::uno::Reference< css::ui::XUIElement >& rUIElement + ) : m_aType( rType ), + m_aName( rName ), + m_xUIElement( rUIElement ), + m_bFloating( false ), + m_bVisible( true ), + m_bUserActive( false ), + m_bMasterHide( false ), + m_bContextSensitive( false ), + m_bNoClose( false ), + m_bStateRead( false ), + m_nStyle( ButtonType::SYMBOLONLY ) {} + + bool operator< ( const UIElement& aUIElement ) const; + + OUString m_aType; + OUString m_aName; + OUString m_aUIName; + css::uno::Reference< css::ui::XUIElement > m_xUIElement; + bool m_bFloating, + m_bVisible, + m_bUserActive, + m_bMasterHide, + m_bContextSensitive; + bool m_bNoClose, + m_bStateRead; + ButtonType m_nStyle; + DockedData m_aDockedData; + FloatingData m_aFloatingData; +}; + +typedef std::vector< UIElement > UIElementVector; + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_UIELEMENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/uielementtypenames.hxx b/framework/inc/uielement/uielementtypenames.hxx new file mode 100644 index 000000000..cd5617a8a --- /dev/null +++ b/framework/inc/uielement/uielementtypenames.hxx @@ -0,0 +1,33 @@ +/* -*- 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_UIELEMENTTYPENAMES_HXX +#define INCLUDED_FRAMEWORK_INC_UIELEMENT_UIELEMENTTYPENAMES_HXX + +#define UIELEMENTTYPE_MENUBAR_NAME "menubar" +#define UIELEMENTTYPE_POPUPMENU_NAME "popupmenu" +#define UIELEMENTTYPE_TOOLBAR_NAME "toolbar" +#define UIELEMENTTYPE_STATUSBAR_NAME "statusbar" +#define UIELEMENTTYPE_FLOATINGWINDOW_NAME "floater" +#define UIELEMENTTYPE_PROGRESSBAR_NAME "progressbar" +#define UIELEMENTTYPE_TOOLPANEL_NAME "toolpanel" + +#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_UIELEMENTTYPENAMES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3