summaryrefslogtreecommitdiffstats
path: root/framework/inc/uielement
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--framework/inc/uielement/FixedImageToolbarController.hxx55
-rw-r--r--framework/inc/uielement/FixedTextToolbarController.hxx52
-rw-r--r--framework/inc/uielement/addonstoolbarwrapper.hxx57
-rw-r--r--framework/inc/uielement/buttontoolbarcontroller.hxx94
-rw-r--r--framework/inc/uielement/comboboxtoolbarcontroller.hxx62
-rw-r--r--framework/inc/uielement/commandinfo.hxx45
-rw-r--r--framework/inc/uielement/complextoolbarcontroller.hxx97
-rw-r--r--framework/inc/uielement/constitemcontainer.hxx97
-rw-r--r--framework/inc/uielement/dropdownboxtoolbarcontroller.hxx63
-rw-r--r--framework/inc/uielement/edittoolbarcontroller.hxx63
-rw-r--r--framework/inc/uielement/fontmenucontroller.hxx63
-rw-r--r--framework/inc/uielement/fontsizemenucontroller.hxx66
-rw-r--r--framework/inc/uielement/footermenucontroller.hxx39
-rw-r--r--framework/inc/uielement/genericstatusbarcontroller.hxx57
-rw-r--r--framework/inc/uielement/headermenucontroller.hxx58
-rw-r--r--framework/inc/uielement/imagebuttontoolbarcontroller.hxx54
-rw-r--r--framework/inc/uielement/itemcontainer.hxx80
-rw-r--r--framework/inc/uielement/langselectionmenucontroller.hxx84
-rw-r--r--framework/inc/uielement/macrosmenucontroller.hxx53
-rw-r--r--framework/inc/uielement/menubarmanager.hxx194
-rw-r--r--framework/inc/uielement/menubarmerger.hxx110
-rw-r--r--framework/inc/uielement/menubarwrapper.hxx81
-rw-r--r--framework/inc/uielement/newmenucontroller.hxx84
-rw-r--r--framework/inc/uielement/progressbarwrapper.hxx82
-rw-r--r--framework/inc/uielement/rootitemcontainer.hxx125
-rw-r--r--framework/inc/uielement/spinfieldtoolbarcontroller.hxx73
-rw-r--r--framework/inc/uielement/statusbar.hxx52
-rw-r--r--framework/inc/uielement/statusbaritem.hxx76
-rw-r--r--framework/inc/uielement/statusbarmanager.hxx104
-rw-r--r--framework/inc/uielement/statusbarmerger.hxx75
-rw-r--r--framework/inc/uielement/statusbarwrapper.hxx56
-rw-r--r--framework/inc/uielement/statusindicatorinterfacewrapper.hxx53
-rw-r--r--framework/inc/uielement/styletoolbarcontroller.hxx78
-rw-r--r--framework/inc/uielement/togglebuttontoolbarcontroller.hxx76
-rw-r--r--framework/inc/uielement/toolbarmanager.hxx249
-rw-r--r--framework/inc/uielement/toolbarmerger.hxx138
-rw-r--r--framework/inc/uielement/toolbarmodemenucontroller.hxx59
-rw-r--r--framework/inc/uielement/toolbarsmenucontroller.hxx89
-rw-r--r--framework/inc/uielement/toolbarwrapper.hxx89
-rw-r--r--framework/inc/uielement/uicommanddescription.hxx95
-rw-r--r--framework/inc/uielement/uielement.hxx106
-rw-r--r--framework/inc/uielement/uielementtypenames.hxx30
42 files changed, 3413 insertions, 0 deletions
diff --git a/framework/inc/uielement/FixedImageToolbarController.hxx b/framework/inc/uielement/FixedImageToolbarController.hxx
new file mode 100644
index 000000000..ffe40713b
--- /dev/null
+++ b/framework/inc/uielement/FixedImageToolbarController.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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/ControlCommand.hpp>
+
+#include <uielement/complextoolbarcontroller.hxx>
+#include <vcl/vclptr.hxx>
+
+class ToolBox;
+
+namespace framework
+{
+class FixedImageControl;
+
+class FixedImageToolbarController final : public ComplexToolbarController
+{
+public:
+ FixedImageToolbarController(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ ToolBox* pToolBar, ToolBoxItemId 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<FixedImageControl> m_pFixedImageControl;
+ sal_Int16 m_eSymbolSize;
+};
+} // namespace framework
+
+/* 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..bcf1d093f
--- /dev/null
+++ b/framework/inc/uielement/FixedTextToolbarController.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/ControlCommand.hpp>
+
+#include <uielement/complextoolbarcontroller.hxx>
+
+class ToolBox;
+
+namespace framework
+{
+class FixedTextControl;
+
+class FixedTextToolbarController final : public ComplexToolbarController
+{
+public:
+ FixedTextToolbarController(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ ToolBox* pToolBar, ToolBoxItemId 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<css::beans::PropertyValue>
+ getExecuteArgs(sal_Int16 KeyModifier) const override;
+
+ VclPtr<FixedTextControl> m_pFixedTextControl;
+};
+}
+
+/* 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..68cfc0ff3
--- /dev/null
+++ b/framework/inc/uielement/addonstoolbarwrapper.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <helper/uielementwrapperbase.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace framework
+{
+
+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;
+};
+
+}
+
+/* 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..759775ef8
--- /dev/null
+++ b/framework/inc/uielement/buttontoolbarcontroller.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 <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/frame/XToolbarController.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/weak.hxx>
+#include <vcl/vclptr.hxx>
+
+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( css::uno::Reference< css::uno::XComponentContext > xContext,
+ ToolBox* pToolBar,
+ OUString aCommand );
+ virtual ~ButtonToolbarController() override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept 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<ToolBox> m_pToolbar;
+};
+
+}
+
+/* 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..126aab650
--- /dev/null
+++ b/framework/inc/uielement/comboboxtoolbarcontroller.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/ControlCommand.hpp>
+
+#include <uielement/complextoolbarcontroller.hxx>
+
+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,
+ ToolBoxItemId 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<ComboBoxControl> m_pComboBox;
+};
+
+}
+
+/* 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..a93c693e6
--- /dev/null
+++ b/framework/inc/uielement/commandinfo.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+#include <vcl/toolbox.hxx>
+
+#include <unordered_map>
+#include <vector>
+
+namespace framework
+{
+
+struct CommandInfo
+{
+ CommandInfo() : nId( 0 ),
+ nImageInfo( 0 ) {}
+
+ ::std::vector< ToolBoxItemId > aIds;
+ ToolBoxItemId nId;
+ sal_Int16 nImageInfo;
+};
+
+typedef std::unordered_map<OUString, CommandInfo> CommandToInfoMap;
+
+} // namespace framework
+
+/* 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..0aa10471b
--- /dev/null
+++ b/framework/inc/uielement/complextoolbarcontroller.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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/ControlCommand.hpp>
+#include <com/sun/star/frame/XControlNotificationListener.hpp>
+
+#include <svtools/toolboxcontroller.hxx>
+#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
+
+class ToolBox;
+
+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,
+ ToolBoxItemId 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:
+ 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<ToolBox> m_xToolbar;
+ ToolBoxItemId m_nID;
+ bool m_bMadeInvisible;
+ mutable css::util::URL m_aURL;
+ css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer;
+};
+
+}
+
+/* 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..e25edc57f
--- /dev/null
+++ b/framework/inc/uielement/constitemcontainer.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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <rtl/ustring.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/propshlp.hxx>
+
+#include <vector>
+
+namespace framework
+{
+
+class RootItemContainer;
+class ItemContainer;
+class 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() noexcept;
+ 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<css::uno::Sequence< css::beans::PropertyValue >>::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;
+};
+
+}
+
+/* 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..cb0157862
--- /dev/null
+++ b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/ControlCommand.hpp>
+
+#include <uielement/complextoolbarcontroller.hxx>
+#include <vcl/vclptr.hxx>
+
+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,
+ ToolBoxItemId 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<ListBoxControl> m_pListBoxControl;
+};
+
+}
+
+/* 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..c45aa3893
--- /dev/null
+++ b/framework/inc/uielement/edittoolbarcontroller.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/ControlCommand.hpp>
+
+#include <uielement/complextoolbarcontroller.hxx>
+
+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,
+ ToolBoxItemId 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<EditControl> m_pEditControl;
+};
+
+}
+
+/* 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..b98e8c7b1
--- /dev/null
+++ b/framework/inc/uielement/fontmenucontroller.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/XDispatch.hpp>
+
+#include <svtools/popupmenucontrollerbase.hxx>
+#include <rtl/ustring.hxx>
+
+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;
+
+ /* interface 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;
+
+ // 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;
+ };
+}
+
+/* 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..d04bc637a
--- /dev/null
+++ b/framework/inc/uielement/fontsizemenucontroller.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/status/FontHeight.hpp>
+
+#include <svtools/popupmenucontrollerbase.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/long.hxx>
+
+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;
+
+ /* interface 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;
+
+ // 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( tools::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::vector<tools::Long> m_aHeightArray;
+ css::frame::status::FontHeight m_aFontHeight;
+ css::uno::Reference< css::frame::XDispatch > m_xCurrentFontDispatch;
+ };
+}
+
+/* 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..304ffeec3
--- /dev/null
+++ b/framework/inc/uielement/footermenucontroller.hxx
@@ -0,0 +1,39 @@
+/* -*- 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 <uielement/headermenucontroller.hxx>
+
+namespace framework
+{
+ class FooterMenuController final : public HeaderMenuController
+ {
+ public:
+ FooterMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ virtual ~FooterMenuController() override;
+
+ /* interface 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;
+ };
+}
+
+/* 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..e0eae738f
--- /dev/null
+++ b/framework/inc/uielement/genericstatusbarcontroller.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <svtools/statusbarcontroller.hxx>
+
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+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;
+};
+
+}
+
+/* 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..cdd48fea4
--- /dev/null
+++ b/framework/inc/uielement/headermenucontroller.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <svtools/popupmenucontrollerbase.hxx>
+
+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;
+
+ /* interface 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;
+
+ // 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;
+ };
+}
+
+/* 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..0e8ecbae6
--- /dev/null
+++ b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/ControlCommand.hpp>
+
+#include <uielement/complextoolbarcontroller.hxx>
+#include <vcl/image.hxx>
+
+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,
+ ToolBoxItemId 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 );
+};
+
+}
+
+/* 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..5d5bc9c85
--- /dev/null
+++ b/framework/inc/uielement/itemcontainer.hxx
@@ -0,0 +1,80 @@
+/* -*- 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 <helper/shareablemutex.hxx>
+
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <cppuhelper/implbase.hxx>
+
+#include <vector>
+
+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() noexcept;
+
+ // 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<css::uno::Sequence< css::beans::PropertyValue >>::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;
+};
+
+}
+
+/* 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..c27f42b56
--- /dev/null
+++ b/framework/inc/uielement/langselectionmenucontroller.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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/XDispatch.hpp>
+
+#include <svtools/popupmenucontrollerbase.hxx>
+#include <rtl/ustring.hxx>
+
+#include <helper/mischelper.hxx>
+
+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;
+
+ /* interface 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;
+
+ // 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 );
+ };
+}
+
+/* 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..7419f02a7
--- /dev/null
+++ b/framework/inc/uielement/macrosmenucontroller.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/popupmenucontrollerbase.hxx>
+
+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;
+
+ /* interface 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;
+
+ // 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::awt::XPopupMenu>& rPopupMenu);
+ void addScriptItems(const css::uno::Reference<css::awt::XPopupMenu>& rPopupMenu, sal_uInt16 startItemId);
+ };
+}
+
+/* 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..61bec0443
--- /dev/null
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -0,0 +1,194 @@
+/* -*- 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 <sal/config.h>
+
+#include <unordered_map>
+#include <utility>
+#include <vector>
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/FeatureStateEvent.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
+#include <com/sun/star/awt/XSystemDependentMenuPeer.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
+#include <com/sun/star/ui/XUIConfigurationListener.hpp>
+#include <com/sun/star/ui/XImageManager.hpp>
+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+
+#include <rtl/ustring.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/timer.hxx>
+#include <comphelper/compbase.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <framework/addonsoptions.hxx>
+
+namespace framework
+{
+
+struct PopupControllerEntry
+{
+ css::uno::WeakReference< css::frame::XDispatchProvider > m_xDispatchProvider;
+};
+
+typedef std::unordered_map< OUString, PopupControllerEntry > PopupControllerCache;
+
+class MenuBarManager final :
+ public comphelper::WeakComponentImplHelper<
+ css::frame::XStatusListener,
+ css::frame::XFrameActionListener,
+ css::ui::XUIConfigurationListener,
+ css::awt::XSystemDependentMenuPeer>
+{
+ 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 disposing(std::unique_lock<std::mutex>&) 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);
+
+ struct MenuItemHandler
+ {
+ MenuItemHandler( sal_uInt16 aItemId,
+ css::uno::Reference< css::frame::XStatusListener > xManager,
+ css::uno::Reference< css::frame::XDispatch > xDispatch ) :
+ nItemId( aItemId ),
+ bMadeInvisible ( false ),
+ xSubMenuManager(std::move( xManager )),
+ xMenuItemDispatch(std::move( xDispatch )) {}
+
+ 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<MenuItemHandler> >& aMenuShortCuts );
+ 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<MenuItemHandler> >& aMenuShortCuts );
+ static void MergeAddonMenus( Menu* pMenuBar, const MergeMenuInstructionContainer&, const OUString& aModuleIdentifier );
+
+ MenuItemHandler* GetMenuItemHandler( sal_uInt16 nItemId );
+ bool CreatePopupMenuController( MenuItemHandler* pMenuItemHandler,
+ const css::uno::Reference< css::frame::XDispatchProvider >& rDispatchProvider,
+ const OUString& rModuleIdentifier );
+ void AddMenu(MenuBarManager* pSubMenuManager,const OUString& _sItemCommand,sal_uInt16 _nItemId);
+ sal_uInt16 FillItemCommand(OUString& _rItemCommand, Menu* _pMenu,sal_uInt16 _nIndex) const;
+ void SetHdl();
+
+ bool m_bDeleteMenu;
+ bool m_bActive;
+ bool m_bShowMenuImages;
+ bool m_bRetrieveImages;
+ bool m_bAcceleratorCfg;
+ bool m_bHasMenuBar;
+ OUString m_aModuleIdentifier;
+ VclPtr<Menu> m_pVCLMenu;
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+ css::uno::Reference< css::frame::XUIControllerFactory > m_xPopupMenuControllerFactory;
+ ::std::vector< std::unique_ptr<MenuItemHandler> > 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_xDeferredItemContainer;
+ OUString m_sIconTheme;
+ Timer m_aAsyncSettingsTimer;
+};
+
+} // namespace
+
+/* 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..16bb8ec67
--- /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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <rtl/ustring.hxx>
+#include <vcl/menu.hxx>
+
+#include <string_view>
+#include <vector>
+
+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<Menu> pPopupMenu;
+ sal_uInt16 nPos;
+ sal_Int32 nLevel;
+ RPResultInfo eResult;
+};
+
+namespace MenuBarMerger
+{
+ bool IsCorrectContext(
+ std::u16string_view aContext, std::u16string_view aModuleIdentifier );
+
+ void RetrieveReferencePath( std::u16string_view,
+ std::vector< OUString >& aReferencePath );
+ ReferencePathInfo FindReferencePath( const std::vector< OUString >& aReferencePath, Menu* pMenu );
+ sal_uInt16 FindMenuItem( std::u16string_view 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,
+ std::u16string_view rMergeCommand,
+ std::u16string_view rMergeCommandParameter,
+ const OUString& rModuleIdentifier,
+ const AddonMenuContainer& rAddonMenuItems );
+ bool ProcessFallbackOperation( const ReferencePathInfo& aRefPathInfo,
+ sal_uInt16& rItemId,
+ std::u16string_view rMergeCommand,
+ std::u16string_view rMergeFallback,
+ const ::std::vector< OUString >& rReferencePath,
+ std::u16string_view 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,
+ std::u16string_view rMergeCommandParameter );
+ bool CreateSubMenu( Menu* pSubMenu,
+ sal_uInt16& nItemId,
+ const OUString& rModuleIdentifier,
+ const AddonMenuContainer& rAddonSubMenu );
+}
+
+} // namespace framework
+
+/* 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..d696ec6c3
--- /dev/null
+++ b/framework/inc/uielement/menubarwrapper.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 .
+ */
+
+#pragma once
+
+#include <helper/uiconfigelementwrapperbase.hxx>
+#include <uielement/menubarmanager.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+namespace framework
+{
+
+class MenuBarWrapper final : public UIConfigElementWrapperBase,
+ public css::container::XNameAccess
+
+{
+ public:
+ MenuBarWrapper( css::uno::Reference< css::uno::XComponentContext > xContext );
+ virtual ~MenuBarWrapper() override;
+
+ // XInterface, XTypeProvider
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ 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
+
+/* 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..57e58239f
--- /dev/null
+++ b/framework/inc/uielement/newmenucontroller.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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+
+#include <svtools/popupmenucontrollerbase.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/menu.hxx>
+
+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;
+
+ /* interface 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;
+
+ // 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();
+ void determineAndSetNewDocAccel(const css::awt::KeyEvent& 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;
+ };
+}
+
+/* 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..5b6ca9019
--- /dev/null
+++ b/framework/inc/uielement/progressbarwrapper.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <helper/uielementwrapperbase.hxx>
+
+#include <com/sun/star/awt/XWindow.hpp>
+
+#include <cppuhelper/weakref.hxx>
+
+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
+
+/* 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..cdfc82fad
--- /dev/null
+++ b/framework/inc/uielement/rootitemcontainer.hxx
@@ -0,0 +1,125 @@
+/* -*- 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 <helper/shareablemutex.hxx>
+
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <rtl/ustring.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/propshlp.hxx>
+
+#include <vector>
+
+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:
+ RootItemContainer();
+ RootItemContainer( const css::uno::Reference< css::container::XIndexAccess >& rItemAccessContainer );
+ virtual ~RootItemContainer() override;
+
+ // XInterface
+ virtual void SAL_CALL acquire() noexcept override
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() noexcept 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 const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() noexcept;
+ 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<css::uno::Sequence< css::beans::PropertyValue >>::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;
+};
+
+}
+
+/* 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..609f4ec01
--- /dev/null
+++ b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/ControlCommand.hpp>
+
+#include <uielement/complextoolbarcontroller.hxx>
+#include <vcl/vclptr.hxx>
+
+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,
+ ToolBoxItemId nID,
+ sal_Int32 nWidth,
+ const OUString& aCommand );
+ virtual ~SpinfieldToolbarController() override;
+
+ // XComponent
+ virtual void SAL_CALL dispose() override;
+
+ // called from SpinfieldControl
+ void Modify();
+ void GetFocus();
+ void LoseFocus();
+ void Activate();
+
+ OUString FormatOutputString(double fValue);
+ 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 );
+
+ bool m_bFloat;
+ double m_nMax;
+ double m_nMin;
+ double m_nValue;
+ double m_nStep;
+ VclPtr<SpinfieldControl> m_pSpinfieldControl;
+ OUString m_aOutFormat;
+};
+
+}
+
+/* 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..6d33396db
--- /dev/null
+++ b/framework/inc/uielement/statusbar.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <uielement/statusbarmanager.hxx>
+
+#include <vcl/status.hxx>
+
+namespace framework
+{
+
+class FrameworkStatusBar final : 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;
+};
+
+}
+
+/* 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..b9597bd2a
--- /dev/null
+++ b/framework/inc/uielement/statusbaritem.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <com/sun/star/ui/XStatusbarItem.hpp>
+#include <comphelper/compbase.hxx>
+#include <vcl/vclptr.hxx>
+
+class StatusBar;
+
+namespace framework
+{
+
+struct AddonStatusbarItemData;
+
+typedef comphelper::WeakComponentImplHelper< css::ui::XStatusbarItem > StatusbarItem_Base;
+
+class StatusbarItem final : public StatusbarItem_Base
+{
+public:
+ explicit StatusbarItem(
+ StatusBar *pStatusBar,
+ sal_uInt16 nId,
+ OUString aCommand );
+ virtual ~StatusbarItem() override;
+
+ void disposing(std::unique_lock<std::mutex>&) 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<StatusBar> m_pStatusBar;
+ sal_uInt16 m_nId;
+ sal_uInt16 m_nStyle;
+ OUString m_aCommand;
+
+};
+
+}
+
+/* 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..c893e4abd
--- /dev/null
+++ b/framework/inc/uielement/statusbarmanager.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XStatusbarController.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
+#include <com/sun/star/ui/XUIConfigurationListener.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/interfacecontainer4.hxx>
+#include <vcl/status.hxx>
+#include <vcl/vclptr.hxx>
+#include <map>
+#include <mutex>
+
+namespace framework
+{
+
+class FrameworkStatusBar;
+class StatusBarManager final: public ::cppu::WeakImplHelper<
+ css::frame::XFrameActionListener,
+ css::lang::XComponent,
+ css::ui::XUIConfigurationListener >
+
+{
+ friend class FrameworkStatusBar;
+
+ public:
+ StatusBarManager( css::uno::Reference< css::uno::XComponentContext > xContext,
+ css::uno::Reference< css::frame::XFrame > xFrame,
+ 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<StatusBar> m_pStatusBar;
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+ StatusBarControllerMap m_aControllerMap;
+ std::mutex m_mutex;
+ comphelper::OInterfaceContainerHelper4<XEventListener> m_aListenerContainer;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::frame::XUIControllerFactory > m_xStatusbarControllerFactory;
+};
+
+}
+
+/* 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..1eaec5a88
--- /dev/null
+++ b/framework/inc/uielement/statusbarmerger.hxx
@@ -0,0 +1,75 @@
+/* -*- 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 <sal/config.h>
+
+#include <string_view>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/status.hxx>
+
+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( std::u16string_view aContext );
+
+ bool ConvertSeqSeqToVector( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rSequence,
+ AddonStatusbarItemContainer& rContainer );
+
+ sal_uInt16 FindReferencePos( StatusBar* pStatusbar,
+ std::u16string_view rReferencePoint );
+
+ bool ProcessMergeOperation( StatusBar* pStatusbar,
+ sal_uInt16 nPos,
+ sal_uInt16& rItemId,
+ std::u16string_view rMergeCommand,
+ std::u16string_view rMergeCommandParameter,
+ const AddonStatusbarItemContainer& rItems );
+
+ bool ProcessMergeFallback( StatusBar* pStatusbar,
+ sal_uInt16& rItemId,
+ std::u16string_view rMergeCommand,
+ std::u16string_view rMergeFallback,
+ const AddonStatusbarItemContainer& rItems );
+}
+
+}
+
+/* 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..203ae6956
--- /dev/null
+++ b/framework/inc/uielement/statusbarwrapper.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <helper/uiconfigelementwrapperbase.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace framework
+{
+
+class StatusBarWrapper final : public UIConfigElementWrapperBase
+{
+ public:
+ StatusBarWrapper(
+ css::uno::Reference< css::uno::XComponentContext > xContext );
+ 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
+
+/* 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..abfae53e7
--- /dev/null
+++ b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <rtl/ustring.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/weakref.hxx>
+
+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;
+};
+
+}
+
+/* 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..45b1ad7ec
--- /dev/null
+++ b/framework/inc/uielement/styletoolbarcontroller.hxx
@@ -0,0 +1,78 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <svtools/toolboxcontroller.hxx>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+
+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,
+ css::uno::Reference< css::util::XURLTransformer > xUrlTransformer,
+ 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;
+};
+
+}
+
+/* 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..fe1143343
--- /dev/null
+++ b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/ControlCommand.hpp>
+
+#include <uielement/complextoolbarcontroller.hxx>
+#include <tools/link.hxx>
+
+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,
+ ToolBoxItemId 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;
+};
+
+}
+
+/* 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..1cfddd99e
--- /dev/null
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -0,0 +1,249 @@
+/* -*- 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 <uielement/commandinfo.hxx>
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
+#include <com/sun/star/frame/XSubToolbarController.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/frame/XToolbarController.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ui/XImageManager.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+
+#include <framework/addonsoptions.hxx>
+
+#include <rtl/ustring.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/interfacecontainer4.hxx>
+
+#include <tools/link.hxx>
+#include <vcl/weld.hxx>
+#include <vcl/window.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/toolbox.hxx>
+
+#include <mutex>
+#include <unordered_map>
+
+class PopupMenu;
+class ToolBox;
+class Menu;
+
+namespace framework
+{
+
+class ToolBarManager;
+
+class ToolBarManagerImpl
+{
+public:
+ virtual ~ToolBarManagerImpl() = default;
+ virtual void Init() = 0;
+ virtual void Destroy() = 0;
+ virtual css::uno::Reference<css::awt::XWindow> GetInterface() = 0;
+ virtual css::uno::Reference<css::frame::XStatusListener> CreateToolBoxController(
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ ToolBoxItemId nId,
+ const OUString& aCommandURL ) = 0;
+ virtual void InsertItem(ToolBoxItemId nId,
+ const OUString& rString,
+ const OUString& rCommandURL,
+ const OUString& rTooltip,
+ const OUString& rLabel,
+ ToolBoxItemBits nItemBits) = 0;
+ virtual void InsertSeparator() = 0;
+ virtual void InsertSpace() = 0;
+ virtual void InsertBreak() = 0;
+ virtual ToolBoxItemId GetItemId(sal_uInt16 nPos) = 0;
+ virtual ToolBoxItemId GetCurItemId() = 0;
+ virtual OUString GetItemCommand(ToolBoxItemId nId) = 0;
+ virtual sal_uInt16 GetItemCount() = 0;
+ virtual void SetItemCheckable(ToolBoxItemId nId) = 0;
+ virtual void HideItem(ToolBoxItemId nId, const OUString& rCommandURL) = 0;
+ virtual bool IsItemVisible(ToolBoxItemId nId, const OUString& rCommandURL) = 0;
+ virtual void Clear() = 0;
+ virtual void SetName(const OUString& rName) = 0;
+ virtual void SetHelpId(const OString& rHelpId) = 0;
+ virtual bool WillUsePopupMode() = 0;
+ virtual bool IsReallyVisible() = 0;
+ virtual void SetIconSize(ToolBoxButtonSize eSize) = 0;
+ virtual vcl::ImageType GetImageSize() = 0;
+ virtual void ConnectCallbacks(ToolBarManager* pManager) = 0;
+ virtual void SetMenuType(ToolBoxMenuType eType) = 0;
+ virtual void MergeToolbar(ToolBoxItemId & rItemId,
+ const OUString& rModuleIdentifier,
+ CommandToInfoMap& rCommandMap,
+ MergeToolbarInstruction& rInstruction) = 0;
+ virtual void SetItemImage(ToolBoxItemId nId,
+ const OUString& rCommandURL,
+ const Image& rImage) = 0;
+ virtual void UpdateSize() = 0;
+ virtual void SetItemWindow(ToolBoxItemId nItemId, vcl::Window* pNewWindow) = 0;
+};
+
+typedef ::cppu::WeakImplHelper<
+ css::frame::XFrameActionListener,
+ css::lang::XComponent,
+ css::ui::XUIConfigurationListener
+ > ToolbarManager_Base;
+
+class ToolBarManager final : public ToolbarManager_Base
+{
+ public:
+ ToolBarManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ OUString aResourceName,
+ ToolBox* pToolBar );
+ ToolBarManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XFrame >& rFrame,
+ OUString aResourceName,
+ weld::Toolbar* pToolBar,
+ weld::Builder* pBuilder );
+ 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();
+ void RequestImages();
+ void FillToolbar( const css::uno::Reference< css::container::XIndexAccess >& rToolBarData );
+ void FillAddonToolbar( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rAddonToolbar );
+ void FillOverflowToolbar( ToolBox const * pParent );
+ void notifyRegisteredControllers( const OUString& aUIElementName, const OUString& aCommand );
+ void Destroy();
+
+ enum ExecuteCommand
+ {
+ EXEC_CMD_CLOSETOOLBAR,
+ EXEC_CMD_UNDOCKTOOLBAR,
+ EXEC_CMD_DOCKTOOLBAR,
+ EXEC_CMD_DOCKALLTOOLBARS
+ };
+
+ enum ClickAction
+ {
+ Click,
+ DblClick,
+ Execute
+ };
+
+ struct ExecuteInfo
+ {
+ OUString aToolbarResName;
+ ExecuteCommand nCmd;
+ css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
+ css::uno::Reference< css::awt::XWindow > xWindow;
+ };
+
+ public:
+ void OnClick(bool bUseExecute = false);
+ void OnDropdownClick(bool bCreatePopupWindow = true);
+
+ 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 );
+
+ private:
+ void Init();
+ 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 RefreshImages();
+ ToolBoxItemBits ConvertStyleToToolboxItemBits( sal_Int32 nStyle );
+ css::uno::Reference< css::frame::XModel > GetModelFromFrame() const;
+ bool IsPluginMode() const;
+ void HandleClick(ClickAction eAction);
+ void setToolBarImage(const Image& _aImage,const CommandToInfoMap::const_iterator& _pIter);
+ void impl_elementChanged(bool _bRemove,const css::ui::ConfigurationEvent& Event );
+
+ typedef std::unordered_map< ToolBoxItemId, css::uno::Reference< css::frame::XStatusListener > > ToolBarControllerMap;
+ typedef ::std::vector< css::uno::Reference< css::frame::XSubToolbarController > > SubToolBarControllerVector;
+ typedef std::unordered_map<OUString, SubToolBarControllerVector> SubToolBarToSubToolBarControllerMap;
+
+ bool m_bDisposed : 1,
+ m_bFrameActionRegistered : 1,
+ m_bUpdateControllers : 1;
+
+ sal_Int16 m_eSymbolSize;
+
+ std::unique_ptr<ToolBarManagerImpl> m_pImpl;
+ VclPtr<ToolBox> 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;
+ std::mutex m_mutex;
+ comphelper::OInterfaceContainerHelper4<XEventListener> m_aListenerContainer;
+ 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;
+};
+
+}
+
+/* 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..837507baa
--- /dev/null
+++ b/framework/inc/uielement/toolbarmerger.hxx
@@ -0,0 +1,138 @@
+/* -*- 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 <sal/config.h>
+
+#include <string_view>
+
+#include <uielement/commandinfo.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <cppuhelper/weak.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/toolbox.hxx>
+
+namespace framework
+{
+
+struct AddonsParams
+{
+ OUString aControlType;
+ sal_uInt16 nWidth;
+};
+
+struct AddonToolbarItem
+{
+ OUString aCommandURL;
+ OUString aLabel;
+ 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( std::u16string_view aContext, std::u16string_view 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& rTarget,
+ OUString& rContext,
+ OUString& rControlType,
+ sal_uInt16& rWidth );
+
+ static ReferenceToolbarPathInfo FindReferencePoint( const ToolBox* pToolbar,
+ std::u16string_view rReferencePoint );
+
+ static bool ProcessMergeOperation( ToolBox* pToolbar,
+ ToolBox::ImplToolItems::size_type nPos,
+ ToolBoxItemId& rItemId,
+ CommandToInfoMap& rCommandMap,
+ std::u16string_view rModuleIdentifier,
+ std::u16string_view rMergeCommand,
+ std::u16string_view rMergeCommandParameter,
+ const AddonToolbarItemContainer& rItems );
+
+ static bool ProcessMergeFallback( ToolBox* pToolbar,
+ ToolBoxItemId& rItemId,
+ CommandToInfoMap& rCommandMap,
+ std::u16string_view rModuleIdentifier,
+ std::u16string_view rMergeCommand,
+ std::u16string_view rMergeFallback,
+ const AddonToolbarItemContainer& rItems );
+
+ static void MergeItems( ToolBox* pToolbar,
+ ToolBox::ImplToolItems::size_type nPos,
+ sal_uInt16 nModIndex,
+ ToolBoxItemId& rItemId,
+ CommandToInfoMap& rCommandMap,
+ std::u16string_view rModuleIdentifier,
+ const AddonToolbarItemContainer& rAddonToolbarItems );
+
+ static void ReplaceItem( ToolBox* pToolbar,
+ ToolBox::ImplToolItems::size_type nPos,
+ ToolBoxItemId& rItemId,
+ CommandToInfoMap& rCommandMap,
+ std::u16string_view rModuleIdentifier,
+ const AddonToolbarItemContainer& rAddonToolbarItems );
+
+ static void RemoveItems( ToolBox* pToolbar,
+ ToolBox::ImplToolItems::size_type nPos,
+ std::u16string_view rMergeCommandParameter );
+
+ static rtl::Reference<::cppu::OWeakObject> CreateController(
+ const css::uno::Reference< css::uno::XComponentContext > & rxContext,
+ const css::uno::Reference< css::frame::XFrame > & xFrame,
+ ToolBox* pToolbar,
+ const OUString& rCommandURL,
+ ToolBoxItemId nId,
+ sal_uInt16 nWidth,
+ std::u16string_view rControlType );
+
+ static void CreateToolbarItem( ToolBox* pToolbox,
+ ToolBox::ImplToolItems::size_type nPos,
+ ToolBoxItemId nItemId,
+ const AddonToolbarItem& rAddonToolbarItem );
+
+ private:
+ ToolBarMerger( const ToolBarMerger& ) = delete;
+ ToolBarMerger& operator=( const ToolBarMerger& ) = delete;
+};
+
+} // namespace framework
+
+/* 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..cee2b0dac
--- /dev/null
+++ b/framework/inc/uielement/toolbarmodemenucontroller.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 .
+ */
+
+#pragma once
+
+#include <svtools/popupmenucontrollerbase.hxx>
+
+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;
+
+ /* interface 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;
+
+ // 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;
+
+ private:
+ void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu );
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ };
+}
+
+/* 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..99d64775d
--- /dev/null
+++ b/framework/inc/uielement/toolbarsmenucontroller.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/ui/XUIConfigurationManager.hpp>
+
+#include <svtools/popupmenucontrollerbase.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/intlwrapper.hxx>
+
+#include <vector>
+
+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;
+
+ /* interface 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;
+
+ // 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;
+ };
+}
+
+/* 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..da90455b2
--- /dev/null
+++ b/framework/inc/uielement/toolbarwrapper.hxx
@@ -0,0 +1,89 @@
+/* -*- 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 <helper/uiconfigelementwrapperbase.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ui/XUIFunctionListener.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <memory>
+
+namespace weld
+{
+ class Builder;
+ class Container;
+ class Toolbar;
+}
+
+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() noexcept override;
+ virtual void SAL_CALL release() noexcept 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;
+
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xTopLevel;
+ std::unique_ptr<weld::Toolbar> m_xWeldedToolbar;
+};
+
+}
+
+/* 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..aeeb1f9aa
--- /dev/null
+++ b/framework/inc/uielement/uicommanddescription.hxx
@@ -0,0 +1,95 @@
+/* -*- 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 <unordered_map>
+#include <map>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/XModuleManager2.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <comphelper/compbase.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <rtl/ustring.hxx>
+#include <i18nlangtag/languagetag.hxx>
+
+namespace framework
+{
+typedef comphelper::WeakComponentImplHelper< css::lang::XServiceInfo,
+ css::container::XNameAccess > UICommandDescription_BASE;
+
+class UICommandDescription : 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<OUString> 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);
+ void ensureGenericUICommandsForLanguage(const LanguageTag& rLanguage);
+
+ OUString m_aPrivateResourceURL;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ ModuleToCommandFileMap m_aModuleToCommandFileMap;
+ std::map<LanguageTag, UICommandsHashMap> m_aUICommandsHashMap;
+ std::map<LanguageTag, 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..8e6f0c7de
--- /dev/null
+++ b/framework/inc/uielement/uielement.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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/DockingArea.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+
+#include <rtl/ustring.hxx>
+#include <utility>
+#include <vcl/toolbox.hxx>
+
+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( OUString aName,
+ OUString aType,
+ css::uno::Reference< css::ui::XUIElement > xUIElement
+ ) : m_aType(std::move( aType )),
+ m_aName(std::move( aName )),
+ m_xUIElement(std::move( xUIElement )),
+ 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
+
+/* 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..a248a0d9f
--- /dev/null
+++ b/framework/inc/uielement/uielementtypenames.hxx
@@ -0,0 +1,30 @@
+/* -*- 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
+
+#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"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */