diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /include/toolkit/helper | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/toolkit/helper')
-rw-r--r-- | include/toolkit/helper/accessiblefactory.hxx | 139 | ||||
-rw-r--r-- | include/toolkit/helper/convert.hxx | 61 | ||||
-rw-r--r-- | include/toolkit/helper/emptyfontdescriptor.hxx | 42 | ||||
-rw-r--r-- | include/toolkit/helper/formpdfexport.hxx | 55 | ||||
-rw-r--r-- | include/toolkit/helper/listenermultiplexer.hxx | 263 | ||||
-rw-r--r-- | include/toolkit/helper/macros.hxx | 158 | ||||
-rw-r--r-- | include/toolkit/helper/mutexandbroadcasthelper.hxx | 44 | ||||
-rw-r--r-- | include/toolkit/helper/mutexhelper.hxx | 41 | ||||
-rw-r--r-- | include/toolkit/helper/property.hxx | 250 | ||||
-rw-r--r-- | include/toolkit/helper/vclunohelper.hxx | 156 |
10 files changed, 1209 insertions, 0 deletions
diff --git a/include/toolkit/helper/accessiblefactory.hxx b/include/toolkit/helper/accessiblefactory.hxx new file mode 100644 index 000000000..109e1cbea --- /dev/null +++ b/include/toolkit/helper/accessiblefactory.hxx @@ -0,0 +1,139 @@ +/* -*- 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_HELPER_ACCESSIBLEFACTORY_HXX +#define INCLUDED_TOOLKIT_HELPER_ACCESSIBLEFACTORY_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <salhelper/simplereferenceobject.hxx> + +namespace com::sun::star::accessibility { + class XAccessible; + class XAccessibleContext; +} +class VCLXButton; +class VCLXCheckBox; +class VCLXRadioButton; +class VCLXListBox; +class VCLXFixedHyperlink; +class VCLXFixedText; +class VCLXScrollBar; +class VCLXEdit; +class VCLXComboBox; +class VCLXToolBox; +class VCLXHeaderBar; +class VCLXWindow; +class Menu; + + +namespace toolkit +{ + + + /** a function which is able to create a factory for the standard Accessible/Context + components needed for standard toolkit controls + + The returned pointer denotes an instance of the IAccessibleFactory, which has been acquired + <em>once</em>. The caller is responsible for holding this reference as long as it needs the + factory, and release it afterwards. + */ + typedef void* (* GetStandardAccComponentFactory)( ); + + + //= IAccessibleFactory + + class IAccessibleFactory : public virtual salhelper::SimpleReferenceObject + { + public: + /** creates an accessible context for a button window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXButton* _pXWindow ) = 0; + + /** creates an accessible context for a checkbox window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXCheckBox* _pXWindow ) = 0; + + /** creates an accessible context for a radio button window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXRadioButton* _pXWindow ) = 0; + + /** creates an accessible context for a listbox window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXListBox* _pXWindow ) = 0; + + /** creates an accessible context for a fixed hyperlink window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXFixedHyperlink* _pXWindow ) = 0; + + /** creates an accessible context for a fixed text window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXFixedText* _pXWindow ) = 0; + + /** creates an accessible context for a scrollbar window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXScrollBar* _pXWindow ) = 0; + + /** creates an accessible context for an edit window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXEdit* _pXWindow ) = 0; + + /** creates an accessible context for a combo box window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXComboBox* _pXWindow ) = 0; + + /** creates an accessible context for a toolbox window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXToolBox* _pXWindow ) = 0; + + /** creates an accessible context for a headerbar window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXHeaderBar* _pXWindow ) = 0; + + /** creates an accessible context for a generic window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXWindow* _pXWindow ) = 0; + + /** creates an accessible component for the given menu + */ + virtual css::uno::Reference< css::accessibility::XAccessible > + createAccessible( Menu* _pMenu, bool _bIsMenuBar ) = 0; + + protected: + virtual ~IAccessibleFactory() override {} + }; + + +} // namespace toolkit + + +#endif // INCLUDED_TOOLKIT_HELPER_ACCESSIBLEFACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/convert.hxx b/include/toolkit/helper/convert.hxx new file mode 100644 index 000000000..3e4d23696 --- /dev/null +++ b/include/toolkit/helper/convert.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_HELPER_CONVERT_HXX +#define INCLUDED_TOOLKIT_HELPER_CONVERT_HXX + +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/awt/Point.hpp> + +#include <tools/gen.hxx> + +inline css::awt::Size AWTSize( const Size& rVCLSize ) +{ + return css::awt::Size( rVCLSize.Width(), rVCLSize.Height() ); +} + +inline ::Size VCLSize( const css::awt::Size& rAWTSize ) +{ + return ::Size( rAWTSize.Width, rAWTSize.Height ); +} + +inline css::awt::Point AWTPoint( const ::Point& rVCLPoint ) +{ + return css::awt::Point( rVCLPoint.X(), rVCLPoint.Y() ); +} + +inline ::Point VCLPoint( const css::awt::Point& rAWTPoint ) +{ + return ::Point( rAWTPoint.X, rAWTPoint.Y ); +} + +inline css::awt::Rectangle AWTRectangle( const ::tools::Rectangle& rVCLRect ) +{ + return css::awt::Rectangle( rVCLRect.Left(), rVCLRect.Top(), rVCLRect.GetWidth(), rVCLRect.GetHeight() ); +} + +inline ::tools::Rectangle VCLRectangle( const css::awt::Rectangle& rAWTRect ) +{ + return ::tools::Rectangle( ::Point( rAWTRect.X, rAWTRect.Y ), ::Size( rAWTRect.Width, rAWTRect.Height ) ); +} + +#endif // INCLUDED_TOOLKIT_HELPER_CONVERT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/emptyfontdescriptor.hxx b/include/toolkit/helper/emptyfontdescriptor.hxx new file mode 100644 index 000000000..ffd6f65b6 --- /dev/null +++ b/include/toolkit/helper/emptyfontdescriptor.hxx @@ -0,0 +1,42 @@ +/* -*- 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/awt/FontDescriptor.hpp> +#include <com/sun/star/awt/FontSlant.hpp> +#include <com/sun/star/awt/FontUnderline.hpp> +#include <com/sun/star/awt/FontStrikeout.hpp> + + + +class EmptyFontDescriptor : public css::awt::FontDescriptor +{ +public: + EmptyFontDescriptor() + { + // Not all enums are initialized correctly in FontDescriptor-CTOR because + // they are set to the first enum value, this is not always the default value. + Slant = css::awt::FontSlant_DONTKNOW; + Underline = css::awt::FontUnderline::DONTKNOW; + Strikeout = css::awt::FontStrikeout::DONTKNOW; + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/formpdfexport.hxx b/include/toolkit/helper/formpdfexport.hxx new file mode 100644 index 000000000..d1aa35ebf --- /dev/null +++ b/include/toolkit/helper/formpdfexport.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_HELPER_FORMPDFEXPORT_HXX +#define INCLUDED_TOOLKIT_HELPER_FORMPDFEXPORT_HXX + +#include <toolkit/dllapi.h> + +#include <vcl/pdfwriter.hxx> + +#include <memory> + +namespace com::sun::star::awt { class XControl; } +namespace com::sun::star::uno { template <class interface_type> class Reference; } + +namespace vcl +{ + class PDFExtOutDevData; +} + + +namespace toolkitform +{ + + + /** creates a PDF compatible control descriptor for the given control + */ + std::unique_ptr<vcl::PDFWriter::AnyWidget> TOOLKIT_DLLPUBLIC describePDFControl( + const css::uno::Reference< css::awt::XControl >& _rxControl, + vcl::PDFExtOutDevData& i_pdfExportData + ); + + +} // namespace toolkitform + + +#endif // INCLUDED_TOOLKIT_HELPER_FORMPDFEXPORT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/listenermultiplexer.hxx b/include/toolkit/helper/listenermultiplexer.hxx new file mode 100644 index 000000000..a837aeb83 --- /dev/null +++ b/include/toolkit/helper/listenermultiplexer.hxx @@ -0,0 +1,263 @@ +/* -*- 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_HELPER_LISTENERMULTIPLEXER_HXX +#define INCLUDED_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX + +#include <config_options.h> +#include <toolkit/dllapi.h> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/awt/XVclContainerListener.hpp> +#include <com/sun/star/awt/XKeyListener.hpp> +#include <com/sun/star/awt/XMouseListener.hpp> +#include <com/sun/star/awt/XMouseMotionListener.hpp> +#include <com/sun/star/awt/XPaintListener.hpp> +#include <com/sun/star/awt/XTopWindowListener.hpp> +#include <com/sun/star/awt/XTextListener.hpp> +#include <com/sun/star/awt/XActionListener.hpp> +#include <com/sun/star/awt/XItemListener.hpp> +#include <com/sun/star/awt/XTabListener.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/awt/XSpinListener.hpp> +#include <com/sun/star/awt/XAdjustmentListener.hpp> +#include <com/sun/star/awt/XMenuListener.hpp> +#include <com/sun/star/awt/tree/XTreeExpansionListener.hpp> +#include <com/sun/star/awt/tree/XTreeEditListener.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> +#include <cppuhelper/weak.hxx> +#include <comphelper/interfacecontainer2.hxx> +#include <toolkit/helper/mutexhelper.hxx> +#include <toolkit/helper/macros.hxx> +#include <com/sun/star/awt/grid/XGridSelectionListener.hpp> +#include <com/sun/star/awt/tab/XTabPageContainerListener.hpp> + +// class ListenerMultiplexerBase + + +class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) ListenerMultiplexerBase : public MutexHelper, + public ::comphelper::OInterfaceContainerHelper2, + public css::uno::XInterface +{ +private: + ::cppu::OWeakObject& mrContext; + +protected: + ::cppu::OWeakObject& GetContext() { return mrContext; } + +public: + ListenerMultiplexerBase( ::cppu::OWeakObject& rSource ); + virtual ~ListenerMultiplexerBase(); + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() throw() override { mrContext.acquire(); } + void SAL_CALL release() throw() override { mrContext.release(); } +}; + + +// class EventListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( EventListenerMultiplexer, css::lang::XEventListener ) +DECL_LISTENERMULTIPLEXER_END + + +// class FocusListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( FocusListenerMultiplexer, css::awt::XFocusListener ) + void SAL_CALL focusGained( const css::awt::FocusEvent& e ) override; + void SAL_CALL focusLost( const css::awt::FocusEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class WindowListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( WindowListenerMultiplexer, css::awt::XWindowListener ) + void SAL_CALL windowResized( const css::awt::WindowEvent& e ) override; + void SAL_CALL windowMoved( const css::awt::WindowEvent& e ) override; + void SAL_CALL windowShown( const css::lang::EventObject& e ) override; + void SAL_CALL windowHidden( const css::lang::EventObject& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class VclContainerListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( VclContainerListenerMultiplexer, css::awt::XVclContainerListener ) + void SAL_CALL windowAdded( const css::awt::VclContainerEvent& e ) override; + void SAL_CALL windowRemoved( const css::awt::VclContainerEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class KeyListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( KeyListenerMultiplexer, css::awt::XKeyListener ) + void SAL_CALL keyPressed( const css::awt::KeyEvent& e ) override; + void SAL_CALL keyReleased( const css::awt::KeyEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class MouseListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer, css::awt::XMouseListener ) + void SAL_CALL mousePressed( const css::awt::MouseEvent& e ) override; + void SAL_CALL mouseReleased( const css::awt::MouseEvent& e ) override; + void SAL_CALL mouseEntered( const css::awt::MouseEvent& e ) override; + void SAL_CALL mouseExited( const css::awt::MouseEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class MouseMotionListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseMotionListenerMultiplexer, css::awt::XMouseMotionListener ) + void SAL_CALL mouseDragged( const css::awt::MouseEvent& e ) override; + void SAL_CALL mouseMoved( const css::awt::MouseEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class PaintListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( PaintListenerMultiplexer, css::awt::XPaintListener ) + void SAL_CALL windowPaint( const css::awt::PaintEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TopWindowListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TopWindowListenerMultiplexer, css::awt::XTopWindowListener ) + void SAL_CALL windowOpened( const css::lang::EventObject& e ) override; + void SAL_CALL windowClosing( const css::lang::EventObject& e ) override; + void SAL_CALL windowClosed( const css::lang::EventObject& e ) override; + void SAL_CALL windowMinimized( const css::lang::EventObject& e ) override; + void SAL_CALL windowNormalized( const css::lang::EventObject& e ) override; + void SAL_CALL windowActivated( const css::lang::EventObject& e ) override; + void SAL_CALL windowDeactivated( const css::lang::EventObject& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TextListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( TextListenerMultiplexer, css::awt::XTextListener ) + void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class ActionListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( ActionListenerMultiplexer, css::awt::XActionListener ) + void SAL_CALL actionPerformed( const css::awt::ActionEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class ItemListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( ItemListenerMultiplexer, css::awt::XItemListener ) + void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TabListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TabListenerMultiplexer, css::awt::XTabListener ) + void SAL_CALL inserted( ::sal_Int32 ID ) override; + void SAL_CALL removed( ::sal_Int32 ID ) override; + void SAL_CALL changed( ::sal_Int32 ID, const css::uno::Sequence< css::beans::NamedValue >& Properties ) override; + void SAL_CALL activated( ::sal_Int32 ID ) override; + void SAL_CALL deactivated( ::sal_Int32 ID ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class ContainerListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer, css::container::XContainerListener ) + void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override; + void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override; + void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class SpinListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( SpinListenerMultiplexer, css::awt::XSpinListener ) + void SAL_CALL up( const css::awt::SpinEvent& rEvent ) override; + void SAL_CALL down( const css::awt::SpinEvent& rEvent ) override; + void SAL_CALL first( const css::awt::SpinEvent& rEvent ) override; + void SAL_CALL last( const css::awt::SpinEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class AdjustmentListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( AdjustmentListenerMultiplexer, css::awt::XAdjustmentListener ) + void SAL_CALL adjustmentValueChanged( const css::awt::AdjustmentEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class MenuListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer, css::awt::XMenuListener ) + void SAL_CALL itemHighlighted( const css::awt::MenuEvent& rEvent ) override; + void SAL_CALL itemSelected( const css::awt::MenuEvent& rEvent ) override; + void SAL_CALL itemActivated( const css::awt::MenuEvent& rEvent ) override; + void SAL_CALL itemDeactivated( const css::awt::MenuEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TreeSelectionListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TreeSelectionListenerMultiplexer, css::view::XSelectionChangeListener ) + virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TreeExpansionListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TreeExpansionListenerMultiplexer, css::awt::tree::XTreeExpansionListener ) + virtual void SAL_CALL requestChildNodes( const css::awt::tree::TreeExpansionEvent& aEvent ) override; + virtual void SAL_CALL treeExpanding( const css::awt::tree::TreeExpansionEvent& aEvent ) override; + virtual void SAL_CALL treeCollapsing( const css::awt::tree::TreeExpansionEvent& aEvent ) override; + virtual void SAL_CALL treeExpanded( const css::awt::tree::TreeExpansionEvent& aEvent ) override; + virtual void SAL_CALL treeCollapsed( const css::awt::tree::TreeExpansionEvent& aEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TreeEditListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TreeEditListenerMultiplexer, css::awt::tree::XTreeEditListener ) + virtual void SAL_CALL nodeEditing( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override; + virtual void SAL_CALL nodeEdited( const css::uno::Reference< css::awt::tree::XTreeNode >& Node, const OUString& NewText ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class SelectionListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, css::awt::grid::XGridSelectionListener ) + void SAL_CALL selectionChanged( const css::awt::grid::GridSelectionEvent& aEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TabPageListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TabPageListenerMultiplexer, css::awt::tab::XTabPageContainerListener ) + void SAL_CALL tabPageActivated( const css::awt::tab::TabPageActivatedEvent& aEvent ) override; +DECL_LISTENERMULTIPLEXER_END + +#endif // INCLUDED_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/macros.hxx b/include/toolkit/helper/macros.hxx new file mode 100644 index 000000000..1bfd46b1b --- /dev/null +++ b/include/toolkit/helper/macros.hxx @@ -0,0 +1,158 @@ +/* -*- 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_HELPER_MACROS_HXX +#define INCLUDED_TOOLKIT_HELPER_MACROS_HXX + +#include <sal/log.hxx> +#include <osl/diagnose.h> +#include <tools/diagnose_ex.h> + +#define IMPL_IMPLEMENTATION_ID( ClassName ) \ +css::uno::Sequence< sal_Int8 > ClassName::getImplementationId() \ +{ \ + return css::uno::Sequence<sal_Int8>(); \ +} + + +#define DECL_LISTENERMULTIPLEXER_START( ClassName, InterfaceName ) \ +class ClassName final : public ListenerMultiplexerBase, public InterfaceName \ +{ \ +public: \ + ClassName( ::cppu::OWeakObject& rSource ); \ + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; \ + void SAL_CALL acquire() throw() override; \ + void SAL_CALL release() throw() override; \ + void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + +#define DECL_LISTENERMULTIPLEXER_START_DLLPUB( ClassName, InterfaceName ) \ +class TOOLKIT_DLLPUBLIC ClassName final : public ListenerMultiplexerBase, public InterfaceName \ +{ \ +public: \ + ClassName( ::cppu::OWeakObject& rSource ); \ + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; \ + void SAL_CALL acquire() throw() override; \ + void SAL_CALL release() throw() override; \ + void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + +#define DECL_LISTENERMULTIPLEXER_END \ +}; + + +#define IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ClassName, InterfaceName ) \ +ClassName::ClassName( ::cppu::OWeakObject& rSource ) \ + : ListenerMultiplexerBase( rSource ) \ +{ \ +} \ +void SAL_CALL ClassName::acquire() throw() { ListenerMultiplexerBase::acquire(); } \ +void SAL_CALL ClassName::release() throw() { ListenerMultiplexerBase::release(); } \ +css::uno::Any ClassName::queryInterface( const css::uno::Type & rType ) \ +{ \ + css::uno::Any aRet = ::cppu::queryInterface( rType, \ + (static_cast< css::lang::XEventListener* >(this)), \ + (static_cast< InterfaceName* >(this)) ); \ + return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType )); \ +} \ +void ClassName::disposing( const css::lang::EventObject& ) \ +{ \ +} + + +#if OSL_DEBUG_LEVEL > 0 + #define DISPLAY_EXCEPTION( ClassName, MethodName ) \ + css::uno::Any ex( cppu::getCaughtException() ); \ + SAL_WARN( "toolkit", #ClassName "::" #MethodName ": caught an exception! " << exceptionToString(ex)); +#else + #define DISPLAY_EXCEPTION( ClassName, MethodName ) +#endif + +#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( ClassName, InterfaceName, MethodName, ParamType1 ) \ +{ \ + ParamType1 aMulti( evt ); \ + ::comphelper::OInterfaceIteratorHelper2 aIt( *this ); \ + while( aIt.hasMoreElements() ) \ + { \ + css::uno::Reference< InterfaceName > xListener( \ + static_cast< InterfaceName* >( aIt.next() ) ); \ + try \ + { \ + xListener->MethodName( aMulti ); \ + } \ + catch(const css::lang::DisposedException& e) \ + { \ + OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \ + if ( e.Context == xListener || !e.Context.is() ) \ + aIt.remove(); \ + } \ + catch(const css::uno::RuntimeException&) \ + { \ + DISPLAY_EXCEPTION( ClassName, MethodName ) \ + } \ + } \ +} + +#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) \ +{ \ + EventType aMulti( evt ); \ + aMulti.Source = &GetContext(); \ + ::comphelper::OInterfaceIteratorHelper2 aIt( *this ); \ + while( aIt.hasMoreElements() ) \ + { \ + css::uno::Reference< InterfaceName > xListener( \ + static_cast< InterfaceName* >( aIt.next() ) ); \ + try \ + { \ + xListener->MethodName( aMulti ); \ + } \ + catch(const css::lang::DisposedException& e) \ + { \ + OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \ + if ( e.Context == xListener || !e.Context.is() ) \ + aIt.remove(); \ + } \ + catch(const css::uno::RuntimeException&) \ + { \ + DISPLAY_EXCEPTION( ClassName, MethodName ) \ + } \ + } \ +} + +#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( ClassName, InterfaceName, MethodName, EventType, Exception ) \ +void ClassName::MethodName( const EventType& evt ) \ +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) + +#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ClassName, InterfaceName, MethodName, EventType ) \ +void ClassName::MethodName( const EventType& evt ) \ +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) + +#define DECLIMPL_SERVICEINFO_DERIVED( ImplName, BaseClass, ServiceName ) \ + OUString SAL_CALL getImplementationName( ) override { return "stardiv.Toolkit." #ImplName; } \ + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override \ + { \ + css::uno::Sequence< OUString > aNames = BaseClass::getSupportedServiceNames( ); \ + aNames.realloc( aNames.getLength() + 1 ); \ + aNames[ aNames.getLength() - 1 ] = ServiceName; \ + return aNames; \ + } \ + +#endif // INCLUDED_TOOLKIT_HELPER_MACROS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/mutexandbroadcasthelper.hxx b/include/toolkit/helper/mutexandbroadcasthelper.hxx new file mode 100644 index 000000000..4cc98e6a9 --- /dev/null +++ b/include/toolkit/helper/mutexandbroadcasthelper.hxx @@ -0,0 +1,44 @@ +/* -*- 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_HELPER_MUTEXANDBROADCASTHELPER_HXX +#define INCLUDED_TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX + +#include <cppuhelper/interfacecontainer.h> + + +// Helper class with Mutex and BroadcastHelper, because they must be +// initialized before calling the OPropertySetHelper-CTOR + +class MutexAndBroadcastHelper +{ +public: + MutexAndBroadcastHelper() : BrdcstHelper( Mutex ) {} + + ::osl::Mutex Mutex; + ::cppu::OBroadcastHelper BrdcstHelper; + + ::osl::Mutex& GetMutex() { return Mutex; } + ::cppu::OBroadcastHelper& GetBroadcastHelper() { return BrdcstHelper; } +}; + +#endif // _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/mutexhelper.hxx b/include/toolkit/helper/mutexhelper.hxx new file mode 100644 index 000000000..7c11d9b79 --- /dev/null +++ b/include/toolkit/helper/mutexhelper.hxx @@ -0,0 +1,41 @@ +/* -*- 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_HELPER_MUTEXHELPER_HXX +#define INCLUDED_TOOLKIT_HELPER_MUTEXHELPER_HXX + +#include <osl/mutex.hxx> + + + + +class MutexHelper +{ +private: + ::osl::Mutex maMutex; + +public: + ::osl::Mutex& GetMutex() { return maMutex; } + +}; + + +#endif // INCLUDED_TOOLKIT_HELPER_MUTEXHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/property.hxx b/include/toolkit/helper/property.hxx new file mode 100644 index 000000000..efc924a1a --- /dev/null +++ b/include/toolkit/helper/property.hxx @@ -0,0 +1,250 @@ +/* -*- 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_HELPER_PROPERTY_HXX +#define INCLUDED_TOOLKIT_HELPER_PROPERTY_HXX + +#include <toolkit/dllapi.h> + +#include <sal/types.h> +#include <rtl/ustring.hxx> + +namespace com { +namespace sun { +namespace star { +namespace uno { + class Type; + class Any; +} } } } + + +#define BASEPROPERTY_NOTFOUND 0 + +#define BASEPROPERTY_TEXT 1 // OUString +#define BASEPROPERTY_BACKGROUNDCOLOR 2 // sal_Int32 +#define BASEPROPERTY_FILLCOLOR 3 // sal_Int32 +#define BASEPROPERTY_TEXTCOLOR 4 // sal_Int32 +#define BASEPROPERTY_LINECOLOR 5 // sal_Int32 +#define BASEPROPERTY_BORDER 6 // sal_Int16 +#define BASEPROPERTY_ALIGN 7 // sal_Int16 +#define BASEPROPERTY_FONTDESCRIPTOR 8 // css::awt::FontDescriptor +#define BASEPROPERTY_DROPDOWN 9 // sal_Bool +#define BASEPROPERTY_MULTILINE 10 // sal_Bool +#define BASEPROPERTY_STRINGITEMLIST 11 // UStringSequence +#define BASEPROPERTY_HSCROLL 12 // sal_Bool +#define BASEPROPERTY_VSCROLL 13 // sal_Bool +#define BASEPROPERTY_TABSTOP 14 // sal_Bool +#define BASEPROPERTY_STATE 15 // sal_Int16 +#define BASEPROPERTY_FONT_TYPE 16 // OLD: Font_Type +#define BASEPROPERTY_FONT_SIZE 17 // OLD: Font_Size +#define BASEPROPERTY_FONT_ATTRIBS 18 // OLD: Font_Attribs +#define BASEPROPERTY_DEFAULTCONTROL 19 // OUString (ServiceName) +#define BASEPROPERTY_LABEL 20 // OUString +#define BASEPROPERTY_LINECOUNT 21 // sal_Int16 +#define BASEPROPERTY_EXTDATEFORMAT 22 // sal_Int16 +#define BASEPROPERTY_DATESHOWCENTURY 23 // sal_Bool +#define BASEPROPERTY_EXTTIMEFORMAT 24 // sal_Int16 +#define BASEPROPERTY_NUMSHOWTHOUSANDSEP 25 // sal_Bool +#define BASEPROPERTY_CURRENCYSYMBOL 26 // OUString +#define BASEPROPERTY_SPIN 27 // sal_Bool +#define BASEPROPERTY_STRICTFORMAT 28 // sal_Bool +#define BASEPROPERTY_DECIMALACCURACY 29 // sal_Int16 +#define BASEPROPERTY_DATE 30 // css::util::Date +#define BASEPROPERTY_DATEMIN 31 // css::util::Date +#define BASEPROPERTY_DATEMAX 32 // css::util::Date +#define BASEPROPERTY_TIME 33 // css::util::Time +#define BASEPROPERTY_TIMEMIN 34 // css::util::Time +#define BASEPROPERTY_TIMEMAX 35 // css::util::Time +#define BASEPROPERTY_VALUE_INT32 36 // sal_Int32 +#define BASEPROPERTY_VALUEMIN_INT32 37 // sal_Int32 +#define BASEPROPERTY_VALUEMAX_INT32 38 // sal_Int32 +#define BASEPROPERTY_VALUESTEP_INT32 39 // sal_Int32 +#define BASEPROPERTY_EDITMASK 40 // OUString +#define BASEPROPERTY_LITERALMASK 41 // OUString +#define BASEPROPERTY_IMAGEURL 42 // OUString +#define BASEPROPERTY_READONLY 43 // sal_Bool +#define BASEPROPERTY_ENABLED 44 // sal_Bool +#define BASEPROPERTY_PRINTABLE 45 // sal_Bool +#define BASEPROPERTY_ECHOCHAR 46 // sal_Int16 +#define BASEPROPERTY_MAXTEXTLEN 47 // sal_Int16 +#define BASEPROPERTY_HARDLINEBREAKS 48 // sal_Int16 +#define BASEPROPERTY_AUTOCOMPLETE 49 // sal_Bool +#define BASEPROPERTY_MULTISELECTION 50 // sal_Bool +#define BASEPROPERTY_SELECTEDITEMS 51 // INT16Sequence +#define BASEPROPERTY_VALUE_DOUBLE 52 // DOUBLE +#define BASEPROPERTY_VALUEMIN_DOUBLE 53 // DOUBLE +#define BASEPROPERTY_VALUEMAX_DOUBLE 54 // DOUBLE +#define BASEPROPERTY_VALUESTEP_DOUBLE 55 // DOUBLE +#define BASEPROPERTY_TRISTATE 56 // sal_Bool +#define BASEPROPERTY_DEFAULTBUTTON 57 // sal_Bool +#define BASEPROPERTY_HELPURL 58 // OUString +#define BASEPROPERTY_AUTOTOGGLE 59 // sal_Bool +//#define BASEPROPERTY_FOCUSSELECTIONHIDE 60 // sal_Bool +#define BASEPROPERTY_FORMATKEY 61 // sal_Bool +#define BASEPROPERTY_FORMATSSUPPLIER 62 // css::util::XNumberFormatsSupplier +#define BASEPROPERTY_EFFECTIVE_VALUE 63 // Any (double or string) +#define BASEPROPERTY_TREATASNUMBER 64 // sal_Bool +#define BASEPROPERTY_EFFECTIVE_DEFAULT 65 // Any (double or string) +#define BASEPROPERTY_EFFECTIVE_MIN 66 // Double +#define BASEPROPERTY_EFFECTIVE_MAX 67 // Double +#define BASEPROPERTY_CURSYM_POSITION 68 // sal_Bool +#define BASEPROPERTY_TITLE 69 // OUString +#define BASEPROPERTY_MOVEABLE 70 // sal_Bool +#define BASEPROPERTY_CLOSEABLE 71 // sal_Bool +#define BASEPROPERTY_SIZEABLE 72 // sal_Bool +#define BASEPROPERTY_HELPTEXT 73 // OUString +#define BASEPROPERTY_PROGRESSVALUE 74 // sal_Int32 +#define BASEPROPERTY_PROGRESSVALUE_MIN 75 // sal_Int32 +#define BASEPROPERTY_PROGRESSVALUE_MAX 76 // sal_Int32 +#define BASEPROPERTY_SCROLLVALUE 77 // sal_Int32 +#define BASEPROPERTY_SCROLLVALUE_MAX 78 // sal_Int32 +#define BASEPROPERTY_LINEINCREMENT 79 // sal_Int32 +#define BASEPROPERTY_BLOCKINCREMENT 80 // sal_Int32 +#define BASEPROPERTY_VISIBLESIZE 81 // sal_Int32 +#define BASEPROPERTY_ORIENTATION 82 // sal_Int32 +#define BASEPROPERTY_FONTRELIEF 83 // sal_Int16 +#define BASEPROPERTY_FONTEMPHASISMARK 84 // sal_Int16 +#define BASEPROPERTY_TEXTLINECOLOR 85 // sal_Int32 +#define BASEPROPERTY_IMAGEALIGN 86 // sal_Int16 +#define BASEPROPERTY_SCALEIMAGE 87 // sal_Bool +#define BASEPROPERTY_PUSHBUTTONTYPE 88 // sal_Int16 +#define BASEPROPERTY_DISPLAYBACKGROUNDCOLOR 89 // sal_Int32 +#define BASEPROPERTY_AUTOMNEMONICS 90 // sal_Bool +#define BASEPROPERTY_MOUSETRANSPARENT 91 // sal_Bool +#define BASEPROPERTY_ACCESSIBLENAME 92 // OUString +#define BASEPROPERTY_PLUGINPARENT 93 // sal_Int64 +#define BASEPROPERTY_SCROLLVALUE_MIN 94 // sal_Int32 +#define BASEPROPERTY_REPEAT_DELAY 95 // sal_Int32 +#define BASEPROPERTY_SYMBOL_COLOR 96 // sal_Int32 +#define BASEPROPERTY_SPINVALUE 97 // sal_Int32 +#define BASEPROPERTY_SPINVALUE_MIN 98 // sal_Int32 +#define BASEPROPERTY_SPINVALUE_MAX 99 // sal_Int32 +#define BASEPROPERTY_SPININCREMENT 100 // sal_Int32 +#define BASEPROPERTY_REPEAT 101 // sal_Bool +#define BASEPROPERTY_ENFORCE_FORMAT 102 // sal_Bool +#define BASEPROPERTY_LIVE_SCROLL 103 // sal_Bool +#define BASEPROPERTY_LINE_END_FORMAT 104 // sal_Int16 +#define BASEPROPERTY_ACTIVATED 105 // sal Bool +#define BASEPROPERTY_COMPLETE 106 // sal_Bool +#define BASEPROPERTY_CURRENTITEMID 107 // sal_Int16 +#define BASEPROPERTY_TOGGLE 108 // sal_Bool +#define BASEPROPERTY_FOCUSONCLICK 109 // sal_Bool +#define BASEPROPERTY_HIDEINACTIVESELECTION 110 // sal_Bool +#define BASEPROPERTY_VISUALEFFECT 111 // sal_Int16 +#define BASEPROPERTY_BORDERCOLOR 112 // sal_Int32 +#define BASEPROPERTY_IMAGEPOSITION 113 // sal_Int16 +#define BASEPROPERTY_NATIVE_WIDGET_LOOK 114 // sal_Bool +#define BASEPROPERTY_VERTICALALIGN 115 // VerticalAlignment +#define BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR 116 // sal_Int16 +#define BASEPROPERTY_GRAPHIC 117 // css.graphic.XGraphic +#define BASEPROPERTY_STEP_TIME 118 // sal_Int32 +#define BASEPROPERTY_DECORATION 119 // sal_Bool +#define BASEPROPERTY_PAINTTRANSPARENT 120 // sal_Bool +#define BASEPROPERTY_AUTOHSCROLL 121 // sal_Bool +#define BASEPROPERTY_AUTOVSCROLL 122 // sal_Bool +#define BASEPROPERTY_DESKTOP_AS_PARENT 123 // sal_Bool +#define BASEPROPERTY_TREE_START 124 +#define BASEPROPERTY_TREE_SELECTIONTYPE 124 +#define BASEPROPERTY_TREE_EDITABLE 125 +#define BASEPROPERTY_TREE_DATAMODEL 126 +#define BASEPROPERTY_TREE_ROOTDISPLAYED 127 +#define BASEPROPERTY_TREE_SHOWSHANDLES 128 +#define BASEPROPERTY_TREE_SHOWSROOTHANDLES 129 +#define BASEPROPERTY_ROW_HEIGHT 130 +#define BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING 131 +#define BASEPROPERTY_TREE_END 131 +#define BASEPROPERTY_DIALOGSOURCEURL 132 +#define BASEPROPERTY_NOLABEL 133 // OUString added for issue79712 +#define BASEPROPERTY_URL 134 // OUString +#define BASEPROPERTY_UNIT 135 // ::awt::FieldUnit +#define BASEPROPERTY_CUSTOMUNITTEXT 136 // OUString +#define BASEPROPERTY_IMAGE_SCALE_MODE 137 +#define BASEPROPERTY_WRITING_MODE 138 +#define BASEPROPERTY_CONTEXT_WRITING_MODE 139 +#define BASEPROPERTY_GRID_SHOWROWHEADER 140 +#define BASEPROPERTY_GRID_SHOWCOLUMNHEADER 141 +#define BASEPROPERTY_GRID_DATAMODEL 142 +#define BASEPROPERTY_GRID_COLUMNMODEL 143 +#define BASEPROPERTY_GRID_SELECTIONMODE 144 +#define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool +#define BASEPROPERTY_REFERENCE_DEVICE 146 + +#define BASEPROPERTY_HIGHCONTRASTMODE 147 +#define BASEPROPERTY_GRID_HEADER_BACKGROUND 148 +#define BASEPROPERTY_GRID_HEADER_TEXT_COLOR 149 +#define BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS 150 +#define BASEPROPERTY_GRID_LINE_COLOR 151 +#define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152 +#define BASEPROPERTY_ITEM_SEPARATOR_POS 153 +#define BASEPROPERTY_GROUPNAME 154 // OUString +#define BASEPROPERTY_MULTIPAGEVALUE 155 // sal_Int32 +#define BASEPROPERTY_USERFORMCONTAINEES 156 // css::container::XNameContainer +#define BASEPROPERTY_AUTO_REPEAT 157 +#define BASEPROPERTY_ROW_HEADER_WIDTH 158 +#define BASEPROPERTY_COLUMN_HEADER_HEIGHT 159 +#define BASEPROPERTY_USE_GRID_LINES 160 +#define BASEPROPERTY_SCROLLWIDTH 161 +#define BASEPROPERTY_SCROLLHEIGHT 162 +#define BASEPROPERTY_SCROLLTOP 163 +#define BASEPROPERTY_SCROLLLEFT 164 +#define BASEPROPERTY_ACTIVE_SEL_BACKGROUND_COLOR 165 +#define BASEPROPERTY_INACTIVE_SEL_BACKGROUND_COLOR 166 +#define BASEPROPERTY_ACTIVE_SEL_TEXT_COLOR 167 +#define BASEPROPERTY_INACTIVE_SEL_TEXT_COLOR 168 +#define BASEPROPERTY_TYPEDITEMLIST 169 // AnySequence + + +// These properties are not bound, they are always extracted from the BASEPROPERTY_FONTDESCRIPTOR property +#define BASEPROPERTY_FONTDESCRIPTORPART_START 1000 +#define BASEPROPERTY_FONTDESCRIPTORPART_NAME 1000 // OUString, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME 1001 // OUString, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_FAMILY 1002 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_CHARSET 1003 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT 1004 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT 1005 // Float, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_SLANT 1006 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE 1007 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT 1008 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_WIDTH 1009 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_PITCH 1010 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH 1011 // Float, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION 1012 // Float, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_KERNING 1013 // sal_Bool, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE 1014 // sal_Bool, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_TYPE 1015 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_END 1015 + +#define PROPERTY_ALIGN_LEFT 0 +#define PROPERTY_ALIGN_CENTER 1 +#define PROPERTY_ALIGN_RIGHT 2 + + +TOOLKIT_DLLPUBLIC sal_uInt16 GetPropertyId( const OUString& rPropertyName ); +const css::uno::Type* GetPropertyType( sal_uInt16 nPropertyId ); +const OUString& GetPropertyName( sal_uInt16 nPropertyId ); +sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId ); +sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId ); +bool DoesDependOnOthers( sal_uInt16 nPropertyId ); +bool CompareProperties( const css::uno::Any& r1, const css::uno::Any& r2 ); + + +#endif // INCLUDED_TOOLKIT_HELPER_PROPERTY_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx new file mode 100644 index 000000000..6bdffe9f1 --- /dev/null +++ b/include/toolkit/helper/vclunohelper.hxx @@ -0,0 +1,156 @@ +/* -*- 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_HELPER_VCLUNOHELPER_HXX +#define INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX + +#include <toolkit/dllapi.h> +#include <com/sun/star/uno/Reference.h> + +#include <com/sun/star/awt/MouseEvent.hpp> + +#include <vcl/bitmapex.hxx> +#include <vcl/font.hxx> +#include <vcl/region.hxx> +#include <vcl/vclptr.hxx> +#include <tools/mapunit.hxx> +#include <tools/fldunit.hxx> +#include <tools/poly.hxx> + + +namespace com::sun::star::uno { template <typename > class Sequence; } + +namespace com::sun::star::uno { + class XInterface; +} + +namespace com::sun::star::awt { + class XBitmap; + class XWindow; + class XWindow2; + class XWindowPeer; + class XGraphics; + class XRegion; + class XDevice; + class XToolkit; + class XFont; + class XControlContainer; + struct Size; + struct Point; + struct SimpleFontMetric; + struct FontDescriptor; + struct Rectangle; + struct KeyEvent; +} + + +class FontMetric; +class OutputDevice; +class MouseEvent; +class KeyEvent; + + + +class TOOLKIT_DLLPUBLIC VCLUnoHelper +{ +public: + // Toolkit + static css::uno::Reference< css::awt::XToolkit> CreateToolkit(); + + // Bitmap + static BitmapEx GetBitmap( const css::uno::Reference< css::awt::XBitmap>& rxBitmap ); + static css::uno::Reference< css::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap ); + static css::uno::Reference< css::awt::XBitmap> CreateVCLXBitmap( const BitmapEx& rBitmap ); + + // Window + static VclPtr< vcl::Window > GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow ); + static VclPtr< vcl::Window > GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow2 ); + static VclPtr< vcl::Window > GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindowPeer ); + static css::uno::Reference< css::awt::XWindow> GetInterface( vcl::Window* pWindow ); + + // OutputDevice + static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XDevice>& rxDevice ); + static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XGraphics>& rxGraphics ); + + // Region + static vcl::Region GetRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion ); + + // Polygon + static tools::Polygon CreatePolygon( const css::uno::Sequence< sal_Int32 >& DataX, const css::uno::Sequence< sal_Int32 >& DataY ); + + /** convert Font to css::awt::FontDescriptor + @param rFont Font to be converted + @return the new FontDescriptor + */ + static css::awt::FontDescriptor CreateFontDescriptor( const vcl::Font& rFont ); + static vcl::Font CreateFont( const css::awt::FontDescriptor& rDescr, const vcl::Font& rInitFont ); + static vcl::Font CreateFont( const css::uno::Reference< css::awt::XFont >& rxFont ); + static css::awt::SimpleFontMetric CreateFontMetric( const FontMetric& rFontMetric ); + + // Rectangle + static bool IsZero(const css::awt::Rectangle& rRect); + + static css::uno::Reference< css::awt::XControlContainer> CreateControlContainer( vcl::Window* pWindow ); + + // MapUnits + static MapUnit UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit ); + static sal_Int32 VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit ); + + + //= MeasurementUnitConversion + + /** small helper to convert between MeasurementUnit and + FieldUnit + */ + static sal_Int16 ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _rFieldToUNOValueFactor ); + static FieldUnit ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor ); + + /// @throws css::lang::IllegalArgumentException + static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit); + + static ::Size /* VCLSize */ ConvertToVCLSize(css::awt::Size const& _aSize); + static css::awt::Size ConvertToAWTSize(::Size /* VCLSize */ const& _aSize); + + static ::Point /* VCLPoint */ ConvertToVCLPoint(css::awt::Point const& _aPoint); + static css::awt::Point ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint); + + static ::tools::Rectangle ConvertToVCLRect( css::awt::Rectangle const & _rRect ); + static css::awt::Rectangle ConvertToAWTRect( ::tools::Rectangle const & _rRect ); + + static css::awt::MouseEvent + createMouseEvent( + const ::MouseEvent& _rVclEvent, + const css::uno::Reference< css::uno::XInterface >& _rxContext + ); + + static ::MouseEvent createVCLMouseEvent( const css::awt::MouseEvent& _rAwtEvent ); + + static css::awt::KeyEvent + createKeyEvent( + const ::KeyEvent& _rVclEvent, + const css::uno::Reference< css::uno::XInterface >& _rxContext + ); + + static ::KeyEvent createVCLKeyEvent( const css::awt::KeyEvent& _rAwtEvent ); +}; + + +#endif // INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |