diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /include/toolkit/helper | |
parent | move global headers script (diff) | |
download | core-b9337e22ce1dbf2eba0e8c8db294ae99f4111f91.tar.gz core-b9337e22ce1dbf2eba0e8c8db294ae99f4111f91.zip |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/toolkit/helper')
-rw-r--r-- | include/toolkit/helper/accessibilityclient.hxx | 66 | ||||
-rw-r--r-- | include/toolkit/helper/accessiblefactory.hxx | 134 | ||||
-rw-r--r-- | include/toolkit/helper/convert.hxx | 61 | ||||
-rw-r--r-- | include/toolkit/helper/emptyfontdescriptor.hxx | 49 | ||||
-rw-r--r-- | include/toolkit/helper/externallock.hxx | 38 | ||||
-rw-r--r-- | include/toolkit/helper/formpdfexport.hxx | 55 | ||||
-rw-r--r-- | include/toolkit/helper/imagealign.hxx | 53 | ||||
-rw-r--r-- | include/toolkit/helper/listenermultiplexer.hxx | 268 | ||||
-rw-r--r-- | include/toolkit/helper/macros.hxx | 305 | ||||
-rw-r--r-- | include/toolkit/helper/mutexandbroadcasthelper.hxx | 44 | ||||
-rw-r--r-- | include/toolkit/helper/mutexhelper.hxx | 44 | ||||
-rw-r--r-- | include/toolkit/helper/property.hxx | 254 | ||||
-rw-r--r-- | include/toolkit/helper/servicenames.hxx | 118 | ||||
-rw-r--r-- | include/toolkit/helper/tkresmgr.hxx | 71 | ||||
-rw-r--r-- | include/toolkit/helper/unopropertyarrayhelper.hxx | 58 | ||||
-rw-r--r-- | include/toolkit/helper/unowrapper.hxx | 86 | ||||
-rw-r--r-- | include/toolkit/helper/vclunohelper.hxx | 155 |
17 files changed, 1859 insertions, 0 deletions
diff --git a/include/toolkit/helper/accessibilityclient.hxx b/include/toolkit/helper/accessibilityclient.hxx new file mode 100644 index 000000000000..02e44e6c47e8 --- /dev/null +++ b/include/toolkit/helper/accessibilityclient.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 TOOLKIT_HELPER_ACCESSIBILITY_CLIENT_HXX +#define TOOLKIT_HELPER_ACCESSIBILITY_CLIENT_HXX + +#include <toolkit/helper/accessiblefactory.hxx> + +//........................................................................ +namespace toolkit +{ +//........................................................................ + + //==================================================================== + //= AccessibilityClient + //==================================================================== + /** 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 aways, this factory goes aways, to, and the respective + library is unloaded. + + This class is not thread-safe. + */ + class AccessibilityClient + { + private: + bool m_bInitialized; + + public: + AccessibilityClient(); + ~AccessibilityClient(); + + IAccessibleFactory& getFactory(); + + private: + void ensureInitialized(); + }; + +//........................................................................ +} // namespace toolkit +//........................................................................ + +#endif // TOOLKIT_HELPER_ACCESSIBILITY_CLIENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/accessiblefactory.hxx b/include/toolkit/helper/accessiblefactory.hxx new file mode 100644 index 000000000000..66117a6bdbba --- /dev/null +++ b/include/toolkit/helper/accessiblefactory.hxx @@ -0,0 +1,134 @@ +/* -*- 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 TOOLKIT_HELPER_ACCESSIBLE_FACTORY_HXX +#define TOOLKIT_HELPER_ACCESSIBLE_FACTORY_HXX + +#include <com/sun/star/uno/Reference.hxx> + +#include <rtl/ref.hxx> + +namespace com { namespace sun { namespace star { namespace 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 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* (SAL_CALL * GetStandardAccComponentFactory)( ); + + //================================================================ + //= IAccessibleFactory + //================================================================ + class IAccessibleFactory : public ::rtl::IReference + { + public: + /** creates an accessible context for a button window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXButton* _pXWindow ) = 0; + + /** creates an accessible context for a checkbox window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXCheckBox* _pXWindow ) = 0; + + /** creates an accessible context for a radio button window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXRadioButton* _pXWindow ) = 0; + + /** creates an accessible context for a listbox window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXListBox* _pXWindow ) = 0; + + /** creates an accessible context for a fixed hyperlink window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXFixedHyperlink* _pXWindow ) = 0; + + /** creates an accessible context for a fixed text window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXFixedText* _pXWindow ) = 0; + + /** creates an accessible context for a scrollbar window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXScrollBar* _pXWindow ) = 0; + + /** creates an accessible context for a edit window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXEdit* _pXWindow ) = 0; + + /** creates an accessible context for a combo box window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXComboBox* _pXWindow ) = 0; + + /** creates an accessible context for a toolbox window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXToolBox* _pXWindow ) = 0; + + /** creates an accessible context for a generic window + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleContext( VCLXWindow* _pXWindow ) = 0; + + /** creates an accessible component for the given menu + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + createAccessible( Menu* _pMenu, sal_Bool _bIsMenuBar ) = 0; + + protected: + ~IAccessibleFactory() {} + }; + +//........................................................................ +} // namespace toolkit +//........................................................................ + +#endif // TOOLKIT_HELPER_ACCESSIBLE_FACTORY_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 000000000000..27ad9aa17a0e --- /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 _TOOLKIT_HELPER_CONVERT_HXX_ +#define _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 ::com::sun::star::awt::Size AWTSize( const Size& rVCLSize ) +{ + return ::com::sun::star::awt::Size( rVCLSize.Width(), rVCLSize.Height() ); +} + +inline ::Size VCLSize( const ::com::sun::star::awt::Size& rAWTSize ) +{ + return ::Size( rAWTSize.Width, rAWTSize.Height ); +} + +inline ::com::sun::star::awt::Point AWTPoint( const ::Point& rVCLPoint ) +{ + return ::com::sun::star::awt::Point( rVCLPoint.X(), rVCLPoint.Y() ); +} + +inline ::Point VCLPoint( const ::com::sun::star::awt::Point& rAWTPoint ) +{ + return ::Point( rAWTPoint.X, rAWTPoint.Y ); +} + +inline ::com::sun::star::awt::Rectangle AWTRectangle( const ::Rectangle& rVCLRect ) +{ + return ::com::sun::star::awt::Rectangle( rVCLRect.Left(), rVCLRect.Top(), rVCLRect.GetWidth(), rVCLRect.GetHeight() ); +} + +inline ::Rectangle VCLRectangle( const ::com::sun::star::awt::Rectangle& rAWTRect ) +{ + return ::Rectangle( ::Point( rAWTRect.X, rAWTRect.Y ), ::Size( rAWTRect.Width, rAWTRect.Height ) ); +} + +#endif // _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 000000000000..3110d8195f5a --- /dev/null +++ b/include/toolkit/helper/emptyfontdescriptor.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_ +#define _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_ + +#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 +// ---------------------------------------------------- +class EmptyFontDescriptor : public ::com::sun::star::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 = ::com::sun::star::awt::FontSlant_DONTKNOW; + Underline = ::com::sun::star::awt::FontUnderline::DONTKNOW; + Strikeout = ::com::sun::star::awt::FontStrikeout::DONTKNOW; + } +}; + + + + +#endif // _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/externallock.hxx b/include/toolkit/helper/externallock.hxx new file mode 100644 index 000000000000..5b0421d558e2 --- /dev/null +++ b/include/toolkit/helper/externallock.hxx @@ -0,0 +1,38 @@ +/* -*- 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 _TOOLKIT_HELPER_EXTERNALLOCK_HXX_ +#define _TOOLKIT_HELPER_EXTERNALLOCK_HXX_ + +#include <toolkit/dllapi.h> +#include <comphelper/accessiblecontexthelper.hxx> + +// ----------------------------------------------------------------------------- +// class VCLExternalSolarLock +// ----------------------------------------------------------------------------- + +class TOOLKIT_DLLPUBLIC VCLExternalSolarLock : public ::comphelper::IMutex +{ +public: + virtual void acquire(); + virtual void release(); +}; + +#endif // _TOOLKIT_HELPER_EXTERNALLOCK_HXX_ + +/* 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 000000000000..9e88d71f5b3f --- /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 _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX +#define _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX + +#include <toolkit/dllapi.h> + +#include <com/sun/star/awt/XControl.hpp> + +#include <vcl/pdfwriter.hxx> + +#include <memory> + +namespace vcl +{ + class PDFExtOutDevData; +} + +//........................................................................ +namespace toolkitform +{ +//........................................................................ + + /** creates a PDF compatible control descriptor for the given control + */ + void TOOLKIT_DLLPUBLIC describePDFControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl, + ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor, + ::vcl::PDFExtOutDevData& i_pdfExportData + ) SAL_THROW(()); + +//........................................................................ +} // namespace toolkitform +//........................................................................ + +#endif // _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/imagealign.hxx b/include/toolkit/helper/imagealign.hxx new file mode 100644 index 000000000000..f6f2ac5e3860 --- /dev/null +++ b/include/toolkit/helper/imagealign.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef TOOLKIT_INC_TOOLKIT_HELPER_IMAGEALIGN_HXX +#define TOOLKIT_INC_TOOLKIT_HELPER_IMAGEALIGN_HXX + +#include <sal/types.h> +#include <vcl/button.hxx> + +//........................................................................ +namespace toolkit +{ +//........................................................................ + + /** translates a VCL ImageAlign value into an css.awt.ImagePosition value + */ + sal_Int16 translateImagePosition( ImageAlign _eVCLAlign ); + + /** translates a css.awt.ImagePosition value into an 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 // TOOLKIT_INC_TOOLKIT_HELPER_IMAGEALIGN_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 000000000000..dc0626893e37 --- /dev/null +++ b/include/toolkit/helper/listenermultiplexer.hxx @@ -0,0 +1,268 @@ +/* -*- 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 _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ +#define _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ + +#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 <com/sun/star/util/VetoException.hpp> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <osl/mutex.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 TOOLKIT_DLLPUBLIC ListenerMultiplexerBase : public MutexHelper, + public ::cppu::OInterfaceContainerHelper, + public ::com::sun::star::uno::XInterface +{ +private: + ::cppu::OWeakObject& mrContext; + +protected: + ::cppu::OWeakObject& GetContext() { return mrContext; } + +public: + ListenerMultiplexerBase( ::cppu::OWeakObject& rSource ); + virtual ~ListenerMultiplexerBase(); + + // ::com::sun::star::uno::XInterface + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw() { mrContext.acquire(); } + void SAL_CALL release() throw() { mrContext.release(); } +}; + + +// ---------------------------------------------------- +// class EventListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( EventListenerMultiplexer, ::com::sun::star::lang::XEventListener ) +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class FocusListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener ) + void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + + +// ---------------------------------------------------- +// class WindowListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener ) + void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + + + +// ---------------------------------------------------- +// class VclContainerListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener ) + void SAL_CALL windowAdded( const ::com::sun::star::awt::VclContainerEvent& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL windowRemoved( const ::com::sun::star::awt::VclContainerEvent& e ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class KeyListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener ) + void SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& e ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class MouseListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener ) + void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class MouseMotionListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener ) + void SAL_CALL mouseDragged( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL mouseMoved( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class PaintListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener ) + void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class TopWindowListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener ) + void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class TextListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener ) + void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class ActionListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener ) + void SAL_CALL actionPerformed( const ::com::sun::star::awt::ActionEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class ItemListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener ) + void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class TabListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener ) + void SAL_CALL inserted( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL removed( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL changed( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL activated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL deactivated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class ContainerListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener ) + void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class SpinListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener ) + void SAL_CALL up( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL down( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL first( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL last( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class AdjustmentListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener ) + void SAL_CALL adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class MenuListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener ) + void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class TreeSelectionListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeSelectionListenerMultiplexer, ::com::sun::star::view::XSelectionChangeListener ) + virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class TreeExpansionListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener ) + virtual void SAL_CALL requestChildNodes( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL treeExpanding( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL treeCollapsing( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL treeExpanded( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL treeCollapsed( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class TreeEditListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeEditListenerMultiplexer, ::com::sun::star::awt::tree::XTreeEditListener ) + virtual void SAL_CALL nodeEditing( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::uno::RuntimeException,::com::sun::star::util::VetoException); + virtual void SAL_CALL nodeEdited( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node, const OUString& NewText ) throw (::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class SelectionListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener ) + void SAL_CALL selectionChanged( const ::com::sun::star::awt::grid::GridSelectionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +// ---------------------------------------------------- +// class TabPageListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener ) + void SAL_CALL tabPageActivated( const ::com::sun::star::awt::tab::TabPageActivatedEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + +#endif // _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 000000000000..7d2eaea67403 --- /dev/null +++ b/include/toolkit/helper/macros.hxx @@ -0,0 +1,305 @@ +/* -*- 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 _TOOLKIT_HELPER_MACROS_HXX_ +#define _TOOLKIT_HELPER_MACROS_HXX_ + +#include <string.h> + +#include <comphelper/servicehelper.hxx> + +#define IMPL_XUNOTUNNEL_MINIMAL( ClassName ) \ +sal_Int64 ClassName::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException) \ +{ \ + if( ( rIdentifier.getLength() == 16 ) && ( 0 == memcmp( ClassName::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) ) \ + { \ + return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); \ + } \ + return 0; \ +} \ +namespace \ +{ \ + class the##ClassName##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##ClassName##UnoTunnelId> {}; \ +} \ +const ::com::sun::star::uno::Sequence< sal_Int8 >& ClassName::GetUnoTunnelId() throw() \ +{ \ + return the##ClassName##UnoTunnelId::get().getSeq(); \ +} + +#define IMPL_XUNOTUNNEL( ClassName ) \ +IMPL_XUNOTUNNEL_MINIMAL( ClassName ) \ +ClassName* ClassName::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw() \ +{ \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( rxIFace, ::com::sun::star::uno::UNO_QUERY ); \ + return xUT.is() ? reinterpret_cast<ClassName*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( ClassName::GetUnoTunnelId() ))) : NULL; \ +} + +#define IMPL_XUNOTUNNEL2( ClassName, BaseClass ) \ +sal_Int64 ClassName::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException) \ +{ \ + if( ( rIdentifier.getLength() == 16 ) && ( 0 == memcmp( ClassName::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) ) \ + { \ + return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); \ + } \ + return BaseClass::getSomething( rIdentifier ); \ +} \ +namespace \ +{ \ + class the##ClassName##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##ClassName##UnoTunnelId> {}; \ +} \ +const ::com::sun::star::uno::Sequence< sal_Int8 >& ClassName::GetUnoTunnelId() throw() \ +{ \ + return the##ClassName##UnoTunnelId::get().getSeq(); \ +} \ +ClassName* ClassName::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw() \ +{ \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( rxIFace, ::com::sun::star::uno::UNO_QUERY ); \ + return xUT.is() ? reinterpret_cast<ClassName*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( ClassName::GetUnoTunnelId() ))) : NULL; \ +} + +// ------------------------------------------------------------------------------------- + +#define IMPL_IMPLEMENTATION_ID( ClassName ) \ +::com::sun::star::uno::Sequence< sal_Int8 > ClassName::getImplementationId() throw(::com::sun::star::uno::RuntimeException) \ +{ \ + static ::cppu::OImplementationId* pId = NULL; \ + if( !pId ) \ + { \ + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \ + if( ! pId ) \ + { \ + static ::cppu::OImplementationId id( sal_False ); \ + pId = &id; \ + } \ + } \ + return (*pId).getImplementationId(); \ +} + +#define IMPL_XTYPEPROVIDER_START( ClassName ) \ +IMPL_IMPLEMENTATION_ID( ClassName ) \ +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > ClassName::getTypes() throw(::com::sun::star::uno::RuntimeException) \ +{ \ + static ::cppu::OTypeCollection* pCollection = NULL; \ + if( !pCollection ) \ + { \ + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \ + if( !pCollection ) \ + { \ + static ::cppu::OTypeCollection collection( \ + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), + +// ------------------------------------------------------------------------------------- + +#define IMPL_XTYPEPROVIDER_END \ + ); \ + pCollection = &collection; \ + } \ + } \ + return (*pCollection).getTypes(); \ +} + +// ------------------------------------------------------------------------------------- + +#define DECL_LISTENERMULTIPLEXER_START( ClassName, InterfaceName ) \ +class ClassName : public ListenerMultiplexerBase, public InterfaceName \ +{ \ +public: \ + ClassName( ::cppu::OWeakObject& rSource ); \ + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); \ + void SAL_CALL acquire() throw() { ListenerMultiplexerBase::acquire(); } \ + void SAL_CALL release() throw() { ListenerMultiplexerBase::release(); } \ + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + +// ------------------------------------------------------------------------------------- + +#define DECL_LISTENERMULTIPLEXER_START_DLLPUB( ClassName, InterfaceName ) \ +class TOOLKIT_DLLPUBLIC ClassName : public ListenerMultiplexerBase, public InterfaceName \ +{ \ +public: \ + ClassName( ::cppu::OWeakObject& rSource ); \ + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); \ + void SAL_CALL acquire() throw() { ListenerMultiplexerBase::acquire(); } \ + void SAL_CALL release() throw() { ListenerMultiplexerBase::release(); } \ + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + +// ------------------------------------------------------------------------------------- + +#define DECL_LISTENERMULTIPLEXER_END \ +}; + +// ------------------------------------------------------------------------------------- + +#define IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ClassName, InterfaceName ) \ +ClassName::ClassName( ::cppu::OWeakObject& rSource ) \ + : ListenerMultiplexerBase( rSource ) \ +{ \ +} \ +::com::sun::star::uno::Any ClassName::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) \ +{ \ + ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, \ + (static_cast< ::com::sun::star::lang::XEventListener* >(this)), \ + (static_cast< InterfaceName* >(this)) ); \ + return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType )); \ +} \ +void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException) \ +{ \ +} + +// ------------------------------------------------------------------------------------- + +#if OSL_DEBUG_LEVEL > 0 + #define DISPLAY_EXCEPTION( ClassName, MethodName, e ) \ + OString sMessage( #ClassName "::" #MethodName ": caught an exception!\n" ); \ + sMessage += OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US ); \ + OSL_FAIL( sMessage.getStr() ); +#else + #define DISPLAY_EXCEPTION( ClassName, MethodName, e ) (void)e; +#endif + +#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_2PARAM( ClassName, InterfaceName, MethodName, ParamType1, ParamType2 ) \ +{ \ + ParamType1 aMulti( evt ); \ + ParamType2 aMulti2( evt2 ); \ + ::cppu::OInterfaceIteratorHelper aIt( *this ); \ + while( aIt.hasMoreElements() ) \ + { \ + ::com::sun::star::uno::Reference< InterfaceName > xListener( \ + static_cast< InterfaceName* >( aIt.next() ) ); \ + try \ + { \ + xListener->MethodName( aMulti, aMulti2 ); \ + } \ + catch(const ::com::sun::star::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 ::com::sun::star::uno::RuntimeException& e) \ + { \ + DISPLAY_EXCEPTION( ClassName, MethodName, e ) \ + } \ + } \ +} + +#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( ClassName, InterfaceName, MethodName, ParamType1 ) \ +{ \ + ParamType1 aMulti( evt ); \ + ::cppu::OInterfaceIteratorHelper aIt( *this ); \ + while( aIt.hasMoreElements() ) \ + { \ + ::com::sun::star::uno::Reference< InterfaceName > xListener( \ + static_cast< InterfaceName* >( aIt.next() ) ); \ + try \ + { \ + xListener->MethodName( aMulti ); \ + } \ + catch(const ::com::sun::star::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 ::com::sun::star::uno::RuntimeException& e) \ + { \ + DISPLAY_EXCEPTION( ClassName, MethodName, e ) \ + } \ + } \ +} + +#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) \ +{ \ + EventType aMulti( evt ); \ + aMulti.Source = &GetContext(); \ + ::cppu::OInterfaceIteratorHelper aIt( *this ); \ + while( aIt.hasMoreElements() ) \ + { \ + ::com::sun::star::uno::Reference< InterfaceName > xListener( \ + static_cast< InterfaceName* >( aIt.next() ) ); \ + try \ + { \ + xListener->MethodName( aMulti ); \ + } \ + catch(const ::com::sun::star::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 ::com::sun::star::uno::RuntimeException& e) \ + { \ + DISPLAY_EXCEPTION( ClassName, MethodName, e ) \ + } \ + } \ +} + +#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( ClassName, InterfaceName, MethodName, EventType, Exception ) \ +void ClassName::MethodName( const EventType& evt ) throw(::com::sun::star::uno::RuntimeException, Exception) \ +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) + +#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ClassName, InterfaceName, MethodName, EventType ) \ +void ClassName::MethodName( const EventType& evt ) throw(::com::sun::star::uno::RuntimeException) \ +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) + +// ------------------------------------------------------------------------------------- + +#define DECLIMPL_SUPPORTS_SERVICE( ) \ + sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< OUString > aServiceNames( getSupportedServiceNames() ); \ + const OUString* pSupported = aServiceNames.getConstArray(); \ + const OUString* pSupportedEnd = pSupported + aServiceNames.getLength(); \ + for ( ; pSupported != pSupportedEnd; ++pSupported ) \ + if ( *pSupported == rServiceName ) \ + return sal_True; \ + return sal_False; \ + } + +// ------------------------------------------------------------------------------------- + +#define DECLIMPL_SERVICEINFO_DERIVED( ImplName, BaseClass, ServiceName ) \ + OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return OUString("stardiv.Toolkit." #ImplName ); } \ + ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< OUString > aNames = BaseClass::getSupportedServiceNames( ); \ + aNames.realloc( aNames.getLength() + 1 ); \ + aNames[ aNames.getLength() - 1 ] = OUString::createFromAscii( ServiceName ); \ + return aNames; \ + } \ + +// ------------------------------------------------------------------------------------- + +#define DECLIMPL_SERVICEINFO( ImplName, ServiceName ) \ + OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return OUString("stardiv.Toolkit." #ImplName ); } \ + ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< OUString > aNames( 1 ); \ + aNames[ 0 ] = OUString::createFromAscii( ServiceName ); \ + return aNames; \ + } \ + DECLIMPL_SUPPORTS_SERVICE( ) + + + + + + +#endif // _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 000000000000..f887e018452d --- /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 _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX_ +#define _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 000000000000..85f98635ab73 --- /dev/null +++ b/include/toolkit/helper/mutexhelper.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 _TOOLKIT_HELPER_MUTEXHELPER_HXX_ +#define _TOOLKIT_HELPER_MUTEXHELPER_HXX_ + +#include <osl/mutex.hxx> + +// ---------------------------------------------------- +// class MutexHelper +// ---------------------------------------------------- + +class MutexHelper +{ +private: + ::osl::Mutex maMutex; + +public: + ::osl::Mutex& GetMutex() { return maMutex; } + +}; + + + + +#endif // _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 000000000000..fa1fbbf2a125 --- /dev/null +++ b/include/toolkit/helper/property.hxx @@ -0,0 +1,254 @@ +/* -*- 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 _TOOLKIT_HELPER_PROPERTY_HXX_ +#define _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 // ::com::sun::star::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 // sal_Int32 +#define BASEPROPERTY_DATEMIN 31 // sal_Int32 +#define BASEPROPERTY_DATEMAX 32 // sal_Int32 +#define BASEPROPERTY_TIME 33 // sal_Int32 +#define BASEPROPERTY_TIMEMIN 34 // sal_Int32 +#define BASEPROPERTY_TIMEMAX 35 // sal_Int32 +#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 // ::com::sun::star::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 + + +// 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 + +#define PROPERTY_STATE_OFF 0 +#define PROPERTY_STATE_ON 1 +#define PROPERTY_STATE_DONTCARE 2 + +TOOLKIT_DLLPUBLIC sal_uInt16 GetPropertyId( const OUString& rPropertyName ); +const ::com::sun::star::uno::Type* GetPropertyType( sal_uInt16 nPropertyId ); +TOOLKIT_DLLPUBLIC const OUString& GetPropertyName( sal_uInt16 nPropertyId ); +sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId ); +sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId ); +sal_Bool DoesDependOnOthers( sal_uInt16 nPropertyId ); +sal_Bool CompareProperties( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ); + + + + +#endif // _TOOLKIT_HELPER_PROPERTY_HXX_ + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/servicenames.hxx b/include/toolkit/helper/servicenames.hxx new file mode 100644 index 000000000000..5105fc12484b --- /dev/null +++ b/include/toolkit/helper/servicenames.hxx @@ -0,0 +1,118 @@ +/* -*- 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 _TOOLKIT_HELPER_SERVICENAMES_HXX_ +#define _TOOLKIT_HELPER_SERVICENAMES_HXX_ + +#include <sal/types.h> +#include <tools/solar.h> + +extern const sal_Char szServiceName_Toolkit[], szServiceName2_Toolkit[]; +extern const sal_Char szServiceName_MVCIntrospection[], szServiceName2_MVCIntrospection[]; +extern const sal_Char szServiceName_PopupMenu[], szServiceName2_PopupMenu[]; +extern const sal_Char szServiceName_MenuBar[], szServiceName2_MenuBar[]; +extern const sal_Char szServiceName_Pointer[], szServiceName2_Pointer[]; +extern const sal_Char szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[]; +extern const sal_Char szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[]; +extern const sal_Char szServiceName_UnoMultiPageControl[], szServiceName2_UnoMultiPageControl[]; +extern const sal_Char szServiceName_UnoMultiPageModel[], szServiceName2_UnoMultiPageModel[]; +extern const sal_Char szServiceName_UnoPageControl[], szServiceName2_UnoPageControl[]; +extern const sal_Char szServiceName_UnoPageModel[], szServiceName2_UnoPageModel[]; +extern const sal_Char szServiceName_UnoFrameControl[], szServiceName2_UnoFrameControl[]; +extern const sal_Char szServiceName_UnoFrameModel[], szServiceName2_UnoFrameModel[]; +extern const sal_Char szServiceName_TabController[], szServiceName2_TabController[]; +extern const sal_Char szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[]; +extern const sal_Char szServiceName_UnoControlDialog[], szServiceName2_UnoControlDialog[]; +extern const sal_Char szServiceName_UnoControlDialogModel[], szServiceName2_UnoControlDialogModel[]; +extern const sal_Char szServiceName_UnoControlEdit[], szServiceName2_UnoControlEdit[]; +extern const sal_Char szServiceName_UnoControlEditModel[], szServiceName2_UnoControlEditModel[]; +extern const sal_Char szServiceName_UnoControlFileControl[], szServiceName2_UnoControlFileControl[]; +extern const sal_Char szServiceName_UnoControlFileControlModel[], szServiceName2_UnoControlFileControlModel[]; +extern const sal_Char szServiceName_UnoControlButton[], szServiceName2_UnoControlButton[]; +extern const sal_Char szServiceName_UnoControlButtonModel[], szServiceName2_UnoControlButtonModel[]; +extern const sal_Char szServiceName_UnoControlImageButton[], szServiceName2_UnoControlImageButton[]; +extern const sal_Char szServiceName_UnoControlImageButtonModel[], szServiceName2_UnoControlImageButtonModel[]; +extern const sal_Char szServiceName_UnoControlImageControl[], szServiceName2_UnoControlImageControl[]; +extern const sal_Char szServiceName_UnoControlImageControlModel[], szServiceName2_UnoControlImageControlModel[]; +extern const sal_Char szServiceName_UnoControlRadioButton[], szServiceName2_UnoControlRadioButton[]; +extern const sal_Char szServiceName_UnoControlRadioButtonModel[], szServiceName2_UnoControlRadioButtonModel[]; +extern const sal_Char szServiceName_UnoControlCheckBox[], szServiceName2_UnoControlCheckBox[]; +extern const sal_Char szServiceName_UnoControlCheckBoxModel[], szServiceName2_UnoControlCheckBoxModel[]; +extern const sal_Char szServiceName_UnoControlListBox[], szServiceName2_UnoControlListBox[]; +extern const sal_Char szServiceName_UnoControlListBoxModel[], szServiceName2_UnoControlListBoxModel[]; +extern const sal_Char szServiceName_UnoControlComboBox[], szServiceName2_UnoControlComboBox[]; +extern const sal_Char szServiceName_UnoControlComboBoxModel[], szServiceName2_UnoControlComboBoxModel[]; +extern const sal_Char szServiceName_UnoControlFixedText[], szServiceName2_UnoControlFixedText[]; +extern const sal_Char szServiceName_UnoControlFixedTextModel[], szServiceName2_UnoControlFixedTextModel[]; +extern const sal_Char szServiceName_UnoControlGroupBox[], szServiceName2_UnoControlGroupBox[]; +extern const sal_Char szServiceName_UnoControlGroupBoxModel[], szServiceName2_UnoControlGroupBoxModel[]; +extern const sal_Char szServiceName_UnoControlDateField[], szServiceName2_UnoControlDateField[]; +extern const sal_Char szServiceName_UnoControlDateFieldModel[], szServiceName2_UnoControlDateFieldModel[]; +extern const sal_Char szServiceName_UnoControlTimeField[], szServiceName2_UnoControlTimeField[]; +extern const sal_Char szServiceName_UnoControlTimeFieldModel[], szServiceName2_UnoControlTimeFieldModel[]; +extern const sal_Char szServiceName_UnoControlNumericField[], szServiceName2_UnoControlNumericField[]; +extern const sal_Char szServiceName_UnoControlNumericFieldModel[], szServiceName2_UnoControlNumericFieldModel[]; +extern const sal_Char szServiceName_UnoControlCurrencyField[], szServiceName2_UnoControlCurrencyField[]; +extern const sal_Char szServiceName_UnoControlCurrencyFieldModel[], szServiceName2_UnoControlCurrencyFieldModel[]; +extern const sal_Char szServiceName_UnoControlPatternField[], szServiceName2_UnoControlPatternField[]; +extern const sal_Char szServiceName_UnoControlPatternFieldModel[], szServiceName2_UnoControlPatternFieldModel[]; +extern const sal_Char szServiceName_UnoControlFormattedField[], szServiceName2_UnoControlFormattedField[]; +extern const sal_Char szServiceName_UnoControlFormattedFieldModel[], szServiceName2_UnoControlFormattedFieldModel[]; +extern const sal_Char szServiceName_UnoControlProgressBar[], szServiceName2_UnoControlProgressBar[]; +extern const sal_Char szServiceName_UnoControlProgressBarModel[], szServiceName2_UnoControlProgressBarModel[]; +extern const sal_Char szServiceName_UnoControlScrollBar[], szServiceName2_UnoControlScrollBar[]; +extern const sal_Char szServiceName_UnoControlScrollBarModel[], szServiceName2_UnoControlScrollBarModel[]; +extern const sal_Char szServiceName_UnoControlFixedLine[], szServiceName2_UnoControlFixedLine[]; +extern const sal_Char szServiceName_UnoControlFixedLineModel[], szServiceName2_UnoControlFixedLineModel[]; +extern const sal_Char szServiceName_PrinterServer[], szServiceName2_PrinterServer[]; +extern const sal_Char szServiceName_UnoControlRoadmap[], szServiceName2_UnoControlRoadmap[]; +extern const sal_Char szServiceName_UnoControlRoadmapModel[], szServiceName2_UnoControlRoadmapModel[]; + +extern const sal_Char szServiceName_UnoSpinButtonControl[], szServiceName_UnoSpinButtonModel[]; + +extern const sal_Char szServiceName_TreeControl[]; +extern const sal_Char szServiceName_TreeControlModel[]; +extern const sal_Char szServiceName_MutableTreeDataModel[]; + +extern const sal_Char szServiceName_GridControl[]; +extern const sal_Char szServiceName_GridControlModel[]; +extern const sal_Char szServiceName_DefaultGridDataModel[]; +extern const sal_Char szServiceName_DefaultGridColumnModel[]; +extern const sal_Char szServiceName_GridColumn[]; +extern const sal_Char szServiceName_SortableGridDataModel[]; + +extern const sal_Char szServiceName_UnoSimpleAnimationControl[], szServiceName2_UnoSimpleAnimationControl[]; +extern const sal_Char szServiceName_UnoSimpleAnimationControlModel[], szServiceName2_UnoSimpleAnimationControlModel[]; +extern const sal_Char szServiceName_UnoThrobberControl[], szServiceName2_UnoThrobberControl[]; +extern const sal_Char szServiceName_UnoThrobberControlModel[], szServiceName2_UnoThrobberControlModel[]; +extern const sal_Char szServiceName_AnimatedImagesControl[]; +extern const sal_Char szServiceName_AnimatedImagesControlModel[]; +extern const sal_Char szServiceName_SpinningProgressControlModel[]; +extern const sal_Char szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[]; + +extern const sal_Char szServiceName_UnoControlTabPageModel[], szServiceName2_UnoControlTabPageModel[]; +extern const sal_Char szServiceName_UnoControlTabPage[]; +extern const sal_Char szServiceName_UnoControlTabPageContainerModel[]; +extern const sal_Char szServiceName_UnoControlTabPageContainer[]; + +// ExtUnoWrapper: +extern const char szServiceName_ImageProducer[], szServiceName2_ImageProducer[]; +#endif // _TOOLKIT_HELPER_SERVICENAMES_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/tkresmgr.hxx b/include/toolkit/helper/tkresmgr.hxx new file mode 100644 index 000000000000..362220aa0393 --- /dev/null +++ b/include/toolkit/helper/tkresmgr.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _TOOLKIT_HELPER_TKRESMGR_HXX_ +#define _TOOLKIT_HELPER_TKRESMGR_HXX_ + +#include <rtl/ustring.hxx> +#include <vcl/image.hxx> + +class SimpleResMgr; +class ResMgr; + +#define TK_RES_STRING(id) TkResMgr::loadString(id) +#define TK_RES_IMAGE(id) TkResMgr::loadImage(id) + +// ----------------------------------------------------------------------------- +// TkResMgr +// ----------------------------------------------------------------------------- + +class TkResMgr +{ + static SimpleResMgr* m_pSimpleResMgr; + static ResMgr* m_pResMgr; + +private: + // no instantiation allowed + TkResMgr() { } + ~TkResMgr() { } + + // we'll instantiate one static member of the following class, + // which in it's dtor ensures that m_pSimpleResMgr will be deleted + class EnsureDelete + { + public: + EnsureDelete() { } + ~EnsureDelete(); + }; + friend class EnsureDelete; + +protected: + static void ensureImplExists(); + +public: + // loads the string with the specified resource id + static OUString loadString( sal_uInt16 nResId ); + + // loads the image with the specified resource id + static Image loadImage( sal_uInt16 nResId ); + static Image getImageFromURL( const OUString& i_rImageURL ); +}; + + +#endif // _TOOLKIT_HELPER_TKRESMGR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/unopropertyarrayhelper.hxx b/include/toolkit/helper/unopropertyarrayhelper.hxx new file mode 100644 index 000000000000..b46dcfe9bc99 --- /dev/null +++ b/include/toolkit/helper/unopropertyarrayhelper.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_ +#define _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_ + +#include <toolkit/dllapi.h> +#include <cppuhelper/propshlp.hxx> + +#include <list> +#include <set> +#include "toolkit/dllapi.h" + +// ---------------------------------------------------- +// class UnoPropertyArrayHelper +// ---------------------------------------------------- +class TOOLKIT_DLLPUBLIC UnoPropertyArrayHelper : public ::cppu::IPropertyArrayHelper +{ +private: + std::set<sal_Int32> maIDs; + +protected: + sal_Bool ImplHasProperty( sal_uInt16 nPropId ) const; + +public: + UnoPropertyArrayHelper( const ::com::sun::star::uno::Sequence<sal_Int32>& rIDs ); + UnoPropertyArrayHelper( const std::list< sal_uInt16 > &rIDs ); + + // ::cppu::IPropertyArrayHelper + sal_Bool SAL_CALL fillPropertyMembersByHandle( OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(); + ::com::sun::star::beans::Property SAL_CALL getPropertyByName(const OUString& rPropertyName) throw (::com::sun::star::beans::UnknownPropertyException); + sal_Bool SAL_CALL hasPropertyByName(const OUString& rPropertyName); + sal_Int32 SAL_CALL getHandleByName( const OUString & rPropertyName ); + sal_Int32 SAL_CALL fillHandles( sal_Int32* pHandles, const ::com::sun::star::uno::Sequence< OUString > & rPropNames ); +}; + + + +#endif // _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/unowrapper.hxx b/include/toolkit/helper/unowrapper.hxx new file mode 100644 index 000000000000..a0b82f4c175d --- /dev/null +++ b/include/toolkit/helper/unowrapper.hxx @@ -0,0 +1,86 @@ +/* -*- 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 _TOOLKIT_HELPER_UNOWRAPPER_HXX_ +#define _TOOLKIT_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 <toolkit/helper/accessibilityclient.hxx> + +#include <vcl/unowrap.hxx> +#include <vcl/window.hxx> + +// ---------------------------------------------------- +// class UnoWrapper +// ---------------------------------------------------- + +class UnoWrapper : public UnoWrapperBase +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> mxToolkit; + ::toolkit::AccessibilityClient maAccessibleFactoryAccess; + +public: + UnoWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>& rxToolkit ); + + virtual void Destroy(); + + // Toolkit + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> GetVCLToolkit(); + + // Graphics + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> CreateGraphics( OutputDevice* pOutDev ); + virtual void ReleaseAllGraphics( OutputDevice* pOutDev ); + + // Window + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> GetWindowInterface( Window* pWindow, sal_Bool bCreate ); + virtual void SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xIFace ); + + void WindowDestroyed( Window* pWindow ); + void WindowEvent_Move( Window* pWindow ); + void WindowEvent_Resize( Window* pWindow ); + void WindowEvent_Show( Window* pWindow, sal_Bool bShow ); + void WindowEvent_Close( Window* pWindow ); + void WindowEvent_Minimize( Window* pWindow ); + void WindowEvent_Normalize( Window* pWindow ); + void WindowEvent_Activate( Window* pWindow, sal_Bool bActivated ); + void WindowEvent_MouseButtonUp( Window* pWindow, const MouseEvent& rEvt ); + void WindowEvent_MouseButtonDown( Window* pWindow, const MouseEvent& rEvt ); + void WindowEvent_MouseMove( Window* pWindow, const MouseEvent& rEvt ); + void WindowEvent_Command( Window* pWindow, const CommandEvent& rCEvt ); + void WindowEvent_KeyInput( Window* pWindow, const KeyEvent& rEvt ); + void WindowEvent_KeyUp( Window* pWindow, const KeyEvent& rEvt ); + void WindowEvent_GetFocus( Window* pWindow ); + void WindowEvent_LoseFocus( Window* pWindow ); + void WindowEvent_Paint( Window* pWindow, const Rectangle& rRect ); + + // Accessibility + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreateAccessible( Menu* pMenu, sal_Bool bIsMenuBar ); + +private: + virtual ~UnoWrapper(); +}; + +#endif // _TOOLKIT_HELPER_UNOWRAPPER_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 000000000000..cb1da9ffe4d2 --- /dev/null +++ b/include/toolkit/helper/vclunohelper.hxx @@ -0,0 +1,155 @@ +/* -*- 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 _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ +#define _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ + +#include <toolkit/dllapi.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> + +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/awt/MouseEvent.hpp> + + +namespace com { namespace sun { namespace star { namespace uno { + class XInterface; +}}}} + +namespace com { namespace sun { namespace star { namespace awt { + class XBitmap; + class XWindow; + class XWindow2; + class XWindowPeer; + class XGraphics; + class XRegion; + class XDevice; + class XPointer; + class XToolkit; + class XFont; + class XControlContainer; + struct Size; + struct Point; + struct SimpleFontMetric; + struct FontDescriptor; + struct Rectangle; + struct KeyEvent; +}}}} + + +#include <vcl/bitmapex.hxx> +#include <vcl/region.hxx> +#include <vcl/metric.hxx> +#include <tools/mapunit.hxx> +#include <tools/fldunit.hxx> +#include <tools/poly.hxx> + +class Window; +class OutputDevice; +class MouseEvent; +class KeyEvent; + +// ---------------------------------------------------- +// class VclUnoHelper +// ---------------------------------------------------- +class TOOLKIT_DLLPUBLIC VCLUnoHelper +{ +public: + // Toolkit + static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> CreateToolkit(); + + // Bitmap + static BitmapEx GetBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>& rxBitmap ); + static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap ); + + // Window + static Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow ); + static Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow2 ); + static Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer ); + static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> GetInterface( Window* pWindow ); + + // OutputDevice + static OutputDevice* GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>& rxDevice ); + static OutputDevice* GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>& rxGraphics ); + + // Region + static Region GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ); + + // Polygon + static Polygon CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ); + + /** convert Font to ::com::sun::star::awt::FontDescriptor + @param rFont Font to be converted + @return the new FontDescriptor + */ + static ::com::sun::star::awt::FontDescriptor CreateFontDescriptor( const Font& rFont ); + static Font CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont ); + static Font CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont ); + static ::com::sun::star::awt::SimpleFontMetric CreateFontMetric( const FontMetric& rFontMetric ); + static float ConvertFontWidth( FontWidth eWidth ); + static FontWidth ConvertFontWidth( float f ); + static float ConvertFontWeight( FontWeight eWeight ); + static FontWeight ConvertFontWeight( float f ); + + // Rectangle + static sal_Bool IsZero( ::com::sun::star::awt::Rectangle rRect ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> CreateControlContainer( Window* pWindow ); + + // MapUnits + static MapUnit UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit ); + static sal_Int32 VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit ); + + //======================================================================== + //= MeasurementUnitConversion + //======================================================================== + /** small helper to convert between <type>MeasurementUnit</type> and + <type>FieldUnit</type> + */ + static sal_Int16 ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _rFieldToUNOValueFactor ); + static FieldUnit ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor ); + + static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit) throw (::com::sun::star::lang::IllegalArgumentException); + + static ::Size /* VCLSize */ ConvertToVCLSize(::com::sun::star::awt::Size const& _aSize); + static ::com::sun::star::awt::Size ConvertToAWTSize(::Size /* VCLSize */ const& _aSize); + + static ::Point /* VCLPoint */ ConvertToVCLPoint(::com::sun::star::awt::Point const& _aPoint); + static ::com::sun::star::awt::Point ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint); + + static ::Rectangle ConvertToVCLRect( ::com::sun::star::awt::Rectangle const & _rRect ); + static ::com::sun::star::awt::Rectangle ConvertToAWTRect( ::Rectangle const & _rRect ); + + static ::com::sun::star::awt::MouseEvent + createMouseEvent( + const ::MouseEvent& _rVclEvent, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext + ); + + static ::com::sun::star::awt::KeyEvent + createKeyEvent( + const ::KeyEvent& _rVclEvent, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext + ); +}; + + +#endif // _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |