diff options
Diffstat (limited to 'framework/inc/uielement')
42 files changed, 258 insertions, 322 deletions
diff --git a/framework/inc/uielement/FixedImageToolbarController.hxx b/framework/inc/uielement/FixedImageToolbarController.hxx index 66533fbc9cde..ffe40713b524 100644 --- a/framework/inc/uielement/FixedImageToolbarController.hxx +++ b/framework/inc/uielement/FixedImageToolbarController.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDIMAGETOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDIMAGETOOLBARCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/ControlCommand.hpp> @@ -36,7 +35,7 @@ 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, sal_uInt16 nID, const OUString& aCommand); + ToolBox* pToolBar, ToolBoxItemId nID, const OUString& aCommand); // XComponent virtual void SAL_CALL dispose() override; @@ -53,6 +52,4 @@ private: }; } // namespace framework -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDIMAGETOOLBARCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/FixedTextToolbarController.hxx b/framework/inc/uielement/FixedTextToolbarController.hxx index 3d257414b6d2..bcf1d093f3f6 100644 --- a/framework/inc/uielement/FixedTextToolbarController.hxx +++ b/framework/inc/uielement/FixedTextToolbarController.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDTEXTTOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDTEXTTOOLBARCONTROLLER_HXX +#pragma once #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/ControlCommand.hpp> @@ -36,7 +35,7 @@ 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, sal_uInt16 nID, const OUString& aCommand); + ToolBox* pToolBar, ToolBoxItemId nID, const OUString& aCommand); // XComponent virtual void SAL_CALL dispose() override; @@ -50,6 +49,4 @@ private: }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_FIXEDTEXTTOOLBARCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/addonstoolbarwrapper.hxx b/framework/inc/uielement/addonstoolbarwrapper.hxx index 2970ce6d13fa..fc09465eea5a 100644 --- a/framework/inc/uielement/addonstoolbarwrapper.hxx +++ b/framework/inc/uielement/addonstoolbarwrapper.hxx @@ -17,16 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX +#pragma once #include <helper/uielementwrapperbase.hxx> - +#include <rtl/ref.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/uno/XComponentContext.hpp> namespace framework { +class ToolBarManager; class AddonsToolBarWrapper final : public UIElementWrapperBase { @@ -48,13 +48,11 @@ class AddonsToolBarWrapper final : public UIElementWrapperBase private: css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::lang::XComponent > m_xToolBarManager; + rtl::Reference< ToolBarManager > m_xToolBarManager; css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > m_aConfigData; bool m_bCreatedImages; }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/buttontoolbarcontroller.hxx b/framework/inc/uielement/buttontoolbarcontroller.hxx index 989c952038a4..759775ef8b65 100644 --- a/framework/inc/uielement/buttontoolbarcontroller.hxx +++ b/framework/inc/uielement/buttontoolbarcontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX +#pragma once #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/util/XUpdatable.hpp> @@ -46,15 +45,15 @@ class ButtonToolbarController final : public css::frame::XStatusListener, public ::cppu::OWeakObject { public: - ButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + ButtonToolbarController( css::uno::Reference< css::uno::XComponentContext > xContext, ToolBox* pToolBar, - const OUString& aCommand ); + OUString aCommand ); virtual ~ButtonToolbarController() override; // XInterface virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; - virtual void SAL_CALL acquire() throw () override; - virtual void SAL_CALL release() throw () override; + 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; @@ -92,6 +91,4 @@ class ButtonToolbarController final : public css::frame::XStatusListener, } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/comboboxtoolbarcontroller.hxx b/framework/inc/uielement/comboboxtoolbarcontroller.hxx index 8dcf79b03510..126aab6500dd 100644 --- a/framework/inc/uielement/comboboxtoolbarcontroller.hxx +++ b/framework/inc/uielement/comboboxtoolbarcontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/ControlCommand.hpp> @@ -36,7 +35,7 @@ class ComboboxToolbarController final : public ComplexToolbarController ComboboxToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~ComboboxToolbarController() override; @@ -60,6 +59,4 @@ class ComboboxToolbarController final : public ComplexToolbarController } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/commandinfo.hxx b/framework/inc/uielement/commandinfo.hxx index b2c7c3e880a9..a93c693e6a2e 100644 --- a/framework/inc/uielement/commandinfo.hxx +++ b/framework/inc/uielement/commandinfo.hxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_COMMANDINFO_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_COMMANDINFO_HXX +#pragma once #include <rtl/ustring.hxx> +#include <vcl/toolbox.hxx> #include <unordered_map> #include <vector> @@ -33,8 +33,8 @@ struct CommandInfo CommandInfo() : nId( 0 ), nImageInfo( 0 ) {} - sal_uInt16 nId; - ::std::vector< sal_uInt16 > aIds; + ::std::vector< ToolBoxItemId > aIds; + ToolBoxItemId nId; sal_Int16 nImageInfo; }; @@ -42,6 +42,4 @@ typedef std::unordered_map<OUString, CommandInfo> CommandToInfoMap; } // namespace framework -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_COMMANDINFO_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/complextoolbarcontroller.hxx b/framework/inc/uielement/complextoolbarcontroller.hxx index 5036943299e9..0aa10471be44 100644 --- a/framework/inc/uielement/complextoolbarcontroller.hxx +++ b/framework/inc/uielement/complextoolbarcontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX +#pragma once #include <com/sun/star/util/URL.hpp> #include <com/sun/star/beans/NamedValue.hpp> @@ -31,7 +30,6 @@ #include <vcl/vclptr.hxx> class ToolBox; -namespace vcl { class Window; } namespace framework { @@ -43,7 +41,7 @@ class ComplexToolbarController : public svt::ToolboxController ComplexToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, const OUString& aCommand ); virtual ~ComplexToolbarController() override; @@ -88,7 +86,7 @@ class ComplexToolbarController : public svt::ToolboxController void notifyTextChanged( const OUString& aText ); VclPtr<ToolBox> m_xToolbar; - sal_uInt16 m_nID; + ToolBoxItemId m_nID; bool m_bMadeInvisible; mutable css::util::URL m_aURL; css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; @@ -96,6 +94,4 @@ class ComplexToolbarController : public svt::ToolboxController } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/constitemcontainer.hxx b/framework/inc/uielement/constitemcontainer.hxx index 512baa2cb467..ae820c29b10f 100644 --- a/framework/inc/uielement/constitemcontainer.hxx +++ b/framework/inc/uielement/constitemcontainer.hxx @@ -17,14 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_CONSTITEMCONTAINER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_CONSTITEMCONTAINER_HXX +#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> @@ -39,7 +37,6 @@ class RootItemContainer; class ItemContainer; class ConstItemContainer final : public ::cppu::WeakImplHelper< css::container::XIndexAccess, - css::lang::XUnoTunnel , css::beans::XFastPropertySet, css::beans::XPropertySet > { @@ -52,10 +49,6 @@ class ConstItemContainer final : public ::cppu::WeakImplHelper< ConstItemContainer( const css::uno::Reference< css::container::XIndexAccess >& rSourceContainer, bool bFastCopy = false ); virtual ~ConstItemContainer() override; - // XUnoTunnel - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() throw(); - sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) override; - // XIndexAccess virtual sal_Int32 SAL_CALL getCount() override; @@ -83,11 +76,11 @@ class ConstItemContainer final : public ::cppu::WeakImplHelper< virtual css::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle ) override; private: - ::cppu::IPropertyArrayHelper& getInfoHelper(); - css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); + static ::cppu::IPropertyArrayHelper& getInfoHelper(); + static 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 ); + static 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; @@ -95,6 +88,4 @@ class ConstItemContainer final : public ::cppu::WeakImplHelper< } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_CONSTITEMCONTAINER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx index eb95c142cef3..cb01578629cd 100644 --- a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx +++ b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/ControlCommand.hpp> @@ -39,7 +38,7 @@ class DropdownToolbarController final : public ComplexToolbarController DropdownToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~DropdownToolbarController() override; @@ -61,6 +60,4 @@ class DropdownToolbarController final : public ComplexToolbarController } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/edittoolbarcontroller.hxx b/framework/inc/uielement/edittoolbarcontroller.hxx index 21e7f6935f6d..c45aa38937cf 100644 --- a/framework/inc/uielement/edittoolbarcontroller.hxx +++ b/framework/inc/uielement/edittoolbarcontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_EDITTOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_EDITTOOLBARCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/ControlCommand.hpp> @@ -38,7 +37,7 @@ class EditToolbarController final : public ComplexToolbarController EditToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~EditToolbarController() override; @@ -61,6 +60,4 @@ class EditToolbarController final : public ComplexToolbarController } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_EDITTOOLBARCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/fontmenucontroller.hxx b/framework/inc/uielement/fontmenucontroller.hxx index 27da18f204a5..b98e8c7b1dab 100644 --- a/framework/inc/uielement/fontmenucontroller.hxx +++ b/framework/inc/uielement/fontmenucontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTMENUCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTMENUCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/XDispatch.hpp> @@ -61,6 +60,4 @@ namespace framework }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTMENUCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/fontsizemenucontroller.hxx b/framework/inc/uielement/fontsizemenucontroller.hxx index f7feba920825..d04bc637a388 100644 --- a/framework/inc/uielement/fontsizemenucontroller.hxx +++ b/framework/inc/uielement/fontsizemenucontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -28,8 +27,6 @@ #include <rtl/ustring.hxx> #include <tools/long.hxx> -#include <memory> - namespace framework { class FontSizeMenuController final : public svt::PopupMenuControllerBase @@ -60,13 +57,10 @@ namespace framework void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); OUString retrievePrinterName( css::uno::Reference< css::frame::XFrame > const & rFrame ); - std::unique_ptr<tools::Long[]> m_pHeightArray; - css::awt::FontDescriptor m_aFontDescriptor; + std::vector<tools::Long> m_aHeightArray; css::frame::status::FontHeight m_aFontHeight; css::uno::Reference< css::frame::XDispatch > m_xCurrentFontDispatch; }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/footermenucontroller.hxx b/framework/inc/uielement/footermenucontroller.hxx index 5cf3388667dc..304ffeec3cc7 100644 --- a/framework/inc/uielement/footermenucontroller.hxx +++ b/framework/inc/uielement/footermenucontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_FOOTERMENUCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_FOOTERMENUCONTROLLER_HXX +#pragma once #include <uielement/headermenucontroller.hxx> @@ -37,6 +36,4 @@ namespace framework }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_FOOTERMENUCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/genericstatusbarcontroller.hxx b/framework/inc/uielement/genericstatusbarcontroller.hxx index 95521d2a29e2..e0eae738fda0 100644 --- a/framework/inc/uielement/genericstatusbarcontroller.hxx +++ b/framework/inc/uielement/genericstatusbarcontroller.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_GENERICSTATUSBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_GENERICSTATUSBARCONTROLLER_HXX +#pragma once #include <svtools/statusbarcontroller.hxx> @@ -55,6 +54,4 @@ class GenericStatusbarController final : public svt::StatusbarController } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/headermenucontroller.hxx b/framework/inc/uielement/headermenucontroller.hxx index bf395bf75af7..cdd48fea49ff 100644 --- a/framework/inc/uielement/headermenucontroller.hxx +++ b/framework/inc/uielement/headermenucontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_HEADERMENUCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_HEADERMENUCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/XModel.hpp> @@ -56,6 +55,4 @@ namespace framework }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_HEADERMENUCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx index 9b625059717f..f6c07c206128 100644 --- a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx +++ b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/ControlCommand.hpp> @@ -37,7 +36,7 @@ class ImageButtonToolbarController final : public ComplexToolbarController ImageButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, const OUString& aCommand ); virtual ~ImageButtonToolbarController() override; @@ -47,11 +46,9 @@ class ImageButtonToolbarController final : public ComplexToolbarController private: virtual void executeControlCommand( const css::frame::ControlCommand& rControlCommand ) override; - bool ReadImageFromURL( bool bBigImage, const OUString& aImageURL, Image& aImage ); + static bool ReadImageFromURL( bool bBigImage, const OUString& aImageURL, Image& aImage ); }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/itemcontainer.hxx b/framework/inc/uielement/itemcontainer.hxx index 5f2142caa19b..b15514f66648 100644 --- a/framework/inc/uielement/itemcontainer.hxx +++ b/framework/inc/uielement/itemcontainer.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_ITEMCONTAINER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_ITEMCONTAINER_HXX +#pragma once #include <helper/shareablemutex.hxx> @@ -44,9 +43,6 @@ class ItemContainer final : public ::cppu::WeakImplHelper< css::container::XInde // XInterface, XTypeProvider - // XUnoTunnel - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() throw(); - // XIndexContainer virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; @@ -70,7 +66,7 @@ class ItemContainer final : public ::cppu::WeakImplHelper< css::container::XInde 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 ); + static 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; @@ -78,6 +74,4 @@ class ItemContainer final : public ::cppu::WeakImplHelper< css::container::XInde } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_ITEMCONTAINER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/langselectionmenucontroller.hxx b/framework/inc/uielement/langselectionmenucontroller.hxx index 0651a1ababb3..070054a2f4ac 100644 --- a/framework/inc/uielement/langselectionmenucontroller.hxx +++ b/framework/inc/uielement/langselectionmenucontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_LANGSELECTIONMENUCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_LANGSELECTIONMENUCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/XDispatch.hpp> @@ -45,9 +44,6 @@ namespace framework // 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; @@ -55,6 +51,9 @@ namespace framework virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; private: + // XInitialization + virtual void initializeImpl( std::unique_lock<std::mutex>& rGuard, const css::uno::Sequence< css::uno::Any >& aArguments ) override; + virtual void impl_setPopupMenu() override; enum Mode { @@ -82,6 +81,4 @@ namespace framework }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_LANGSELECTIONMENUCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/macrosmenucontroller.hxx b/framework/inc/uielement/macrosmenucontroller.hxx index 819dc316f3f5..7419f02a7059 100644 --- a/framework/inc/uielement/macrosmenucontroller.hxx +++ b/framework/inc/uielement/macrosmenucontroller.hxx @@ -17,11 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_MACROSMENUCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_MACROSMENUCONTROLLER_HXX +#pragma once #include <svtools/popupmenucontrollerbase.hxx> -#include <vcl/menu.hxx> namespace framework { @@ -47,11 +45,9 @@ namespace framework virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; private: - void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); - void addScriptItems( PopupMenu* pPopupMenu, sal_uInt16 startItemId ); + void fillPopupMenu(const css::uno::Reference<css::awt::XPopupMenu>& rPopupMenu); + void addScriptItems(const css::uno::Reference<css::awt::XPopupMenu>& rPopupMenu, sal_uInt16 startItemId); }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_MACROSMENUCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx index 9cb47eedc7d3..1beb2961e690 100644 --- a/framework/inc/uielement/menubarmanager.hxx +++ b/framework/inc/uielement/menubarmanager.hxx @@ -17,13 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMANAGER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMANAGER_HXX +#pragma once + +#include <sal/config.h> -/** Attention: stl headers must(!) be included at first. Otherwise it can make trouble - with solaris headers ... -*/ #include <unordered_map> +#include <utility> #include <vector> #include <com/sun/star/frame/XFrame.hpp> @@ -43,8 +42,8 @@ #include <rtl/ustring.hxx> #include <vcl/menu.hxx> #include <vcl/timer.hxx> -#include <cppuhelper/basemutex.hxx> -#include <cppuhelper/compbase.hxx> +#include <comphelper/compbase.hxx> +#include <cppuhelper/weakref.hxx> #include <framework/addonsoptions.hxx> namespace framework @@ -58,8 +57,7 @@ struct PopupControllerEntry typedef std::unordered_map< OUString, PopupControllerEntry > PopupControllerCache; class MenuBarManager final : - protected cppu::BaseMutex, - public cppu::WeakComponentImplHelper< + public comphelper::WeakComponentImplHelper< css::frame::XStatusListener, css::frame::XFrameActionListener, css::ui::XUIConfigurationListener, @@ -123,31 +121,29 @@ class MenuBarManager final : DECL_LINK( Deactivate, Menu *, bool ); DECL_LINK( AsyncSettingsHdl, Timer *, void ); - void SAL_CALL disposing() override; + 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); - void Destroy(); - struct MenuItemHandler { MenuItemHandler( sal_uInt16 aItemId, - css::uno::Reference< css::frame::XStatusListener > const & xManager, - css::uno::Reference< css::frame::XDispatch > const & rDispatch ) : + rtl::Reference< MenuBarManager > xManager, + css::uno::Reference< css::frame::XDispatch > xDispatch ) : nItemId( aItemId ), bMadeInvisible ( false ), - xSubMenuManager( xManager ), - xMenuItemDispatch( rDispatch ) {} + 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; + rtl::Reference< MenuBarManager > xSubMenuManager; css::uno::Reference< css::frame::XDispatch > xMenuItemDispatch; css::uno::Reference< css::frame::XPopupMenuController > xPopupMenuController; css::uno::Reference< css::awt::XPopupMenu > xPopupMenu; @@ -166,7 +162,7 @@ class MenuBarManager final : 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; + static sal_uInt16 FillItemCommand(OUString& _rItemCommand, Menu* _pMenu,sal_uInt16 _nIndex); void SetHdl(); bool m_bDeleteMenu; @@ -195,6 +191,4 @@ class MenuBarManager final : } // namespace -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/menubarmerger.hxx b/framework/inc/uielement/menubarmerger.hxx index 8de837c5e81e..16bb8ec67610 100644 --- a/framework/inc/uielement/menubarmerger.hxx +++ b/framework/inc/uielement/menubarmerger.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMERGER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMERGER_HXX +#pragma once #include <com/sun/star/beans/PropertyValue.hpp> @@ -61,9 +60,9 @@ struct ReferencePathInfo namespace MenuBarMerger { bool IsCorrectContext( - const OUString& aContext, std::u16string_view aModuleIdentifier ); + std::u16string_view aContext, std::u16string_view aModuleIdentifier ); - void RetrieveReferencePath( const OUString&, + 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, @@ -76,7 +75,7 @@ namespace MenuBarMerger sal_uInt16 nPos, sal_uInt16& rItemId, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const OUString& rModuleIdentifier, const AddonMenuContainer& rAddonMenuItems ); bool ProcessFallbackOperation( const ReferencePathInfo& aRefPathInfo, @@ -99,7 +98,7 @@ namespace MenuBarMerger const AddonMenuContainer& rAddonMenuItems ); bool RemoveMenuItems( Menu* pMenu, sal_uInt16 nPos, - const OUString& rMergeCommandParameter ); + std::u16string_view rMergeCommandParameter ); bool CreateSubMenu( Menu* pSubMenu, sal_uInt16& nItemId, const OUString& rModuleIdentifier, @@ -108,6 +107,4 @@ namespace MenuBarMerger } // namespace framework -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMERGER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/menubarwrapper.hxx b/framework/inc/uielement/menubarwrapper.hxx index 374c1b1e9b21..848af5c693f7 100644 --- a/framework/inc/uielement/menubarwrapper.hxx +++ b/framework/inc/uielement/menubarwrapper.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARWRAPPER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARWRAPPER_HXX +#pragma once #include <helper/uiconfigelementwrapperbase.hxx> #include <uielement/menubarmanager.hxx> @@ -29,23 +28,15 @@ namespace framework { -class MenuBarWrapper final : public UIConfigElementWrapperBase, - public css::container::XNameAccess +typedef cppu::ImplInheritanceHelper< UIConfigElementWrapperBase, css::container::XNameAccess> MenuBarWrapper_Base; +class MenuBarWrapper final : public MenuBarWrapper_Base { public: - MenuBarWrapper( - const css::uno::Reference< css::uno::XComponentContext >& xContext ); + 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() throw() override; - virtual void SAL_CALL release() throw() 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() ); } + MenuBarManager* GetMenuBarManager() const { return m_xMenuBarManager.get(); } // XComponent virtual void SAL_CALL dispose() override; @@ -73,13 +64,11 @@ class MenuBarWrapper final : public UIConfigElementWrapperBase, void fillPopupControllerCache(); bool m_bRefreshPopupControllerCache : 1; - css::uno::Reference< css::lang::XComponent > m_xMenuBarManager; + rtl::Reference< MenuBarManager > m_xMenuBarManager; PopupControllerCache m_aPopupControllerCache; css::uno::Reference< css::uno::XComponentContext > m_xContext; }; } // namespace framework -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARWRAPPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/newmenucontroller.hxx b/framework/inc/uielement/newmenucontroller.hxx index 8356ab4925e7..abc10e03e678 100644 --- a/framework/inc/uielement/newmenucontroller.hxx +++ b/framework/inc/uielement/newmenucontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_NEWMENUCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_NEWMENUCONTROLLER_HXX +#pragma once #include <com/sun/star/ui/XAcceleratorConfiguration.hpp> @@ -41,9 +40,6 @@ namespace framework 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; @@ -55,14 +51,17 @@ namespace framework virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; private: + // XInitialization + virtual void initializeImpl( std::unique_lock<std::mutex>& rGuard, const css::uno::Sequence< css::uno::Any >& aArguments ) override; + 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, + static void retrieveShortcutsFromConfiguration( const css::uno::Reference< css::ui::XAcceleratorConfiguration >& rAccelCfg, const css::uno::Sequence< OUString >& rCommands, std::vector< vcl::KeyCode >& aMenuShortCuts ); - void setAccelerators( PopupMenu* pPopupMenu ); - void determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const vcl::KeyCode& rKeyCode ); + void setAccelerators(); + void determineAndSetNewDocAccel(const css::awt::KeyEvent& rKeyCode); void setMenuImages( PopupMenu* pPopupMenu, bool bSetImages ); private: @@ -82,6 +81,4 @@ namespace framework }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_NEWMENUCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/progressbarwrapper.hxx b/framework/inc/uielement/progressbarwrapper.hxx index 78dad538fe04..5b6ca9019e16 100644 --- a/framework/inc/uielement/progressbarwrapper.hxx +++ b/framework/inc/uielement/progressbarwrapper.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_PROGRESSBARWRAPPER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_PROGRESSBARWRAPPER_HXX +#pragma once #include <helper/uielementwrapperbase.hxx> @@ -80,6 +79,4 @@ class ProgressBarWrapper final : public UIElementWrapperBase } // namespace framework -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_PROGRESSBARWRAPPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/rootitemcontainer.hxx b/framework/inc/uielement/rootitemcontainer.hxx index cc12b5fa18f5..159137f0f67e 100644 --- a/framework/inc/uielement/rootitemcontainer.hxx +++ b/framework/inc/uielement/rootitemcontainer.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_ROOTITEMCONTAINER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_ROOTITEMCONTAINER_HXX +#pragma once #include <helper/shareablemutex.hxx> @@ -26,7 +25,6 @@ #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> @@ -41,8 +39,7 @@ class ConstItemContainer; typedef ::cppu::WeakImplHelper< css::container::XIndexContainer, - css::lang::XSingleComponentFactory, - css::lang::XUnoTunnel > RootItemContainer_BASE; + css::lang::XSingleComponentFactory > RootItemContainer_BASE; class RootItemContainer final : private cppu::BaseMutex, public ::cppu::OBroadcastHelper , @@ -57,19 +54,15 @@ class RootItemContainer final : private cppu::BaseMutex, virtual ~RootItemContainer() override; // XInterface - virtual void SAL_CALL acquire() throw () override + virtual void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } - virtual void SAL_CALL release() throw () override + 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() throw(); - sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) override; - // XIndexContainer virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; @@ -123,6 +116,4 @@ class RootItemContainer final : private cppu::BaseMutex, } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_ROOTITEMCONTAINER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx index beb95049a206..796a5e00b277 100644 --- a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx +++ b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/ControlCommand.hpp> @@ -39,7 +38,7 @@ class SpinfieldToolbarController final : public ComplexToolbarController SpinfieldToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~SpinfieldToolbarController() override; @@ -58,7 +57,7 @@ class SpinfieldToolbarController final : public ComplexToolbarController 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 ); + static bool impl_getValue( const css::uno::Any& rAny, sal_Int32& nValue, double& fValue, bool& bFloat ); bool m_bFloat; double m_nMax; @@ -71,6 +70,4 @@ class SpinfieldToolbarController final : public ComplexToolbarController } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusbar.hxx b/framework/inc/uielement/statusbar.hxx index fec07a45bc26..6d33396dbecd 100644 --- a/framework/inc/uielement/statusbar.hxx +++ b/framework/inc/uielement/statusbar.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBAR_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBAR_HXX +#pragma once #include <uielement/statusbarmanager.hxx> @@ -27,7 +26,7 @@ namespace framework { -class FrameworkStatusBar : public StatusBar +class FrameworkStatusBar final : public StatusBar { public: @@ -50,6 +49,4 @@ class FrameworkStatusBar : public StatusBar } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBAR_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusbaritem.hxx b/framework/inc/uielement/statusbaritem.hxx index 7dd3ed672327..b9597bd2ab57 100644 --- a/framework/inc/uielement/statusbaritem.hxx +++ b/framework/inc/uielement/statusbaritem.hxx @@ -16,12 +16,10 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARITEM_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARITEM_HXX +#pragma once #include <com/sun/star/ui/XStatusbarItem.hpp> -#include <cppuhelper/compbase.hxx> -#include <cppuhelper/basemutex.hxx> +#include <comphelper/compbase.hxx> #include <vcl/vclptr.hxx> class StatusBar; @@ -31,19 +29,18 @@ namespace framework struct AddonStatusbarItemData; -typedef cppu::WeakComponentImplHelper< css::ui::XStatusbarItem > StatusbarItem_Base; +typedef comphelper::WeakComponentImplHelper< css::ui::XStatusbarItem > StatusbarItem_Base; -class StatusbarItem final : protected cppu::BaseMutex, - public StatusbarItem_Base +class StatusbarItem final : public StatusbarItem_Base { public: explicit StatusbarItem( StatusBar *pStatusBar, sal_uInt16 nId, - const OUString& aCommand ); + OUString aCommand ); virtual ~StatusbarItem() override; - void SAL_CALL disposing() override; + void disposing(std::unique_lock<std::mutex>&) override; // css::ui::XStatusbarItem Attributes virtual OUString SAL_CALL getCommand() override; @@ -76,6 +73,4 @@ private: } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx index 5fc341ae1588..c893e4abdc69 100644 --- a/framework/inc/uielement/statusbarmanager.hxx +++ b/framework/inc/uielement/statusbarmanager.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMANAGER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMANAGER_HXX +#pragma once #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XStatusbarController.hpp> @@ -27,10 +26,11 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <vcl/status.hxx> #include <vcl/vclptr.hxx> #include <map> +#include <mutex> namespace framework { @@ -45,8 +45,8 @@ class StatusBarManager final: public ::cppu::WeakImplHelper< friend class FrameworkStatusBar; public: - StatusBarManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext, - const css::uno::Reference< css::frame::XFrame >& rFrame, + StatusBarManager( css::uno::Reference< css::uno::XComponentContext > xContext, + css::uno::Reference< css::frame::XFrame > xFrame, StatusBar* pStatusBar ); virtual ~StatusBarManager() override; @@ -93,14 +93,12 @@ class StatusBarManager final: public ::cppu::WeakImplHelper< VclPtr<StatusBar> m_pStatusBar; css::uno::Reference< css::frame::XFrame > m_xFrame; StatusBarControllerMap m_aControllerMap; - osl::Mutex m_mutex; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + 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; }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMANAGER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusbarmerger.hxx b/framework/inc/uielement/statusbarmerger.hxx index ae7543be4360..1eaec5a88f81 100644 --- a/framework/inc/uielement/statusbarmerger.hxx +++ b/framework/inc/uielement/statusbarmerger.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMERGER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMERGER_HXX +#pragma once #include <sal/config.h> @@ -61,7 +60,7 @@ namespace StatusbarMerger sal_uInt16 nPos, sal_uInt16& rItemId, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const AddonStatusbarItemContainer& rItems ); bool ProcessMergeFallback( StatusBar* pStatusbar, @@ -73,6 +72,4 @@ namespace StatusbarMerger } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusbarwrapper.hxx b/framework/inc/uielement/statusbarwrapper.hxx index c8f0e53e11fa..c281b4f4866f 100644 --- a/framework/inc/uielement/statusbarwrapper.hxx +++ b/framework/inc/uielement/statusbarwrapper.hxx @@ -17,22 +17,22 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARWRAPPER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARWRAPPER_HXX +#pragma once #include <helper/uiconfigelementwrapperbase.hxx> - +#include <rtl/ref.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/uno/XComponentContext.hpp> namespace framework { +class StatusBarManager; class StatusBarWrapper final : public UIConfigElementWrapperBase { public: StatusBarWrapper( - const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + css::uno::Reference< css::uno::XComponentContext > xContext ); virtual ~StatusBarWrapper() override; // XComponent @@ -48,12 +48,10 @@ class StatusBarWrapper final : public UIConfigElementWrapperBase virtual void SAL_CALL updateSettings() override; private: - css::uno::Reference< css::lang::XComponent > m_xStatusBarManager; + rtl::Reference< StatusBarManager > m_xStatusBarManager; css::uno::Reference< css::uno::XComponentContext > m_xContext; }; } // namespace framework -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARWRAPPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/statusindicatorinterfacewrapper.hxx b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx index c9913de0d83c..abfae53e754f 100644 --- a/framework/inc/uielement/statusindicatorinterfacewrapper.hxx +++ b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX +#pragma once #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -51,6 +50,4 @@ class StatusIndicatorInterfaceWrapper final : public ::cppu::WeakImplHelper< css } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/styletoolbarcontroller.hxx b/framework/inc/uielement/styletoolbarcontroller.hxx index e6d596905e4c..45b1ad7eccce 100644 --- a/framework/inc/uielement/styletoolbarcontroller.hxx +++ b/framework/inc/uielement/styletoolbarcontroller.hxx @@ -7,8 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_STYLETOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_STYLETOOLBARCONTROLLER_HXX +#pragma once #include <svtools/toolboxcontroller.hxx> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -35,7 +34,7 @@ class StyleDispatcher final : public cppu::WeakImplHelper< css::frame::XDispatch { public: StyleDispatcher( const css::uno::Reference< css::frame::XFrame >& rFrame, - const css::uno::Reference< css::util::XURLTransformer >& rUrlTransformer, + css::uno::Reference< css::util::XURLTransformer > xUrlTransformer, const css::util::URL& rURL ); // XDispatch @@ -76,6 +75,4 @@ public: } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx index 9e667da83ba0..fe11433434b7 100644 --- a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx +++ b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/ControlCommand.hpp> @@ -51,7 +50,7 @@ class ToggleButtonToolbarController final : public ComplexToolbarController ToggleButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, Style eStyle, const OUString& aCommand ); virtual ~ToggleButtonToolbarController() override; @@ -74,6 +73,4 @@ class ToggleButtonToolbarController final : public ComplexToolbarController } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index d77ae16312aa..6af5e93aea65 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMANAGER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMANAGER_HXX +#pragma once #include <uielement/commandinfo.hxx> @@ -34,14 +33,19 @@ #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 <cppuhelper/interfacecontainer.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; @@ -51,6 +55,52 @@ class Menu; namespace framework { +class ImageOrientationController; +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 void InsertItem(ToolBoxItemId nId, + 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 OUString& 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, + sal_uInt16 nFirstItem, + 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, @@ -62,8 +112,13 @@ class ToolBarManager final : public ToolbarManager_Base public: ToolBarManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, - const OUString& rResourceName, + 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; @@ -86,7 +141,9 @@ class ToolBarManager final : public ToolbarManager_Base void CheckAndUpdateImages(); void RequestImages(); - void FillToolbar( const css::uno::Reference< css::container::XIndexAccess >& rToolBarData ); + void FillToolbar( const css::uno::Reference< css::container::XIndexAccess >& rToolBarData, + const css::uno::Reference< css::container::XIndexAccess >& rContextData, + const OUString& rContextToolbarName ); 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 ); @@ -100,6 +157,13 @@ class ToolBarManager final : public ToolbarManager_Base EXEC_CMD_DOCKALLTOOLBARS }; + enum ClickAction + { + Click, + DblClick, + Execute + }; + struct ExecuteInfo { OUString aToolbarResName; @@ -108,8 +172,10 @@ class ToolBarManager final : public ToolbarManager_Base css::uno::Reference< css::awt::XWindow > xWindow; }; - private: - DECL_LINK(Click, ToolBox *, void); + 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); @@ -124,6 +190,11 @@ class ToolBarManager final : public ToolbarManager_Base DECL_LINK( OverflowEventListener, VclWindowEvent&, void ); DECL_STATIC_LINK( ToolBarManager, ExecuteHdl_Impl, void*, void ); + private: + void Init(); + void FillToolbarFromContainer(const css::uno::Reference< css::container::XIndexAccess >& rItemContainer, + const OUString& rResourceName, ToolBoxItemId& nId, ToolBoxItemId& nAddonId); + void ToggleButton(const OUString& rResourceName, std::u16string_view rCommand); void AddCustomizeMenuItems(ToolBox const * pToolBar); void InitImageManager(); void RemoveControllers(); @@ -134,34 +205,37 @@ class ToolBarManager final : public ToolbarManager_Base //end void AddFrameActionListener(); void RefreshImages(); - ToolBoxItemBits ConvertStyleToToolboxItemBits( sal_Int32 nStyle ); + static ToolBoxItemBits ConvertStyleToToolboxItemBits( sal_Int32 nStyle ); css::uno::Reference< css::frame::XModel > GetModelFromFrame() const; bool IsPluginMode() const; - void HandleClick(void ( SAL_CALL css::frame::XToolbarController::*_pClick )( )); + void 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< sal_uInt16, css::uno::Reference< css::frame::XStatusListener > > ToolBarControllerMap; + 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_bAddedToTaskPaneList : 1, m_bFrameActionRegistered : 1, m_bUpdateControllers : 1; sal_Int16 m_eSymbolSize; + sal_uInt16 m_nContextMinPos; + std::unique_ptr<ToolBarManagerImpl> m_pImpl; VclPtr<ToolBox> m_pToolBar; + weld::Toolbar* m_pWeldedToolBar; OUString m_aModuleIdentifier; OUString m_aResourceName; + OUString m_aContextResourceName; css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; css::uno::Reference< css::frame::XFrame > m_xFrame; ToolBarControllerMap m_aControllerMap; - osl::Mutex m_mutex; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + 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; @@ -173,10 +247,9 @@ class ToolBarManager final : public ToolbarManager_Base OUString m_sIconTheme; rtl::Reference< ToolBarManager > m_aOverflowManager; + rtl::Reference< ImageOrientationController > m_aImageController; }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMANAGER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx index b62e3be6972c..b84ca2005e39 100644 --- a/framework/inc/uielement/toolbarmerger.hxx +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMERGER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMERGER_HXX +#pragma once #include <sal/config.h> @@ -63,7 +62,7 @@ struct ReferenceToolbarPathInfo class ToolBarMerger { public: - static bool IsCorrectContext( const OUString& aContext, std::u16string_view aModuleIdentifier ); + 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 ); @@ -76,20 +75,20 @@ class ToolBarMerger OUString& rControlType, sal_uInt16& rWidth ); - static ReferenceToolbarPathInfo FindReferencePoint( const ToolBox* pToolbar, + static ReferenceToolbarPathInfo FindReferencePoint( const ToolBox* pToolbar, sal_uInt16 nFirstItem, std::u16string_view rReferencePoint ); static bool ProcessMergeOperation( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const AddonToolbarItemContainer& rItems ); static bool ProcessMergeFallback( ToolBox* pToolbar, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, @@ -99,34 +98,34 @@ class ToolBarMerger static void MergeItems( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, sal_uInt16 nModIndex, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ); static void ReplaceItem( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ); static void RemoveItems( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - const OUString& rMergeCommandParameter ); + std::u16string_view rMergeCommandParameter ); - static ::cppu::OWeakObject* CreateController( + 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, - sal_uInt16 nId, + ToolBoxItemId nId, sal_uInt16 nWidth, std::u16string_view rControlType ); static void CreateToolbarItem( ToolBox* pToolbox, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16 nItemId, + ToolBoxItemId nItemId, const AddonToolbarItem& rAddonToolbarItem ); private: @@ -136,6 +135,4 @@ class ToolBarMerger } // namespace framework -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMERGER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/toolbarmodemenucontroller.hxx b/framework/inc/uielement/toolbarmodemenucontroller.hxx index fb3072c6bbf7..cee2b0dac3a0 100644 --- a/framework/inc/uielement/toolbarmodemenucontroller.hxx +++ b/framework/inc/uielement/toolbarmodemenucontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMODEMENUCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMODEMENUCONTROLLER_HXX +#pragma once #include <svtools/popupmenucontrollerbase.hxx> @@ -57,6 +56,4 @@ namespace framework }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARMODEMENUCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/toolbarsmenucontroller.hxx b/framework/inc/uielement/toolbarsmenucontroller.hxx index 5016235f9c16..23d07ef509d6 100644 --- a/framework/inc/uielement/toolbarsmenucontroller.hxx +++ b/framework/inc/uielement/toolbarsmenucontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX +#pragma once #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> @@ -49,9 +48,6 @@ namespace framework // 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; @@ -65,15 +61,17 @@ namespace framework struct ExecuteInfo { css::uno::Reference< css::frame::XDispatch > xDispatch; - css::util::URL aTargetURL; - css::uno::Sequence< css::beans::PropertyValue > aArgs; + css::util::URL aTargetURL; }; DECL_STATIC_LINK( ToolbarsMenuController, ExecuteHdl_Impl, void*, void ); private: + // XInitialization + virtual void initializeImpl( std::unique_lock<std::mutex>& rGuard, const css::uno::Sequence< css::uno::Any >& aArguments ) override; + 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 ); + static 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 ); @@ -87,6 +85,4 @@ namespace framework }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/toolbarwrapper.hxx b/framework/inc/uielement/toolbarwrapper.hxx index 60d5759f6316..6325c0b54183 100644 --- a/framework/inc/uielement/toolbarwrapper.hxx +++ b/framework/inc/uielement/toolbarwrapper.hxx @@ -17,31 +17,36 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARWRAPPER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARWRAPPER_HXX +#pragma once #include <helper/uiconfigelementwrapperbase.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/ui/XUIFunctionListener.hpp> +#include <com/sun/star/ui/XContextChangeEventListener.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <rtl/ref.hxx> +#include <memory> -namespace framework +namespace weld { + class Builder; + class Container; + class Toolbar; +} +namespace framework +{ class ToolBarManager; -class ToolBarWrapper final : public css::ui::XUIFunctionListener, - public UIConfigElementWrapperBase + +class ToolBarWrapper final : public cppu::ImplInheritanceHelper<UIConfigElementWrapperBase, + css::ui::XUIFunctionListener, + css::ui::XContextChangeEventListener> { public: ToolBarWrapper( const css::uno::Reference< css::uno::XComponentContext >& xContext ); virtual ~ToolBarWrapper() override; - // XInterface - virtual void SAL_CALL acquire() throw() override; - virtual void SAL_CALL release() throw() override; - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - // XComponent virtual void SAL_CALL dispose() override; @@ -60,6 +65,9 @@ class ToolBarWrapper final : public css::ui::XUIFunctionListener, // XUIFunctionListener virtual void SAL_CALL functionExecute( const OUString& aUIElementName, const OUString& aCommand ) override; + // XContextChangeEventListener + virtual void SAL_CALL notifyContextChangeEvent( const css::ui::ContextChangeEventObject& aEvent ) override; + // XEventListener using cppu::OPropertySetHelper::disposing; virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) override; @@ -68,12 +76,15 @@ class ToolBarWrapper final : public css::ui::XUIFunctionListener, 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; + rtl::Reference< ToolBarManager > m_xToolBarManager; css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::ui::XUIElement > m_xSubElement; + + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Container> m_xTopLevel; + std::unique_ptr<weld::Toolbar> m_xWeldedToolbar; }; } -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_TOOLBARWRAPPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/uicommanddescription.hxx b/framework/inc/uielement/uicommanddescription.hxx index 146b4f42db3a..aeeb1f9aa216 100644 --- a/framework/inc/uielement/uicommanddescription.hxx +++ b/framework/inc/uielement/uicommanddescription.hxx @@ -26,19 +26,17 @@ #include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/basemutex.hxx> -#include <cppuhelper/compbase.hxx> +#include <comphelper/compbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <rtl/ustring.hxx> #include <i18nlangtag/languagetag.hxx> namespace framework { -typedef ::cppu::WeakComponentImplHelper< css::lang::XServiceInfo, +typedef comphelper::WeakComponentImplHelper< css::lang::XServiceInfo, css::container::XNameAccess > UICommandDescription_BASE; -class UICommandDescription : private cppu::BaseMutex, - public UICommandDescription_BASE +class UICommandDescription : public UICommandDescription_BASE { public: UICommandDescription( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); diff --git a/framework/inc/uielement/uielement.hxx b/framework/inc/uielement/uielement.hxx index 9e63b1c0f68f..8e6f0c7de470 100644 --- a/framework/inc/uielement/uielement.hxx +++ b/framework/inc/uielement/uielement.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_UIELEMENT_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_UIELEMENT_HXX +#pragma once #include <com/sun/star/ui/XUIElement.hpp> #include <com/sun/star/ui/DockingArea.hpp> @@ -26,6 +25,7 @@ #include <com/sun/star/awt/Size.hpp> #include <rtl/ustring.hxx> +#include <utility> #include <vcl/toolbox.hxx> namespace framework @@ -66,12 +66,12 @@ struct UIElement m_nStyle( ButtonType::SYMBOLONLY ) {} - UIElement( const OUString& rName, - const OUString& rType, - const css::uno::Reference< css::ui::XUIElement >& rUIElement - ) : m_aType( rType ), - m_aName( rName ), - m_xUIElement( rUIElement ), + 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 ), @@ -103,6 +103,4 @@ typedef std::vector< UIElement > UIElementVector; } // namespace framework -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_UIELEMENT_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/uielementtypenames.hxx b/framework/inc/uielement/uielementtypenames.hxx index cd5617a8afef..a248a0d9f259 100644 --- a/framework/inc/uielement/uielementtypenames.hxx +++ b/framework/inc/uielement/uielementtypenames.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_UIELEMENTTYPENAMES_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_UIELEMENTTYPENAMES_HXX +#pragma once #define UIELEMENTTYPE_MENUBAR_NAME "menubar" #define UIELEMENTTYPE_POPUPMENU_NAME "popupmenu" @@ -28,6 +27,4 @@ #define UIELEMENTTYPE_PROGRESSBAR_NAME "progressbar" #define UIELEMENTTYPE_TOOLPANEL_NAME "toolpanel" -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_UIELEMENTTYPENAMES_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |