diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /toolkit/inc/helper | |
parent | Initial commit. (diff) | |
download | libreoffice-cb75148ebd0135178ff46f89a30139c44f8d2040.tar.xz libreoffice-cb75148ebd0135178ff46f89a30139c44f8d2040.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/inc/helper')
-rw-r--r-- | toolkit/inc/helper/accessibilityclient.hxx | 57 | ||||
-rw-r--r-- | toolkit/inc/helper/btndlg.hxx | 89 | ||||
-rw-r--r-- | toolkit/inc/helper/imagealign.hxx | 52 | ||||
-rw-r--r-- | toolkit/inc/helper/msgbox.hxx | 79 | ||||
-rw-r--r-- | toolkit/inc/helper/scrollabledialog.hxx | 66 | ||||
-rw-r--r-- | toolkit/inc/helper/servicenames.hxx | 24 | ||||
-rw-r--r-- | toolkit/inc/helper/tkresmgr.hxx | 34 | ||||
-rw-r--r-- | toolkit/inc/helper/unopropertyarrayhelper.hxx | 52 | ||||
-rw-r--r-- | toolkit/inc/helper/unowrapper.hxx | 73 |
9 files changed, 526 insertions, 0 deletions
diff --git a/toolkit/inc/helper/accessibilityclient.hxx b/toolkit/inc/helper/accessibilityclient.hxx new file mode 100644 index 000000000..f90414671 --- /dev/null +++ b/toolkit/inc/helper/accessibilityclient.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_INC_HELPER_ACCESSIBILITYCLIENT_HXX +#define INCLUDED_TOOLKIT_INC_HELPER_ACCESSIBILITYCLIENT_HXX + +#include <toolkit/helper/accessiblefactory.hxx> + +namespace toolkit +{ + /** a client for the accessibility implementations which have been + outsourced from the main toolkit library + + All instances of this class share a reference to a common IAccessibleFactory + instance, which is used for creating all kind of Accessibility related + components. + + When the AccessibilityClient goes away, also this factory goes away, and the respective + library is unloaded. + + This class is not thread-safe. + */ + class AccessibilityClient + { + private: + bool m_bInitialized; + + public: + AccessibilityClient(); + + IAccessibleFactory& getFactory(); + + private: + void ensureInitialized(); + }; + +} // namespace toolkit + +#endif // INCLUDED_TOOLKIT_INC_HELPER_ACCESSIBILITYCLIENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/btndlg.hxx b/toolkit/inc/helper/btndlg.hxx new file mode 100644 index 000000000..8894b8dec --- /dev/null +++ b/toolkit/inc/helper/btndlg.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 . + */ + +#ifndef INCLUDED_VCL_BTNDLG_HXX +#define INCLUDED_VCL_BTNDLG_HXX + +#include <vcl/toolkit/dialog.hxx> +#include <o3tl/typed_flags_set.hxx> + +#include <vector> +#include <memory> + +struct ImplBtnDlgItem; +class PushButton; +class Button; + +#define BUTTONDIALOG_BUTTON_NOTFOUND (sal_uInt16(0xFFFF)) + +enum class ButtonDialogFlags +{ + NONE = 0x0000, + Default = 0x0001, + OK = 0x0002, + Cancel = 0x0004, + Help = 0x0008, + Focus = 0x0010, +}; +namespace o3tl +{ + template<> struct typed_flags<ButtonDialogFlags> : is_typed_flags<ButtonDialogFlags, 0x001f> {}; +} + +class ButtonDialog : public Dialog +{ +public: + virtual ~ButtonDialog() override; + virtual void dispose() override; + + virtual void Resize() override; + virtual void StateChanged( StateChangedType nStateChange ) override; + + void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; } + + void AddButton( StandardButtonType eType, sal_uInt16 nId, ButtonDialogFlags nBtnFlags, tools::Long nSepPixel = 0 ); + void RemoveButton( sal_uInt16 nId ); + +protected: + ButtonDialog( WindowType nType ); + tools::Long ImplGetButtonSize(); + +private: + ButtonDialog( const ButtonDialog & ) = delete; + ButtonDialog& operator=( const ButtonDialog& ) = delete; + +private: + std::vector<std::unique_ptr<ImplBtnDlgItem>> m_ItemList; + Size maPageSize; + Size maCtrlSize; + tools::Long mnButtonSize; + sal_uInt16 mnCurButtonId; + sal_uInt16 mnFocusButtonId; + bool mbFormat; + + void ImplInitButtonDialogData(); + VclPtr<PushButton> ImplCreatePushButton( ButtonDialogFlags nBtnFlags ); + DECL_LINK( ImplClickHdl, Button* pBtn, void ); + void ImplPosControls(); + +}; + +#endif // INCLUDED_VCL_BTNDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/imagealign.hxx b/toolkit/inc/helper/imagealign.hxx new file mode 100644 index 000000000..087a9f540 --- /dev/null +++ b/toolkit/inc/helper/imagealign.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 . + */ + +#ifndef INCLUDED_TOOLKIT_INC_HELPER_IMAGEALIGN_HXX +#define INCLUDED_TOOLKIT_INC_HELPER_IMAGEALIGN_HXX + +#include <sal/types.h> +#include <tools/wintypes.hxx> + +namespace toolkit +{ + + + /** translates a VCL ImageAlign value into a css.awt.ImagePosition value + */ + sal_Int16 translateImagePosition( ImageAlign _eVCLAlign ); + + /** translates a css.awt.ImagePosition value into a VCL ImageAlign + */ + ImageAlign translateImagePosition( sal_Int16 _nImagePosition ); + + /** translates a VCL ImageAlign value into a compatible css.awt.ImageAlign value + */ + sal_Int16 getCompatibleImageAlign( ImageAlign _eAlign ); + + /** translates a css.awt.ImageAlign value into a css.awt.ImagePosition value + */ + sal_Int16 getExtendedImagePosition( sal_Int16 _nImageAlign ); + + +} // namespace toolkit + + +#endif // INCLUDED_TOOLKIT_INC_HELPER_IMAGEALIGN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/msgbox.hxx b/toolkit/inc/helper/msgbox.hxx new file mode 100644 index 000000000..cef129cf4 --- /dev/null +++ b/toolkit/inc/helper/msgbox.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <o3tl/typed_flags_set.hxx> +#include <helper/btndlg.hxx> +#include <vcl/toolkit/fixed.hxx> +#include <vcl/toolkit/vclmedit.hxx> + +// Window-Bits for MessageBoxen +enum class MessBoxStyle +{ + NONE = 0x0000, + Ok = 0x0001, + OkCancel = 0x0002, + YesNo = 0x0004, + YesNoCancel = 0x0008, + RetryCancel = 0x0010, + DefaultOk = 0x0020, + DefaultCancel = 0x0040, + DefaultRetry = 0x0080, + DefaultYes = 0x0100, + DefaultNo = 0x0200, + AbortRetryIgnore = 0x1000, + DefaultIgnore = 0x2000, +}; +namespace o3tl +{ +template <> struct typed_flags<MessBoxStyle> : is_typed_flags<MessBoxStyle, 0x33ff> +{ +}; +} + +class MessBox : public ButtonDialog +{ + VclPtr<VclMultiLineEdit> mpVCLMultiLineEdit; + VclPtr<FixedImage> mpFixedImage; + Image maImage; + bool mbHelpBtn; + MessBoxStyle mnMessBoxStyle; + +protected: + OUString maMessText; + + void ImplInitButtons(); + void ImplPosControls(); + +public: + MessBox(vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits n, const OUString& rTitle, + const OUString& rMessage); + virtual ~MessBox() override; + virtual void dispose() override; + + virtual void StateChanged(StateChangedType nStateChange) override; + + void SetMessText(const OUString& rText) { maMessText = rText; } + const OUString& GetMessText() const { return maMessText; } + + void SetImage(const Image& rImage) { maImage = rImage; } + + virtual Size GetOptimalSize() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/scrollabledialog.hxx b/toolkit/inc/helper/scrollabledialog.hxx new file mode 100644 index 000000000..26068b4f5 --- /dev/null +++ b/toolkit/inc/helper/scrollabledialog.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_AWT_SCROLLABLEDIALOG_HXX +#define INCLUDED_TOOLKIT_AWT_SCROLLABLEDIALOG_HXX + +#include <vcl/toolkit/dialog.hxx> +#include <vcl/scrbar.hxx> + +namespace toolkit +{ + class ScrollableDialog final : public Dialog + { + public: + enum ScrollBarVisibility { None, Vert, Hori, Both }; + + private: + VclPtr<ScrollBar> maHScrollBar; + VclPtr<ScrollBar> maVScrollBar; + Size maScrollArea; + bool mbHasHoriBar; + bool mbHasVertBar; + Point mnScrollPos; + tools::Long mnScrWidth; + ScrollBarVisibility maScrollVis; + + void lcl_Scroll( tools::Long nX, tools::Long nY ); + DECL_LINK( ScrollBarHdl, ScrollBar*, void ); + + public: + ScrollableDialog( vcl::Window* pParent, WinBits nStyle, Dialog::InitFlag eFlag = Dialog::InitFlag::Default ); + virtual ~ScrollableDialog() override; + virtual void dispose() override; + // Window + virtual void Resize() override; + + void SetScrollWidth( tools::Long nWidth ); + void SetScrollHeight( tools::Long nHeight ); + void SetScrollLeft( tools::Long nLeft ); + void SetScrollTop( tools::Long Top ); + void setScrollVisibility( ScrollBarVisibility rState ); + void ResetScrollBars(); + }; + +} // namespacetoolkit + + +#endif // INCLUDED_TOOLKIT_AWT_SCROLLABLEDIALOG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/servicenames.hxx b/toolkit/inc/helper/servicenames.hxx new file mode 100644 index 000000000..7fb7ab2a5 --- /dev/null +++ b/toolkit/inc/helper/servicenames.hxx @@ -0,0 +1,24 @@ +/* -*- 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 + +extern const char szServiceName_UnoControlDialog[]; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/tkresmgr.hxx b/toolkit/inc/helper/tkresmgr.hxx new file mode 100644 index 000000000..70cc4118c --- /dev/null +++ b/toolkit/inc/helper/tkresmgr.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_INC_HELPER_TKRESMGR_HXX +#define INCLUDED_TOOLKIT_INC_HELPER_TKRESMGR_HXX + +#include <rtl/ustring.hxx> + +class Image; + +namespace TkResMgr +{ +Image getImageFromURL(const OUString& i_rImageURL); +}; + +#endif // INCLUDED_TOOLKIT_INC_HELPER_TKRESMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/unopropertyarrayhelper.hxx b/toolkit/inc/helper/unopropertyarrayhelper.hxx new file mode 100644 index 000000000..31940ec4c --- /dev/null +++ b/toolkit/inc/helper/unopropertyarrayhelper.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 . + */ + +#ifndef INCLUDED_TOOLKIT_INC_HELPER_UNOPROPERTYARRAYHELPER_HXX +#define INCLUDED_TOOLKIT_INC_HELPER_UNOPROPERTYARRAYHELPER_HXX + +#include <cppuhelper/propshlp.hxx> + +#include <vector> +#include <o3tl/sorted_vector.hxx> + + + +class UnoPropertyArrayHelper final : public ::cppu::IPropertyArrayHelper +{ + o3tl::sorted_vector<sal_Int32> maIDs; + + bool ImplHasProperty( sal_uInt16 nPropId ) const; + +public: + UnoPropertyArrayHelper( const css::uno::Sequence<sal_Int32>& rIDs ); + UnoPropertyArrayHelper( const std::vector< sal_uInt16 > &rIDs ); + + // ::cppu::IPropertyArrayHelper + sal_Bool SAL_CALL fillPropertyMembersByHandle( OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) override; + css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override; + css::beans::Property SAL_CALL getPropertyByName(const OUString& rPropertyName) override; + sal_Bool SAL_CALL hasPropertyByName(const OUString& rPropertyName) override; + sal_Int32 SAL_CALL getHandleByName( const OUString & rPropertyName ) override; + sal_Int32 SAL_CALL fillHandles( sal_Int32* pHandles, const css::uno::Sequence< OUString > & rPropNames ) override; +}; + + +#endif // INCLUDED_TOOLKIT_INC_HELPER_UNOPROPERTYARRAYHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/unowrapper.hxx b/toolkit/inc/helper/unowrapper.hxx new file mode 100644 index 000000000..03a9b525c --- /dev/null +++ b/toolkit/inc/helper/unowrapper.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 . + */ + +#ifndef INCLUDED_TOOLKIT_INC_HELPER_UNOWRAPPER_HXX +#define INCLUDED_TOOLKIT_INC_HELPER_UNOWRAPPER_HXX + +#include <com/sun/star/awt/XToolkit.hpp> +#include <com/sun/star/awt/XGraphics.hpp> +#include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +#include <vcl/toolkit/unowrap.hxx> +#include <vcl/window.hxx> + +#include <helper/accessibilityclient.hxx> + + + +class UnoWrapper final : public UnoWrapperBase +{ +private: + css::uno::Reference< css::awt::XToolkit> mxToolkit; + ::toolkit::AccessibilityClient maAccessibleFactoryAccess; + +public: + UnoWrapper( const css::uno::Reference< css::awt::XToolkit>& rxToolkit ); + + virtual void Destroy() override; + + // Toolkit + virtual css::uno::Reference< css::awt::XToolkit> GetVCLToolkit() override; + + // Graphics + virtual css::uno::Reference< css::awt::XGraphics> CreateGraphics( OutputDevice* pOutDev ) override; + virtual void ReleaseAllGraphics( OutputDevice* pOutDev ) override; + + // Window + virtual css::uno::Reference< css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) override; + virtual void SetWindowInterface( vcl::Window* pWindow, const css::uno::Reference< css::awt::XWindowPeer> & xIFace ) override; + virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) override; + + // Menu + virtual css::uno::Reference<css::awt::XPopupMenu> CreateMenuInterface( PopupMenu* pPopupMenu ) override; + + void WindowDestroyed( vcl::Window* pWindow ) override; + + // Accessibility + virtual css::uno::Reference< css::accessibility::XAccessible > + CreateAccessible( Menu* pMenu, bool bIsMenuBar ) override; + +private: + virtual ~UnoWrapper(); +}; + +#endif // INCLUDED_TOOLKIT_INC_HELPER_UNOWRAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |