diff options
Diffstat (limited to 'toolkit/inc/toolkit/helper')
21 files changed, 2162 insertions, 0 deletions
diff --git a/toolkit/inc/toolkit/helper/accessibilityclient.hxx b/toolkit/inc/toolkit/helper/accessibilityclient.hxx new file mode 100644 index 000000000000..732e2d76279a --- /dev/null +++ b/toolkit/inc/toolkit/helper/accessibilityclient.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 + diff --git a/toolkit/inc/toolkit/helper/accessiblefactory.hxx b/toolkit/inc/toolkit/helper/accessiblefactory.hxx new file mode 100644 index 000000000000..f3f28287d460 --- /dev/null +++ b/toolkit/inc/toolkit/helper/accessiblefactory.hxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef TOOLKIT_HELPER_ACCESSIBLE_FACTORY_HXX +#define TOOLKIT_HELPER_ACCESSIBLE_FACTORY_HXX + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX +#include <com/sun/star/uno/Reference.hxx> +#endif + +#ifndef _RTL_REF_HXX +#include <rtl/ref.hxx> +#endif + +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; + }; + +//........................................................................ +} // namespace toolkit +//........................................................................ + +#endif // TOOLKIT_HELPER_ACCESSIBLE_FACTORY_HXX diff --git a/toolkit/inc/toolkit/helper/convert.hxx b/toolkit/inc/toolkit/helper/convert.hxx new file mode 100644 index 000000000000..5de2b8861abf --- /dev/null +++ b/toolkit/inc/toolkit/helper/convert.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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_ diff --git a/toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx b/toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx new file mode 100644 index 000000000000..e35b1395eb54 --- /dev/null +++ b/toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 allways 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_ + diff --git a/toolkit/inc/toolkit/helper/externallock.hxx b/toolkit/inc/toolkit/helper/externallock.hxx new file mode 100644 index 000000000000..75246a829790 --- /dev/null +++ b/toolkit/inc/toolkit/helper/externallock.hxx @@ -0,0 +1,45 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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_ + diff --git a/toolkit/inc/toolkit/helper/fixedhyperbase.hxx b/toolkit/inc/toolkit/helper/fixedhyperbase.hxx new file mode 100644 index 000000000000..4688e2a3f33d --- /dev/null +++ b/toolkit/inc/toolkit/helper/fixedhyperbase.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef TOOLKIT_INC_TOOLKIT_HELPER_FIXEDHYPERBASE_HXX +#define TOOLKIT_INC_TOOLKIT_HELPER_FIXEDHYPERBASE_HXX + +#include <toolkit/dllapi.h> + +#include <vcl/fixed.hxx> + +//........................................................................ +namespace toolkit +{ +//........................................................................ + + class TOOLKIT_DLLPUBLIC FixedHyperlinkBase : public FixedText + { + public: + FixedHyperlinkBase( Window* pParent, const ResId& rId ); + FixedHyperlinkBase( Window* pParent, WinBits nWinStyle ); + virtual ~FixedHyperlinkBase(); + + virtual void SetURL( const String& rNewURL ); + virtual String GetURL() const; + virtual void SetDescription( const String& rNewDescription ); + }; + +//........................................................................ +} // namespace toolkit +//........................................................................ + +#endif // TOOLKIT_INC_TOOLKIT_HELPER_FIXEDHYPERBASE_HXX + diff --git a/toolkit/inc/toolkit/helper/formpdfexport.hxx b/toolkit/inc/toolkit/helper/formpdfexport.hxx new file mode 100644 index 000000000000..502f25520145 --- /dev/null +++ b/toolkit/inc/toolkit/helper/formpdfexport.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX +#define _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX + +#ifndef TOOLKIT_DLLAPI_H +#include <toolkit/dllapi.h> +#endif + +/** === begin UNO includes === **/ +#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_ +#include <com/sun/star/awt/XControl.hpp> +#endif +/** === end UNO includes === **/ + +#ifndef _VCL_PDFWRITER_HXX +#include <vcl/pdfwriter.hxx> +#endif + +#include <memory> + +//........................................................................ +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 + ) SAL_THROW(()); + +//........................................................................ +} // namespace toolkitform +//........................................................................ + +#endif // _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX diff --git a/toolkit/inc/toolkit/helper/imagealign.hxx b/toolkit/inc/toolkit/helper/imagealign.hxx new file mode 100644 index 000000000000..5d725a692bc6 --- /dev/null +++ b/toolkit/inc/toolkit/helper/imagealign.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef TOOLKIT_INC_TOOLKIT_HELPER_IMAGEALIGN_HXX +#define TOOLKIT_INC_TOOLKIT_HELPER_IMAGEALIGN_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#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 diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx new file mode 100644 index 000000000000..65e555f9d799 --- /dev/null +++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx @@ -0,0 +1,251 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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/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> + +// ---------------------------------------------------- +// 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( 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 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 ::rtl::OUString& NewText ) throw (::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END + + + + +#endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ + diff --git a/toolkit/inc/toolkit/helper/macros.hxx b/toolkit/inc/toolkit/helper/macros.hxx new file mode 100644 index 000000000000..48386d9a404c --- /dev/null +++ b/toolkit/inc/toolkit/helper/macros.hxx @@ -0,0 +1,270 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_MACROS_HXX_ +#define _TOOLKIT_HELPER_MACROS_HXX_ + +// ------------------------------------------------------------------------------------- + +#define IMPL_XUNOTUNNEL( 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 == rtl_compareMemory( ClassName::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) ) \ + { \ + return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); \ + } \ + return 0; \ +} \ +const ::com::sun::star::uno::Sequence< sal_Int8 >& ClassName::GetUnoTunnelId() throw() \ +{ \ + static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = NULL; \ + if( !pSeq ) \ + { \ + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \ + if( !pSeq ) \ + { \ + static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \ + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \ + pSeq = &aSeq; \ + } \ + } \ + return *pSeq; \ +} \ +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 == rtl_compareMemory( ClassName::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) ) \ + { \ + return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); \ + } \ + return BaseClass::getSomething( rIdentifier ); \ +} \ +const ::com::sun::star::uno::Sequence< sal_Int8 >& ClassName::GetUnoTunnelId() throw() \ +{ \ + static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = NULL; \ + if( !pSeq ) \ + { \ + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \ + if( !pSeq ) \ + { \ + static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \ + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \ + pSeq = &aSeq; \ + } \ + } \ + return *pSeq; \ +} \ +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, \ + SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ), \ + SAL_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 ) \ + ::rtl::OString sMessage( #ClassName "::" #MethodName ": caught an exception!\n" ); \ + sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US ); \ + OSL_ENSURE( sal_False, sMessage.getStr() ); +#else + #define DISPLAY_EXCEPTION( ClassName, MethodName, e ) +#endif + +#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( ::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( ::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 ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); \ + const ::rtl::OUString* pSupported = aServiceNames.getConstArray(); \ + const ::rtl::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 ) \ + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii( "stardiv.Toolkit." #ImplName ); } \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames = BaseClass::getSupportedServiceNames( ); \ + aNames.realloc( aNames.getLength() + 1 ); \ + aNames[ aNames.getLength() - 1 ] = ::rtl::OUString::createFromAscii( ServiceName ); \ + return aNames; \ + } \ + +// ------------------------------------------------------------------------------------- + +#define DECLIMPL_SERVICEINFO( ImplName, ServiceName ) \ + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii( "stardiv.Toolkit." #ImplName ); } \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( 1 ); \ + aNames[ 0 ] = ::rtl::OUString::createFromAscii( ServiceName ); \ + return aNames; \ + } \ + DECLIMPL_SUPPORTS_SERVICE( ) + + + + + + +#endif // _TOOLKIT_HELPER_MACROS_HXX_ + diff --git a/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx new file mode 100644 index 000000000000..c84a6e54d73b --- /dev/null +++ b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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; } + +}; + + + + + + +#endif // _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX + + diff --git a/toolkit/inc/toolkit/helper/mutexhelper.hxx b/toolkit/inc/toolkit/helper/mutexhelper.hxx new file mode 100644 index 000000000000..43d5e77b353e --- /dev/null +++ b/toolkit/inc/toolkit/helper/mutexhelper.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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_ + diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx new file mode 100644 index 000000000000..d9adc182f4d7 --- /dev/null +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_PROPERTY_HXX_ +#define _TOOLKIT_HELPER_PROPERTY_HXX_ + +#include <toolkit/dllapi.h> + +#include <sal/types.h> + +namespace com { +namespace sun { +namespace star { +namespace uno { + class Type; + class Any; +} } } } + +namespace rtl { + class OUString; +} + + +#define BASEPROPERTY_NOTFOUND 0 + +#define BASEPROPERTY_TEXT 1 // ::rtl::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, war mal Font, aber nie gespeichert... +#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 // ::rtl::OUString (ServiceName) +#define BASEPROPERTY_LABEL 20 // ::rtl::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 // ::rtl::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 // ::rtl::OUString +#define BASEPROPERTY_LITERALMASK 41 // ::rtl::OUString +#define BASEPROPERTY_IMAGEURL 42 // ::rtl::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 // ::rtl::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 // ::rtl::OUString +#define BASEPROPERTY_MOVEABLE 70 // sal_Bool +#define BASEPROPERTY_CLOSEABLE 71 // sal_Bool +#define BASEPROPERTY_SIZEABLE 72 // sal_Bool +#define BASEPROPERTY_HELPTEXT 73 // ::rtl::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 // ::rtl::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_TREE_ROWHEIGHT 130 +#define BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING 131 +#define BASEPROPERTY_TREE_END 131 +#define BASEPROPERTY_DIALOGSOURCEURL 132 +#define BASEPROPERTY_NOLABEL 133 // ::rtl::OUString added for issue79712 +#define BASEPROPERTY_URL 134 // ::rtl::OUString +#define BASEPROPERTY_UNIT 135 // ::awt::FieldUnit +#define BASEPROPERTY_CUSTOMUNITTEXT 136 // ::rtl::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 + + +// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. +#define BASEPROPERTY_FONTDESCRIPTORPART_START 1000 +#define BASEPROPERTY_FONTDESCRIPTORPART_NAME 1000 // ::rtl::OUString, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME 1001 // ::rtl::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 ::rtl::OUString& rPropertyName ); +const ::com::sun::star::uno::Type* GetPropertyType( sal_uInt16 nPropertyId ); +const ::rtl::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_ + + diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx new file mode 100644 index 000000000000..70f18f91fb09 --- /dev/null +++ b/toolkit/inc/toolkit/helper/servicenames.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_SERVICENAMES_HXX_ +#define _TOOLKIT_HELPER_SERVICENAMES_HXX_ + +#include <sal/types.h> +#include <tools/solar.h> + +extern const sal_Char __FAR_DATA szServiceName_Toolkit[], szServiceName2_Toolkit[]; +extern const sal_Char __FAR_DATA szServiceName_MVCIntrospection[], szServiceName2_MVCIntrospection[]; +extern const sal_Char __FAR_DATA szServiceName_PopupMenu[], szServiceName2_PopupMenu[]; +extern const sal_Char __FAR_DATA szServiceName_MenuBar[], szServiceName2_MenuBar[]; +extern const sal_Char __FAR_DATA szServiceName_Pointer[], szServiceName2_Pointer[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[]; +extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[]; +extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlDialog[], szServiceName2_UnoControlDialog[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlDialogModel[], szServiceName2_UnoControlDialogModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlEdit[], szServiceName2_UnoControlEdit[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlEditModel[], szServiceName2_UnoControlEditModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlFileControl[], szServiceName2_UnoControlFileControl[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlFileControlModel[], szServiceName2_UnoControlFileControlModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlButton[], szServiceName2_UnoControlButton[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlButtonModel[], szServiceName2_UnoControlButtonModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlImageButton[], szServiceName2_UnoControlImageButton[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlImageButtonModel[], szServiceName2_UnoControlImageButtonModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlImageControl[], szServiceName2_UnoControlImageControl[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlImageControlModel[], szServiceName2_UnoControlImageControlModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlRadioButton[], szServiceName2_UnoControlRadioButton[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlRadioButtonModel[], szServiceName2_UnoControlRadioButtonModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlCheckBox[], szServiceName2_UnoControlCheckBox[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlCheckBoxModel[], szServiceName2_UnoControlCheckBoxModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlListBox[], szServiceName2_UnoControlListBox[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlListBoxModel[], szServiceName2_UnoControlListBoxModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlComboBox[], szServiceName2_UnoControlComboBox[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlComboBoxModel[], szServiceName2_UnoControlComboBoxModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedText[], szServiceName2_UnoControlFixedText[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedTextModel[], szServiceName2_UnoControlFixedTextModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlGroupBox[], szServiceName2_UnoControlGroupBox[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlGroupBoxModel[], szServiceName2_UnoControlGroupBoxModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlDateField[], szServiceName2_UnoControlDateField[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlDateFieldModel[], szServiceName2_UnoControlDateFieldModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlTimeField[], szServiceName2_UnoControlTimeField[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlTimeFieldModel[], szServiceName2_UnoControlTimeFieldModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlNumericField[], szServiceName2_UnoControlNumericField[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlNumericFieldModel[], szServiceName2_UnoControlNumericFieldModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyField[], szServiceName2_UnoControlCurrencyField[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyFieldModel[], szServiceName2_UnoControlCurrencyFieldModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlPatternField[], szServiceName2_UnoControlPatternField[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlPatternFieldModel[], szServiceName2_UnoControlPatternFieldModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlFormattedField[], szServiceName2_UnoControlFormattedField[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlFormattedFieldModel[], szServiceName2_UnoControlFormattedFieldModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlProgressBar[], szServiceName2_UnoControlProgressBar[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlProgressBarModel[], szServiceName2_UnoControlProgressBarModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlScrollBar[], szServiceName2_UnoControlScrollBar[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlScrollBarModel[], szServiceName2_UnoControlScrollBarModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedLine[], szServiceName2_UnoControlFixedLine[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedLineModel[], szServiceName2_UnoControlFixedLineModel[]; +extern const sal_Char __FAR_DATA szServiceName_PrinterServer[], szServiceName2_PrinterServer[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlRoadmap[], szServiceName2_UnoControlRoadmap[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlRoadmapModel[], szServiceName2_UnoControlRoadmapModel[]; + +extern const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[], szServiceName_UnoSpinButtonModel[]; + +extern const sal_Char __FAR_DATA szServiceName_TreeControl[]; +extern const sal_Char __FAR_DATA szServiceName_TreeControlModel[]; +extern const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[]; + +extern const sal_Char __FAR_DATA szServiceName_GridControl[]; +extern const sal_Char __FAR_DATA szServiceName_GridControlModel[]; +extern const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[]; +extern const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[]; +extern const sal_Char __FAR_DATA szServiceName_GridColumn[]; + +extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName_UnoSimpleAnimationControlModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName_UnoThrobberControlModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[]; + +// ExtUnoWrapper: +extern const char __FAR_DATA szServiceName_ImageProducer[], szServiceName2_ImageProducer[]; + + + +#endif // _TOOLKIT_HELPER_SERVICENAMES_HXX_ + diff --git a/toolkit/inc/toolkit/helper/solarrelease.hxx b/toolkit/inc/toolkit/helper/solarrelease.hxx new file mode 100644 index 000000000000..d8938b41c220 --- /dev/null +++ b/toolkit/inc/toolkit/helper/solarrelease.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef TOOLKIT_INC_TOOLKIT_HELPER_SOLARRELEASE_HXX +#define TOOLKIT_INC_TOOLKIT_HELPER_SOLARRELEASE_HXX + +#include <vcl/svapp.hxx> + +//........................................................................ +namespace toolkit +{ +//........................................................................ + + //==================================================================== + //= ReleaseSolarMutex + //==================================================================== + class ReleaseSolarMutex + { + sal_uInt32 mnLockCount; + public: + ReleaseSolarMutex() + { + mnLockCount = Application::ReleaseSolarMutex(); + } + + ~ReleaseSolarMutex() + { + Application::AcquireSolarMutex( mnLockCount ); + } + }; + +//........................................................................ +} // namespace toolkit +//........................................................................ + +#endif // TOOLKIT_INC_TOOLKIT_HELPER_SOLARRELEASE_HXX + diff --git a/toolkit/inc/toolkit/helper/throbberimpl.hxx b/toolkit/inc/toolkit/helper/throbberimpl.hxx new file mode 100644 index 000000000000..5ca6ec83d330 --- /dev/null +++ b/toolkit/inc/toolkit/helper/throbberimpl.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_THROBBERIMPL_HXX_ +#define _TOOLKIT_HELPER_THROBBERIMPL_HXX_ + +#include <toolkit/awt/vclxwindow.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <com/sun/star/graphic/XGraphic.hpp> +#include <vcl/timer.hxx> +#include <vos/mutex.hxx> + +//........................................................................ +namespace toolkit +//........................................................................ +{ + + class Throbber_Impl + { + private: + NAMESPACE_VOS(IMutex)& mrMutex; // Reference to SolarMutex + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > maImageList; + ::com::sun::star::uno::Reference< VCLXWindow > mxParent; + + sal_Bool mbRepeat; + sal_Int32 mnStepTime; + sal_Int32 mnCurStep; + sal_Int32 mnStepCount; + AutoTimer maWaitTimer; + + DECL_LINK( TimeOutHdl, Throbber_Impl* ); + + NAMESPACE_VOS(IMutex)& GetMutex() { return mrMutex; } + + public: + Throbber_Impl( ::com::sun::star::uno::Reference< VCLXWindow > xParent, + sal_Int32 nStepTime, + sal_Bool bRepeat ); + ~Throbber_Impl(); + + // Properties + void setStepTime( sal_Int32 nStepTime ) { mnStepTime = nStepTime; } + void setRepeat( sal_Bool bRepeat ) { mbRepeat = bRepeat; } + + // XSimpleAnimation + void start() throw ( ::com::sun::star::uno::RuntimeException ); + void stop() throw ( ::com::sun::star::uno::RuntimeException ); + void setImageList( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& ImageList ) + throw ( ::com::sun::star::uno::RuntimeException ); + // Helpers + void initImage() throw ( ::com::sun::star::uno::RuntimeException ); + sal_Bool isHCMode() throw ( ::com::sun::star::uno::RuntimeException ); + }; +//........................................................................ +} // namespacetoolkit +//........................................................................ + +#endif //_TOOLKIT_HELPER_THROBBERIMPL_HXX_ + diff --git a/toolkit/inc/toolkit/helper/tkresmgr.hxx b/toolkit/inc/toolkit/helper/tkresmgr.hxx new file mode 100644 index 000000000000..d7a1c42ea13c --- /dev/null +++ b/toolkit/inc/toolkit/helper/tkresmgr.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 ::rtl::OUString loadString( sal_uInt16 nResId ); + + // loads the image with the specified resource id + static Image loadImage( sal_uInt16 nResId ); +}; + + +#endif // _TOOLKIT_HELPER_TKRESMGR_HXX_ + diff --git a/toolkit/inc/toolkit/helper/unomemorystream.hxx b/toolkit/inc/toolkit/helper/unomemorystream.hxx new file mode 100644 index 000000000000..c7d91e076f73 --- /dev/null +++ b/toolkit/inc/toolkit/helper/unomemorystream.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_ +#define _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_ + + +#include <com/sun/star/io/XInputStream.hpp> +#include <cppuhelper/weak.hxx> +#include <osl/mutex.hxx> + +#include <tools/stream.hxx> + +// ---------------------------------------------------- +// class UNOMEMORYSTREAM +// ---------------------------------------------------- + +class UnoMemoryStream : public SvMemoryStream, + public ::com::sun::star::io::XInputStream, + public ::cppu::OWeakObject +{ +private: + ::osl::Mutex maMutex; + +protected: + ::osl::Mutex& GetMutex() { return maMutex; } + + +public: + UnoMemoryStream( sal_uInt32 nInitSize = 0x3FFF, sal_uInt32 nResize = 0x3FFFF ); + + // ::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() { OWeakObject::acquire(); } + void SAL_CALL release() throw() { OWeakObject::release(); } + + // ::com::sun::star::io::XInputStream + sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); +}; + + + + +#endif // _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_ + diff --git a/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx new file mode 100644 index 000000000000..2a42d05b72fd --- /dev/null +++ b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_ +#define _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_ + +#include <cppuhelper/propshlp.hxx> + +#include <tools/table.hxx> + +#include <list> + +// ---------------------------------------------------- +// class UnoPropertyArrayHelper +// ---------------------------------------------------- +class UnoPropertyArrayHelper : public ::cppu::IPropertyArrayHelper +{ +private: + Table 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( ::rtl::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 ::rtl::OUString& rPropertyName) throw (::com::sun::star::beans::UnknownPropertyException); + sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName); + sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ); + sal_Int32 SAL_CALL fillHandles( sal_Int32* pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames ); +}; + + + +#endif // _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_ + diff --git a/toolkit/inc/toolkit/helper/unowrapper.hxx b/toolkit/inc/toolkit/helper/unowrapper.hxx new file mode 100644 index 000000000000..31cc259b7fd0 --- /dev/null +++ b/toolkit/inc/toolkit/helper/unowrapper.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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, 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, BOOL bShow ); + void WindowEvent_Close( Window* pWindow ); + void WindowEvent_Minimize( Window* pWindow ); + void WindowEvent_Normalize( Window* pWindow ); + void WindowEvent_Activate( Window* pWindow, 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_ + diff --git a/toolkit/inc/toolkit/helper/vclunohelper.hxx b/toolkit/inc/toolkit/helper/vclunohelper.hxx new file mode 100644 index 000000000000..cc11f3a586bb --- /dev/null +++ b/toolkit/inc/toolkit/helper/vclunohelper.hxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 <vcl/mapunit.hxx> +#include <vcl/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 ); + + + // Pointer + static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> CreatePointer(); + + // Polygon + static Polygon CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ); + + // Font + 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 sal_Int16 /* com.sun.star.util.MeasureUnit.* */ ConvertToMeasurementUnit(MapUnit /* MapModeUnit */ _nMapModeUnit) 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_ |