diff options
Diffstat (limited to 'toolkit')
71 files changed, 26073 insertions, 0 deletions
diff --git a/toolkit/inc/toolkit/awt/vclxbitmap.hxx b/toolkit/inc/toolkit/awt/vclxbitmap.hxx new file mode 100644 index 000000000000..fc9ce2b44e16 --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxbitmap.hxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * $RCSfile: vclxbitmap.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXBITMAP_HXX_ +#define _TOOLKIT_AWT_VCLXBITMAP_HXX_ + +#ifndef _COM_SUN_STAR_AWT_XBITMAP_HPP_ +#include <com/sun/star/awt/XBitmap.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XDISPLAYBITMAP_HPP_ +#include <com/sun/star/awt/XDisplayBitmap.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef _SV_BITMAPEX_HXX +#include <vcl/bitmapex.hxx> +#endif + + +// ---------------------------------------------------- +// class VCLXBitmap +// ---------------------------------------------------- + +class VCLXBitmap : public ::com::sun::star::awt::XBitmap, + public ::com::sun::star::awt::XDisplayBitmap, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XUnoTunnel, + public ::cppu::OWeakObject +{ +private: + ::osl::Mutex maMutex; + BitmapEx maBitmap; + +protected: + ::osl::Mutex& GetMutex() { return maMutex; } + + +public: + void SetBitmap( const BitmapEx& rBmp ) { maBitmap = rBmp; } + const BitmapEx& GetBitmap() const { return maBitmap; } + + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static VCLXBitmap* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XBitmap + ::com::sun::star::awt::Size SAL_CALL getSize() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getDIB() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getMaskDIB() throw(::com::sun::star::uno::RuntimeException); +}; + + + + +#endif // _TOOLKIT_AWT_VCLXBITMAP_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxcontainer.hxx b/toolkit/inc/toolkit/awt/vclxcontainer.hxx new file mode 100644 index 000000000000..8ca2117966c7 --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxcontainer.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * $RCSfile: vclxcontainer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXCONTAINER_HXX_ +#define _TOOLKIT_AWT_VCLXCONTAINER_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINER_HPP_ +#include <com/sun/star/awt/XVclContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_ +#include <com/sun/star/awt/XVclContainerPeer.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <toolkit/awt/vclxwindow.hxx> + + +// ---------------------------------------------------- +// class VCLXContainer +// ---------------------------------------------------- + +class VCLXContainer : public ::com::sun::star::awt::XVclContainer, + public ::com::sun::star::awt::XVclContainerPeer, + public VCLXWindow +{ +public: + VCLXContainer(); + ~VCLXContainer(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XVclContainer + void SAL_CALL addVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > SAL_CALL getWindows( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XVclContainerPeer + void SAL_CALL enableDialogControl( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setTabOrder( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& WindowOrder, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Tabs, sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& Windows ) throw(::com::sun::star::uno::RuntimeException); + +}; + + + + +#endif // _TOOLKIT_AWT_VCLXCONTAINER_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxdevice.hxx b/toolkit/inc/toolkit/awt/vclxdevice.hxx new file mode 100644 index 000000000000..af080e4981e6 --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxdevice.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * $RCSfile: vclxdevice.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXDEVICE_HXX_ +#define _TOOLKIT_AWT_VCLXDEVICE_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XDEVICE_HPP_ +#include <com/sun/star/awt/XDevice.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _VOS_MUTEX_HXX_ +#include <vos/mutex.hxx> +#endif + +class OutputDevice; +class VirtualDevice; + +// ---------------------------------------------------- +// class VCLXDevice +// ---------------------------------------------------- + +class VCLXDevice : public ::com::sun::star::awt::XDevice, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XUnoTunnel, + public ::cppu::OWeakObject +{ + friend class VCLXGraphics; + +private: + NAMESPACE_VOS(IMutex)& mrMutex; // Reference to SolarMutex + OutputDevice* mpOutputDevice; + +public: + void* pDummy; + sal_uInt32 nDummy; + +protected: + NAMESPACE_VOS(IMutex)& GetMutex() { return mrMutex; } + void DestroyOutputDevice(); + +public: + VCLXDevice(); + ~VCLXDevice(); + + void SetOutputDevice( OutputDevice* pOutDev ) { mpOutputDevice = pOutDev; } + OutputDevice* GetOutputDevice() const { return mpOutputDevice; } + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static VCLXDevice* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XDevice, + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL createGraphics( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createDevice( sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor > SAL_CALL getFontDescriptors( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( const ::com::sun::star::awt::FontDescriptor& aDescriptor ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > SAL_CALL createBitmap( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap > SAL_CALL createDisplayBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& Bitmap ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXVirtualDevice +// ---------------------------------------------------- + +class VCLXVirtualDevice : public VCLXDevice +{ +private: + VirtualDevice* mpVDev; + +public: + ~VCLXVirtualDevice() { DestroyOutputDevice(); } + + void SetVirtualDevice( VirtualDevice* pVDev ) { SetOutputDevice( (OutputDevice*)pVDev ); } +}; + + + + +#endif // _TOOLKIT_AWT_VCLXDEVICE_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxfont.hxx b/toolkit/inc/toolkit/awt/vclxfont.hxx new file mode 100644 index 000000000000..41eee883a245 --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxfont.hxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * $RCSfile: vclxfont.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXFONT_HXX_ +#define _TOOLKIT_AWT_VCLXFONT_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XFONT_HPP_ +#include <com/sun/star/awt/XFont.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XDEVICE_HPP_ +#include <com/sun/star/awt/XDevice.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef _SV_METRIC_HXX +#include <vcl/metric.hxx> +#endif + +// ---------------------------------------------------- +// class VCLXFont +// ---------------------------------------------------- + +class VCLXFont : public ::com::sun::star::awt::XFont, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XUnoTunnel, + public ::cppu::OWeakObject +{ +private: + ::osl::Mutex maMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice> mxDevice; + Font maFont; + FontMetric* mpFontMetric; + +protected: + BOOL ImplAssertValidFontMetric(); + ::osl::Mutex& GetMutex() { return maMutex; } + +public: + VCLXFont(); + ~VCLXFont(); + + void Init( ::com::sun::star::awt::XDevice& rxDev, const Font& rFont ); + const Font& GetFont() const { return maFont; } + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static VCLXFont* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XFont + ::com::sun::star::awt::FontDescriptor SAL_CALL getFontDescriptor( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::SimpleFontMetric SAL_CALL getFontMetric( ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getCharWidth( sal_Unicode c ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getCharWidths( sal_Unicode nFirst, sal_Unicode nLast ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getStringWidth( const ::rtl::OUString& str ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getStringWidthArray( const ::rtl::OUString& str, ::com::sun::star::uno::Sequence< sal_Int32 >& rDXArray ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getKernPairs( ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars1, ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars2, ::com::sun::star::uno::Sequence< sal_Int16 >& rnKerns ) throw(::com::sun::star::uno::RuntimeException); +}; + + + +#endif // _TOOLKIT_AWT_VCLXFONT_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxgraphics.hxx b/toolkit/inc/toolkit/awt/vclxgraphics.hxx new file mode 100644 index 000000000000..58e47054564d --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxgraphics.hxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * $RCSfile: vclxgraphics.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXGRAPHICS_HXX_ +#define _TOOLKIT_AWT_VCLXGRAPHICS_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XGRAPHICS_HPP_ +#include <com/sun/star/awt/XGraphics.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _VOS_MUTEX_HXX_ +#include <vos/mutex.hxx> +#endif + +#include <vcl/font.hxx> +#include <vcl/color.hxx> +#include <vcl/vclenum.hxx> + +class OutputDevice; +class Region; + + +#define INITOUTDEV_FONT 0x0001 +#define INITOUTDEV_COLORS 0x0002 +#define INITOUTDEV_RASTEROP 0x0004 +#define INITOUTDEV_CLIPREGION 0x0008 +#define INITOUTDEV_ALL 0xFFFF + + +// ---------------------------------------------------- +// class VCLXGraphics +// ---------------------------------------------------- + +class VCLXGraphics : public ::com::sun::star::awt::XGraphics, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XUnoTunnel, + public ::cppu::OWeakObject +{ +private: + NAMESPACE_VOS(IMutex)& mrMutex; // Reference to SolarMutex + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice> mxDevice; // nur um bei getDevice() immer das gleiche zurueckzugeben + + OutputDevice* mpOutputDevice; + Font maFont; + Color maTextColor; + Color maTextFillColor; + Color maLineColor; + Color maFillColor; + RasterOp meRasterOp; + Region* mpClipRegion; + +protected: + NAMESPACE_VOS(IMutex)& GetMutex() { return mrMutex; } + +public: + VCLXGraphics(); + ~VCLXGraphics(); + + void Init( OutputDevice* pOutDev ); + void InitOutputDevice( sal_uInt16 nFlags ); + + void SetOutputDevice( OutputDevice* pOutDev ); + OutputDevice* GetOutputDevice() const { return mpOutputDevice; } + + const Font& GetFont() const { return maFont; } + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static VCLXGraphics* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XGraphics + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL getDevice( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::SimpleFontMetric SAL_CALL getFontMetric() throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& xNewFont ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL selectFont( const ::com::sun::star::awt::FontDescriptor& aDescription ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setTextColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setTextFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLineColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setRasterOp( ::com::sun::star::awt::RasterOperation ROP ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& Clipping ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL intersectClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& xClipping ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL push( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL pop( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL copy( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >& xSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL draw( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap >& xBitmapHandle, sal_Int32 SourceX, sal_Int32 SourceY, sal_Int32 SourceWidth, sal_Int32 SourceHeight, sal_Int32 DestX, sal_Int32 DestY, sal_Int32 DestWidth, sal_Int32 DestHeight ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawPixel( sal_Int32 X, sal_Int32 Y ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawLine( sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawRect( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawRoundedRect( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawPolyLine( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawPolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataX, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataY ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawEllipse( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawArc( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawPie( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawChord( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawGradient( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 Height, const ::com::sun::star::awt::Gradient& aGradient ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawText( sal_Int32 X, sal_Int32 Y, const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL drawTextArray( sal_Int32 X, sal_Int32 Y, const ::rtl::OUString& Text, const ::com::sun::star::uno::Sequence< sal_Int32 >& Longs ) throw(::com::sun::star::uno::RuntimeException); +}; + + + + +#endif // _TOOLKIT_AWT_VCLXGRAPHICS_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxmenu.hxx b/toolkit/inc/toolkit/awt/vclxmenu.hxx new file mode 100644 index 000000000000..8c6cd3db788f --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxmenu.hxx @@ -0,0 +1,194 @@ +/************************************************************************* + * + * $RCSfile: vclxmenu.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXMENU_HXX_ +#define _TOOLKIT_AWT_VCLXMENU_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XMENUBAR_HPP_ +#include <com/sun/star/awt/XMenuBar.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPOPUPMENU_HPP_ +#include <com/sun/star/awt/XPopupMenu.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <tools/list.hxx> +#include <tools/link.hxx> + +#include <toolkit/helper/listenermultiplexer.hxx> + +class Menu; + +DECLARE_LIST( PopupMenuRefList, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >* ); + +// ---------------------------------------------------- +// class VCLXMenu +// ---------------------------------------------------- + +class VCLXMenu : public ::com::sun::star::awt::XMenuBar, + public ::com::sun::star::awt::XPopupMenu, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XUnoTunnel, + public ::cppu::OWeakObject +{ +private: + ::osl::Mutex maMutex; + Menu* mpMenu; + BOOL mbPopup; + MenuListenerMultiplexer maMenuListeners; + PopupMenuRefList maPopupMenueRefs; + +protected: + ::osl::Mutex& GetMutex() { return maMutex; } + + DECL_LINK( SelectHdl, Menu* ); + DECL_LINK( HighlightHdl, Menu* ); + DECL_LINK( ActivateHdl, Menu* ); + DECL_LINK( DeactivateHdl, Menu* ); + + void ImplCreateMenu( BOOL bPopup ); + +public: + VCLXMenu(); + ~VCLXMenu(); + + + Menu* GetMenu() const { return mpMenu; } + BOOL IsPopupMenu() const { return mbPopup; } + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static VCLXMenu* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XMenu + void SAL_CALL addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& aPopupMenu ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > SAL_CALL getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XPopupMenu + void SAL_CALL insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent, const ::com::sun::star::awt::Rectangle& Area, sal_Int16 Direction ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XMenuBar + +}; + +// ---------------------------------------------------- +// class VCLXMenuBar +// ---------------------------------------------------- +class VCLXMenuBar : public VCLXMenu +{ +public: + VCLXMenuBar() { ImplCreateMenu( FALSE ); } +}; + +// ---------------------------------------------------- +// class VCLXPopupMenu +// ---------------------------------------------------- +class VCLXPopupMenu : public VCLXMenu +{ +public: + VCLXPopupMenu() { ImplCreateMenu( TRUE ); } +}; + + + + +#endif // _TOOLKIT_AWT_VCLXMENU_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxpointer.hxx b/toolkit/inc/toolkit/awt/vclxpointer.hxx new file mode 100644 index 000000000000..88774ca14ebd --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxpointer.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * $RCSfile: vclxpointer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXPOINTER_HXX_ +#define _TOOLKIT_AWT_VCLXPOINTER_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XPOINTER_HPP_ +#include <com/sun/star/awt/XPointer.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <vcl/pointr.hxx> + +// ---------------------------------------------------- +// class VCLXPointer +// ---------------------------------------------------- + +class VCLXPointer : public ::com::sun::star::awt::XPointer, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XUnoTunnel, + public ::cppu::OWeakObject +{ +private: + ::osl::Mutex maMutex; + Pointer maPointer; + +protected: + ::osl::Mutex& GetMutex() { return maMutex; } + +public: + VCLXPointer(); + ~VCLXPointer(); + + const Pointer& GetPointer() const { return maPointer; } + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static VCLXPointer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XPointer + void SAL_CALL setType( sal_Int32 nType ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException); +}; + + + + +#endif // _TOOLKIT_AWT_VCLXPOINTER_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxprinter.hxx b/toolkit/inc/toolkit/awt/vclxprinter.hxx new file mode 100644 index 000000000000..5a8aa1be9420 --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxprinter.hxx @@ -0,0 +1,278 @@ +/************************************************************************* + * + * $RCSfile: vclxprinter.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXPRINTER_HXX_ +#define _TOOLKIT_AWT_VCLXPRINTER_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XPRINTERPROPERTYSET_HPP_ +#include <com/sun/star/awt/XPrinterPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPRINTER_HPP_ +#include <com/sun/star/awt/XPrinter.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPRINTERSERVER_HPP_ +#include <com/sun/star/awt/XPrinterServer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XINFOPRINTER_HPP_ +#include <com/sun/star/awt/XInfoPrinter.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <toolkit/helper/mutexandbroadcasthelper.hxx> +#include <cppuhelper/propshlp.hxx> + +class Printer; +class String; + + +// Fuer den Drucker relevante Properties: +/* + sal_Bool Horizontal + sal_uInt16 CopyCount; + sal_Bool Collate; + String FormDescriptor; + sal_uInt16 Orientation; // PORTRAIT, LANDSCAPE +*/ + +// ---------------------------------------------------- +// class VCLXPrinterPropertySet +// ---------------------------------------------------- + +class VCLXPrinterPropertySet : public ::com::sun::star::awt::XPrinterPropertySet, + public ::com::sun::star::lang::XTypeProvider, + public MutexAndBroadcastHelper, + public ::cppu::OPropertySetHelper +{ +private: + Printer* mpPrinter; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxPrnDevice; + + sal_Int16 mnOrientation; + sal_Bool mbHorizontal; + +protected: + +public: + VCLXPrinterPropertySet( const String& rPrinterName ); + ~VCLXPrinterPropertySet(); + + Printer* GetPrinter() const { return mpPrinter; } + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > GetDevice(); + + // ::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); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::setPropertyValue( rPropertyName, aValue ); } + ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { return OPropertySetHelper::getPropertyValue( rPropertyName ); } + void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::addPropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::removePropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::addVetoableChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::removeVetoableChangeListener( rPropertyName, rxListener ); } + + // ::cppu::OPropertySetHelper + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException); + void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); + void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; + + // ::com::sun::star::awt::XPrinterPropertySet + void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL selectForm( const ::rtl::OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXPrinter +// ---------------------------------------------------- + +class VCLXPrinter: public ::com::sun::star::awt::XPrinter, + public VCLXPrinterPropertySet, + public ::cppu::OWeakObject +{ +public: + VCLXPrinter( const String& rPrinterName ); + ~VCLXPrinter(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::beans::XPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertySetInfo(); } + void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); } + ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); } + void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); } + + // ::com::sun::star::awt::XPrinterPropertySet + void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); } + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getFormDescriptions(); } + void SAL_CALL selectForm( const ::rtl::OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::selectForm( aFormDescription ); } + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getBinarySetup(); } + void SAL_CALL setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setBinarySetup( data ); } + + // ::com::sun::star::awt::XPrinter + sal_Bool SAL_CALL start( const ::rtl::OUString& nJobName, sal_Int16 nCopies, sal_Bool nCollate ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL end( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL terminate( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL endPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXInfoPrinter +// ---------------------------------------------------- + +class VCLXInfoPrinter: public ::com::sun::star::awt::XInfoPrinter, + public VCLXPrinterPropertySet, + public ::cppu::OWeakObject +{ +public: + VCLXInfoPrinter( const String& rPrinterName ); + ~VCLXInfoPrinter(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::beans::XPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertySetInfo(); } + void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); } + ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); } + void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); } + + // ::com::sun::star::awt::XPrinterPropertySet + void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); } + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getFormDescriptions(); } + void SAL_CALL selectForm( const ::rtl::OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::selectForm( aFormDescription ); } + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getBinarySetup(); } + void SAL_CALL setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setBinarySetup( data ); } + + // ::com::sun::star::awt::XInfoPrinter + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createDevice( ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXPrinterServer +// ---------------------------------------------------- + +class VCLXPrinterServer : public ::com::sun::star::awt::XPrinterServer, + public ::cppu::OWeakObject +{ +public: + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XPrinterServer + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getPrinterNames( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > SAL_CALL createPrinter( const ::rtl::OUString& printerName ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > SAL_CALL createInfoPrinter( const ::rtl::OUString& printerName ) throw(::com::sun::star::uno::RuntimeException); +}; + + + + +#endif // _TOOLKIT_AWT_VCLXPRINTER_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxregion.hxx b/toolkit/inc/toolkit/awt/vclxregion.hxx new file mode 100644 index 000000000000..2c620a93ff18 --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxregion.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * $RCSfile: vclxregion.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXREGION_HXX_ +#define _TOOLKIT_AWT_VCLXREGION_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XREGION_HPP_ +#include <com/sun/star/awt/XRegion.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <vcl/region.hxx> + +// ---------------------------------------------------- +// class VCLXRegion +// ---------------------------------------------------- + +class VCLXRegion : public ::com::sun::star::awt::XRegion, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XUnoTunnel, + public ::cppu::OWeakObject +{ +private: + ::osl::Mutex maMutex; + Region maRegion; + +protected: + ::osl::Mutex& GetMutex() { return maMutex; } + +public: + VCLXRegion(); + ~VCLXRegion(); + + void SetRegion( const Region& rRegion ) { maRegion = rRegion; } + const Region& GetRegion() const { return maRegion; } + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static VCLXRegion* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XRegion + ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL clear() throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL move( sal_Int32 nHorzMove, sal_Int32 nVertMove ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL unionRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL intersectRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL excludeRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL xOrRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL unionRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL intersectRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL excludeRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL xOrRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > SAL_CALL getRectangles() throw(::com::sun::star::uno::RuntimeException); + +}; + + + +#endif // _TOOLKIT_AWT_VCLXREGION_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx b/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx new file mode 100644 index 000000000000..0cbd8472c0ba --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * $RCSfile: vclxsystemdependentwindow.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXSYSTEMDEPENDENTWINDOW_HXX_ +#define _TOOLKIT_AWT_VCLXSYSTEMDEPENDENTWINDOW_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XSYSTEMDEPENDENTWINDOWPEER_HPP_ +#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <toolkit/awt/vclxwindow.hxx> + +// ---------------------------------------------------- +// class VCLXSystemDependendtWindow +// ---------------------------------------------------- + +class VCLXSystemDependentWindow : public ::com::sun::star::awt::XSystemDependentWindowPeer, + public VCLXWindow +{ +public: + VCLXSystemDependentWindow(); + ~VCLXSystemDependentWindow(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XSystemDependendtWindowPeer + ::com::sun::star::uno::Any SAL_CALL getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException); +}; + + + + +#endif // _TOOLKIT_AWT_VCLXSYSTEMDEPENDENTWINDOW_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx new file mode 100644 index 000000000000..271f2b9f491f --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * $RCSfile: vclxtoolkit.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXTOOLKIT_HXX_ +#define _TOOLKIT_AWT_VCLXTOOLKIT_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XTOOLKIT_HPP_ +#include <com/sun/star/awt/XToolkit.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +class Window; +class VCLXWindow; + +namespace com { +namespace sun { +namespace star { +namespace awt { + struct WindowDescriptor; +} } } } + +// ---------------------------------------------------- +// class VCLXTOOLKIT +// ---------------------------------------------------- + +class VCLXToolkit : public ::com::sun::star::awt::XToolkit, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakObject +{ +private: + ::osl::Mutex maMutex; + +protected: + ::osl::Mutex& GetMutex() { return maMutex; } + +public: + + virtual Window* CreateComponent( VCLXWindow** ppNewComp, + const ::com::sun::star::awt::WindowDescriptor& rDescriptor, Window* pParent, sal_uInt32 nWinBits ); + + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XToolkit + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getDesktopWindow( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Rectangle SAL_CALL getWorkArea( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL createWindow( const ::com::sun::star::awt::WindowDescriptor& Descriptor ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > SAL_CALL createWindows( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::WindowDescriptor >& Descriptors ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > SAL_CALL createRegion( ) throw(::com::sun::star::uno::RuntimeException); +}; + + + + +#endif // _TOOLKIT_AWT_VCLXTOOLKIT_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx new file mode 100644 index 000000000000..cb52648d78fe --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * $RCSfile: vclxtopwindow.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_ +#define _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_ +#include <com/sun/star/awt/XTopWindow.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XMENUBAR_HPP_ +#include <com/sun/star/awt/XMenuBar.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <toolkit/awt/vclxcontainer.hxx> + +// ---------------------------------------------------- +// class VCLXTopWindow +// ---------------------------------------------------- + +class VCLXTopWindow : public ::com::sun::star::awt::XTopWindow, + public VCLXContainer +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar> mxMenuBar; + +public: + VCLXTopWindow(); + ~VCLXTopWindow(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTopWindow + void SAL_CALL addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL toFront( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL toBack( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw(::com::sun::star::uno::RuntimeException); +}; + + + + +#endif // _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxwindow.hxx b/toolkit/inc/toolkit/awt/vclxwindow.hxx new file mode 100644 index 000000000000..6255f73986ee --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxwindow.hxx @@ -0,0 +1,224 @@ +/************************************************************************* + * + * $RCSfile: vclxwindow.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_ +#define _TOOLKIT_AWT_VCLXWINDOW_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ +#include <com/sun/star/awt/XWindow.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_ +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_ +#include <com/sun/star/awt/XLayoutConstrains.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XVIEW_HPP_ +#include <com/sun/star/awt/XView.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPOINTER_HPP_ +#include <com/sun/star/awt/XPointer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XGraphics_HPP_ +#include <com/sun/star/awt/XGraphics.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <toolkit/awt/vclxdevice.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> + +#include <tools/gen.hxx> // Size + +class Window; + +// ---------------------------------------------------- +// class VCLXWINDOW +// ---------------------------------------------------- + +class VCLXWindow : public ::com::sun::star::awt::XWindow, + public ::com::sun::star::awt::XVclWindowPeer, + public ::com::sun::star::awt::XLayoutConstrains, + public ::com::sun::star::awt::XView, + public VCLXDevice +{ +private: + EventListenerMultiplexer maEventListeners; + FocusListenerMultiplexer maFocusListeners; + WindowListenerMultiplexer maWindowListeners; + KeyListenerMultiplexer maKeyListeners; + MouseListenerMultiplexer maMouseListeners; + MouseMotionListenerMultiplexer maMouseMotionListeners; + PaintListenerMultiplexer maPaintListeners; + VclContainerListenerMultiplexer maContainerListeners; + TopWindowListenerMultiplexer maTopWindowListeners; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> mxPointer; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> mxViewGraphics; + + sal_Bool mbDisposing; + sal_Bool mbDesignMode; + +protected: + Size ImplCalcWindowSize( const Size& rOutSz ) const; + +public: + VCLXWindow(); + ~VCLXWindow(); + + virtual void SetWindow( Window* pWindow ); + Window* GetWindow() const { return (Window*)GetOutputDevice(); } + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> GetViewGraphics() const { return mxViewGraphics; } + + EventListenerMultiplexer& GetEventListeners() { return maEventListeners; } + FocusListenerMultiplexer& GetFocusListeners() { return maFocusListeners; } + WindowListenerMultiplexer& GetWindowListeners() { return maWindowListeners; } + KeyListenerMultiplexer& GetKeyListeners() { return maKeyListeners; } + MouseListenerMultiplexer& GetMouseListeners() { return maMouseListeners; } + MouseMotionListenerMultiplexer& GetMouseMotionListeners() { return maMouseMotionListeners; } + PaintListenerMultiplexer& GetPaintListeners() { return maPaintListeners; } + VclContainerListenerMultiplexer& GetContainerListeners() { return maContainerListeners; } + TopWindowListenerMultiplexer& GetTopWindowListeners() { return maTopWindowListeners; } + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static VCLXWindow* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::lang::Component + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XWindow + void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setEnable( sal_Bool Enable ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFocus( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XWindowPeer + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > SAL_CALL getToolkit( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& Pointer ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setBackground( sal_Int32 Color ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL invalidate( sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL invalidateRect( const ::com::sun::star::awt::Rectangle& Rect, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XVclWindowPeer + sal_Bool SAL_CALL isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Peer ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isDesignMode( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setForeground( sal_Int32 Color ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setControlFont( const ::com::sun::star::awt::FontDescriptor& aFont ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XView + sal_Bool SAL_CALL setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& aDevice ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getSize( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException); + + +}; + + + + +#endif // _TOOLKIT_AWT_VCLXWINDOW_HXX_ + diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx new file mode 100644 index 000000000000..514720987daa --- /dev/null +++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx @@ -0,0 +1,1093 @@ +/************************************************************************* + * + * $RCSfile: vclxwindows.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_VCLXWINDOWS_HXX_ +#define _TOOLKIT_AWT_VCLXWINDOWS_HXX_ + + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HPP_ +#include <com/sun/star/beans/PropertyValues.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_ +#include <com/sun/star/beans/PropertyState.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_ +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_ +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSET_HPP_ +#include <com/sun/star/beans/XFastPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XVETOABLECHANGELISTENER_HPP_ +#include <com/sun/star/beans/XVetoableChangeListener.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_ +#include <com/sun/star/beans/XPropertyState.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGELISTENER_HPP_ +#include <com/sun/star/beans/XPropertiesChangeListener.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_ +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_ +#include <com/sun/star/beans/XPropertyAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HPP_ +#include <com/sun/star/beans/XPropertyContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATECHANGEEVENT_HPP_ +#include <com/sun/star/beans/PropertyStateChangeEvent.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_ +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XFILEDIALOG_HPP_ +#include <com/sun/star/awt/XFileDialog.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTEXTCOMPONENT_HPP_ +#include <com/sun/star/awt/XTextComponent.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XLISTBOX_HPP_ +#include <com/sun/star/awt/XListBox.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPROGRESSMONITOR_HPP_ +#include <com/sun/star/awt/XProgressMonitor.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_ +#include <com/sun/star/awt/TextAlign.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XSCROLLBAR_HPP_ +#include <com/sun/star/awt/XScrollBar.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_ +#include <com/sun/star/awt/XVclContainerPeer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLERMODEL_HPP_ +#include <com/sun/star/awt/XTabControllerModel.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XMESSAGEBOX_HPP_ +#include <com/sun/star/awt/XMessageBox.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTEXTEDITFIELD_HPP_ +#include <com/sun/star/awt/XTextEditField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_STYLE_HPP_ +#include <com/sun/star/awt/Style.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTIMEFIELD_HPP_ +#include <com/sun/star/awt/XTimeField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_ +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_ +#include <com/sun/star/awt/XControlModel.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XSPINFIELD_HPP_ +#include <com/sun/star/awt/XSpinField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_ +#include <com/sun/star/awt/XUnoControlContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTEXTLAYOUTCONSTRAINS_HPP_ +#include <com/sun/star/awt/XTextLayoutConstrains.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XNUMERICFIELD_HPP_ +#include <com/sun/star/awt/XNumericField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XBUTTON_HPP_ +#include <com/sun/star/awt/XButton.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPOINTER_HPP_ +#include <com/sun/star/awt/XPointer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTEXTAREA_HPP_ +#include <com/sun/star/awt/XTextArea.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XIMAGEBUTTON_HPP_ +#include <com/sun/star/awt/XImageButton.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XFIXEDTEXT_HPP_ +#include <com/sun/star/awt/XFixedText.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_ +#include <com/sun/star/awt/XControlContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XDIALOG_HPP_ +#include <com/sun/star/awt/XDialog.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_SCROLLBARORIENTATION_HPP_ +#include <com/sun/star/awt/ScrollBarOrientation.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XRADIOBUTTON_HPP_ +#include <com/sun/star/awt/XRadioButton.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCURRENCYFIELD_HPP_ +#include <com/sun/star/awt/XCurrencyField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPATTERNFIELD_HPP_ +#include <com/sun/star/awt/XPatternField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_ +#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLER_HPP_ +#include <com/sun/star/awt/XTabController.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINER_HPP_ +#include <com/sun/star/awt/XVclContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XDATEFIELD_HPP_ +#include <com/sun/star/awt/XDateField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCOMBOBOX_HPP_ +#include <com/sun/star/awt/XComboBox.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_ +#include <com/sun/star/awt/XControl.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCHECKBOX_HPP_ +#include <com/sun/star/awt/XCheckBox.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XIMAGECONSUMER_HPP_ +#include <com/sun/star/awt/XImageConsumer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_MESSAGEBOXCOMMAND_HPP_ +#include <com/sun/star/awt/MessageBoxCommand.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_ +#include <com/sun/star/awt/XLayoutConstrains.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPROGRESSBAR_HPP_ +#include <com/sun/star/awt/XProgressBar.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_MENUITEMSTYLE_HPP_ +#include <com/sun/star/awt/MenuItemStyle.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPOPUPMENU_HPP_ +#include <com/sun/star/awt/XPopupMenu.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XMENUBAR_HPP_ +#include <com/sun/star/awt/XMenuBar.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_POPUPMENUDIRECTION_HPP_ +#include <com/sun/star/awt/PopupMenuDirection.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_MENUEVENT_HPP_ +#include <com/sun/star/awt/MenuEvent.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XMENULISTENER_HPP_ +#include <com/sun/star/awt/XMenuListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XMENU_HPP_ +#include <com/sun/star/awt/XMenu.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/awt/vclxtopwindow.hxx> + +#include <vcl/pointr.hxx> +#include <vcl/imgcons.hxx> +#include <vcl/bitmapex.hxx> + +class Button; +class CheckBox; +class RadioButton; +class ListBox; +class ScrollBar; +class Edit; +class Menu; +class ComboBox; +class FormatterBase; +class SpinField; + + +static double ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) +{ + double n = nValue; + for ( sal_uInt16 d = 0; d < nDigits; d++ ) + n *= 10; + return n; +} + +static double ImplCalcDoubleValue( double nValue, sal_uInt16 nDigits ) +{ + double n = nValue; + for ( sal_uInt16 d = 0; d < nDigits; d++ ) + n /= 10; + return n; +} + +// ---------------------------------------------------- +// class VCLXButton +// ---------------------------------------------------- +class VCLXButton : public ::com::sun::star::awt::XImageConsumer, + public ::com::sun::star::awt::XButton, + public VCLXWindow +{ +private: + ::rtl::OUString maActionCommand; + ImageConsumer maImageConsumer; + BitmapEx maBitmap; + ActionListenerMultiplexer maActionListeners; + +protected: + DECL_LINK( ClickHdl, Button* ); + void ImplUpdateImage( sal_Bool bGetNewImage ); + +public: + VCLXButton(); + ~VCLXButton(); + + void SetWindow( Window* pWindow ); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XButton: + void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XImageConsumer + void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXImageControl +// ---------------------------------------------------- +class VCLXImageControl : public ::com::sun::star::awt::XImageConsumer, + public VCLXWindow +{ + ImageConsumer maImageConsumer; + BitmapEx maBitmap; + +protected: + void ImplUpdateImage( sal_Bool bGetNewImage ); + +public: + VCLXImageControl(); + ~VCLXImageControl(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XWindow + void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XImageConsumer + void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXCheckBox +// ---------------------------------------------------- +class VCLXCheckBox : public ::com::sun::star::awt::XCheckBox, + public VCLXWindow +{ +private: + ItemListenerMultiplexer maItemListeners; + +protected: + DECL_LINK( ClickHdl, CheckBox* ); + +public: + VCLXCheckBox(); + ~VCLXCheckBox(); + + void SetWindow( Window* pWindow ); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XCheckBox + void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setState( sal_Int16 n ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXRadioButton +// ---------------------------------------------------- +class VCLXRadioButton : public ::com::sun::star::awt::XRadioButton, + public VCLXWindow +{ +private: + ItemListenerMultiplexer maItemListeners; + +protected: + DECL_LINK( ClickHdl, RadioButton* ); + +public: + VCLXRadioButton(); + ~VCLXRadioButton(); + + void SetWindow( Window* pWindow ); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XRadioButton + void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXMessageBox +// ---------------------------------------------------- +class VCLXMessageBox : public ::com::sun::star::awt::XMessageBox, + public VCLXWindow +{ +public: + VCLXMessageBox(); + ~VCLXMessageBox(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::awt::XMessageBox + void SAL_CALL setCaptionText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getCaptionText( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMessageText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getMessageText( ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL execute( ) throw(::com::sun::star::uno::RuntimeException); +}; + + + +// ---------------------------------------------------- +// class VCLXDialog +// ---------------------------------------------------- +class VCLXDialog : public ::com::sun::star::awt::XDialog, + public VCLXTopWindow +{ +public: + VCLXDialog(); + ~VCLXDialog(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XDialog + void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getTitle( ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL execute( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL endExecute( ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXFixedText +// ---------------------------------------------------- +class VCLXFixedText : public ::com::sun::star::awt::XFixedText, + public VCLXWindow +{ +public: + VCLXFixedText(); + ~VCLXFixedText(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XFixedText + void SAL_CALL setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setAlignment( sal_Int16 nAlign ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getAlignment( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXScrollBar +// ---------------------------------------------------- +class VCLXScrollBar : public ::com::sun::star::awt::XScrollBar, + public VCLXWindow +{ +private: + AdjustmentListenerMultiplexer maAdjustmentListeners; + +protected: + DECL_LINK( ScrollHdl, ScrollBar* ); + +public: + VCLXScrollBar(); + ~VCLXScrollBar(); + + void SetWindow( Window* pWindow ); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // XScrollbar + void SAL_CALL addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getMaximum( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getLineIncrement( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getBlockIncrement( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getVisibleSize( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getOrientation( ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXEdit +// ---------------------------------------------------- +class VCLXEdit : public ::com::sun::star::awt::XTextComponent, + public ::com::sun::star::awt::XTextEditField, + public ::com::sun::star::awt::XTextLayoutConstrains, + public VCLXWindow +{ +private: + TextListenerMultiplexer maTextListeners; + +protected: + DECL_LINK( ModifyHdl, Edit* ); + +public: + VCLXEdit(); + ~VCLXEdit(); + + void SetWindow( Window* pWindow ); + TextListenerMultiplexer& GetTextListeners() { return maTextListeners; } + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextComponent + void SAL_CALL addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL insertText( const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getSelectedText( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Selection SAL_CALL getSelection( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isEditable( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getMaxTextLen( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextEditField: + void SAL_CALL setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXListBox +// ---------------------------------------------------- +class VCLXListBox : public ::com::sun::star::awt::XListBox, + public ::com::sun::star::awt::XTextLayoutConstrains, + public VCLXWindow +{ +private: + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; + +protected: + DECL_LINK( SelectHdl, ListBox* ); + DECL_LINK( DoubleClickHdl, ListBox* ); + +public: + VCLXListBox(); + ~VCLXListBox(); + + void SetWindow( Window* pWindow ); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XListBox + void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getSelectedItemPos( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos( ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getSelectedItem( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedItems( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL selectItemsPos( const ::com::sun::star::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isMutipleMode( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXComboBox +// ---------------------------------------------------- +class VCLXComboBox : public ::com::sun::star::awt::XComboBox, + public VCLXEdit +{ +private: + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; + +protected: + DECL_LINK( SelectHdl, ComboBox* ); + DECL_LINK( DoubleClickHdl, ComboBox* ); + +public: + VCLXComboBox(); + ~VCLXComboBox(); + + void SetWindow( Window* pWindow ); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XComboBox + void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXSpinField +// ---------------------------------------------------- +class VCLXSpinField : public ::com::sun::star::awt::XSpinField, + public VCLXEdit +{ +private: + SpinListenerMultiplexer maSpinListeners; + +protected: + DECL_LINK( SpinUpHdl, SpinField* ); + DECL_LINK( SpinDownHdl, SpinField* ); + DECL_LINK( SpinFirstHdl, SpinField* ); + DECL_LINK( SpinLastHdl, SpinField* ); + +public: + VCLXSpinField(); + ~VCLXSpinField(); + + void SetWindow( Window* pWindow ); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::awt::XSpinField + void SAL_CALL addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL up( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL down( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL first( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL last( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXFormattedSpinField +// ---------------------------------------------------- +class VCLXFormattedSpinField : public VCLXSpinField +{ +private: + FormatterBase* mpFormatter; + +protected: + FormatterBase* GetFormatter() const { return GetWindow() ? mpFormatter : NULL; } + +public: + VCLXFormattedSpinField(); + ~VCLXFormattedSpinField(); + + void SetFormatter( FormatterBase* pFormatter ) { mpFormatter = pFormatter; } + + void setStrictFormat( sal_Bool bStrict ); + sal_Bool isStrictFormat(); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXDateField +// ---------------------------------------------------- +class VCLXDateField : public ::com::sun::star::awt::XDateField, + public VCLXFormattedSpinField +{ +public: + VCLXDateField(); + ~VCLXDateField(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::awt::XDateField + void SAL_CALL setDate( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getDate( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMin( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMax( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFirst( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLast( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isLongFormat( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXTimeField +// ---------------------------------------------------- +class VCLXTimeField : public ::com::sun::star::awt::XTimeField, + public VCLXFormattedSpinField +{ +public: + VCLXTimeField(); + ~VCLXTimeField(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTimeField + void SAL_CALL setTime( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMin( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMax( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFirst( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLast( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXNumericField +// ---------------------------------------------------- +class VCLXNumericField : public ::com::sun::star::awt::XNumericField, + public VCLXFormattedSpinField +{ +public: + VCLXNumericField(); + ~VCLXNumericField(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XNumericField + void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXCurrencyField +// ---------------------------------------------------- +class VCLXCurrencyField : public ::com::sun::star::awt::XCurrencyField, + public VCLXFormattedSpinField +{ +public: + VCLXCurrencyField(); + ~VCLXCurrencyField(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::awt::XCurrencyField + void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + +// ---------------------------------------------------- +// class VCLXPatternField +// ---------------------------------------------------- +class VCLXPatternField : public ::com::sun::star::awt::XPatternField, + public VCLXFormattedSpinField +{ +public: + VCLXPatternField(); + ~VCLXPatternField(); + + // ::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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::awt::XPatternField + void SAL_CALL setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getString( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::VclWindowPeer + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); +}; + + + +#endif // _TOOLKIT_AWT_VCLXWINDOWS_HXX_ + diff --git a/toolkit/inc/toolkit/controls/stdtabcontroller.hxx b/toolkit/inc/toolkit/controls/stdtabcontroller.hxx new file mode 100644 index 000000000000..ed21f93c80c4 --- /dev/null +++ b/toolkit/inc/toolkit/controls/stdtabcontroller.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * $RCSfile: stdtabcontroller.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_CONTROLS_STDTABCONTROLLER_HXX_ +#define _TOOLKIT_CONTROLS_STDTABCONTROLLER_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLER_HPP_ +#include <com/sun/star/awt/XTabController.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_ +#include <com/sun/star/awt/XControl.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_ +#include <com/sun/star/awt/XControlContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ +#include <com/sun/star/awt/XWINDOW.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif + +#ifndef _CPPUHELPER_WEAKAGG_HXX_ +#include <cppuhelper/weakagg.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +class StdTabController : public ::com::sun::star::awt::XTabController, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ +private: + ::osl::Mutex maMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > mxModel; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > mxControlContainer; + +protected: + ::osl::Mutex& GetMutex() { return maMutex; } + sal_Bool ImplCreateComponentSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rControls, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rModels, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& rComponents, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>* pTabStops, sal_Bool bPeerComponent ) const; + // wenn rModels kuerzer als rControls ist, werden nur die rModels entsprechenden Elemente geliefert und die korrespondierenden Elemente aus rControls entfernt + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > ImplFindControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rCtrls, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & rxCtrlModel ) const; + void ImplActivateControl( sal_Bool bFirst ) const; + +public: + StdTabController(); + ~StdTabController(); + + // ::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) { return OWeakAggObject::queryInterface(rType); } + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // XTabController + void SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& Model ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > SAL_CALL getModel( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& Container ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > SAL_CALL getContainer( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL autoTabOrder( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL activateTabOrder( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL activateFirst( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL activateLast( ) throw(::com::sun::star::uno::RuntimeException); +}; + + + +#endif // _TOOLKIT_AWT_STDTABCONTROLLER_HXX_ + diff --git a/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx b/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx new file mode 100644 index 000000000000..128357467902 --- /dev/null +++ b/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * $RCSfile: stdtabcontrollermodel.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_CONTROLS_STDTABCONTROLLERMODEL_HXX_ +#define _TOOLKIT_CONTROLS_STDTABCONTROLLERMODEL_HXX_ + + +#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_ +#include <com/sun/star/io/XPersistObject.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLERMODEL_HPP_ +#include <com/sun/star/awt/XTabControllerModel.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ +#include <com/sun/star/awt/XWindow.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +#ifndef _CPPUHELPER_WEAKAGG_HXX_ +#include <cppuhelper/weakagg.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <tools/list.hxx> +#include <tools/gen.hxx> + +struct UnoControlModelEntry; + +DECLARE_LIST( UnoControlModelEntryListBase, UnoControlModelEntry* ); + +class UnoControlModelEntryList : public UnoControlModelEntryListBase +{ +private: + ::rtl::OUString maGroupName; + +public: + UnoControlModelEntryList(); + ~UnoControlModelEntryList(); + + const ::rtl::OUString& GetName() const { return maGroupName; } + void SetName( const ::rtl::OUString& rName ) { maGroupName = rName; } + + void Reset(); + void DestroyEntry( sal_uInt32 nEntry ); +}; + +struct UnoControlModelEntry +{ + sal_Bool bGroup; + union + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >* pxControl; + UnoControlModelEntryList* pGroup; + }; +}; + +// Keine Referenz halten, nur temporaer fuer AutoTabOrder +struct ComponentEntry +{ + ::com::sun::star::awt::XWindow* pComponent; + Point aPos; +}; + +DECLARE_LIST( ComponentEntryList, ComponentEntry* ); + +#define CONTROLPOS_NOTFOUND 0xFFFFFFFF + +class StdTabControllerModel : public ::com::sun::star::awt::XTabControllerModel, + public ::com::sun::star::io::XPersistObject, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ +private: + ::osl::Mutex maMutex; + UnoControlModelEntryList maControls; + sal_Bool mbGroupControl; + +protected: + ::osl::Mutex& GetMutex() { return maMutex; } + sal_uInt32 ImplGetControlCount( const UnoControlModelEntryList& rList ) const; + void ImplGetControlModels( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ** pRefs, const UnoControlModelEntryList& rList ) const; + void ImplSetControlModels( UnoControlModelEntryList& rList, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) const; + sal_uInt32 ImplGetControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrl, const UnoControlModelEntryList& rList ) const; + +public: + StdTabControllerModel(); + ~StdTabControllerModel(); + + // ::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) { return OWeakAggObject::queryInterface(rType); } + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTabControllerModel + sal_Bool SAL_CALL getGroupControl( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setGroupControl( sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getGroupCount( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, ::rtl::OUString& Name ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getGroupByName( const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::io::XPersistObject + ::rtl::OUString SAL_CALL getServiceName( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); +}; + + + +#endif // _TOOLKIT_HELPER_STDTABCONTROLLERMODEL_HXX_ + diff --git a/toolkit/inc/toolkit/controls/unocontrol.hxx b/toolkit/inc/toolkit/controls/unocontrol.hxx new file mode 100644 index 000000000000..6a2b88224ba3 --- /dev/null +++ b/toolkit/inc/toolkit/controls/unocontrol.hxx @@ -0,0 +1,243 @@ +/************************************************************************* + * + * $RCSfile: unocontrol.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_CONTROLS_UNOCONTROL_HXX_ +#define _TOOLKIT_CONTROLS_UNOCONTROL_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_ +#include <com/sun/star/awt/XControl.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ +#include <com/sun/star/awt/XWindow.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XView_HPP_ +#include <com/sun/star/awt/XView.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGELISTENER_HPP_ +#include <com/sun/star/beans/XPropertiesChangeListener.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +#ifndef _CPPUHELPER_WEAKAGG_HXX_ +#include <cppuhelper/weakagg.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <toolkit/helper/mutexandbroadcasthelper.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> + +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> + + +struct UnoControlComponentInfos +{ + sal_Bool bVisible; + sal_Bool bEnable; + long nX, nY, nWidth, nHeight; + sal_uInt16 nFlags; + float nZoomX, nZoomY; + + UnoControlComponentInfos() + { + bVisible = sal_True; + bEnable = sal_True; + nX = nY = nWidth = nHeight = 0; + nFlags = 0; // POSSIZE_POSSIZE; + nZoomX = nZoomY = 1.0f; + } +}; + +// ---------------------------------------------------- +// class UnoControl +// ---------------------------------------------------- +class UnoControl : public ::com::sun::star::awt::XControl, + public ::com::sun::star::awt::XWindow, + public ::com::sun::star::awt::XView, + public ::com::sun::star::beans::XPropertiesChangeListener, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ +private: + ::osl::Mutex maMutex; + +protected: + EventListenerMultiplexer maDisposeListeners; + WindowListenerMultiplexer maWindowListeners; + FocusListenerMultiplexer maFocusListeners; + KeyListenerMultiplexer maKeyListeners; + MouseListenerMultiplexer maMouseListeners; + MouseMotionListenerMultiplexer maMouseMotionListeners; + PaintListenerMultiplexer maPaintListeners; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxPeer; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxContext; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > mxModel; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > mxGraphics; + + sal_Bool mbDisposePeer; + sal_Bool mbUpdatingModel; + sal_Bool mbRefeshingPeer; + sal_Bool mbDesignMode; + + UnoControlComponentInfos maComponentInfos; + + ::osl::Mutex& GetMutex() { return maMutex; } + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getParentPeer() const; + void updateFromModel(); + sal_Bool IsUpdatingModel() const { return mbUpdatingModel; } + void StartUpdatingModel() { mbUpdatingModel = sal_True; } + void EndUpdatingModel() { mbUpdatingModel = sal_False; } + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer ); + virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); + virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc ); + +public: + UnoControl(); + ~UnoControl(); + + virtual ::rtl::OUString GetComponentServiceName(); + + // ::com::sun::star::uno::XAggregation + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); } + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::beans::XPropertiesChangeListener + void SAL_CALL propertiesChange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& evt ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XWindow + void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setEnable( sal_Bool Enable ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFocus( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XView + sal_Bool SAL_CALL setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& aDevice ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getSize( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XControl + void SAL_CALL setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Context ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getContext( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > SAL_CALL getView( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isDesignMode( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); +}; + + + + +#endif // _TOOLKIT_CONTROLS_UNOCONTROL_HXX_ + diff --git a/toolkit/inc/toolkit/controls/unocontrolbase.hxx b/toolkit/inc/toolkit/controls/unocontrolbase.hxx new file mode 100644 index 000000000000..72c77fb3c9b0 --- /dev/null +++ b/toolkit/inc/toolkit/controls/unocontrolbase.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * $RCSfile: unocontrolbase.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_UNOCONTROLBASE_HXX_ +#define _TOOLKIT_AWT_UNOCONTROLBASE_HXX_ + +#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_ +#include <com/sun/star/awt/Size.hpp> +#endif + +#include <toolkit/controls/unocontrol.hxx> + +// ---------------------------------------------------- +// class UnoControlBase +// ---------------------------------------------------- + +class UnoControlBase : public UnoControl +{ +protected: + sal_Bool ImplHasProperty( const ::rtl::OUString& aPropertyName ); + void ImplSetPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Bool bUpdateThis ); + ::com::sun::star::uno::Any ImplGetPropertyValue( const ::rtl::OUString& aPropertyName ); + + sal_Bool ImplGetPropertyValue_BOOL( sal_uInt16 nProp ); + sal_Int16 ImplGetPropertyValue_INT16( sal_uInt16 nProp ); + sal_uInt16 ImplGetPropertyValue_UINT16( sal_uInt16 nProp ); + sal_Int32 ImplGetPropertyValue_INT32( sal_uInt16 nProp ); + sal_uInt32 ImplGetPropertyValue_UINT32( sal_uInt16 nProp ); + double ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp ); + ::rtl::OUString ImplGetPropertyValue_UString( sal_uInt16 nProp ); + + // XLayoutConstrains (nur wenn das Control es unterstuetzt!) + ::com::sun::star::awt::Size Impl_getMinimumSize(); + ::com::sun::star::awt::Size Impl_getPreferredSize(); + ::com::sun::star::awt::Size Impl_calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ); + + // XTextLayoutConstrains (nur wenn das Control es unterstuetzt!) + ::com::sun::star::awt::Size Impl_getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ); + void Impl_getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ); +}; + + + +#endif // _TOOLKIT_AWT_UNOCONTROLBASE_HXX_ + diff --git a/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx new file mode 100644 index 000000000000..a0c2b2680b7c --- /dev/null +++ b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * $RCSfile: unocontrolcontainer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_ +#define _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_ + + +#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_ +#include <com/sun/star/awt/XControlContainer.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_ +#include <com/sun/star/awt/XUnoControlContainer.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_ +#include <com/sun/star/container/XContainer.hpp> +#endif + +#include <toolkit/controls/unocontrol.hxx> + +class UnoControlHolderList; + +// ---------------------------------------------------- +// class UnoControlContainer +// ---------------------------------------------------- +class UnoControlContainer : public ::com::sun::star::awt::XUnoControlContainer, + public ::com::sun::star::awt::XControlContainer, + public ::com::sun::star::container::XContainer, + public UnoControl +{ +private: + UnoControlHolderList* mpControls; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > maTabControllers; + ContainerListenerMultiplexer maCListeners; + +protected: + void ImplActivateTabControllers(); + +public: + UnoControlContainer(); + UnoControlContainer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer ); + ~UnoControlContainer(); + + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControl::queryInterface(rType); } + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XEventListener + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::container::XContainer + void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XControlContainer + void SAL_CALL setStatusText( const ::rtl::OUString& StatusText ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getControl( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addControl( const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XUnoControlContainer + void SAL_CALL setTabControllers( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > >& TabControllers ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > SAL_CALL getTabControllers( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XControl + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XWindow + void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException); +}; + + + +#endif // _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_ + diff --git a/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx b/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx new file mode 100644 index 000000000000..22efa42e98fe --- /dev/null +++ b/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * $RCSfile: unocontrolcontainermodel.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_CONTROLS_UNOCONTROLCONTAINERMODEL_HXX_ +#define _TOOLKIT_CONTROLS_UNOCONTROLCONTAINERMODEL_HXX_ + + +#include <toolkit/controls/unocontrolmodel.hxx> +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/servicenames.hxx> + + +// ---------------------------------------------------- +// class ::com::sun::star::awt::UnoControlContainerModel +// ---------------------------------------------------- +class UnoControlContainerModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlContainerModel(); + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::io::XPersistObject + ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlContainerModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlContainerModel ) ) +}; + + + +#endif // _TOOLKIT_CONTROLS_UNOCONTROLCONTAINERMODEL_HXX_ + diff --git a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx new file mode 100644 index 000000000000..f053206fd49e --- /dev/null +++ b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx @@ -0,0 +1,193 @@ +/************************************************************************* + * + * $RCSfile: unocontrolmodel.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_AWT_UNOCONTROLMODEL_HXX_ +#define _TOOLKIT_AWT_UNOCONTROLMODEL_HXX_ + +#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_ +#include <com/sun/star/awt/XControlModel.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_ +#include <com/sun/star/lang/XComponent.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_ +#include <com/sun/star/beans/XPropertyState.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_ +#include <com/sun/star/io/XPersistObject.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +#ifndef _CPPUHELPER_WEAKAGG_HXX_ +#include <cppuhelper/weakagg.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <toolkit/helper/mutexandbroadcasthelper.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> + +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +class ImplPropertyTable; + +// ---------------------------------------------------- +// class UnoControlModel +// ---------------------------------------------------- + +class UnoControlModel : public ::com::sun::star::awt::XControlModel, + public ::com::sun::star::beans::XPropertyState, + public ::com::sun::star::io::XPersistObject, + public ::com::sun::star::lang::XComponent, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XUnoTunnel, + public MutexAndBroadcastHelper, + public ::cppu::OPropertySetHelper, + public ::cppu::OWeakAggObject +{ +private: + ImplPropertyTable* mpData; + EventListenerMultiplexer maDisposeListeners; + +protected: + void ImplRegisterProperty( sal_uInt16 nPropType ); + void ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault ); + ::com::sun::star::uno::Sequence<sal_Int32> ImplGetPropertyIds() const; + virtual void ImplPropertyChanged( sal_uInt16 nPropId ); + virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + sal_Bool ImplHasProperty( sal_uInt16 nPropId ) const; + +public: + UnoControlModel(); + ~UnoControlModel(); + + // ::com::sun::star::uno::XAggregation + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); } + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static UnoControlModel* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XControlModel + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XPropertyState + ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::io::XPersistObject + ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // ::cppu::OPropertySetHelper + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() = 0; + sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException); + void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); + void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; + + // setValue-Methoden ueberladen, um die Einzelproperties des FontDescriptors abzufangen + // ::com::sun::star::beans::XPropertySet + void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + // ::com::sun::star::beans::XFastPropertySet + void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) = 0; + void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + + + + +#endif // _TOOLKIT_AWT_UNOCONTROLMODEL_HXX_ + diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx new file mode 100644 index 000000000000..bf65df79bb8d --- /dev/null +++ b/toolkit/inc/toolkit/controls/unocontrols.hxx @@ -0,0 +1,1166 @@ +/************************************************************************* + * + * $RCSfile: unocontrols.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_UNOCONTROLS_HXX_ +#define _TOOLKIT_HELPER_UNOCONTROLS_HXX_ + +#ifndef _COM_SUN_STAR_AWT_XTEXTCOMPONENT_HPP_ +#include <com/sun/star/awt/XTextComponent.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTEXTLISTENER_HPP_ +#include <com/sun/star/awt/XTextListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_ +#include <com/sun/star/awt/XLayoutConstrains.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTEXTLAYOUTCONSTRAINS_HPP_ +#include <com/sun/star/awt/XTextLayoutConstrains.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XBUTTON_HPP_ +#include <com/sun/star/awt/XButton.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XIMAGECONSUMER_HPP_ +#include <com/sun/star/awt/XImageConsumer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XIMAGEPRODUCER_HPP_ +#include <com/sun/star/awt/XImageProducer.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XRADIOBUTTON_HPP_ +#include <com/sun/star/awt/XRadioButton.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XITEMLISTENER_HPP_ +#include <com/sun/star/awt/XItemListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCHECKBOX_HPP_ +#include <com/sun/star/awt/XCheckBox.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XFIXEDTEXT_HPP_ +#include <com/sun/star/awt/XFixedText.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XLISTBOX_HPP_ +#include <com/sun/star/awt/XListBox.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCOMBOBOX_HPP_ +#include <com/sun/star/awt/XComboBox.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XDATEFIELD_HPP_ +#include <com/sun/star/awt/XDateField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTIMEFIELD_HPP_ +#include <com/sun/star/awt/XTimeField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XNUMERICFIELD_HPP_ +#include <com/sun/star/awt/XNumericField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XCURRENCYFIELD_HPP_ +#include <com/sun/star/awt/XCurrencyField.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPATTERNFIELD_HPP_ +#include <com/sun/star/awt/XPatternField.hpp> +#endif + +#include <toolkit/controls/unocontrolmodel.hxx> +#include <toolkit/controls/unocontrolbase.hxx> +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/servicenames.hxx> + +#include <vcl/imgcons.hxx> +#include <vcl/bitmapex.hxx> + +// ---------------------------------------------------- +// class UnoControlEditModel +// ---------------------------------------------------- +class UnoControlEditModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlEditModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlEditModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel ) ) +}; + +// ---------------------------------------------------- +// class UnoEditControl +// ---------------------------------------------------- +class UnoEditControl : public UnoControlBase, + public ::com::sun::star::awt::XTextComponent, + public ::com::sun::star::awt::XTextListener, + public ::com::sun::star::awt::XLayoutConstrains, + public ::com::sun::star::awt::XTextLayoutConstrains +{ +private: + TextListenerMultiplexer maTextListeners; + +public: + + UnoEditControl(); + ::rtl::OUString GetComponentServiceName(); + TextListenerMultiplexer& GetTextListeners() { return maTextListeners; } + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); } + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextListener + void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextComponent + void SAL_CALL addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL insertText( const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getSelectedText( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Selection SAL_CALL getSelection( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isEditable( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getMaxTextLen( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoEditControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEdit ) ) +}; + +// ---------------------------------------------------- +// class UnoControlFormattedFieldModel +// ---------------------------------------------------- +class UnoControlFormattedFieldModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlFormattedFieldModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlFormattedFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel ) ) +}; + +// ---------------------------------------------------- +// class UnoFormattedFieldControl +// ---------------------------------------------------- +class UnoFormattedFieldControl : public UnoEditControl +{ +public: + UnoFormattedFieldControl(); + ::rtl::OUString GetComponentServiceName(); + + // ::com::sun::star::awt::XTextListener + void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoFormattedFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedField ) ) +}; + +// ---------------------------------------------------- +// class UnoControlFileControlModel +// ---------------------------------------------------- +class UnoControlFileControlModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlFileControlModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlFileControlModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel ) ) +}; + +// ---------------------------------------------------- +// class UnoFileControl +// ---------------------------------------------------- +class UnoFileControl : public UnoEditControl +{ +public: + UnoFileControl(); + ::rtl::OUString GetComponentServiceName(); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoFileControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControl ) ) +}; + +// ---------------------------------------------------- +// class UnoControlButtonModel +// ---------------------------------------------------- +class UnoControlButtonModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlButtonModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlButtonModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel ) ) +}; + +// ---------------------------------------------------- +// class UnoButtonControl +// ---------------------------------------------------- +class UnoButtonControl : public UnoControlBase, + public ::com::sun::star::awt::XButton, + public ::com::sun::star::awt::XImageConsumer, + public ::com::sun::star::awt::XImageProducer, + public ::com::sun::star::awt::XLayoutConstrains +{ +private: + ActionListenerMultiplexer maActionListeners; + ::rtl::OUString maActionCommand; + + ImageConsumer maImageConsumer; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > mxImageProducer; + BitmapEx maBitmap; + +protected: + void ImplUpdateImage( sal_Bool bGetNewImage ); + +public: + + UnoButtonControl(); + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XButton + void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XImageConsumer + void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XImageProducer + void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL startProduction( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoButtonControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButton ) ) + +}; + +// ---------------------------------------------------- +// class UnoControlImageControlModel +// ---------------------------------------------------- +class UnoControlImageControlModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlImageControlModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlImageControlModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel ) ) +}; + +// ---------------------------------------------------- +// class UnoImageControlControl +// ---------------------------------------------------- +class UnoImageControlControl : public UnoControlBase, + public ::com::sun::star::awt::XImageConsumer, + public ::com::sun::star::awt::XImageProducer, + public ::com::sun::star::awt::XLayoutConstrains +{ +private: + ActionListenerMultiplexer maActionListeners; + ::rtl::OUString maActionCommand; + + ImageConsumer maImageConsumer; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > mxImageProducer; + BitmapEx maBitmap; + +protected: + void ImplUpdateImage( sal_Bool bGetNewImage ); + +public: + + UnoImageControlControl(); + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XControl + sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XImageConsumer + void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XImageProducer + void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL startProduction( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoImageControlControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControl ) ) + +}; + +// ---------------------------------------------------- +// class UnoControlRadioButtonModel +// ---------------------------------------------------- +class UnoControlRadioButtonModel : public UnoControlModel + +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlRadioButtonModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlRadioButtonModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) ) + +}; + +// ---------------------------------------------------- +// class UnoRadioButtonControl +// ---------------------------------------------------- +class UnoRadioButtonControl : public UnoControlBase, + public ::com::sun::star::awt::XRadioButton, + public ::com::sun::star::awt::XItemListener, + public ::com::sun::star::awt::XLayoutConstrains +{ +private: + ItemListenerMultiplexer maItemListeners; + ::rtl::OUString maLabel; + +public: + + UnoRadioButtonControl(); + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XControl + sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XRadioButton + void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XItemListener + void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoRadioButtonControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButton ) ) + +}; + +// ---------------------------------------------------- +// class UnoControlCheckBoxModel +// ---------------------------------------------------- +class UnoControlCheckBoxModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlCheckBoxModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlCheckBoxModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel ) ) +}; + +// ---------------------------------------------------- +// class UnoCheckBoxControl +// ---------------------------------------------------- +class UnoCheckBoxControl : public UnoControlBase, + public ::com::sun::star::awt::XCheckBox, + public ::com::sun::star::awt::XItemListener, + public ::com::sun::star::awt::XLayoutConstrains +{ +private: + ItemListenerMultiplexer maItemListeners; + ::rtl::OUString maLabel; + +public: + + UnoCheckBoxControl(); + ~UnoCheckBoxControl(){;} + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XControl + sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XCheckBox + void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setState( sal_Int16 n ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XItemListener + void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoCheckBoxControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBox ) ) + +}; + +// ---------------------------------------------------- +// class UnoControlFixedTextModel +// ---------------------------------------------------- +class UnoControlFixedTextModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlFixedTextModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlFixedTextModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel ) ) + +}; + +// ---------------------------------------------------- +// class UnoFixedTextControl +// ---------------------------------------------------- +class UnoFixedTextControl : public UnoControlBase, + public ::com::sun::star::awt::XFixedText, + public ::com::sun::star::awt::XLayoutConstrains +{ +public: + UnoFixedTextControl(); + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XControl + sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XFixedText + void SAL_CALL setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setAlignment( sal_Int16 nAlign ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getAlignment( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoFixedTextControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedText ) ) + +}; + +// ---------------------------------------------------- +// class UnoControlGroupBoxModel +// ---------------------------------------------------- +class UnoControlGroupBoxModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlGroupBoxModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlGroupBoxModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel ) ) + +}; + +// ---------------------------------------------------- +// class UnoGroupBoxControl +// ---------------------------------------------------- +class UnoGroupBoxControl : public UnoControlBase +{ +public: + UnoGroupBoxControl(); + ::rtl::OUString GetComponentServiceName(); + + sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoGroupBoxControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBox ) ) + +}; + +// ---------------------------------------------------- +// class UnoControlListBoxModel +// ---------------------------------------------------- +class UnoControlListBoxModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlListBoxModel(); + ::rtl::OUString getServiceName() const; + + void ImplPropertyChanged( sal_uInt16 nPropId ); + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlListBoxModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel ) ) + +}; + +// ---------------------------------------------------- +// class UnoListBoxControl +// ---------------------------------------------------- +class UnoListBoxControl : public UnoControlBase, + public ::com::sun::star::awt::XListBox, + public ::com::sun::star::awt::XItemListener, + public ::com::sun::star::awt::XLayoutConstrains, + public ::com::sun::star::awt::XTextLayoutConstrains +{ +private: + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; + +public: + + UnoListBoxControl(); + ::rtl::OUString GetComponentServiceName(); + + void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XListBox + void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getSelectedItemPos( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos( ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getSelectedItem( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedItems( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL selectItemsPos( const ::com::sun::star::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isMutipleMode( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XItemListener + void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextLayoutConstrains + ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoListBoxControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBox ) ) + +}; + +// ---------------------------------------------------- +// class UnoControlComboBoxModel +// ---------------------------------------------------- +class UnoControlComboBoxModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlComboBoxModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlComboBoxModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel ) ) + +}; + +// ---------------------------------------------------- +// class UnoComboBoxControl +// ---------------------------------------------------- +class UnoComboBoxControl : public UnoEditControl, + public ::com::sun::star::awt::XComboBox +{ +private: + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; + +public: + + UnoComboBoxControl(); + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XComboBox + void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoComboBoxControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBox ) ) + +}; + +// ---------------------------------------------------- +// class UnoControlDateFieldModel +// ---------------------------------------------------- +class UnoControlDateFieldModel: public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlDateFieldModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlDateFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel ) ) + +}; + +// ---------------------------------------------------- +// class UnoDateFieldControl +// ---------------------------------------------------- +class UnoDateFieldControl : public UnoEditControl, + public ::com::sun::star::awt::XDateField +{ +public: + UnoDateFieldControl(); + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextListener + void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + + //XDateField + void SAL_CALL setDate( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getDate( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMin( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMax( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFirst( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLast( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isLongFormat( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoDateFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateField ) ) +}; + +// ---------------------------------------------------- +// class UnoControlTimeFieldModel +// ---------------------------------------------------- +class UnoControlTimeFieldModel: public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlTimeFieldModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlTimeFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel ) ) + +}; + +// ---------------------------------------------------- +// class UnoTimeFieldControl +// ---------------------------------------------------- +class UnoTimeFieldControl : public UnoEditControl, + public ::com::sun::star::awt::XTimeField +{ +public: + UnoTimeFieldControl(); + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextListener + void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + + //XTimeField + void SAL_CALL setTime( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMin( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMax( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFirst( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLast( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoTimeFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeField ) ) + +}; + +// ---------------------------------------------------- +// class UnoControlNumericFieldModel +// ---------------------------------------------------- +class UnoControlNumericFieldModel: public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlNumericFieldModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlNumericFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel ) ) + +}; + +// ---------------------------------------------------- +// class UnoNumericFieldControl +// ---------------------------------------------------- +class UnoNumericFieldControl : public UnoEditControl, + public ::com::sun::star::awt::XNumericField +{ +public: + UnoNumericFieldControl(); + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextListener + void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XNumericField + void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoNumericFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericField ) ) + +}; + +// ---------------------------------------------------- +// class UnoControlCurrencyFieldModel +// ---------------------------------------------------- +class UnoControlCurrencyFieldModel: public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlCurrencyFieldModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlCurrencyFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel ) ) + +}; + +// ---------------------------------------------------- +// class UnoCurrencyFieldControl +// ---------------------------------------------------- +class UnoCurrencyFieldControl : public UnoEditControl, + public ::com::sun::star::awt::XCurrencyField +{ +public: + UnoCurrencyFieldControl(); + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTextListener + void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XCurrencyField + void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException); + double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoCurrencyFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyField ) ) +}; + +// ---------------------------------------------------- +// class UnoControlPatternFieldModel +// ---------------------------------------------------- +class UnoControlPatternFieldModel: public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoControlPatternFieldModel(); + ::rtl::OUString getServiceName() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoControlPatternFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel ) ) + +}; + +// ---------------------------------------------------- +// class UnoPatternFieldControl +// ---------------------------------------------------- +class UnoPatternFieldControl : public UnoEditControl, + public ::com::sun::star::awt::XPatternField +{ +protected: + void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); + +public: + UnoPatternFieldControl(); + ::rtl::OUString GetComponentServiceName(); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XPatternField + void SAL_CALL setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getString( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO( UnoPatternFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternField ) ) + +}; + + + +#endif // _TOOLKIT_HELPER_UNOCONTROLS_HXX_ + diff --git a/toolkit/inc/toolkit/helper/convert.hxx b/toolkit/inc/toolkit/helper/convert.hxx new file mode 100644 index 000000000000..58284c01d71a --- /dev/null +++ b/toolkit/inc/toolkit/helper/convert.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: convert.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_CONVERT_HXX_ +#define _TOOLKIT_HELPER_CONVERT_HXX_ + +#ifndef _COM_SUN_STAR_AWT_RECTANGLE_HPP_ +#include <com/sun/star/awt/Rectangle.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_ +#include <com/sun/star/awt/Size.hpp> +#endif + +#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::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( rAWTRect.X, rAWTRect.Y, rAWTRect.X+rAWTRect.Width, rAWTRect.Y+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..96821f4c327f --- /dev/null +++ b/toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * $RCSfile: emptyfontdescriptor.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_ +#define _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_ + +#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_ +#include <com/sun/star/awt/FontDescriptor.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_ +#include <com/sun/star/awt/FontSlant.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTUNDERLINE_HPP_ +#include <com/sun/star/awt/FontUnderline.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTSTRIKEOUT_HPP_ +#include <com/sun/star/awt/FontStrikeout.hpp> +#endif + +// ---------------------------------------------------- +// 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/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx new file mode 100644 index 000000000000..84f15e728eb9 --- /dev/null +++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx @@ -0,0 +1,301 @@ +/************************************************************************* + * + * $RCSfile: listenermultiplexer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ +#define _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ + + +#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_ +#include <com/sun/star/lang/XEventListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_ +#include <com/sun/star/awt/XFocusListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XWINDOWLISTENER_HPP_ +#include <com/sun/star/awt/XWindowListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERLISTENER_HPP_ +#include <com/sun/star/awt/XVclContainerListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XKEYLISTENER_HPP_ +#include <com/sun/star/awt/XKeyListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XMOUSELISTENER_HPP_ +#include <com/sun/star/awt/XMouseListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XMOUSEMOTIONLISTENER_HPP_ +#include <com/sun/star/awt/XMouseMotionListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XPAINTLISTENER_HPP_ +#include <com/sun/star/awt/XPaintListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTOPWINDOWLISTENER_HPP_ +#include <com/sun/star/awt/XTopWindowListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTEXTLISTENER_HPP_ +#include <com/sun/star/awt/XTextListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XACTIONLISTENER_HPP_ +#include <com/sun/star/awt/XActionListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XITEMLISTENER_HPP_ +#include <com/sun/star/awt/XItemListener.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_ +#include <com/sun/star/container/XContainerListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XSPINLISTENER_HPP_ +#include <com/sun/star/awt/XSpinListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XADJUSTMENTLISTENER_HPP_ +#include <com/sun/star/awt/XAdjustmentListener.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XMENULISTENER_HPP_ +#include <com/sun/star/awt/XMenuListener.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_ +#include <cppuhelper/interfacecontainer.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef _TOOLKIT_HELPER_MUTEXHELPER_HXX_ +#include <toolkit/helper/mutexhelper.hxx> +#endif + +#ifndef _TOOLKIT_HELPER_MACROS_HXX_ +#include <toolkit/helper/macros.hxx> +#endif + +// ---------------------------------------------------- +// class ListenerMultiplexerBase +// ---------------------------------------------------- + +class 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 ); + + // ::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(::com::sun::star::uno::RuntimeException) { mrContext.acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { 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( 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( 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( 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( 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 + + + + +#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..27c1dc081626 --- /dev/null +++ b/toolkit/inc/toolkit/helper/macros.hxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * $RCSfile: macros.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#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_Int64)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() ? (ClassName*)xUT->getSomething( ClassName::GetUnoTunnelId() ) : NULL; \ +} + +// ------------------------------------------------------------------------------------- + +#define IMPL_XTYPEPROVIDER_START( 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(); \ +} \ +::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( + +// ------------------------------------------------------------------------------------- + +#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(::com::sun::star::uno::RuntimeException) { ListenerMultiplexerBase::acquire(); } \ + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { 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) \ +{ \ +} + +// ------------------------------------------------------------------------------------- + +#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ClassName, InterfaceName, MethodName, EventType ) \ +void ClassName::MethodName( const EventType& e ) throw(::com::sun::star::uno::RuntimeException) \ +{ \ + EventType aMulti( e ); \ + aMulti.Source = &GetContext(); \ + ::cppu::OInterfaceIteratorHelper aIt( *this ); \ + while( aIt.hasMoreElements() ) \ + ((InterfaceName*)aIt.next())->MethodName( aMulti ); \ +} + +// ------------------------------------------------------------------------------------- + +#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) \ + { \ + ::rtl::OUString aServiceName( ServiceName ); \ + return ::com::sun::star::uno::Sequence< ::rtl::OUString >( &aServiceName, 1);\ + } \ + sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException) \ + { return rServiceName == ServiceName; } + + + + + + +#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..21f3a4f15907 --- /dev/null +++ b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * $RCSfile: mutexandbroadcasthelper.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX_ +#define _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX_ + +#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ +#include <cppuhelper/interfacecontainer.h> +#endif + + +// 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..5add1377f02d --- /dev/null +++ b/toolkit/inc/toolkit/helper/mutexhelper.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * $RCSfile: mutexhelper.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_MUTEXHELPER_HXX_ +#define _TOOLKIT_HELPER_MUTEXHELPER_HXX_ + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +// ---------------------------------------------------- +// 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..bd2e8db1cba3 --- /dev/null +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -0,0 +1,193 @@ +/************************************************************************* + * + * $RCSfile: property.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_PROPERTY_HXX_ +#define _TOOLKIT_HELPER_PROPERTY_HXX_ + +#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 + + +// 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 + +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..e52ab05c6c8b --- /dev/null +++ b/toolkit/inc/toolkit/helper/servicenames.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * $RCSfile: servicenames.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_SERVICENAMES_HXX_ +#define _TOOLKIT_HELPER_SERVICENAMES_HXX_ + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif + +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_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_PrinterServer[], szServiceName2_PrinterServer[]; + +// ExtUnoWrapper: +extern const char __FAR_DATA szServiceName_ImageProducer[], szServiceName2_ImageProducer[]; + + + +#endif // _TOOLKIT_HELPER_SERVICENAMES_HXX_ + diff --git a/toolkit/inc/toolkit/helper/unomemorystream.hxx b/toolkit/inc/toolkit/helper/unomemorystream.hxx new file mode 100644 index 000000000000..29a40cd5501a --- /dev/null +++ b/toolkit/inc/toolkit/helper/unomemorystream.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * $RCSfile: unomemorystream.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_ +#define _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_ + + +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#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(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { 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..2ed9ee4427eb --- /dev/null +++ b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * $RCSfile: unopropertyarrayhelper.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_ +#define _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_ + +#include <cppuhelper/propshlp.hxx> + +#include <tools/table.hxx> + +// ---------------------------------------------------- +// 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 ); + + // ::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..455c4383c969 --- /dev/null +++ b/toolkit/inc/toolkit/helper/unowrapper.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * $RCSfile: unowrapper.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_UNOWRAPPER_HXX_ +#define _TOOLKIT_HELPER_UNOWRAPPER_HXX_ + +#ifndef _COM_SUN_STAR_AWT_XTOOLKIT_HPP_ +#include <com/sun/star/awt/XToolkit.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XGRAPHICS_HPP_ +#include <com/sun/star/awt/XGraphics.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XWINDOWPEER_HPP_ +#include <com/sun/star/awt/XWindowPeer.hpp> +#endif + +#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; + +public: + UnoWrapper(); + + void Destroy(); + + // Toolkit + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> GetVCLToolkit(); + virtual void RegisterUnoServices(); + + // 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 ); + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getNewUnoServiceManager(); + +}; + + + + +#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..837354a7d502 --- /dev/null +++ b/toolkit/inc/toolkit/helper/vclunohelper.hxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: vclunohelper.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ +#define _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ +#include <com/sun/star/uno/Sequence.h> +#endif + +namespace com { namespace sun { namespace star { namespace uno { + class XInterface; +}}}} + +namespace com { namespace sun { namespace star { namespace awt { + class XBitmap; + class XWindow; + class XWindowPeer; + class XGraphics; + class XRegion; + class XDevice; + class XPointer; + class XToolkit; + class XFont; + class XControlContainer; + struct SimpleFontMetric; + struct FontDescriptor; + struct Rectangle; +}}}} + + +#include <vcl/bitmapex.hxx> +#include <vcl/region.hxx> +#include <vcl/metric.hxx> +#include <vcl/poly.hxx> + +class Window; +class OutputDevice; + +// ---------------------------------------------------- +// class VclUnoHelper +// ---------------------------------------------------- +class 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::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 ); + +}; + + +#endif // _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ diff --git a/toolkit/prj/d.lst b/toolkit/prj/d.lst new file mode 100644 index 000000000000..a991dfa0821c --- /dev/null +++ b/toolkit/prj/d.lst @@ -0,0 +1,35 @@ +mkdir: %_DEST%\inc%_EXT%\toolkit +mkdir: %_DEST%\inc%_EXT%\toolkit\helper +mkdir: %_DEST%\inc%_EXT%\toolkit\awt +mkdir: %_DEST%\inc%_EXT%\toolkit\controls + +..\%__SRC%\lib\itk.lib %_DEST%\lib%_EXT%\itk.lib +..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so +..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl +..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a +..\%__SRC%\bin\tk%UPD%??.res %_DEST%\bin%_EXT%\tk%upd%??.res +..\%__SRC%\bin\tk%upd%??.sym %_DEST%\bin%_EXT%\tk?????.sym +..\%__SRC%\bin\tk%upd%??.dll %_DEST%\bin%_EXT%\tk?????.dll +..\%__SRC%\misc\tk%upd%??.map %_DEST%\bin%_EXT%\tk?????.map + +hedabu: ..\inc\toolkit\awt\vclxcontainer.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxcontainer.hxx +hedabu: ..\inc\toolkit\awt\vclxdevice.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxdevice.hxx +hedabu: ..\inc\toolkit\awt\vclxtoolkit.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtoolkit.hxx +hedabu: ..\inc\toolkit\awt\vclxtopwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtopwindow.hxx +hedabu: ..\inc\toolkit\awt\vclxwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindow.hxx +hedabu: ..\inc\toolkit\awt\vclxwindows.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindows.hxx + +hedabu: ..\inc\toolkit\controls\unocontrol.hxx %_DEST%\inc%_EXT%\toolkit\controls\unocontrol.hxx + +hedabu: ..\inc\toolkit\helper\emptyfontdescriptor.hxx %_DEST%\inc%_EXT%\toolkit\helper\emptyfontdescriptor.hxx +hedabu: ..\inc\toolkit\helper\vclunohelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\vclunohelper.hxx +hedabu: ..\inc\toolkit\helper\convert.hxx %_DEST%\inc%_EXT%\toolkit\helper\convert.hxx +hedabu: ..\inc\toolkit\helper\property.hxx %_DEST%\inc%_EXT%\toolkit\helper\property.hxx +hedabu: ..\inc\toolkit\helper\macros.hxx %_DEST%\inc%_EXT%\toolkit\helper\macros.hxx +hedabu: ..\inc\toolkit\helper\mutexhelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\mutexhelper.hxx +hedabu: ..\inc\toolkit\helper\mutexandbroadcasthelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\mutexandbroadcasthelper.hxx +hedabu: ..\inc\toolkit\helper\listenermultiplexer.hxx %_DEST%\inc%_EXT%\toolkit\helper\listenermultiplexer.hxx +hedabu: ..\inc\toolkit\helper\unowrapper.hxx %_DEST%\inc%_EXT%\toolkit\helper\unowrapper.hxx + +hedabu: ..\inc\toolkit\helper\vclunohelper.hxx %_DEST%\inc%_EXT%\toolkit\unohlp.hxx + diff --git a/toolkit/source/awt/makefile.mk b/toolkit/source/awt/makefile.mk new file mode 100644 index 000000000000..160f4956cf6a --- /dev/null +++ b/toolkit/source/awt/makefile.mk @@ -0,0 +1,96 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=toolkit +TARGET=awt + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/vclxbitmap.obj \ + $(SLO)$/vclxcontainer.obj \ + $(SLO)$/vclxdevice.obj \ + $(SLO)$/vclxfont.obj \ + $(SLO)$/vclxgraphics.obj \ + $(SLO)$/vclxmenu.obj \ + $(SLO)$/vclxpointer.obj \ + $(SLO)$/vclxprinter.obj \ + $(SLO)$/vclxregion.obj \ + $(SLO)$/vclxsystemdependentwindow.obj \ + $(SLO)$/vclxtoolkit.obj \ + $(SLO)$/vclxtopwindow.obj \ + $(SLO)$/vclxwindow.obj \ + $(SLO)$/vclxwindows.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/toolkit/source/awt/vclxbitmap.cxx b/toolkit/source/awt/vclxbitmap.cxx new file mode 100644 index 000000000000..b75a4254d6d7 --- /dev/null +++ b/toolkit/source/awt/vclxbitmap.cxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * $RCSfile: vclxbitmap.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <toolkit/awt/vclxbitmap.hxx> +#include <toolkit/helper/macros.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <tools/stream.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +// ---------------------------------------------------- +// class VCLXBitmap +// ---------------------------------------------------- + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXBitmap::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::awt::XBitmap*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XDisplayBitmap*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); +} + +// ::com::sun::star::lang::XUnoTunnel +IMPL_XUNOTUNNEL( VCLXBitmap ) + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXBitmap ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap>* ) NULL ) +IMPL_XTYPEPROVIDER_END + + +// ::com::sun::star::awt::XBitmap +::com::sun::star::awt::Size VCLXBitmap::getSize() throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::awt::Size aSize( maBitmap.GetSizePixel().Width(), maBitmap.GetSizePixel().Height() ); + return aSize; +} + +::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getDIB() throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + SvMemoryStream aMem; + aMem << maBitmap.GetBitmap(); + return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() ); +} + +::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getMaskDIB() throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + SvMemoryStream aMem; + aMem << maBitmap.GetMask(); + return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() ); +} + + + + diff --git a/toolkit/source/awt/vclxcontainer.cxx b/toolkit/source/awt/vclxcontainer.cxx new file mode 100644 index 000000000000..a07c97873f17 --- /dev/null +++ b/toolkit/source/awt/vclxcontainer.cxx @@ -0,0 +1,264 @@ +/************************************************************************* + * + * $RCSfile: vclxcontainer.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <toolkit/awt/vclxcontainer.hxx> +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <vcl/window.hxx> +#include <tools/debug.hxx> + +// ---------------------------------------------------- +// class VCLXContainer +// ---------------------------------------------------- +VCLXContainer::VCLXContainer() +{ +} + +VCLXContainer::~VCLXContainer() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXContainer::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::awt::XVclContainer*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XVclContainerPeer*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXContainer ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainer>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerPeer>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + + +// ::com::sun::star::awt::XVclContainer +void VCLXContainer::addVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetContainerListeners().addInterface( rxListener ); +} + +void VCLXContainer::removeVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetContainerListeners().removeInterface( rxListener ); +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > VCLXContainer::getWindows( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + // Bei allen Childs das Container-Interface abfragen... + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aSeq; + Window* pWindow = GetWindow(); + if ( pWindow ) + { + sal_uInt16 nChilds = pWindow->GetChildCount(); + if ( nChilds ) + { + aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >( nChilds ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pChildRefs = aSeq.getArray(); + for ( sal_uInt16 n = 0; n < nChilds; n++ ) + { + Window* pChild = pWindow->GetChild( n ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xWP = pChild->GetComponentInterface( sal_True ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( xWP, ::com::sun::star::uno::UNO_QUERY ); + pChildRefs[n] = xW; + } + } + } + return aSeq; +} + + +// ::com::sun::star::awt::XVclContainerPeer +void VCLXContainer::enableDialogControl( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + WinBits nStyle = pWindow->GetStyle(); + if ( bEnable ) + nStyle |= WB_DIALOGCONTROL; + else + nStyle &= (~WB_DIALOGCONTROL); + pWindow->SetStyle( nStyle ); + } +} + +void VCLXContainer::setTabOrder( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& Components, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Tabs, sal_Bool bGroupControl ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_uInt32 nCount = Components.getLength(); + DBG_ASSERT( nCount == Tabs.getLength(), "setTabOrder: TabCount != ComponentCount" ); + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComps = Components.getConstArray(); + const ::com::sun::star::uno::Any* pTabs = Tabs.getConstArray(); + + Window* pPrevWin = NULL; + for ( sal_uInt32 n = 0; n < nCount; n++ ) + { + // ::com::sun::star::style::TabStop + Window* pWin = VCLUnoHelper::GetWindow( pComps[n] ); + // NULL kann vorkommen, wenn die ::com::sun::star::uno::Sequence vom TabController kommt und eine Peer fehlt! + if ( pWin ) + { + // Reihenfolge der Fenster vor der Manipulation des Styles, + // weil z.B. der RadioButton in StateChanged das PREV-Window beruecksichtigt. + if ( pPrevWin ) + pWin->SetZOrder( pPrevWin, WINDOW_ZORDER_BEHIND ); + + WinBits nStyle = pWin->GetStyle(); + nStyle &= ~(WB_TABSTOP|WB_NOTABSTOP|WB_GROUP); + if ( pTabs[n].getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN ) + { + sal_Bool bTab; + pTabs[n] >>= bTab; + nStyle |= ( bTab ? WB_TABSTOP : WB_NOTABSTOP ); + } + pWin->SetStyle( nStyle ); + + if ( bGroupControl ) + { + if ( n == 0 ) + pWin->SetDialogControlStart( sal_True ); + else + pWin->SetDialogControlStart( sal_False ); + } + + pPrevWin = pWin; + } + } +} + +void VCLXContainer::setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& Components ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_uInt32 nCount = Components.getLength(); + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComps = Components.getConstArray(); + + Window* pPrevWin = NULL; + Window* pPrevRadio = NULL; + for ( sal_uInt32 n = 0; n < nCount; n++ ) + { + Window* pWin = VCLUnoHelper::GetWindow( pComps[n] ); + if ( pWin ) + { + Window* pSortBehind = pPrevWin; + // #57096# Alle Radios hintereinander sortieren... + sal_Bool bNewPrevWin = sal_True; + if ( pWin->GetType() == WINDOW_RADIOBUTTON ) + { + if ( pPrevRadio ) + { + bNewPrevWin = ( pPrevWin == pPrevRadio ); // Radio-Button wurde vor das PreWin sortiert.... + pSortBehind = pPrevRadio; + } + pPrevRadio = pWin; + } + + // Z-Order + if ( pSortBehind ) + pWin->SetZOrder( pSortBehind, WINDOW_ZORDER_BEHIND ); + + WinBits nStyle = pWin->GetStyle(); + if ( n == 0 ) + nStyle |= WB_GROUP; + else + nStyle &= (~WB_GROUP); + pWin->SetStyle( nStyle ); + + // Ein WB_GROUP hinter die Gruppe, falls keine Gruppe mehr folgt. + if ( n == ( nCount - 1 ) ) + { + Window* pBehindLast = pWin->GetWindow( WINDOW_NEXT ); + if ( pBehindLast ) + { + WinBits nStyle = pBehindLast->GetStyle(); + nStyle |= WB_GROUP; + pBehindLast->SetStyle( nStyle ); + } + } + + if ( bNewPrevWin ) + pPrevWin = pWin; + } + } +} + + + + + diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx new file mode 100644 index 000000000000..79298c2fbda2 --- /dev/null +++ b/toolkit/source/awt/vclxdevice.cxx @@ -0,0 +1,270 @@ +/************************************************************************* + * + * $RCSfile: vclxdevice.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_AWT_DEVICECAPABILITY_HPP_ +#include <com/sun/star/awt/DeviceCapability.hpp> +#endif + +#include <toolkit/awt/vclxdevice.hxx> +#include <toolkit/awt/vclxfont.hxx> +#include <toolkit/awt/vclxbitmap.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <toolkit/helper/macros.hxx> +#include <cppuhelper/typeprovider.hxx> + +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <vcl/svapp.hxx> +#include <vcl/outdev.hxx> +#include <vcl/window.hxx> +#include <vcl/print.hxx> +#include <vcl/virdev.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/font.hxx> + +// ---------------------------------------------------- +// class VCLXDevice +// ---------------------------------------------------- +VCLXDevice::VCLXDevice() : mrMutex( Application::GetSolarMutex() ) +{ + mpOutputDevice = NULL; +#ifdef DEBUG + nDummy = 0x12345678; + pDummy = (void*)0x12345678; +#endif +} + +VCLXDevice::~VCLXDevice() +{ +#ifdef DEBUG + nDummy = 0xbaadbaad; + pDummy = (void*)0xbaadbaad; +#endif +} + +void VCLXDevice::DestroyOutputDevice() +{ + delete mpOutputDevice; + mpOutputDevice = NULL; +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXDevice::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::awt::XDevice*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); +} + +// ::com::sun::star::lang::XUnoTunnel +IMPL_XUNOTUNNEL( VCLXDevice ) + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXDevice ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>* ) NULL ) +IMPL_XTYPEPROVIDER_END + + +// ::com::sun::star::awt::XDevice, +::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXDevice::createGraphics( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > xRef; + + if ( mpOutputDevice ) + xRef = mpOutputDevice->CreateUnoGraphics(); + + return xRef; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXDevice::createDevice( sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > xRef; + if ( GetOutputDevice() ) + { + VCLXVirtualDevice* pVDev = new VCLXVirtualDevice; + VirtualDevice* pVclVDev = new VirtualDevice( *GetOutputDevice() ); + pVclVDev->SetOutputSizePixel( Size( nWidth, nHeight ) ); + pVDev->SetVirtualDevice( pVclVDev ); + xRef = pVDev; + } + return xRef; +} + +::com::sun::star::awt::DeviceInfo VCLXDevice::getInfo() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::awt::DeviceInfo aInfo; + + if( mpOutputDevice ) + { + Size aDevSz; + OutDevType eDevType = mpOutputDevice->GetOutDevType(); + if ( eDevType == OUTDEV_WINDOW ) + { + aDevSz = ((Window*)mpOutputDevice)->GetSizePixel(); + ((Window*)mpOutputDevice)->GetBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset ); + } + else if ( eDevType == OUTDEV_PRINTER ) + { + aDevSz = ((Printer*)mpOutputDevice)->GetPaperSizePixel(); + Size aOutSz = mpOutputDevice->GetOutputSizePixel(); + Point aOffset = ((Printer*)mpOutputDevice)->GetPageOffset(); + aInfo.LeftInset = aOffset.X(); + aInfo.TopInset = aOffset.Y(); + aInfo.RightInset = aDevSz.Width() - aOutSz.Width() - aOffset.X(); + aInfo.BottomInset = aDevSz.Height() - aOutSz.Height() - aOffset.Y(); + } + else // VirtualDevice + { + aDevSz = mpOutputDevice->GetOutputSizePixel(); + aInfo.LeftInset = 0; + aInfo.TopInset = 0; + aInfo.RightInset = 0; + aInfo.BottomInset = 0; + } + + aInfo.Width = aDevSz.Width(); + aInfo.Height = aDevSz.Height(); + + Size aTmpSz = mpOutputDevice->LogicToPixel( Size( 1000, 1000 ), MapMode( MAP_CM ) ); + aInfo.PixelPerMeterX = aTmpSz.Width()/10; + aInfo.PixelPerMeterY = aTmpSz.Height()/10; + + aInfo.BitsPerPixel = mpOutputDevice->GetBitCount(); + + aInfo.Capabilities = 0; + if ( mpOutputDevice->GetOutDevType() != OUTDEV_PRINTER ) + aInfo.Capabilities = ::com::sun::star::awt::DeviceCapability::RASTEROPERATIONS|::com::sun::star::awt::DeviceCapability::GETBITS; + } + + return aInfo; +} + +::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor > VCLXDevice::getFontDescriptors( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor> aFonts; + if( mpOutputDevice ) + { + sal_uInt16 nFonts = mpOutputDevice->GetDevFontCount(); + if ( nFonts ) + { + aFonts = ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor>( nFonts ); + ::com::sun::star::awt::FontDescriptor* pFonts = aFonts.getArray(); + for ( sal_uInt16 n = 0; n < nFonts; n++ ) + pFonts[n] = VCLUnoHelper::CreateFontDescriptor( mpOutputDevice->GetDevFont( n ) ); + } + } + return aFonts; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > VCLXDevice::getFont( const ::com::sun::star::awt::FontDescriptor& rDescriptor ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > xRef; + if( mpOutputDevice ) + { + VCLXFont* pMetric = new VCLXFont; + pMetric->Init( *this, VCLUnoHelper::CreateFont( rDescriptor, mpOutputDevice->GetFont() ) ); + xRef = pMetric; + } + return xRef; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > VCLXDevice::createBitmap( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBmp; + if( mpOutputDevice ) + { + Bitmap aBmp = mpOutputDevice->GetBitmap( Point( nX, nY ), Size( nWidth, nHeight ) ); + + VCLXBitmap* pBmp = new VCLXBitmap; + pBmp->SetBitmap( BitmapEx( aBmp ) ); + xBmp = pBmp; + } + return xBmp; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap > VCLXDevice::createDisplayBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& rxBitmap ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + BitmapEx aBmp = VCLUnoHelper::GetBitmap( rxBitmap ); + VCLXBitmap* pBmp = new VCLXBitmap; + pBmp->SetBitmap( aBmp ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap > xDBmp = pBmp; + return xDBmp; +} + + + diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx new file mode 100644 index 000000000000..99e55f88b44c --- /dev/null +++ b/toolkit/source/awt/vclxfont.cxx @@ -0,0 +1,263 @@ +/************************************************************************* + * + * $RCSfile: vclxfont.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <toolkit/awt/vclxfont.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <toolkit/helper/macros.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> +#include <rtl/ustring.h> + +#include <vcl/outdev.hxx> + +// ---------------------------------------------------- +// class VCLXFont +// ---------------------------------------------------- +VCLXFont::VCLXFont() +{ + mpFontMetric = NULL; +} + +VCLXFont::~VCLXFont() +{ + delete mpFontMetric; +} + +void VCLXFont::Init( ::com::sun::star::awt::XDevice& rxDev, const Font& rFont ) +{ + mxDevice = &rxDev; + + delete mpFontMetric; + mpFontMetric = NULL; + + maFont = rFont; +} + +BOOL VCLXFont::ImplAssertValidFontMetric() +{ + if ( !mpFontMetric && mxDevice.is() ) + { + OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice ); + if ( pOutDev ) + { + Font aOldFont = pOutDev->GetFont(); + pOutDev->SetFont( maFont ); + mpFontMetric = new FontMetric( pOutDev->GetFontMetric() ); + pOutDev->SetFont( aOldFont ); + } + } + return mpFontMetric ? TRUE : FALSE; +} + + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXFont::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::awt::XFont*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); +} + +// ::com::sun::star::lang::XUnoTunnel +IMPL_XUNOTUNNEL( VCLXFont ) + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXFont ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont>* ) NULL ) +IMPL_XTYPEPROVIDER_END + + +::com::sun::star::awt::FontDescriptor VCLXFont::getFontDescriptor( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return VCLUnoHelper::CreateFontDescriptor( maFont ); + +} + +::com::sun::star::awt::SimpleFontMetric VCLXFont::getFontMetric( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::awt::SimpleFontMetric aFM; + if ( ImplAssertValidFontMetric() ) + aFM = VCLUnoHelper::CreateFontMetric( *mpFontMetric ); + return aFM; +} + +sal_Int16 VCLXFont::getCharWidth( sal_Unicode c ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_Int16 nRet = -1; + OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice ); + if ( pOutDev ) + { + Font aOldFont = pOutDev->GetFont(); + pOutDev->SetFont( maFont ); + + nRet = pOutDev->GetTextWidth( c ); + + pOutDev->SetFont( aOldFont ); + } + return nRet; +} + +::com::sun::star::uno::Sequence< sal_Int16 > VCLXFont::getCharWidths( sal_Unicode nFirst, sal_Unicode nLast ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence<sal_Int16> aSeq; + OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice ); + if ( pOutDev ) + { + Font aOldFont = pOutDev->GetFont(); + pOutDev->SetFont( maFont ); + + sal_Int16 nCount = nLast-nFirst + 1; + aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nCount ); + for ( USHORT n = 0; n < nCount; n++ ) + { + aSeq.getArray()[n] = pOutDev->GetTextWidth( nFirst+n ); + } + + pOutDev->SetFont( aOldFont ); + } + return aSeq; +} + +sal_Int32 VCLXFont::getStringWidth( const ::rtl::OUString& str ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_Int32 nRet = -1; + OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice ); + if ( pOutDev ) + { + Font aOldFont = pOutDev->GetFont(); + pOutDev->SetFont( maFont ); + nRet = pOutDev->GetTextWidth( str ); + pOutDev->SetFont( aOldFont ); + } + return nRet; +} + +sal_Int32 VCLXFont::getStringWidthArray( const ::rtl::OUString& str, ::com::sun::star::uno::Sequence< sal_Int32 >& rDXArray ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_Int32 nRet = -1; + OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice ); + if ( pOutDev ) + { + Font aOldFont = pOutDev->GetFont(); + pOutDev->SetFont( maFont ); + rDXArray = ::com::sun::star::uno::Sequence<sal_Int32>( str.getLength() ); + nRet = pOutDev->GetTextArray( str, rDXArray.getArray() ); + pOutDev->SetFont( aOldFont ); + } + return nRet; +} + +void VCLXFont::getKernPairs( ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars1, ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars2, ::com::sun::star::uno::Sequence< sal_Int16 >& rnKerns ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice ); + if( pOutDev ) + { + Font aOldFont = pOutDev->GetFont(); + pOutDev->SetFont( maFont ); + + ULONG nPairs = pOutDev->GetKerningPairCount(); + if ( nPairs ) + { + KerningPair* pData = new KerningPair[ nPairs ]; + pOutDev->GetKerningPairs( nPairs, pData ); + + rnChars1 = ::com::sun::star::uno::Sequence<sal_Unicode>( nPairs ); + rnChars2 = ::com::sun::star::uno::Sequence<sal_Unicode>( nPairs ); + rnKerns = ::com::sun::star::uno::Sequence<sal_Int16>( nPairs ); + + sal_Unicode* pChars1 = rnChars1.getArray(); + sal_Unicode* pChars2 = rnChars2.getArray(); + sal_Int16* pKerns = rnKerns.getArray(); + + for ( ULONG n = 0; n < nPairs; n++ ) + { + pChars1[n] = pData[n].nChar1; + pChars2[n] = pData[n].nChar2; + pKerns[n] = pData[n].nKern; + } + + + delete pData; + } + pOutDev->SetFont( aOldFont ); + } +} + + + diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx new file mode 100644 index 000000000000..1e475328c5c3 --- /dev/null +++ b/toolkit/source/awt/vclxgraphics.cxx @@ -0,0 +1,518 @@ +/************************************************************************* + * + * $RCSfile: vclxgraphics.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#define SMART_UNO_GENERATION // Um einige Funktionen in VCL freizuschalten + +#include <toolkit/awt/vclxgraphics.hxx> +#include <toolkit/awt/vclxdevice.hxx> +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <vcl/svapp.hxx> +#include <vcl/outdev.hxx> +#include <vcl/gradient.hxx> +#include <tools/debug.hxx> + + +// ---------------------------------------------------- +// class VCLXGraphics +// ---------------------------------------------------- + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXGraphics::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::awt::XGraphics*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); +} + +// ::com::sun::star::lang::XUnoTunnel +IMPL_XUNOTUNNEL( VCLXGraphics ) + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXGraphics ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>* ) NULL ) +IMPL_XTYPEPROVIDER_END + +VCLXGraphics::VCLXGraphics() : mrMutex( Application::GetSolarMutex() ) +{ + mpOutputDevice = NULL; + mpClipRegion = NULL; +} + +VCLXGraphics::~VCLXGraphics() +{ + List* pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : NULL; + if ( pLst ) + pLst->Remove( this ); + + delete mpClipRegion; +} + +void VCLXGraphics::SetOutputDevice( OutputDevice* pOutDev ) +{ + mpOutputDevice = pOutDev; + mxDevice = NULL; +} + +void VCLXGraphics::Init( OutputDevice* pOutDev ) +{ + DBG_ASSERT( !mpOutputDevice, "VCLXGraphics::Init allready has pOutDev !" ); + mpOutputDevice = pOutDev; + + maFont = mpOutputDevice->GetFont(); + maTextColor = COL_BLACK; + maTextFillColor = COL_TRANSPARENT; + maLineColor = COL_BLACK; + maFillColor = COL_WHITE; + meRasterOp = ROP_OVERPAINT; + mpClipRegion = NULL; + + // Register at OutputDevice + List* pLst = mpOutputDevice->GetUnoGraphicsList(); + if ( !pLst ) + pLst = mpOutputDevice->CreateUnoGraphicsList(); + pLst->Insert( this, LIST_APPEND ); +} + +void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags ) +{ + if(mpOutputDevice) + { + NAMESPACE_VOS(OGuard) aVclGuard( Application::GetSolarMutex() ); + + if ( nFlags & INITOUTDEV_FONT ) + { + mpOutputDevice->SetFont( maFont ); + mpOutputDevice->SetTextColor( maTextColor ); + mpOutputDevice->SetTextFillColor( maTextFillColor ); + } + + if ( nFlags & INITOUTDEV_COLORS ) + { + mpOutputDevice->SetLineColor( maLineColor ); + mpOutputDevice->SetFillColor( maFillColor ); + } + + if ( nFlags & INITOUTDEV_RASTEROP ) + { + mpOutputDevice->SetRasterOp( meRasterOp ); + } + + if ( nFlags & INITOUTDEV_CLIPREGION ) + { + if( mpClipRegion ) + mpOutputDevice->SetClipRegion( *mpClipRegion ); + else + mpOutputDevice->SetClipRegion(); + } + } +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXGraphics::getDevice() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( !mxDevice.is() && mpOutputDevice ) + { + VCLXDevice* pDev = new VCLXDevice; + pDev->SetOutputDevice( mpOutputDevice ); + mxDevice = pDev; + } + return mxDevice; +} + +::com::sun::star::awt::SimpleFontMetric VCLXGraphics::getFontMetric() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::awt::SimpleFontMetric aM; + if( mpOutputDevice ) + { + mpOutputDevice->SetFont( maFont ); + FontMetric aFMetric = mpOutputDevice->GetFontMetric(); + + aM.Ascent = aFMetric.GetAscent(); + aM.Descent = aFMetric.GetDescent(); + aM.Leading = aFMetric.GetLeading(); + aM.Slant = aFMetric.GetSlant(); + aM.FirstChar = aFMetric.getFirstChar(); + aM.LastChar = aFMetric.getLastChar(); + } + return aM; +} + +void VCLXGraphics::setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maFont = VCLUnoHelper::CreateFont( rxFont ); +} + +void VCLXGraphics::selectFont( const ::com::sun::star::awt::FontDescriptor& rDescription ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maFont = VCLUnoHelper::CreateFont( rDescription, Font() ); +} + +void VCLXGraphics::setTextColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maTextColor = Color( (sal_uInt32)nColor ); +} + +void VCLXGraphics::setTextFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maTextFillColor = Color( (sal_uInt32)nColor ); +} + +void VCLXGraphics::setLineColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maLineColor = Color( (sal_uInt32)nColor ); +} + +void VCLXGraphics::setFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maFillColor = Color( (sal_uInt32)nColor ); +} + +void VCLXGraphics::setRasterOp( ::com::sun::star::awt::RasterOperation eROP ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + meRasterOp = (RasterOp)eROP; +} + +void VCLXGraphics::setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + delete mpClipRegion; + if ( rxRegion.is() ) + mpClipRegion = new Region( VCLUnoHelper::GetRegion( rxRegion ) ); + else + mpClipRegion = NULL; +} + +void VCLXGraphics::intersectClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( rxRegion.is() ) + { + Region aRegion( VCLUnoHelper::GetRegion( rxRegion ) ); + if ( !mpClipRegion ) + mpClipRegion = new Region( aRegion ); + else + mpClipRegion->Intersect( aRegion ); + } +} + +void VCLXGraphics::push( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + + if( mpOutputDevice ) + mpOutputDevice->Push(); +} + +void VCLXGraphics::pop( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + + if( mpOutputDevice ) + mpOutputDevice->Pop(); +} + +void VCLXGraphics::copy( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >& rxSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( mpOutputDevice ) + { + VCLXDevice* pFromDev = VCLXDevice::GetImplementation( rxSource ); + DBG_ASSERT( pFromDev, "VCLXGraphics::copy - invalid device" ); + if ( pFromDev ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP ); + mpOutputDevice->DrawOutDev( Point( nDestX, nDestY ), Size( nDestWidth, nDestHeight ), + Point( nSourceX, nSourceY ), Size( nSourceWidth, nSourceHeight ), *pFromDev->GetOutputDevice() ); + } + } +} + +void VCLXGraphics::draw( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap >& rxBitmapHandle, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap( rxBitmapHandle, ::com::sun::star::uno::UNO_QUERY ); + BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap ); + + Point aPos(nDestX - nSourceX, nDestY - nSourceY); + Size aSz = aBmpEx.GetSizePixel(); + + if(nDestWidth != nSourceWidth) + { + float zoomX = (float)nDestWidth / (float)nSourceWidth; + aSz.Width() = (long) ((float)aSz.Width() * zoomX); + } + + if(nDestHeight != nSourceHeight) + { + float zoomY = (float)nDestHeight / (float)nSourceHeight; + aSz.Height() = (long) ((float)aSz.Height() * zoomY); + } + + if(nSourceX || nSourceY || aSz.Width() != nSourceWidth || aSz.Height() != nSourceHeight) + mpOutputDevice->IntersectClipRegion(Region(Rectangle(nDestX, nDestY, nDestX + nDestWidth - 1, nDestY + nDestHeight - 1))); + + mpOutputDevice->DrawBitmapEx( aPos, aSz, aBmpEx ); + } +} + +void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + mpOutputDevice->DrawPixel( Point( x, y ) ); + } +} + +void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + mpOutputDevice->DrawLine( Point( x1, y1 ), Point( x2, y2 ) ); + } +} + +void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ) ); + } +} + +void VCLXGraphics::drawRoundedRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ), nHorzRound, nVertRound ); + } +} + +void VCLXGraphics::drawPolyLine( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + mpOutputDevice->DrawPolyLine( VCLUnoHelper::CreatePolygon( DataX, DataY ) ); + } +} + +void VCLXGraphics::drawPolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + mpOutputDevice->DrawPolygon( VCLUnoHelper::CreatePolygon( DataX, DataY ) ); + } +} + +void VCLXGraphics::drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataX, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataY ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + sal_Int32 nPolys = (sal_uInt16) DataX.getLength(); + PolyPolygon aPolyPoly( nPolys ); + for ( sal_Int32 n = 0; n < nPolys; n++ ) + aPolyPoly[n] = VCLUnoHelper::CreatePolygon( DataX.getConstArray()[n], DataY.getConstArray()[n] ); + + mpOutputDevice->DrawPolyPolygon( aPolyPoly ); + } +} + +void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + mpOutputDevice->DrawEllipse( Rectangle( Point( x, y ), Size( width, height ) ) ); + } +} + +void VCLXGraphics::drawArc( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + mpOutputDevice->DrawArc( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) ); + } +} + +void VCLXGraphics::drawPie( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + mpOutputDevice->DrawPie( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) ); + } +} + +void VCLXGraphics::drawChord( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + mpOutputDevice->DrawChord( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) ); + } +} + +void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, const ::com::sun::star::awt::Gradient& rGradient ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); + Gradient aGradient((GradientStyle)rGradient.Style, rGradient.StartColor, rGradient.EndColor); + aGradient.SetAngle(rGradient.Angle); + aGradient.SetBorder(rGradient.Border); + aGradient.SetOfsX(rGradient.XOffset); + aGradient.SetOfsY(rGradient.YOffset); + aGradient.SetStartIntensity(rGradient.StartIntensity); + aGradient.SetEndIntensity(rGradient.EndIntensity); + aGradient.SetSteps(rGradient.StepCount); + mpOutputDevice->DrawGradient( Rectangle( Point( x, y ), Size( width, height ) ), aGradient ); + } +} + +void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS |INITOUTDEV_FONT); + mpOutputDevice->DrawText( Point( x, y ), rText ); + } +} + +void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const ::rtl::OUString& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rLongs ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if( mpOutputDevice ) + { + InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS|INITOUTDEV_FONT ); + mpOutputDevice->DrawTextArray( Point( x, y ), rText, rLongs.getConstArray() ); + } +} + + + + diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx new file mode 100644 index 000000000000..861b2ed3d118 --- /dev/null +++ b/toolkit/source/awt/vclxmenu.cxx @@ -0,0 +1,348 @@ +/************************************************************************* + * + * $RCSfile: vclxmenu.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <toolkit/awt/vclxmenu.hxx> +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <toolkit/helper/convert.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <vcl/menu.hxx> + +// ---------------------------------------------------- +// class VCLXMenu +// ---------------------------------------------------- +VCLXMenu::VCLXMenu() : maMenuListeners( *this ) +{ + mpMenu = NULL; +} + +VCLXMenu::~VCLXMenu() +{ + for ( sal_uInt32 n = maPopupMenueRefs.Count(); n; ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n ); + delete pRef; + } + delete mpMenu; +} + +void VCLXMenu::ImplCreateMenu( sal_Bool bPopup ) +{ + DBG_ASSERT( !mpMenu, "CreateMenu: Menu exists!" ); + + mbPopup = bPopup; + if ( mbPopup ) + mpMenu = new PopupMenu; + else + mpMenu = new MenuBar; + + mpMenu->SetSelectHdl( LINK( this, VCLXMenu, SelectHdl ) ); + mpMenu->SetHighlightHdl( LINK( this, VCLXMenu, HighlightHdl ) ); + mpMenu->SetActivateHdl( LINK( this, VCLXMenu, ActivateHdl ) ); + mpMenu->SetDeactivateHdl( LINK( this, VCLXMenu, DeactivateHdl ) ); +} + +IMPL_LINK( VCLXMenu, SelectHdl, Menu*, EMPTYARG ) +{ + if ( maMenuListeners.getLength() ) + { + ::com::sun::star::awt::MenuEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.MenuId = mpMenu->GetCurItemId(); + maMenuListeners.select( aEvent ); + } + return 1; +} + +IMPL_LINK( VCLXMenu, HighlightHdl, Menu*, EMPTYARG ) +{ + if ( maMenuListeners.getLength() ) + { + ::com::sun::star::awt::MenuEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.MenuId = mpMenu->GetCurItemId(); + maMenuListeners.highlight( aEvent ); + } + return 1; +} + +IMPL_LINK( VCLXMenu, ActivateHdl, Menu*, EMPTYARG ) +{ + if ( maMenuListeners.getLength() ) + { + ::com::sun::star::awt::MenuEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.MenuId = mpMenu->GetCurItemId(); + maMenuListeners.activate( aEvent ); + } + return 1; +} + +IMPL_LINK( VCLXMenu, DeactivateHdl, Menu*, EMPTYARG ) +{ + if ( maMenuListeners.getLength() ) + { + ::com::sun::star::awt::MenuEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.MenuId = mpMenu->GetCurItemId(); + maMenuListeners.deactivate( aEvent ); + } + return 1; +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXMenu::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::awt::XMenu*, (::com::sun::star::awt::XMenuBar*) this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XMenuBar*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XPopupMenu*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); +} + +// ::com::sun::star::lang::XUnoTunnel +IMPL_XUNOTUNNEL( VCLXMenu ) + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXMenu ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu>* ) NULL ) +IMPL_XTYPEPROVIDER_END + + +void VCLXMenu::addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maMenuListeners.addInterface( rxListener ); +} + +void VCLXMenu::removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maMenuListeners.removeInterface( rxListener ); +} + +void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mpMenu->InsertItem( nItemId, aText, (MenuItemBits)nItemStyle, nPos ); +} + +void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( nCount ) + { + sal_uInt16 nP = (sal_uInt16) Min( sal_uInt32(nPos+nCount), (sal_uInt32)mpMenu->GetItemCount() ); + for ( nP; nP; ) + mpMenu->RemoveItem( --nP ); + } +} + +sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mpMenu->GetItemCount(); +} + +sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mpMenu->GetItemId( nPos ); +} + +sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mpMenu->GetItemPos( nId ); +} + +void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mpMenu->EnableItem( nItemId, bEnable ); +} + +sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mpMenu->IsItemEnabled( nItemId ); +} + +void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mpMenu->SetItemText( nItemId, aText ); +} + +::rtl::OUString VCLXMenu::getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mpMenu->GetItemText( nItemId ); +} + +void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& rxPopupMenu ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + VCLXMenu* pVCLMenu = VCLXMenu::GetImplementation( rxPopupMenu ); + DBG_ASSERT( pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu(), "setPopupMenu: Invalid Menu!" ); + + if ( pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu() ) + { + // Selbst eine Ref halten! + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pNewRef = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > ; + *pNewRef = rxPopupMenu; + maPopupMenueRefs.Insert( pNewRef, LIST_APPEND ); + + mpMenu->SetPopupMenu( nItemId, (PopupMenu*) pVCLMenu->GetMenu() ); + } +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > VCLXMenu::getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > aRef; + Menu* pMenu = mpMenu->GetPopupMenu( nItemId ); + if ( pMenu ) + { + for ( sal_uInt32 n = maPopupMenueRefs.Count(); n; ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n ); + Menu* pM = ((VCLXMenu*)pRef->get())->GetMenu(); + if ( pM == pMenu ) + { + aRef = *pRef; + break; + } + } + } + return aRef; +} + + +// ::com::sun::star::awt::XPopupMenu +void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mpMenu->InsertSeparator( nPos ); +} + +void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mpMenu->SetDefaultItem( nItemId ); +} + +sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mpMenu->GetDefaultItem(); +} + +void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mpMenu->CheckItem( nItemId, bCheck ); +} + +sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mpMenu->IsItemChecked( nItemId ); +} + +sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxWindowPeer, const ::com::sun::star::awt::Rectangle& rArea, sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_Int16 nRet = 0; + if ( IsPopupMenu() ) + nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle(rArea), nFlags ); + return nRet; +} + + + diff --git a/toolkit/source/awt/vclxpointer.cxx b/toolkit/source/awt/vclxpointer.cxx new file mode 100644 index 000000000000..ed757ea4bf71 --- /dev/null +++ b/toolkit/source/awt/vclxpointer.cxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * $RCSfile: vclxpointer.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <toolkit/awt/vclxpointer.hxx> +#include <toolkit/helper/macros.hxx> +#include <cppuhelper/typeprovider.hxx> + +// ---------------------------------------------------- +// class VCLXPointer +// ---------------------------------------------------- +VCLXPointer::VCLXPointer() +{ +} + +VCLXPointer::~VCLXPointer() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXPointer::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::awt::XPointer*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); +} + +// ::com::sun::star::lang::XUnoTunnel +IMPL_XUNOTUNNEL( VCLXPointer ) + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXPointer ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer>* ) NULL ) +IMPL_XTYPEPROVIDER_END + +void VCLXPointer::setType( sal_Int32 nType ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maPointer = Pointer( (PointerStyle)nType ); +} + +sal_Int32 VCLXPointer::getType() throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return (sal_Int32)maPointer.GetStyle(); +} + + + diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx new file mode 100644 index 000000000000..e3f5e70e29bb --- /dev/null +++ b/toolkit/source/awt/vclxprinter.cxx @@ -0,0 +1,474 @@ +/************************************************************************* + * + * $RCSfile: vclxprinter.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <toolkit/awt/vclxprinter.hxx> +#include <toolkit/helper/macros.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + + +#include <vcl/print.hxx> +#include <vcl/jobset.hxx> + +#include <tools/debug.hxx> +#include <tools/stream.hxx> + +#include <toolkit/awt/vclxdevice.hxx> + + +#define BINARYSETUPMARKER 0x23864691 + +#define PROPERTY_Orientation 0 +#define PROPERTY_Horizontal 1 + +::com::sun::star::beans::Property* ImplGetProperties( sal_uInt16& rElementCount ) +{ + static ::com::sun::star::beans::Property* pProperties = NULL; + static sal_uInt16 nElements = 0; + if( !pProperties ) + { + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pProperties ) + { + static ::com::sun::star::beans::Property __FAR_DATA aPropTable[] = + { + ::com::sun::star::beans::Property( ::rtl::OUString::createFromAscii( "Orientation" ), PROPERTY_Orientation, ::getCppuType((const sal_Int16*)0), 0 ), + ::com::sun::star::beans::Property( ::rtl::OUString::createFromAscii( "Horizontal" ), PROPERTY_Horizontal, ::getBooleanCppuType(), 0 ) + }; + pProperties = aPropTable; + nElements = sizeof( aPropTable ) / sizeof( ::com::sun::star::beans::Property ); + } + } + rElementCount = nElements; + return pProperties; +} + +// ---------------------------------------------------- +// class VCLXPrinterPropertySet +// ---------------------------------------------------- + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXPrinterPropertySet::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::beans::XMultiPropertySet*, this ), + SAL_STATIC_CAST( ::com::sun::star::beans::XFastPropertySet*, this ), + SAL_STATIC_CAST( ::com::sun::star::beans::XPropertySet*, (::cppu::OPropertySetHelper*) this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XPrinterPropertySet*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXPrinterPropertySet ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinterPropertySet>* ) NULL ) +IMPL_XTYPEPROVIDER_END + +VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName ) + : OPropertySetHelper( BrdcstHelper ) +{ + mpPrinter = new Printer( rPrinterName ); + mnOrientation = 0; + mbHorizontal = sal_False; +} + +VCLXPrinterPropertySet::~VCLXPrinterPropertySet() +{ + delete mpPrinter; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinterPropertySet::GetDevice() +{ + if ( !mxPrnDevice.is() ) + { + VCLXDevice* pDev = new VCLXDevice; + pDev->SetOutputDevice( GetPrinter() ); + mxPrnDevice = pDev; + } + return mxPrnDevice; +} + +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXPrinterPropertySet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + +::cppu::IPropertyArrayHelper& VCLXPrinterPropertySet::getInfoHelper() +{ + static ::cppu::OPropertyArrayHelper* pPropertyArrayHelper = NULL; + if ( !pPropertyArrayHelper ) + { + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pPropertyArrayHelper ) + { + sal_uInt16 nElements; + ::com::sun::star::beans::Property* pProps = ImplGetProperties( nElements ); + pPropertyArrayHelper = new ::cppu::OPropertyArrayHelper( pProps, nElements, sal_False ); + } + } + return *pPropertyArrayHelper ; +} + +sal_Bool VCLXPrinterPropertySet::convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + sal_Bool bDifferent = sal_False; + switch ( nHandle ) + { + case PROPERTY_Orientation: + { + sal_Int16 n; + if( ( rValue >>= n ) && ( n != mnOrientation ) ) + { + rConvertedValue <<= n; + rOldValue <<= mnOrientation; + bDifferent = sal_True; + } + } + break; + case PROPERTY_Horizontal: + { + sal_Bool b; + if( ( rValue >>= b ) && ( b != mbHorizontal ) ) + { + rConvertedValue <<= b; + rOldValue <<= mbHorizontal; + bDifferent = sal_True; + } + } + break; + default: + { + DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" ); + } + } + return bDifferent; +} + +void VCLXPrinterPropertySet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + switch( nHandle ) + { + case PROPERTY_Orientation: + { + rValue >>= mnOrientation; + } + break; + case PROPERTY_Horizontal: + { + rValue >>= mbHorizontal; + } + break; + default: + { + DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" ); + } + } +} + +void VCLXPrinterPropertySet::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const +{ + ::osl::Guard< ::osl::Mutex > aGuard( ((VCLXPrinterPropertySet*)this)->Mutex ); + + switch( nHandle ) + { + case PROPERTY_Orientation: + rValue <<= mnOrientation; + break; + case PROPERTY_Horizontal: + rValue <<= mbHorizontal; + break; + default: + { + DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" ); + } + } +} + +// ::com::sun::star::awt::XPrinterPropertySet +void VCLXPrinterPropertySet::setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + ::com::sun::star::uno::Any aValue; + aValue <<= bHorizontal; + setFastPropertyValue( PROPERTY_Horizontal, aValue ); +} + +::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterPropertySet::getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + sal_uInt16 nPaperBinCount = GetPrinter()->GetPaperBinCount(); + ::com::sun::star::uno::Sequence< ::rtl::OUString > aDescriptions( nPaperBinCount ); + for ( sal_uInt16 n = 0; n < nPaperBinCount; n++ ) + { + // Format: <DisplayFormName;FormNameId;DisplayPaperBinName;PaperBinNameId;DisplayPaperName;PaperNameId> + String aDescr( RTL_CONSTASCII_USTRINGPARAM( "*;*;" ) ); + aDescr += GetPrinter()->GetPaperBinName( n ); + aDescr += ';'; + aDescr += n; + aDescr.AppendAscii( ";*;*", 4 ); + + aDescriptions.getArray()[n] = aDescr; + } + return aDescriptions; +} + +void VCLXPrinterPropertySet::selectForm( const ::rtl::OUString& rFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + sal_uInt16 nPaperBin = rFormDescription.getToken( 3, ';' ).toInt32(); + GetPrinter()->SetPaperBin( nPaperBin ); +} + +::com::sun::star::uno::Sequence< sal_Int8 > VCLXPrinterPropertySet::getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + SvMemoryStream aMem; + aMem << BINARYSETUPMARKER; + aMem << GetPrinter()->GetJobSetup(); + return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() ); +} + +void VCLXPrinterPropertySet::setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + SvMemoryStream aMem( (char*) data.getConstArray(), data.getLength(), STREAM_READ ); + sal_uInt32 nMarker; + aMem >> nMarker; + DBG_ASSERT( nMarker == BINARYSETUPMARKER, "setBinarySetup - invalid!" ); + if ( nMarker == BINARYSETUPMARKER ) + { + JobSetup aSetup; + aMem >> aSetup; + GetPrinter()->SetJobSetup( aSetup ); + } +} + + +// ---------------------------------------------------- +// class VCLXPrinter +// ---------------------------------------------------- +VCLXPrinter::VCLXPrinter( const String& rPrinterName ) + : VCLXPrinterPropertySet( rPrinterName ) +{ +} + +VCLXPrinter::~VCLXPrinter() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXPrinter::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::awt::XPrinter*, this ) ); + return (aRet.hasValue() ? aRet : VCLXPrinterPropertySet::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXPrinter ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter>* ) NULL ), + VCLXPrinterPropertySet::getTypes() +IMPL_XTYPEPROVIDER_END + +sal_Bool VCLXPrinter::start( const ::rtl::OUString& rJobName, sal_Int16 nCopies, sal_Bool bCollate ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + sal_Bool bDone = sal_True; + if ( GetPrinter() ) + bDone = GetPrinter()->StartJob( rJobName ); + + return bDone; +} + +void VCLXPrinter::end( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + if ( GetPrinter() ) + GetPrinter()->EndJob(); +} + +void VCLXPrinter::terminate( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + if ( GetPrinter() ) + GetPrinter()->AbortJob(); +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + if ( GetPrinter() ) + GetPrinter()->StartPage(); + return GetDevice(); +} + +void VCLXPrinter::endPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + if ( GetPrinter() ) + GetPrinter()->EndPage(); +} + + +// ---------------------------------------------------- +// class VCLXInfoPrinter +// ---------------------------------------------------- + +VCLXInfoPrinter::VCLXInfoPrinter( const String& rPrinterName ) + : VCLXPrinterPropertySet( rPrinterName ) +{ +} + +VCLXInfoPrinter::~VCLXInfoPrinter() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXInfoPrinter::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::awt::XInfoPrinter*, this ) ); + return (aRet.hasValue() ? aRet : VCLXPrinterPropertySet::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXInfoPrinter ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter>* ) NULL ), + VCLXPrinterPropertySet::getTypes() +IMPL_XTYPEPROVIDER_END + +// ::com::sun::star::awt::XInfoPrinter +::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXInfoPrinter::createDevice( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); + + return GetDevice(); +} + +// ---------------------------------------------------- +// class VCLXPrinterServer +// ---------------------------------------------------- + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXPrinterServer::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::awt::XPrinterServer*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXPrinterServer ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinterServer>* ) NULL ) +IMPL_XTYPEPROVIDER_END + +// ::com::sun::star::awt::XPrinterServer +::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterServer::getPrinterNames( ) throw(::com::sun::star::uno::RuntimeException) +{ + sal_uInt16 nPrinters = Printer::GetQueueCount(); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( nPrinters ); + + for ( sal_uInt16 n = 0; n < nPrinters; n++ ) + { + const QueueInfo& rInfo = Printer::GetQueueInfo( n ); + aNames.getArray()[n] = rInfo.GetPrinterName(); + } + + return aNames; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > VCLXPrinterServer::createPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > xP; + xP = new VCLXPrinter( rPrinterName ); + return xP; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > VCLXPrinterServer::createInfoPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > xP; + xP = new VCLXInfoPrinter( rPrinterName ); + return xP; +} + + + diff --git a/toolkit/source/awt/vclxregion.cxx b/toolkit/source/awt/vclxregion.cxx new file mode 100644 index 000000000000..ed808b915b75 --- /dev/null +++ b/toolkit/source/awt/vclxregion.cxx @@ -0,0 +1,202 @@ +/************************************************************************* + * + * $RCSfile: vclxregion.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <toolkit/awt/vclxregion.hxx> +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <toolkit/helper/convert.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> +#include <vcl/svapp.hxx> + +// ---------------------------------------------------- +// class VCLXRegion +// ---------------------------------------------------- +VCLXRegion::VCLXRegion() +{ +} + +VCLXRegion::~VCLXRegion() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXRegion::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::awt::XRegion*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); +} + +// ::com::sun::star::lang::XUnoTunnel +IMPL_XUNOTUNNEL( VCLXRegion ) + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXRegion ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion>* ) NULL ) +IMPL_XTYPEPROVIDER_END + + + +::com::sun::star::awt::Rectangle VCLXRegion::getBounds() throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return AWTRectangle( maRegion.GetBoundRect() ); +} + +void VCLXRegion::clear() throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maRegion.SetEmpty(); +} + +void VCLXRegion::move( sal_Int32 nHorzMove, sal_Int32 nVertMove ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maRegion.Move( nHorzMove, nVertMove ); +} + +void VCLXRegion::unionRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maRegion.Union( VCLRectangle( rRect ) ); +} + +void VCLXRegion::intersectRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maRegion.Intersect( VCLRectangle( rRect ) ); +} + +void VCLXRegion::excludeRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maRegion.Exclude( VCLRectangle( rRect ) ); +} + +void VCLXRegion::xOrRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maRegion.XOr( VCLRectangle( rRect ) ); +} + +void VCLXRegion::unionRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( rxRegion.is() ) + maRegion.Union( VCLUnoHelper::GetRegion( rxRegion ) ); +} + +void VCLXRegion::intersectRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( rxRegion.is() ) + maRegion.Intersect( VCLUnoHelper::GetRegion( rxRegion ) ); +} + +void VCLXRegion::excludeRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( rxRegion.is() ) + maRegion.Exclude( VCLUnoHelper::GetRegion( rxRegion ) ); +} + +void VCLXRegion::xOrRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( rxRegion.is() ) + maRegion.XOr( VCLUnoHelper::GetRegion( rxRegion ) ); +} + +::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > VCLXRegion::getRectangles() throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ULONG nRects = maRegion.GetRectCount(); + ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > aRects( nRects ); + + Rectangle aRect; + sal_uInt32 nR = 0; + RegionHandle h = maRegion.BeginEnumRects(); + while ( maRegion.GetNextEnumRect( h, aRect ) ) + aRects.getArray()[nR++] = AWTRectangle( aRect ); + maRegion.EndEnumRects( h ); + + return aRects; +} + + + diff --git a/toolkit/source/awt/vclxsystemdependentwindow.cxx b/toolkit/source/awt/vclxsystemdependentwindow.cxx new file mode 100644 index 000000000000..a25fa6b5ff72 --- /dev/null +++ b/toolkit/source/awt/vclxsystemdependentwindow.cxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * $RCSfile: vclxsystemdependentwindow.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _COM_SUN_STAR_LANG_SYSTEMDEPENDENT_HPP_ +#include <com/sun/star/lang/SystemDependent.hpp> +#endif + +#if defined UNX && ! defined _COM_SUN_STAR_AWT_SYSTEMDEPENDENTXWINDOW_HPP_ +#include <com/sun/star/awt/SystemDependentXWindow.hpp> +#endif + +#include <toolkit/awt/vclxsystemdependentwindow.hxx> +#include <toolkit/helper/macros.hxx> +#include <cppuhelper/typeprovider.hxx> + +#ifndef UNX +#include <tools/prewin.h> +#include <windows.h> +#include <tools/postwin.h> +#endif + +#include <vcl/syschild.hxx> +#include <vcl/sysdata.hxx> + +// ---------------------------------------------------- +// class VCLXSystemDependentWindow +// ---------------------------------------------------- +VCLXSystemDependentWindow::VCLXSystemDependentWindow() +{ +} + +VCLXSystemDependentWindow::~VCLXSystemDependentWindow() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXSystemDependentWindow::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::awt::XSystemDependentWindowPeer*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +::com::sun::star::uno::Any VCLXSystemDependentWindow::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + // TODO, check the process id + ::com::sun::star::uno::Any aRet; + Window* pWindow = GetWindow(); + if ( pWindow ) + { + const SystemEnvData* pSysData = ((SystemChildWindow *)pWindow)->GetSystemData(); + if( pSysData ) + { +#ifdef UNX + if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW ) + { + ::com::sun::star::awt::SystemDependentXWindow aSD; + aSD.DisplayPointer = (sal_Int64)pSysData->pDisplay; + aSD.WindowHandle = pSysData->aWindow; + aRet <<= aSD; + } +#elif (defined WNT) + if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 ) + { + aRet <<= (sal_Int32)pSysData->hWnd; + } +#elif (defined OS2) + if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_OS2 ) + { + aRet <<= (sal_Int32)pSysData->hWnd; + } +#endif + } + } + return aRet; +} + + + + + diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx new file mode 100644 index 000000000000..6113d7c03a07 --- /dev/null +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -0,0 +1,737 @@ +/************************************************************************* + * + * $RCSfile: vclxtoolkit.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _COM_SUN_STAR_AWT_WINDOWATTRIBUTE_HPP_ +#include <com/sun/star/awt/WindowAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_ +#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_WINDOWCLASS_HPP_ +#include <com/sun/star/awt/WindowClass.hpp> +#endif + +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <toolkit/awt/vclxwindows.hxx> +#include <toolkit/awt/vclxsystemdependentwindow.hxx> +#include <toolkit/awt/vclxregion.hxx> +#include <toolkit/awt/vclxtoolkit.hxx> +#include <toolkit/awt/vclxtopwindow.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/helper/vclunohelper.hxx> + +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/convert.hxx> + +#include <vcl/btndlg.hxx> +#include <vcl/button.hxx> +#include <vcl/combobox.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/dialog.hxx> +#include <vcl/dockwin.hxx> +#include <vcl/edit.hxx> +#include <vcl/field.hxx> +#include <vcl/fixed.hxx> +#include <vcl/floatwin.hxx> +#include <vcl/group.hxx> +#include <vcl/imgctrl.hxx> +#include <vcl/longcurr.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/menubtn.hxx> +#include <vcl/morebtn.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/scrbar.hxx> +#include <vcl/spin.hxx> +#include <vcl/split.hxx> +#include <vcl/splitwin.hxx> +#include <vcl/status.hxx> +#include <vcl/svapp.hxx> +#include <vcl/syschild.hxx> +#include <vcl/tabctrl.hxx> +#include <vcl/tabdlg.hxx> +#include <vcl/tabpage.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/virdev.hxx> +#include <vcl/window.hxx> +#include <vcl/wrkwin.hxx> + +#include <tools/debug.hxx> + + + +#define VCLWINDOW_FRAMEWINDOW 0x1000 +#define VCLWINDOW_SYSTEMCHILDWINDOW 0x1001 + + +sal_uInt32 ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt16 nCompType ) +{ + sal_uInt32 nWinBits = 0; + + sal_Bool bMessBox = sal_False; + if ( ( nCompType == WINDOW_INFOBOX ) || + ( nCompType == WINDOW_MESSBOX ) || + ( nCompType == WINDOW_QUERYBOX ) || + ( nCompType == WINDOW_WARNINGBOX ) || + ( nCompType == WINDOW_ERRORBOX ) ) + { + bMessBox = sal_True; + } + + if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::BORDER ) + nWinBits |= WB_BORDER; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::NOBORDER ) + nWinBits |= WB_NOBORDER; + if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::SIZEABLE ) + nWinBits |= WB_SIZEABLE; + if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::MOVEABLE ) + nWinBits |= WB_MOVEABLE; + if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::CLOSEABLE ) + nWinBits |= WB_CLOSEABLE; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL ) + nWinBits |= WB_HSCROLL; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL ) + nWinBits |= WB_VSCROLL; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::LEFT ) + nWinBits |= WB_LEFT; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::CENTER ) + nWinBits |= WB_CENTER; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::RIGHT ) + nWinBits |= WB_RIGHT; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::SPIN ) + nWinBits |= WB_SPIN; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::SORT ) + nWinBits |= WB_SORT; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DROPDOWN ) + nWinBits |= WB_DROPDOWN; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEFBUTTON ) + nWinBits |= WB_DEFBUTTON; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::READONLY ) + nWinBits |= WB_READONLY; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::CLIPCHILDREN ) + nWinBits |= WB_CLIPCHILDREN; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::GROUP ) + nWinBits |= WB_GROUP; + + // These bits are not uniqe + if ( bMessBox ) + { + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::OK ) + nWinBits |= WB_OK; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::OK_CANCEL ) + nWinBits |= WB_OK_CANCEL; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO ) + nWinBits |= WB_YES_NO; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO_CANCEL ) + nWinBits |= WB_YES_NO_CANCEL; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::RETRY_CANCEL ) + nWinBits |= WB_RETRY_CANCEL; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_OK ) + nWinBits |= WB_DEF_OK; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_CANCEL ) + nWinBits |= WB_DEF_CANCEL; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_RETRY ) + nWinBits |= WB_DEF_RETRY; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_YES ) + nWinBits |= WB_DEF_YES; + if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_NO ) + nWinBits |= WB_DEF_NO; + } + + return nWinBits; +} + +struct ComponentInfo +{ + const char* pName; + WindowType nWinType; +}; + +static ComponentInfo __FAR_DATA aComponentInfos [] = +{ + { "buttondialog", WINDOW_BUTTONDIALOG }, + { "cancelbutton", WINDOW_CANCELBUTTON }, + { "checkbox", WINDOW_CHECKBOX }, + { "combobox", WINDOW_COMBOBOX }, + { "control", WINDOW_CONTROL }, + { "currencybox", WINDOW_CURRENCYBOX }, + { "currencyfield", WINDOW_CURRENCYFIELD }, + { "datebox", WINDOW_DATEBOX }, + { "datefield", WINDOW_DATEFIELD }, + { "dialog", WINDOW_DIALOG }, + { "dockingwindow", WINDOW_DOCKINGWINDOW }, + { "edit", WINDOW_EDIT }, + { "errorbox", WINDOW_ERRORBOX }, + { "fixedbitmap", WINDOW_FIXEDBITMAP }, + { "fixedimage", WINDOW_FIXEDIMAGE }, + { "fixedline", WINDOW_FIXEDLINE }, + { "fixedtext", WINDOW_FIXEDTEXT }, + { "floatingwindow", WINDOW_FLOATINGWINDOW }, + { "framewindow", VCLWINDOW_FRAMEWINDOW }, + { "groupbox", WINDOW_GROUPBOX }, + { "helpbutton", WINDOW_HELPBUTTON }, + { "imagebutton", WINDOW_IMAGEBUTTON }, + { "imageradiobutton", WINDOW_IMAGERADIOBUTTON }, + { "infobox", WINDOW_INFOBOX }, + { "listbox", WINDOW_LISTBOX }, + { "longcurrencybox", WINDOW_LONGCURRENCYBOX }, + { "longcurrencyfield", WINDOW_LONGCURRENCYFIELD }, + { "menubutton", WINDOW_MENUBUTTON }, + { "messbox", WINDOW_MESSBOX }, + { "metricbox", WINDOW_METRICBOX }, + { "metricfield", WINDOW_METRICFIELD }, + { "modaldialog", WINDOW_MODALDIALOG }, + { "modelessdialog", WINDOW_MODELESSDIALOG }, + { "morebutton", WINDOW_MOREBUTTON }, + { "multilistbox", WINDOW_MULTILISTBOX }, + { "numericbox", WINDOW_NUMERICBOX }, + { "numericfield", WINDOW_NUMERICFIELD }, + { "okbutton", WINDOW_OKBUTTON }, + { "patternbox", WINDOW_PATTERNBOX }, + { "patternfield", WINDOW_PATTERNFIELD }, + { "pushbutton", WINDOW_PUSHBUTTON }, + { "querybox", WINDOW_QUERYBOX }, + { "radiobutton", WINDOW_RADIOBUTTON }, + { "scrollbar", WINDOW_SCROLLBAR }, + { "scrollbarbox", WINDOW_SCROLLBARBOX }, + { "spinbutton", WINDOW_SPINBUTTON }, + { "spinfield", WINDOW_SPINFIELD }, + { "splitter", WINDOW_SPLITTER }, + { "splitwindow", WINDOW_SPLITWINDOW }, + { "statusbar", WINDOW_STATUSBAR }, + { "systemchildwindow", VCLWINDOW_SYSTEMCHILDWINDOW }, + { "tabcontrol", WINDOW_TABCONTROL }, + { "tabdialog", WINDOW_TABDIALOG }, + { "tabpage", WINDOW_TABPAGE }, + { "timebox", WINDOW_TIMEBOX }, + { "timefield", WINDOW_TIMEFIELD }, + { "toolbox", WINDOW_TOOLBOX }, + { "tristatebox", WINDOW_TRISTATEBOX }, + { "warningbox", WINDOW_WARNINGBOX }, + { "window", WINDOW_WINDOW }, + { "workwindow", WINDOW_WORKWINDOW } +}; + +static int +#if defined( WNT ) + __cdecl +#endif +#if defined( ICC ) && defined( OS2 ) +_Optlink +#endif + ComponentInfoCompare( const void* pFirst, const void* pSecond) +{ + return( strcmp( ((ComponentInfo*)pFirst)->pName, + ((ComponentInfo*)pSecond)->pName ) ); +} + +sal_uInt16 ImplGetComponentType( const String& rServiceName ) +{ + static sal_Bool bSorted = sal_False; + if( !bSorted ) + { + qsort( (void*) aComponentInfos, + sizeof( aComponentInfos ) / sizeof( ComponentInfo ), + sizeof( ComponentInfo ), + ComponentInfoCompare ); + bSorted = sal_True; + } + + + ComponentInfo aSearch; + ByteString aServiceName( rServiceName, gsl_getSystemTextEncoding() ); + aServiceName.ToLowerAscii(); + if ( aServiceName.Len() ) + aSearch.pName = aServiceName.GetBuffer(); + else + aSearch.pName = "window"; + + ComponentInfo* pInf = (ComponentInfo*) bsearch( &aSearch, + (void*) aComponentInfos, + sizeof( aComponentInfos ) / sizeof( ComponentInfo ), + sizeof( ComponentInfo ), + ComponentInfoCompare ); + + return pInf ? pInf->nWinType : 0; +} + + +// ---------------------------------------------------- +// class VCLXToolkit +// ---------------------------------------------------- + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXToolkit::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::awt::XToolkit*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXToolkit ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>* ) NULL ) +IMPL_XTYPEPROVIDER_END + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::getDesktopWindow( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xRef; + // 07/00: AppWindow doesn't exist anymore... + return xRef; +} + +::com::sun::star::awt::Rectangle VCLXToolkit::getWorkArea( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::awt::Rectangle aRect; + // 07/00: AppWindow doesn't exist anymore... + return aRect; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::createWindow( const ::com::sun::star::awt::WindowDescriptor& rDescriptor ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xRef; + + Window* pParent = NULL; + if ( rDescriptor.Parent.is() ) + { + VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( rDescriptor.Parent ); + DBG_ASSERT( pParentComponent, "ParentComponent not valid" ); + if ( pParentComponent ) + pParent = pParentComponent->GetWindow(); + } + + sal_uInt32 nWinBits = ImplGetWinBits( rDescriptor.WindowAttributes, + ImplGetComponentType( rDescriptor.WindowServiceName ) ); + + VCLXWindow* pNewComp = NULL; + Window* pNewWindow = CreateComponent( &pNewComp, rDescriptor, pParent, nWinBits ); + + DBG_ASSERT( pNewWindow, "createComponent: Unknown Component!" ); + DBG_ASSERTWARNING( pNewComp, "createComponent: No special Interface!" ); + + if ( pNewWindow ) + { + pNewWindow->SetCreatedWithToolkit( sal_True ); + pNewWindow->SetPosPixel( Point() ); + + if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::MINSIZE ) + { + pNewWindow->SetSizePixel( Size() ); + } + else if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::FULLSIZE ) + { + if ( pParent ) + pNewWindow->SetSizePixel( pParent->GetOutputSizePixel() ); + } + else if ( !VCLUnoHelper::IsZero( rDescriptor.Bounds ) ) + { + Rectangle aRect = VCLRectangle( rDescriptor.Bounds ); + pNewWindow->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() ); + } + + if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::SHOW ) + pNewWindow->Show(); + + if ( !pNewComp ) + { + // Default-Interface + xRef = pNewWindow->GetComponentInterface( sal_True ); + } + else + { + pNewWindow->SetComponentInterface( pNewComp ); + xRef = pNewComp; + } + } + + return xRef; +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > VCLXToolkit::createWindows( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::WindowDescriptor >& rDescriptors ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_uInt32 nComponents = rDescriptors.getLength(); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > aSeq( nComponents ); + for ( sal_uInt32 n = 0; n < nComponents; n++ ) + { + ::com::sun::star::awt::WindowDescriptor aDescr = rDescriptors.getConstArray()[n]; + + if ( aDescr.ParentIndex == (-1) ) + aDescr.Parent = NULL; + else if ( ( aDescr.ParentIndex >= 0 ) && ( aDescr.ParentIndex < (short)n ) ) + aDescr.Parent = aSeq.getConstArray()[aDescr.ParentIndex]; + aSeq.getArray()[n] = createWindow( aDescr ); + } + return aSeq; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXToolkit::createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > xRef; + VCLXVirtualDevice* pVDev = new VCLXVirtualDevice; + VirtualDevice* pV = new VirtualDevice; + pV->SetOutputSizePixel( Size( Width, Height ) ); + pVDev->SetVirtualDevice( pV ); + + xRef = pVDev; + return xRef; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > VCLXToolkit::createRegion( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > xRef = new VCLXRegion; + return xRef; +} + +Window* VCLXToolkit::CreateComponent( VCLXWindow** ppNewComp, + const ::com::sun::star::awt::WindowDescriptor& rDescriptor, Window* pParent, sal_uInt32 nWinBits ) +{ + String aServiceName( rDescriptor.WindowServiceName ); + aServiceName.ToLowerAscii(); + + Window* pNewWindow = NULL; + sal_uInt16 nType = ImplGetComponentType( aServiceName ); + + if ( !pParent ) + { + // Wenn die Component einen Parent braucht, dann NULL zurueckgeben, + // spaeter mal ::com::sun::star::uno::Exception... + sal_Bool bException = sal_True; + if ( ( nType == WINDOW_DIALOG ) || ( nType == WINDOW_MODALDIALOG ) || ( nType == WINDOW_MODELESSDIALOG ) ) + bException = sal_False; + else if ( ( nType == WINDOW_WINDOW ) || + ( nType == WINDOW_WORKWINDOW ) || + ( nType == VCLWINDOW_FRAMEWINDOW ) ) + { + if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_TOP ) + bException = sal_False; + } + + if ( bException ) + { + *ppNewComp = NULL; + return NULL; + } + } + + if ( nType ) + { + NAMESPACE_VOS(OGuard) aVclGuard( Application::GetSolarMutex() ); + switch ( (WindowType)nType ) + { + case WINDOW_CANCELBUTTON: + pNewWindow = new CancelButton( pParent, nWinBits ); + *ppNewComp = new VCLXButton; + break; + case WINDOW_CHECKBOX: + pNewWindow = new CheckBox( pParent, nWinBits ); + *ppNewComp = new VCLXCheckBox; + break; + case WINDOW_COMBOBOX: + pNewWindow = new ComboBox( pParent, nWinBits ); + ((ComboBox*)pNewWindow)->EnableAutoSize( sal_False ); + *ppNewComp = new VCLXComboBox; + break; + case WINDOW_CURRENCYBOX: + pNewWindow = new CurrencyBox( pParent, nWinBits ); + break; + case WINDOW_CURRENCYFIELD: + pNewWindow = new CurrencyField( pParent, nWinBits ); + static_cast<CurrencyField*>(pNewWindow)->EnableEmptyFieldValue( TRUE ); + *ppNewComp = new VCLXNumericField; + ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(CurrencyField*)pNewWindow ); + break; + case WINDOW_DATEBOX: + pNewWindow = new DateBox( pParent, nWinBits ); + break; + case WINDOW_DATEFIELD: + pNewWindow = new DateField( pParent, nWinBits ); + static_cast<DateField*>(pNewWindow)->EnableEmptyFieldValue( TRUE ); + *ppNewComp = new VCLXDateField; + ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(DateField*)pNewWindow ); + break; + case WINDOW_DIALOG: + pNewWindow = new Dialog( pParent, nWinBits ); + *ppNewComp = new VCLXDialog; + break; + case WINDOW_EDIT: + pNewWindow = new Edit( pParent, nWinBits ); + *ppNewComp = new VCLXEdit; + break; + case WINDOW_ERRORBOX: + pNewWindow = new ErrorBox( pParent, nWinBits, String() ); + *ppNewComp = new VCLXMessageBox; + break; + case WINDOW_FIXEDBITMAP: + pNewWindow = new FixedBitmap( pParent, nWinBits ); + break; + case WINDOW_FIXEDIMAGE: + pNewWindow = new ImageControl( pParent, nWinBits ); + *ppNewComp = new VCLXImageControl; + break; + case WINDOW_FIXEDLINE: + pNewWindow = new FixedLine( pParent, nWinBits ); + break; + case WINDOW_FIXEDTEXT: + pNewWindow = new FixedText( pParent, nWinBits ); + *ppNewComp = new VCLXFixedText; + break; + case WINDOW_FLOATINGWINDOW: + pNewWindow = new FloatingWindow( pParent, nWinBits ); + break; + case WINDOW_GROUPBOX: + pNewWindow = new GroupBox( pParent, nWinBits ); + break; + case WINDOW_HELPBUTTON: + pNewWindow = new HelpButton( pParent, nWinBits ); + *ppNewComp = new VCLXButton; + break; + case WINDOW_IMAGEBUTTON: + pNewWindow = new ImageButton( pParent, nWinBits ); + *ppNewComp = new VCLXButton; + break; + case WINDOW_IMAGERADIOBUTTON: + pNewWindow = new ImageRadioButton( pParent, nWinBits ); + *ppNewComp = new VCLXButton; + break; + case WINDOW_INFOBOX: + pNewWindow = new InfoBox( pParent, String() ); + *ppNewComp = new VCLXMessageBox; + break; + case WINDOW_LISTBOX: + pNewWindow = new ListBox( pParent, nWinBits ); + ((ListBox*)pNewWindow)->EnableAutoSize( sal_False ); + *ppNewComp = new VCLXListBox; + break; + case WINDOW_LONGCURRENCYBOX: + pNewWindow = new LongCurrencyBox( pParent, nWinBits ); + break; + case WINDOW_LONGCURRENCYFIELD: + pNewWindow = new LongCurrencyField( pParent, nWinBits ); + *ppNewComp = new VCLXCurrencyField; + ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(LongCurrencyField*)pNewWindow ); + break; + case WINDOW_MENUBUTTON: + pNewWindow = new MenuButton( pParent, nWinBits ); + *ppNewComp = new VCLXButton; + break; + case WINDOW_MESSBOX: + pNewWindow = new MessBox( pParent, nWinBits, String(), String() ); + *ppNewComp = new VCLXMessageBox; + break; + case WINDOW_METRICBOX: + pNewWindow = new MetricBox( pParent, nWinBits ); + break; + case WINDOW_METRICFIELD: + pNewWindow = new MetricField( pParent, nWinBits ); + break; + case WINDOW_MODALDIALOG: + case WINDOW_MODELESSDIALOG: + // Modal/Modeless nur durch Show/Execute + pNewWindow = new Dialog( pParent, nWinBits ); + *ppNewComp = new VCLXDialog; + break; + case WINDOW_MOREBUTTON: + pNewWindow = new MoreButton( pParent, nWinBits ); + *ppNewComp = new VCLXButton; + break; + case WINDOW_MULTILISTBOX: + pNewWindow = new MultiListBox( pParent, nWinBits ); + *ppNewComp = new VCLXListBox; + break; + case WINDOW_NUMERICBOX: + pNewWindow = new NumericBox( pParent, nWinBits ); + break; + case WINDOW_NUMERICFIELD: + pNewWindow = new NumericField( pParent, nWinBits ); + static_cast<NumericField*>(pNewWindow)->EnableEmptyFieldValue( TRUE ); + *ppNewComp = new VCLXNumericField; + ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(NumericField*)pNewWindow ); + break; + case WINDOW_OKBUTTON: + pNewWindow = new OKButton( pParent, nWinBits ); + *ppNewComp = new VCLXButton; + break; + case WINDOW_PATTERNBOX: + pNewWindow = new PatternBox( pParent, nWinBits ); + break; + case WINDOW_PATTERNFIELD: + pNewWindow = new PatternField( pParent, nWinBits ); + *ppNewComp = new VCLXPatternField; + ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(PatternField*)pNewWindow ); + break; + case WINDOW_PUSHBUTTON: + pNewWindow = new PushButton( pParent, nWinBits ); + *ppNewComp = new VCLXButton; + break; + case WINDOW_QUERYBOX: + pNewWindow = new QueryBox( pParent, nWinBits, String() ); + *ppNewComp = new VCLXMessageBox; + break; + case WINDOW_RADIOBUTTON: + pNewWindow = new RadioButton( pParent, nWinBits ); + *ppNewComp = new VCLXRadioButton; + break; + case WINDOW_SCROLLBAR: + pNewWindow = new ScrollBar( pParent, nWinBits ); + *ppNewComp = new VCLXScrollBar; + break; + case WINDOW_SCROLLBARBOX: + pNewWindow = new ScrollBarBox( pParent, nWinBits ); + break; + case WINDOW_SPINBUTTON: + pNewWindow = new SpinButton( pParent, nWinBits ); + *ppNewComp = new VCLXButton; + break; + case WINDOW_SPINFIELD: + pNewWindow = new SpinField( pParent, nWinBits ); + *ppNewComp = new VCLXNumericField; + break; + case WINDOW_SPLITTER: + pNewWindow = new Splitter( pParent, nWinBits ); + break; + case WINDOW_SPLITWINDOW: + pNewWindow = new SplitWindow( pParent, nWinBits ); + break; + case WINDOW_STATUSBAR: + pNewWindow = new StatusBar( pParent, nWinBits ); + break; + case VCLWINDOW_SYSTEMCHILDWINDOW: + pNewWindow = new SystemChildWindow( pParent, nWinBits ); + *ppNewComp = new VCLXSystemDependentWindow(); + break; + case WINDOW_TABCONTROL: + pNewWindow = new TabControl( pParent, nWinBits ); + break; + case WINDOW_TABDIALOG: + pNewWindow = new TabDialog( pParent, nWinBits ); + break; + case WINDOW_TABPAGE: + pNewWindow = new TabPage( pParent, nWinBits ); + break; + case WINDOW_TIMEBOX: + pNewWindow = new TimeBox( pParent, nWinBits ); + break; + case WINDOW_TIMEFIELD: + pNewWindow = new TimeField( pParent, nWinBits ); + static_cast<TimeField*>(pNewWindow)->EnableEmptyFieldValue( TRUE ); + *ppNewComp = new VCLXTimeField; + ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(TimeField*)pNewWindow ); + break; + case WINDOW_TOOLBOX: + pNewWindow = new ToolBox( pParent, nWinBits ); + break; + case WINDOW_TRISTATEBOX: + pNewWindow = new TriStateBox( pParent, nWinBits ); + break; + case WINDOW_WARNINGBOX: + pNewWindow = new WarningBox( pParent, nWinBits, String() ); + *ppNewComp = new VCLXMessageBox; + break; + case WINDOW_WORKWINDOW: + case WINDOW_WINDOW: + case VCLWINDOW_FRAMEWINDOW: + case WINDOW_DOCKINGWINDOW: + if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_TOP ) + { + if (nType == WINDOW_DOCKINGWINDOW ) + pNewWindow = new DockingWindow( pParent, nWinBits ); + else + pNewWindow = new WorkWindow( pParent, nWinBits ); + *ppNewComp = new VCLXTopWindow; + } + else if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_CONTAINER ) + { + if (nType == WINDOW_DOCKINGWINDOW ) + pNewWindow = new DockingWindow( pParent, nWinBits ); + else + pNewWindow = new Window( pParent, nWinBits ); + *ppNewComp = new VCLXContainer; + } + else + { + if (nType == WINDOW_DOCKINGWINDOW ) + pNewWindow = new DockingWindow( pParent, nWinBits ); + else + pNewWindow = new Window( pParent, nWinBits ); + *ppNewComp = new VCLXWindow; + } + break; + default: DBG_ERROR( "UNO3!" ); + } + } + + return pNewWindow; +} + + + diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx new file mode 100644 index 000000000000..1154210da61e --- /dev/null +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -0,0 +1,156 @@ +/************************************************************************* + * + * $RCSfile: vclxtopwindow.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <cppuhelper/typeprovider.hxx> + +#include <toolkit/awt/vclxtopwindow.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <toolkit/helper/macros.hxx> + +#include <vcl/wrkwin.hxx> +#include <vcl/syswin.hxx> +#include <vcl/menu.hxx> + +#include <tools/debug.hxx> + +// ---------------------------------------------------- +// class VCLXTopWindow +// ---------------------------------------------------- + +VCLXTopWindow::VCLXTopWindow() +{ +} + +VCLXTopWindow::~VCLXTopWindow() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXTopWindow::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::awt::XTopWindow*, this ) ); + return (aRet.hasValue() ? aRet : VCLXContainer::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXTopWindow ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow>* ) NULL ), + VCLXContainer::getTypes() +IMPL_XTYPEPROVIDER_END + + +void VCLXTopWindow::addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetTopWindowListeners().addInterface( rxListener ); +} + +void VCLXTopWindow::removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetTopWindowListeners().removeInterface( rxListener ); +} + +void VCLXTopWindow::toFront( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + ((WorkWindow*)pWindow)->ToTop(); +} + +void VCLXTopWindow::toBack( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + // ((WorkWindow*)pWindow)->ToBack(); + DBG_ERROR( "toBack niy" ); + } +} + +void VCLXTopWindow::setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& rxMenu ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + SystemWindow* pWindow = (SystemWindow*) GetWindow(); + if ( pWindow ) + { + pWindow->SetMenuBar( NULL ); + if ( rxMenu.is() ) + { + VCLXMenu* pMenu = VCLXMenu::GetImplementation( rxMenu ); + if ( pMenu && !pMenu->IsPopupMenu() ) + pWindow->SetMenuBar( (MenuBar*) pMenu->GetMenu() ); + } + } + mxMenuBar = rxMenu; +} + + + + diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx new file mode 100644 index 000000000000..f4d2f72e205e --- /dev/null +++ b/toolkit/source/awt/vclxwindow.cxx @@ -0,0 +1,920 @@ +/************************************************************************* + * + * $RCSfile: vclxwindow.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_ +#include <com/sun/star/awt/XTopWindow.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_STYLE_HPP_ +#include <com/sun/star/awt/Style.hpp> +#endif + +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/awt/vclxpointer.hxx> +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <toolkit/helper/convert.hxx> +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/property.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <vcl/svapp.hxx> +#include <vcl/window.hxx> +#include <tools/color.hxx> + +// ---------------------------------------------------- +// class VCLXWindow +// ---------------------------------------------------- +VCLXWindow::VCLXWindow() + : maEventListeners( *this ), + maFocusListeners( *this ), + maWindowListeners( *this ), + maKeyListeners( *this ), + maMouseListeners( *this ), + maMouseMotionListeners( *this ), + maPaintListeners( *this ), + maContainerListeners( *this ), + maTopWindowListeners( *this ) +{ + mbDisposing = sal_False; + mbDesignMode = sal_False; +} + +VCLXWindow::~VCLXWindow() +{ + if ( GetWindow() ) + GetWindow()->SetWindowPeer( NULL, NULL ); +} + +void VCLXWindow::SetWindow( Window* pWindow ) +{ + SetOutputDevice( pWindow ); +} + +Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const +{ + Size aSz = rOutSz; + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + sal_Int32 nLeft, nTop, nRight, nBottom; + pWindow->GetBorder( nLeft, nTop, nRight, nBottom ); + aSz.Width() += nLeft+nRight; + aSz.Height() += nTop+nBottom; + } + return aSz; +} + + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXWindow::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::XComponent*, (::com::sun::star::awt::XWindow*)this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XWindow*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XWindowPeer*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XVclWindowPeer*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XView*, this ) ); + return (aRet.hasValue() ? aRet : VCLXDevice::queryInterface( rType )); +} + +// ::com::sun::star::lang::XUnoTunnel +IMPL_XUNOTUNNEL( VCLXWindow ) + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXWindow ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView>* ) NULL ), + VCLXDevice::getTypes() +IMPL_XTYPEPROVIDER_END + + +// ::com::sun::star::lang::Component +void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + mxViewGraphics = NULL; + + if ( GetWindow() && !mbDisposing ) + { + mbDisposing = sal_True; + + ::com::sun::star::lang::EventObject aObj; + aObj.Source = (::cppu::OWeakObject*)this; + + maEventListeners.disposeAndClear( aObj ); + maFocusListeners.disposeAndClear( aObj ); + maWindowListeners.disposeAndClear( aObj ); + maKeyListeners.disposeAndClear( aObj ); + maMouseListeners.disposeAndClear( aObj ); + maMouseMotionListeners.disposeAndClear( aObj ); + maPaintListeners.disposeAndClear( aObj ); + maContainerListeners.disposeAndClear( aObj ); + maTopWindowListeners.disposeAndClear( aObj ); + + OutputDevice* pOutDev = GetOutputDevice(); + SetWindow( NULL ); // Damit ggf. Handler abgemeldet werden (virtuell). + SetOutputDevice( pOutDev ); + DestroyOutputDevice(); + + mbDisposing = sal_False; + } +} + +void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetEventListeners().addInterface( rxListener ); +} + +void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetEventListeners().removeInterface( rxListener ); +} + + +// ::com::sun::star::awt::XWindow +void VCLXWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + GetWindow()->SetPosSizePixel( X, Y, Width, Height, Flags ); +} + +::com::sun::star::awt::Rectangle VCLXWindow::getPosSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::awt::Rectangle aBounds; + if ( GetWindow() ) + aBounds = AWTRectangle( Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) ); + + return aBounds; +} + +void VCLXWindow::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + if ( bVisible ) + { + // #57167# TopWindows mit unsichtbaren Parent anzeigen... + ::com::sun::star::uno::Any aTest = queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >*) 0 ) ); + if ( aTest.hasValue() ) + { + Window* pParent = pWindow->GetWindow( WINDOW_PARENTOVERLAP ); + if ( pParent && !pParent->IsReallyVisible() ) + pWindow->SetParent( pWindow->GetWindow( WINDOW_FRAME ) ); + } + } + + pWindow->Show( bVisible ); + } +} + +void VCLXWindow::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + GetWindow()->Enable( bEnable ); +} + +void VCLXWindow::setFocus( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + GetWindow()->GrabFocus(); +} + +void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetWindowListeners().addInterface( rxListener ); +} + +void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetWindowListeners().removeInterface( rxListener ); +} + +void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetFocusListeners().addInterface( rxListener ); +} + +void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetFocusListeners().removeInterface( rxListener ); +} + +void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetKeyListeners().addInterface( rxListener ); +} + +void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetKeyListeners().removeInterface( rxListener ); +} + +void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetMouseListeners().addInterface( rxListener ); +} + +void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetMouseListeners().removeInterface( rxListener ); +} + +void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetMouseMotionListeners().addInterface( rxListener ); +} + +void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetMouseMotionListeners().removeInterface( rxListener ); +} + +void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetPaintListeners().addInterface( rxListener ); +} + +void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + GetPaintListeners().removeInterface( rxListener ); +} + +// ::com::sun::star::awt::XWindowPeer +::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > VCLXWindow::getToolkit( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > xRef = Application::GetVCLToolkit(); + return xRef; +} + +void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& rxPointer ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + VCLXPointer* pPointer = VCLXPointer::GetImplementation( rxPointer ); + if ( pPointer ) + { + mxPointer = rxPointer; + if ( GetWindow() ) + GetWindow()->SetPointer( pPointer->GetPointer() ); + } +} + +void VCLXWindow::setBackground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + Color aColor( (sal_uInt32)nColor ); + GetWindow()->SetBackground( aColor ); + GetWindow()->SetControlBackground( aColor ); + + WindowType eWinType = GetWindow()->GetType(); + if ( ( eWinType == WINDOW_WINDOW ) || + ( eWinType == WINDOW_WORKWINDOW ) || + ( eWinType == WINDOW_FLOATINGWINDOW ) ) + { + GetWindow()->Invalidate(); + } + } +} + +void VCLXWindow::invalidate( sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + GetWindow()->Invalidate( (sal_uInt16) nFlags ); +} + +void VCLXWindow::invalidateRect( const ::com::sun::star::awt::Rectangle& rRect, sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + GetWindow()->Invalidate( VCLRectangle(rRect), (sal_uInt16) nFlags ); +} + + +// ::com::sun::star::awt::XVclWindowPeer +sal_Bool VCLXWindow::isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxPeer ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Bool bIsChild = sal_False; + Window* pWindow = GetWindow(); + if ( pWindow ) + { + Window* pPeerWindow = VCLUnoHelper::GetWindow( rxPeer ); + bIsChild = pPeerWindow && pWindow->IsChild( pPeerWindow ); + } + + return bIsChild; +} + +void VCLXWindow::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + mbDesignMode = bOn; +} + +sal_Bool VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + return mbDesignMode; +} + +void VCLXWindow::enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + GetWindow()->EnableClipSiblings( bClip ); +} + +void VCLXWindow::setForeground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + Color aColor( (sal_uInt32)nColor ); + GetWindow()->SetControlForeground( aColor ); + } +} + +void VCLXWindow::setControlFont( const ::com::sun::star::awt::FontDescriptor& rFont ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + GetWindow()->SetControlFont( VCLUnoHelper::CreateFont( rFont, GetWindow()->GetControlFont() ) ); +} + +void VCLXWindow::getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings(); + + switch ( nType ) + { + case ::com::sun::star::awt::Style::FRAME: + { + Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() ); + ForegroundColor = rStyleSettings.GetWindowTextColor().GetColor(); + BackgroundColor = rStyleSettings.GetWindowColor().GetColor(); + } + break; + case ::com::sun::star::awt::Style::DIALOG: + { + Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() ); + ForegroundColor = rStyleSettings.GetDialogTextColor().GetColor(); + BackgroundColor = rStyleSettings.GetDialogColor().GetColor(); + } + break; + default: DBG_ERROR( "VCLWindow::getStyles() - unknown Type" ); + } + + } +} + +void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + + WindowType eWinType = pWindow->GetType(); + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_ENABLED: + { + sal_Bool b; + if ( Value >>= b ) + pWindow->Enable( b ); + } + break; + case BASEPROPERTY_TEXT: + case BASEPROPERTY_LABEL: + { + ::rtl::OUString aText; + if ( Value >>= aText ) + pWindow->SetText( aText ); + } + break; + case BASEPROPERTY_HELPURL: + { + ::rtl::OUString aURL; + if ( Value >>= aURL ) + { + String aHelpURL( aURL ); + String aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) ); + if ( aHelpURL.CompareIgnoreCaseToAscii( aPattern, aPattern.Len() ) == COMPARE_EQUAL ) + { + String aID = aHelpURL.Copy( aPattern.Len() ); + pWindow->SetHelpId( aID.ToInt32() ); + } + } + } + break; + case BASEPROPERTY_FONTDESCRIPTOR: + { + if ( bVoid ) + pWindow->SetControlFont( Font() ); + else + { + ::com::sun::star::awt::FontDescriptor aFont; + if ( Value >>= aFont ) + pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) ); + } + } + break; + case BASEPROPERTY_BACKGROUNDCOLOR: + if ( bVoid ) + { + pWindow->SetControlBackground(); + } + else + { + sal_Int32 nColor; + if ( Value >>= nColor ) + { + Color aColor( nColor ); + pWindow->SetBackground( aColor ); + pWindow->SetControlBackground( aColor ); + pWindow->Invalidate(); // Falls das Control nicht drauf reagiert + } + } + break; + case BASEPROPERTY_TEXTCOLOR: + if ( bVoid ) + { + pWindow->SetControlForeground(); + } + else + { + sal_Int32 nColor; + if ( Value >>= nColor ) + { + Color aColor( nColor ); + pWindow->SetTextColor( aColor ); + pWindow->SetControlForeground( aColor ); + } + } + break; + case BASEPROPERTY_FILLCOLOR: + if ( bVoid ) + pWindow->SetFillColor(); + else + { + sal_Int32 nColor; + if ( Value >>= nColor ) + { + Color aColor( nColor ); + pWindow->SetFillColor( aColor ); + } + } + break; + case BASEPROPERTY_LINECOLOR: + if ( bVoid ) + pWindow->SetLineColor(); + else + { + sal_Int32 nColor; + if ( Value >>= nColor ) + { + Color aColor( nColor ); + pWindow->SetLineColor( aColor ); + } + } + break; + case BASEPROPERTY_BORDER: + { + WinBits nStyle = pWindow->GetStyle(); + sal_uInt16 nBorder; + Value >>= nBorder; + if ( !nBorder ) + { + pWindow->SetStyle( nStyle & ~WB_BORDER ); + } + else + { + pWindow->SetStyle( nStyle | WB_BORDER ); + pWindow->SetBorderStyle( nBorder ); + } + } + break; + case BASEPROPERTY_TABSTOP: + { + WinBits nStyle = pWindow->GetStyle() & ~WB_TABSTOP; + if ( !bVoid ) + { + sal_Bool bTab; + Value >>= bTab; + if ( bTab ) + nStyle |= WB_TABSTOP; + else + nStyle |= WB_NOTABSTOP; + } + pWindow->SetStyle( nStyle ); + } + break; + case BASEPROPERTY_ALIGN: + { + switch ( eWinType ) + { + case WINDOW_FIXEDTEXT: + case WINDOW_EDIT: + { + WinBits nStyle = pWindow->GetStyle(); + nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT); + sal_uInt16 nAlign = 0; + if ( !bVoid ) + Value >>= nAlign; + if ( nAlign == PROPERTY_ALIGN_LEFT ) + nStyle |= WB_LEFT; + else if ( nAlign == PROPERTY_ALIGN_CENTER ) + nStyle |= WB_CENTER; + else + nStyle |= WB_RIGHT; + pWindow->SetStyle( nStyle ); + } + break; + } + } + break; + case BASEPROPERTY_MULTILINE: + { + if ( eWinType == WINDOW_FIXEDTEXT ) + { + WinBits nStyle = pWindow->GetStyle(); + sal_Bool bMulti; + Value >>= bMulti; + if ( bMulti ) + nStyle |= WB_WORDBREAK; + else + nStyle &= ~WB_WORDBREAK; + pWindow->SetStyle( nStyle ); + } + } + break; + } + } +} + +::com::sun::star::uno::Any VCLXWindow::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + if ( GetWindow() ) + { + WindowType eWinType = GetWindow()->GetType(); + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_ENABLED: + aProp <<= (sal_Bool) GetWindow()->IsEnabled(); + break; + case BASEPROPERTY_TEXT: + case BASEPROPERTY_LABEL: + { + ::rtl::OUString aText = GetWindow()->GetText(); + aProp <<= aText; + } + break; + case BASEPROPERTY_FONTDESCRIPTOR: + { + Font aFont = GetWindow()->GetControlFont(); + ::com::sun::star::awt::FontDescriptor aFD = VCLUnoHelper::CreateFontDescriptor( aFont ); + aProp <<= aFD; + } + break; + case BASEPROPERTY_BACKGROUNDCOLOR: + aProp <<= (sal_Int32) GetWindow()->GetControlBackground().GetColor(); + break; + case BASEPROPERTY_TEXTCOLOR: + aProp <<= (sal_Int32) GetWindow()->GetControlForeground().GetColor(); + break; + case BASEPROPERTY_FILLCOLOR: + aProp <<= (sal_Int32) GetWindow()->GetFillColor().GetColor(); + break; + case BASEPROPERTY_LINECOLOR: + aProp <<= (sal_Int32) GetWindow()->GetLineColor().GetColor(); + break; + case BASEPROPERTY_BORDER: + { + sal_uInt16 nBorder = 0; + if ( GetWindow()->GetStyle() & WB_BORDER ) + nBorder = GetWindow()->GetBorderStyle(); + aProp <<= nBorder; + } + break; + case BASEPROPERTY_TABSTOP: + aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_TABSTOP ) ? sal_True : sal_False; + break; + case BASEPROPERTY_ALIGN: + { + switch ( eWinType ) + { + case WINDOW_FIXEDTEXT: + case WINDOW_EDIT: + { + WinBits nStyle = GetWindow()->GetStyle(); + if ( nStyle & WB_LEFT ) + aProp <<= (sal_Int16) PROPERTY_ALIGN_LEFT; + else if ( nStyle & WB_CENTER ) + aProp <<= (sal_Int16) PROPERTY_ALIGN_CENTER; + else if ( nStyle & WB_RIGHT ) + aProp <<= (sal_Int16) PROPERTY_ALIGN_RIGHT; + } + break; + } + } + case BASEPROPERTY_MULTILINE: + { + if ( eWinType == WINDOW_FIXEDTEXT ) + aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_WORDBREAK ) ? sal_True : sal_False; + } + break; + } + } + return aProp; +} + + +// ::com::sun::star::awt::XLayoutConstrains +::com::sun::star::awt::Size VCLXWindow::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + // Diese Methode sollte nur fuer Componenten gerufen werden, die zwar + // ueber das ::com::sun::star::awt::Toolkit erzeugt werden koennen, aber fuer die es + // kein Interface gibt. + + Size aSz; + if ( GetWindow() ) + { + WindowType nWinType = GetWindow()->GetType(); + WinBits nStyle = GetWindow()->GetStyle(); + switch ( nWinType ) + { + case WINDOW_MESSBOX: + case WINDOW_INFOBOX: + case WINDOW_WARNINGBOX: + case WINDOW_ERRORBOX: + case WINDOW_QUERYBOX: + aSz = Size( 250, 100 ); + break; + + case WINDOW_CONTROL: + aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*12; + aSz.Height() = GetWindow()->GetTextHeight()+2*6; + break; + + case WINDOW_PATTERNBOX: + case WINDOW_NUMERICBOX: + case WINDOW_METRICBOX: + case WINDOW_CURRENCYBOX: + case WINDOW_DATEBOX: + case WINDOW_TIMEBOX: + case WINDOW_LONGCURRENCYBOX: + aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*2; + aSz.Height() = GetWindow()->GetTextHeight()+2*2; + break; + case WINDOW_SCROLLBARBOX: + case WINDOW_SCROLLBAR: + { + long n = GetWindow()->GetSettings().GetStyleSettings().GetScrollBarSize(); + aSz = Size( n, n ); + } + break; + default: DBG_ERROR( "getMinimumSize: Unknown Type" ); + } + } + + return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() ); +} + +::com::sun::star::awt::Size VCLXWindow::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return getMinimumSize(); +} + +::com::sun::star::awt::Size VCLXWindow::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::awt::Size aNewSize( rNewSize ); + ::com::sun::star::awt::Size aMinSize = getMinimumSize(); + + if ( aNewSize.Width < aMinSize.Width ) + aNewSize.Width = aMinSize.Width; + if ( aNewSize.Height < aMinSize.Height ) + aNewSize.Height = aMinSize.Height; + + return aNewSize; +} + + +// ::com::sun::star::awt::XView +sal_Bool VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& rxDevice ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( VCLUnoHelper::GetOutputDevice( rxDevice ) ) + mxViewGraphics = rxDevice; + else + mxViewGraphics = NULL; + + return mxViewGraphics.is(); +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXWindow::getGraphics( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + return mxViewGraphics; +} + +::com::sun::star::awt::Size VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + if ( GetWindow() ) + aSz = GetWindow()->GetSizePixel(); + return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() ); +} + +void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mxViewGraphics ); + Point aPos( nX, nY ); + + if ( ( !pDev || ( GetWindow()->GetParent() == pDev ) ) && !GetWindow()->IsVisible() ) + { + Point aOldPos( GetWindow()->GetPosPixel() ); + GetWindow()->SetPosPixel( aPos ); + + // Erstmal ein Update auf den Parent, damit nicht beim Update + // auf dieses Fenster noch ein Paint vom Parent abgearbeitet wird, + // wo dann ggf. dieses Fenster sofort wieder gehidet wird. + if( GetWindow()->GetParent() ) + GetWindow()->GetParent()->Update(); + + GetWindow()->Show(); + GetWindow()->Update(); + GetWindow()->SetParentUpdateMode( sal_False ); + GetWindow()->Hide(); + GetWindow()->SetParentUpdateMode( sal_True ); + + GetWindow()->SetPosPixel( aOldPos ); + } + else if ( pDev ) + { + Size aSz = GetWindow()->GetSizePixel(); + aSz = pDev->PixelToLogic( aSz ); + Point aP = pDev->PixelToLogic( aPos ); + GetWindow()->Draw( pDev, aP, aSz, WINDOW_DRAW_NOCONTROLS ); + } + } +} + +void VCLXWindow::setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + GetWindow()->SetZoom( Fraction( fZoomX ) ); +} + + + + + + + + diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx new file mode 100644 index 000000000000..d1602c73b455 --- /dev/null +++ b/toolkit/source/awt/vclxwindows.cxx @@ -0,0 +1,4078 @@ +/************************************************************************* + * + * $RCSfile: vclxwindows.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <toolkit/awt/vclxwindows.hxx> +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/property.hxx> +#include <toolkit/helper/convert.hxx> +#include <cppuhelper/typeprovider.hxx> + +#include <vcl/button.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/combobox.hxx> +#include <vcl/field.hxx> +#include <vcl/longcurr.hxx> +#include <vcl/imgctrl.hxx> +#include <vcl/dialog.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/scrbar.hxx> + +// ---------------------------------------------------- +// class VCLXButton +// ---------------------------------------------------- +VCLXButton::VCLXButton() : maActionListeners( *this ) +{ +} + +VCLXButton::~VCLXButton() +{ + PushButton* pButton = (PushButton*) GetWindow(); + if ( pButton ) + pButton->SetClickHdl( Link() ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXButton::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::awt::XImageConsumer*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXButton ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXButton::SetWindow( Window* pWindow ) +{ + ::vos::OGuard aGuard( GetMutex() ); + + PushButton* pPrevButton = (PushButton*) GetWindow(); + if ( pPrevButton ) + pPrevButton->SetClickHdl( Link() ); + + PushButton* pNewButton = (PushButton*) pWindow; + if ( pNewButton ) + pNewButton->SetClickHdl( LINK( this, VCLXButton, ClickHdl ) ); + + VCLXWindow::SetWindow( pWindow ); +} + +void VCLXButton::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aObj; + aObj.Source = (::cppu::OWeakObject*)this; + maActionListeners.disposeAndClear( aObj ); + VCLXWindow::dispose(); +} + +void VCLXButton::ImplUpdateImage( sal_Bool bGetNewImage ) +{ + PushButton* pButton = (PushButton*) GetWindow(); + if ( pButton ) + { + sal_Bool bOK = bGetNewImage ? maImageConsumer.GetData( maBitmap ) : sal_True; + if ( bOK ) + pButton->SetBitmap( maBitmap ); + } +} + +void VCLXButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maActionListeners.addInterface( l ); +} + +void VCLXButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maActionListeners.removeInterface( l ); +} + +void VCLXButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + pWindow->SetText( rLabel ); +} + +void VCLXButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maActionCommand = rCommand; +} + +void VCLXButton::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maImageConsumer.Init( Width, Height ); +} + +void VCLXButton::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maImageConsumer.SetColorModel( BitCount, RGBAPal.getLength(), (const unsigned long*) RGBAPal.getConstArray(), RedMask, GreenMask, BlueMask, AlphaMask ); +} + +void VCLXButton::setPixelsByBytes( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maImageConsumer.SetPixelsByBytes( X, Y, Width, Height, (sal_uInt8*)ProducerData.getConstArray(), Offset, Scansize ); + ImplUpdateImage( sal_True ); +} + +void VCLXButton::setPixelsByLongs( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int32 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maImageConsumer.SetPixelsByLongs( X, Y, Width, Height, (const unsigned long*) ProducerData.getConstArray(), Offset, Scansize ); + ImplUpdateImage( sal_True ); +} + +void VCLXButton::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > & Producer ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maImageConsumer.Completed( Status ); + + // Controls sollen angemeldet bleiben... +// Producer->removeConsumer( this ); + + ImplUpdateImage( sal_True ); +} + + +::com::sun::star::awt::Size VCLXButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + PushButton* pButton = (PushButton*) GetWindow(); + if ( pButton ) + aSz = pButton->CalcMinimumSize(); + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::awt::Size aSz = getMinimumSize(); + aSz.Width += 16; + aSz.Height += 10; + return aSz; +} + +::com::sun::star::awt::Size VCLXButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz = VCLSize(rNewSize); + PushButton* pButton = (PushButton*) GetWindow(); + if ( pButton ) + { + Size aMinSz = pButton->CalcMinimumSize(); + // Kein Text, also Image + if ( !pButton->GetText().Len() ) + { + if ( aSz.Width() < aMinSz.Width() ) + aSz.Width() = aMinSz.Width(); + if ( aSz.Height() < aMinSz.Height() ) + aSz.Height() = aMinSz.Height(); + } + else + { + if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) ) + aSz.Height() = aMinSz.Height(); + else + aSz = aMinSz; + } + } + return AWTSize(aSz); +} + +void VCLXButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Button* pButton = (Button*)GetWindow(); + if ( pButton ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_DEFAULTBUTTON: + { + WinBits nStyle = pButton->GetStyle() | WB_DEFBUTTON; + sal_Bool b; + if ( ( Value >>= b ) && !b ) + nStyle &= ~WB_DEFBUTTON; + pButton->SetStyle( nStyle ); + } + break; + default: + { + VCLXWindow::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + Button* pButton = (Button*)GetWindow(); + if ( pButton ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_DEFAULTBUTTON: + { + aProp <<= (sal_Bool) ( ( pButton->GetStyle() & WB_DEFBUTTON ) ? sal_True : sal_False ); + } + break; + default: + { + aProp <<= VCLXWindow::getProperty( PropertyName ); + } + } + } + return aProp; +} + +IMPL_LINK( VCLXButton, ClickHdl, Button*, EMPTYARG ) +{ + if ( GetWindow() && maActionListeners.getLength() ) + { + ::com::sun::star::awt::ActionEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.ActionCommand = maActionCommand; + maActionListeners.actionPerformed( aEvent ); + } + return 1; +} + +// ---------------------------------------------------- +// class VCLXImageControl +// ---------------------------------------------------- +VCLXImageControl::VCLXImageControl() +{ +} + +VCLXImageControl::~VCLXImageControl() +{ +} + +void VCLXImageControl::ImplUpdateImage( sal_Bool bGetNewImage ) +{ + ImageControl* pControl = (ImageControl*) GetWindow(); + if ( pControl ) + { + sal_Bool bOK = bGetNewImage ? maImageConsumer.GetData( maBitmap ) : sal_True; + if ( bOK ) + pControl->SetBitmap( maBitmap ); + } +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXImageControl::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::awt::XImageConsumer*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXImageControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXImageControl::setPosSize( long X, long Y, long Width, long Height, short Flags ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + Size aOldSize = GetWindow()->GetSizePixel(); + VCLXWindow::setPosSize( X, Y, Width, Height, Flags ); + if ( ( aOldSize.Width() != Width ) || ( aOldSize.Height() != Height ) ) + ImplUpdateImage( sal_False ); + } +} + +void VCLXImageControl::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maImageConsumer.Init( Width, Height ); +} + +void VCLXImageControl::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maImageConsumer.SetColorModel( BitCount, RGBAPal.getLength(), (const unsigned long*) RGBAPal.getConstArray(), RedMask, GreenMask, BlueMask, AlphaMask ); +} + +void VCLXImageControl::setPixelsByBytes( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maImageConsumer.SetPixelsByBytes( X, Y, Width, Height, (sal_uInt8*)ProducerData.getConstArray(), Offset, Scansize ); + ImplUpdateImage( sal_True ); +} + +void VCLXImageControl::setPixelsByLongs( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int32 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maImageConsumer.SetPixelsByLongs( X, Y, Width, Height, (const unsigned long*) ProducerData.getConstArray(), Offset, Scansize ); + ImplUpdateImage( sal_True ); +} + +void VCLXImageControl::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > & Producer ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + maImageConsumer.Completed( Status ); + + // Controls sollen angemeldet bleiben... +// Producer->removeConsumer( this ); + + ImplUpdateImage( sal_True ); +} + +::com::sun::star::awt::Size VCLXImageControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz = maBitmap.GetSizePixel(); + aSz = ImplCalcWindowSize( aSz ); + + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXImageControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return getMinimumSize(); +} + +::com::sun::star::awt::Size VCLXImageControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::awt::Size aSz = rNewSize; + ::com::sun::star::awt::Size aMinSz = getMinimumSize(); + if ( aSz.Width < aMinSz.Width ) + aSz.Width = aMinSz.Width; + if ( aSz.Height < aMinSz.Height ) + aSz.Height = aMinSz.Height; + return aSz; +} + +// ---------------------------------------------------- +// class VCLXCheckBox +// ---------------------------------------------------- +VCLXCheckBox::VCLXCheckBox() : maItemListeners( *this ) +{ +} + +VCLXCheckBox::~VCLXCheckBox() +{ + CheckBox* pBox = (CheckBox*) GetWindow(); + if ( pBox ) + pBox->SetClickHdl( Link() ); +} + +void VCLXCheckBox::SetWindow( Window* pWindow ) +{ + CheckBox* pPrevCheckBox = (CheckBox*) GetWindow(); + if ( pPrevCheckBox ) + pPrevCheckBox->SetClickHdl( Link() ); + + CheckBox* pNewCheckBox = (CheckBox*) pWindow; + if ( pNewCheckBox ) + pNewCheckBox->SetClickHdl( LINK( this, VCLXCheckBox, ClickHdl ) ); + + VCLXWindow::SetWindow( pWindow ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXCheckBox::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::awt::XCheckBox*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXCheckBox ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXCheckBox::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aObj; + aObj.Source = (::cppu::OWeakObject*)this; + maItemListeners.disposeAndClear( aObj ); + VCLXWindow::dispose(); +} + +void VCLXCheckBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maItemListeners.addInterface( l ); +} + +void VCLXCheckBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maItemListeners.removeInterface( l ); +} + +void VCLXCheckBox::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + pWindow->SetText( rLabel ); +} + +void VCLXCheckBox::setState( short n ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + CheckBox* pCheckBox = (CheckBox*)GetWindow(); + if ( pCheckBox) + pCheckBox->SetState( (TriState)n ); +} + +short VCLXCheckBox::getState() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + CheckBox* pCheckBox = (CheckBox*)GetWindow(); + return pCheckBox ? pCheckBox->GetState() : 0; +} + +void VCLXCheckBox::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + CheckBox* pCheckBox = (CheckBox*)GetWindow(); + if ( pCheckBox) + pCheckBox->EnableTriState( b ); +} + +::com::sun::star::awt::Size VCLXCheckBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + CheckBox* pCheckBox = (CheckBox*) GetWindow(); + if ( pCheckBox ) + aSz = pCheckBox->CalcMinimumSize(); + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXCheckBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return getMinimumSize(); +} + +::com::sun::star::awt::Size VCLXCheckBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz = VCLSize(rNewSize); + CheckBox* pCheckBox = (CheckBox*) GetWindow(); + if ( pCheckBox ) + { + Size aMinSz = pCheckBox->CalcMinimumSize(); + if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) ) + aSz.Height() = aMinSz.Height(); + else + aSz = aMinSz; + } + return AWTSize(aSz); +} + +void VCLXCheckBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + CheckBox* pCheckBox = (CheckBox*)GetWindow(); + if ( pCheckBox ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_TRISTATE: + { + sal_Bool b; + if ( Value >>= b ) + pCheckBox->EnableTriState( b ); + } + break; + case BASEPROPERTY_STATE: + { + sal_Int16 n; + if ( Value >>= n ) + setState( n ); + } + break; + default: + { + VCLXWindow::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXCheckBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + CheckBox* pCheckBox = (CheckBox*)GetWindow(); + if ( pCheckBox ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_TRISTATE: + { + aProp <<= (sal_Bool)pCheckBox->IsTriStateEnabled(); + } + break; + case BASEPROPERTY_STATE: + { + aProp <<= (sal_Int16)pCheckBox->GetState(); + } + break; + default: + { + aProp <<= VCLXWindow::getProperty( PropertyName ); + } + } + } + return aProp; +} + +IMPL_LINK( VCLXCheckBox, ClickHdl, CheckBox*, EMPTYARG ) +{ + CheckBox* pCheckBox = (CheckBox*)GetWindow(); + if ( pCheckBox && maItemListeners.getLength() ) + { + ::com::sun::star::awt::ItemEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.Highlighted = sal_False; + aEvent.Selected = pCheckBox->GetState(); + maItemListeners.itemStateChanged( aEvent ); + } + return 1; +} + +// ---------------------------------------------------- +// class VCLXRadioButton +// ---------------------------------------------------- +VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ) +{ +} + +VCLXRadioButton::~VCLXRadioButton() +{ + RadioButton* pBox = (RadioButton*) GetWindow(); + if ( pBox ) + pBox->SetClickHdl( Link() ); +} + +void VCLXRadioButton::SetWindow( Window* pWindow ) +{ + RadioButton* pPrevRadioButton = (RadioButton*) GetWindow(); + if ( pPrevRadioButton ) + pPrevRadioButton->SetClickHdl( Link() ); + + RadioButton* pNewRadioButton = (RadioButton*) pWindow; + if ( pNewRadioButton ) + pNewRadioButton->SetClickHdl( LINK( this, VCLXRadioButton, ClickHdl ) ); + + VCLXWindow::SetWindow( pWindow ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXRadioButton::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::awt::XRadioButton*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXRadioButton ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXRadioButton::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aObj; + aObj.Source = (::cppu::OWeakObject*)this; + maItemListeners.disposeAndClear( aObj ); + VCLXWindow::dispose(); +} + +void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + RadioButton* pButton = (RadioButton*)GetWindow(); + if ( pButton ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_STATE: + { + sal_Int16 n; + if ( Value >>= n ) + pButton->SetState( n ? sal_True : sal_False ); + } + break; + case BASEPROPERTY_AUTOTOGGLE: + { + sal_Bool b; + if ( Value >>= b ) + pButton->EnableRadioCheck( b ); + } + break; + default: + { + VCLXWindow::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXRadioButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + RadioButton* pButton = (RadioButton*)GetWindow(); + if ( pButton ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_STATE: + { + aProp <<= (sal_Int16) ( pButton->IsChecked() ? 1 : 0 ); + } + break; + case BASEPROPERTY_AUTOTOGGLE: + { + aProp <<= (sal_Bool) pButton->IsRadioCheckEnabled(); + } + break; + default: + { + aProp <<= VCLXWindow::getProperty( PropertyName ); + } + } + } + return aProp; +} + +void VCLXRadioButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maItemListeners.addInterface( l ); +} + +void VCLXRadioButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maItemListeners.removeInterface( l ); +} + +void VCLXRadioButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + pWindow->SetText( rLabel ); +} + +void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + RadioButton* pRadioButton = (RadioButton*)GetWindow(); + if ( pRadioButton) + pRadioButton->Check( b ); +} + +sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + RadioButton* pRadioButton = (RadioButton*)GetWindow(); + return pRadioButton ? pRadioButton->IsChecked() : sal_False; +} + +::com::sun::star::awt::Size VCLXRadioButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + RadioButton* pRadioButton = (RadioButton*) GetWindow(); + if ( pRadioButton ) + aSz = pRadioButton->CalcMinimumSize(); + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXRadioButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return getMinimumSize(); +} + +::com::sun::star::awt::Size VCLXRadioButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz = VCLSize(rNewSize); + RadioButton* pRadioButton = (RadioButton*) GetWindow(); + if ( pRadioButton ) + { + Size aMinSz = pRadioButton->CalcMinimumSize(); + if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) ) + aSz.Height() = aMinSz.Height(); + else + aSz = aMinSz; + } + return AWTSize(aSz); +} + +IMPL_LINK( VCLXRadioButton, ClickHdl, RadioButton*, EMPTYARG ) +{ + // RadioButton reagiert wieder auf Click() statt auf Toggle(). + // Dadurch wird bei dem RadioButton, den TH uncheckt, kein + // itemStateChanged gerufen. + // Sollte hoffentlich kein Problem sein, unter JAVA und im Office wird + // das Gruppenverhalten von DG/KR erledigt, damit stimmen dann + // auch die Properties. + + RadioButton* pRadioButton = (RadioButton*)GetWindow(); + if ( pRadioButton && pRadioButton->IsStateChanged() && maItemListeners.getLength() ) + { + ::com::sun::star::awt::ItemEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.Highlighted = sal_False; + aEvent.Selected = pRadioButton->IsChecked(); + maItemListeners.itemStateChanged( aEvent ); + } + return 1; +} + + +// ---------------------------------------------------- +// class VCLXSpinField +// ---------------------------------------------------- +VCLXSpinField::VCLXSpinField() : maSpinListeners( *this ) +{ +} + +VCLXSpinField::~VCLXSpinField() +{ + SpinField* pSpinField = (SpinField*) GetWindow(); + if ( pSpinField ) + { + pSpinField->SetUpHdl( Link() ); + pSpinField->SetDownHdl( Link() ); + pSpinField->SetFirstHdl( Link() ); + pSpinField->SetLastHdl( Link() ); + } +} + +void VCLXSpinField::SetWindow( Window* pWindow ) +{ + SpinField* pPrevSpinField = (SpinField*) GetWindow(); + if ( pPrevSpinField ) + { + pPrevSpinField->SetUpHdl( Link() ); + pPrevSpinField->SetDownHdl( Link() ); + pPrevSpinField->SetFirstHdl( Link() ); + pPrevSpinField->SetLastHdl( Link() ); + } + + SpinField* pNewSpinField = (SpinField*) pWindow; + + if ( pNewSpinField ) + { + pNewSpinField->SetUpHdl( LINK( this, VCLXSpinField, SpinUpHdl ) ); + pNewSpinField->SetDownHdl( LINK( this, VCLXSpinField, SpinUpHdl ) ); + pNewSpinField->SetFirstHdl( LINK( this, VCLXSpinField, SpinUpHdl ) ); + pNewSpinField->SetLastHdl( LINK( this, VCLXSpinField, SpinUpHdl ) ); + } + + VCLXEdit::SetWindow( pWindow ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXSpinField::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::awt::XSpinField*, this ) ); + return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXSpinField ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinField>* ) NULL ), + VCLXEdit::getTypes() +IMPL_XTYPEPROVIDER_END + + +void VCLXSpinField::addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maSpinListeners.addInterface( l ); +} + +void VCLXSpinField::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maSpinListeners.removeInterface( l ); +} + +void VCLXSpinField::up() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + SpinField* pSpinField = (SpinField*) GetWindow(); + if ( pSpinField ) + pSpinField->Up(); +} + +void VCLXSpinField::down() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + SpinField* pSpinField = (SpinField*) GetWindow(); + if ( pSpinField ) + pSpinField->Down(); +} + +void VCLXSpinField::first() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + SpinField* pSpinField = (SpinField*) GetWindow(); + if ( pSpinField ) + pSpinField->First(); +} + +void VCLXSpinField::last() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + SpinField* pSpinField = (SpinField*) GetWindow(); + if ( pSpinField ) + pSpinField->Last(); +} + +void VCLXSpinField::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + WinBits nStyle = pWindow->GetStyle(); + if ( bRepeat ) + nStyle |= WB_REPEAT; + else + nStyle &= ~WB_REPEAT; + pWindow->SetStyle( nStyle ); + } +} + +IMPL_LINK( VCLXSpinField, SpinUpHdl, SpinField*, EMPTYARG ) +{ + SpinField* pSpinField = (SpinField*)GetWindow(); + if ( pSpinField && maSpinListeners.getLength() ) + { + ::com::sun::star::awt::SpinEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + maSpinListeners.up( aEvent ); + } + return 1; +} + +IMPL_LINK( VCLXSpinField, SpinDownHdl, SpinField*, EMPTYARG ) +{ + SpinField* pSpinField = (SpinField*)GetWindow(); + if ( pSpinField && maSpinListeners.getLength() ) + { + ::com::sun::star::awt::SpinEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + maSpinListeners.down( aEvent ); + } + return 1; +} + +IMPL_LINK( VCLXSpinField, SpinFirstHdl, SpinField*, EMPTYARG ) +{ + SpinField* pSpinField = (SpinField*)GetWindow(); + if ( pSpinField && maSpinListeners.getLength() ) + { + ::com::sun::star::awt::SpinEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + maSpinListeners.first( aEvent ); + } + return 1; +} + +IMPL_LINK( VCLXSpinField, SpinLastHdl, SpinField*, EMPTYARG ) +{ + SpinField* pSpinField = (SpinField*)GetWindow(); + if ( pSpinField && maSpinListeners.getLength() ) + { + ::com::sun::star::awt::SpinEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + maSpinListeners.last( aEvent ); + } + return 1; +} + + + +// ---------------------------------------------------- +// class VCLXListBox +// ---------------------------------------------------- +VCLXListBox::VCLXListBox() + : maItemListeners( *this ), + maActionListeners( *this ) +{ +} + +VCLXListBox::~VCLXListBox() +{ + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + { + pBox->SetSelectHdl( Link() ); + pBox->SetDoubleClickHdl( Link() ); + } +} + +void VCLXListBox::SetWindow( Window* pWindow ) +{ + ListBox* pPrevListBox = (ListBox*) GetWindow(); + if ( pPrevListBox ) + { + pPrevListBox->SetSelectHdl( Link() ); + pPrevListBox->SetDoubleClickHdl( Link() ); + } + + ListBox* pNewListBox = (ListBox*) pWindow; + if ( pNewListBox ) + { + pNewListBox->SetSelectHdl( LINK( this, VCLXListBox, SelectHdl ) ); + pNewListBox->SetDoubleClickHdl( LINK( this, VCLXListBox, DoubleClickHdl ) ); + } + + VCLXWindow::SetWindow( pWindow ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXListBox::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::awt::XListBox*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXListBox ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aObj; + aObj.Source = (::cppu::OWeakObject*)this; + maItemListeners.disposeAndClear( aObj ); + maActionListeners.disposeAndClear( aObj ); + VCLXWindow::dispose(); +} + +void VCLXListBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maItemListeners.addInterface( l ); +} + +void VCLXListBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maItemListeners.removeInterface( l ); +} + +void VCLXListBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maActionListeners.addInterface( l ); +} + +void VCLXListBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maActionListeners.removeInterface( l ); +} + +void VCLXListBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + pBox->InsertEntry( aItem, nPos ); +} + +void VCLXListBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + { + sal_uInt16 nP = nPos; + for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ ) + { + pBox->InsertEntry( aItems.getConstArray()[n], nP ); + if ( nPos < 0xFFFF ) // Nicht wenn 0xFFFF, weil LIST_APPEND + nP++; + } + } +} + +void VCLXListBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + { + for ( sal_uInt16 n = nCount; n; ) + pBox->RemoveEntry( nPos + (--n) ); + } +} + +sal_Int16 VCLXListBox::getItemCount() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + return pBox ? pBox->GetEntryCount() : 0; +} + +::rtl::OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + String aItem; + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + aItem = pBox->GetEntry( nPos ); + return aItem; +} + +::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getItems() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + { + sal_uInt16 nEntries = pBox->GetEntryCount(); + aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries ); + for ( sal_uInt16 n = nEntries; n; ) + { + --n; + aSeq.getArray()[n] = ::rtl::OUString( pBox->GetEntry( n ) ); + } + } + return aSeq; +} + +sal_Int16 VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + return pBox ? pBox->GetSelectEntryPos() : 0; +} + +::com::sun::star::uno::Sequence<sal_Int16> VCLXListBox::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence<sal_Int16> aSeq; + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + { + sal_uInt16 nSelEntries = pBox->GetSelectEntryCount(); + aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nSelEntries ); + for ( sal_uInt16 n = 0; n < nSelEntries; n++ ) + aSeq.getArray()[n] = pBox->GetSelectEntryPos( n ); + } + return aSeq; +} + +::rtl::OUString VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + String aItem; + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + aItem = pBox->GetSelectEntry(); + return aItem; +} + +::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getSelectedItems() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + { + sal_uInt16 nSelEntries = pBox->GetSelectEntryCount(); + aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nSelEntries ); + for ( sal_uInt16 n = 0; n < nSelEntries; n++ ) + aSeq.getArray()[n] = ::rtl::OUString( pBox->GetSelectEntry( n ) ); + } + return aSeq; +} + +void VCLXListBox::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + pBox->SelectEntryPos( nPos, bSelect ); +} + +void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + { + for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; ) + pBox->SelectEntryPos( (sal_uInt16) aPositions.getConstArray()[--n], bSelect ); + } +} + +void VCLXListBox::selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + pBox->SelectEntry( aItem, bSelect ); +} + + +void VCLXListBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + pBox->SetDropDownLineCount( nLines ); +} + +sal_Int16 VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int16 nLines = 0; + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + nLines = pBox->GetDropDownLineCount(); + return nLines; +} + +sal_Bool VCLXListBox::isMutipleMode() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Bool bMulti = sal_False; + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + bMulti = pBox->IsMultiSelectionEnabled(); + return bMulti; +} + +void VCLXListBox::setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + pBox->EnableMultiSelection( bMulti ); +} + +void VCLXListBox::makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pBox = (ListBox*) GetWindow(); + if ( pBox ) + pBox->SetTopEntry( nEntry ); +} + +IMPL_LINK( VCLXListBox, SelectHdl, ListBox*, EMPTYARG ) +{ + ListBox* pListBox = (ListBox*)GetWindow(); + if ( pListBox ) + { + sal_Bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) ? sal_True : sal_False; + if ( bDropDown ) + { + // Bei DropDown den ActionListener rufen... + DoubleClickHdl( pListBox ); + } + + if ( maItemListeners.getLength() ) + { + ::com::sun::star::awt::ItemEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.Highlighted = sal_False; + + // Bei Mehrfachselektion 0xFFFF, sonst die ID + aEvent.Selected = (pListBox->GetSelectEntryCount() == 1 ) + ? pListBox->GetSelectEntryPos() : 0xFFFF; + + maItemListeners.itemStateChanged( aEvent ); + } + } + return 1; +} + +IMPL_LINK( VCLXListBox, DoubleClickHdl, ListBox*, EMPTYARG ) +{ + ListBox* pListBox = (ListBox*)GetWindow(); + if ( pListBox && maActionListeners.getLength() ) + { + ::com::sun::star::awt::ActionEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.ActionCommand = pListBox->GetSelectEntry(); + maActionListeners.actionPerformed( aEvent ); + } + return 1; +} + +void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pListBox = (ListBox*)GetWindow(); + if ( pListBox ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_READONLY: + { + sal_Bool b; + if ( Value >>= b ) + pListBox->SetReadOnly( b); + } + break; + case BASEPROPERTY_MULTISELECTION: + { + sal_Bool b; + if ( Value >>= b ) + pListBox->EnableMultiSelection( b ); + } + break; + case BASEPROPERTY_LINECOUNT: + { + sal_Int16 n; + if ( Value >>= n ) + pListBox->SetDropDownLineCount( n ); + } + break; + case BASEPROPERTY_STRINGITEMLIST: + { + ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems; + if ( Value >>= aItems ) + { + pListBox->Clear(); + addItems( aItems, 0 ); + } + } + break; + case BASEPROPERTY_SELECTEDITEMS: + { + ::com::sun::star::uno::Sequence<sal_Int16> aItems; + if ( Value >>= aItems ) + { + for ( sal_uInt16 n = pListBox->GetEntryCount(); n; ) + pListBox->SelectEntryPos( --n, sal_False ); + + selectItemsPos( aItems, sal_True ); + + if ( !pListBox->GetSelectEntryCount() ) + pListBox->SetTopEntry( 0 ); + } + } + break; + default: + { + VCLXWindow::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXListBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + ListBox* pListBox = (ListBox*)GetWindow(); + if ( pListBox ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_READONLY: + { + aProp <<= (sal_Bool) pListBox->IsReadOnly(); + } + break; + case BASEPROPERTY_MULTISELECTION: + { + aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled(); + } + break; + case BASEPROPERTY_LINECOUNT: + { + aProp <<= (sal_Int16) pListBox->GetDropDownLineCount(); + } + break; + case BASEPROPERTY_STRINGITEMLIST: + { + sal_uInt16 nItems = pListBox->GetEntryCount(); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems ); + ::rtl::OUString* pStrings = aSeq.getArray(); + for ( sal_uInt16 n = 0; n < nItems; n++ ) + pStrings[n] = pListBox->GetEntry( n ); + aProp <<= aSeq; + + } + break; + default: + { + aProp <<= VCLXWindow::getProperty( PropertyName ); + } + } + } + return aProp; +} + +::com::sun::star::awt::Size VCLXListBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + ListBox* pListBox = (ListBox*) GetWindow(); + if ( pListBox ) + aSz = pListBox->CalcMinimumSize(); + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXListBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + ListBox* pListBox = (ListBox*) GetWindow(); + if ( pListBox ) + { + aSz = pListBox->CalcMinimumSize(); + if ( pListBox->GetStyle() & WB_DROPDOWN ) + aSz.Height() += 4; + } + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXListBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz = VCLSize(rNewSize); + ListBox* pListBox = (ListBox*) GetWindow(); + if ( pListBox ) + aSz = pListBox->CalcAdjustedSize( aSz ); + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXListBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + ListBox* pListBox = (ListBox*) GetWindow(); + if ( pListBox ) + aSz = pListBox->CalcSize( nCols, nLines ); + return AWTSize(aSz); +} + +void VCLXListBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + nCols = nLines = 0; + ListBox* pListBox = (ListBox*) GetWindow(); + if ( pListBox ) + { + sal_uInt16 nC, nL; + pListBox->GetMaxVisColumnsAndLines( nC, nL ); + nCols = nC; + nLines = nL; + } +} + +// ---------------------------------------------------- +// class VCLXMessageBox +// ---------------------------------------------------- +VCLXMessageBox::VCLXMessageBox() +{ +} + +VCLXMessageBox::~VCLXMessageBox() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXMessageBox::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::awt::XMessageBox*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXMessageBox ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXMessageBox::setCaptionText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + pWindow->SetText( rText ); +} + +::rtl::OUString VCLXMessageBox::getCaptionText() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + String aText; + Window* pWindow = GetWindow(); + if ( pWindow ) + aText = pWindow->GetText(); + return aText; +} + +void VCLXMessageBox::setMessageText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + MessBox* pBox = (MessBox*)GetWindow(); + if ( pBox ) + pBox->SetMessText( rText ); +} + +::rtl::OUString VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::rtl::OUString aText; + MessBox* pBox = (MessBox*)GetWindow(); + if ( pBox ) + aText = pBox->GetMessText(); + return aText; +} + +sal_Int16 VCLXMessageBox::execute() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + MessBox* pBox = (MessBox*)GetWindow(); + return pBox ? pBox->Execute() : 0; +} + + + +// ---------------------------------------------------- +// class VCLXDialog +// ---------------------------------------------------- +VCLXDialog::VCLXDialog() +{ +} + +VCLXDialog::~VCLXDialog() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXDialog::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::awt::XDialog*, this ) ); + return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXDialog ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ), + VCLXTopWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + pWindow->SetText( Title ); +} + +::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::rtl::OUString aTitle; + Window* pWindow = GetWindow(); + if ( pWindow ) + aTitle = pWindow->GetText(); + return aTitle; +} + +sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int16 nRet = 0; + if ( GetWindow() ) + { + Dialog* pDlg = (Dialog*) GetWindow(); + Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP ); + Window* pOldParent = NULL; + if ( pParent && !pParent->IsReallyVisible() ) + { + pOldParent = pDlg->GetParent(); + pDlg->SetParent( pDlg->GetWindow( WINDOW_FRAME ) ); + } + nRet = pDlg->Execute(); + if ( pOldParent ) + pDlg->SetParent( pOldParent ); + } + return nRet; +} + +void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Dialog* pDlg = (Dialog*) GetWindow(); + if ( pDlg ) + pDlg->EndDialog( 0 ); +} + +// ---------------------------------------------------- +// class VCLXFixedText +// ---------------------------------------------------- +VCLXFixedText::VCLXFixedText() +{ +} + +VCLXFixedText::~VCLXFixedText() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXFixedText::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::awt::XFixedText*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXFixedText ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXFixedText::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + pWindow->SetText( Text ); +} + +::rtl::OUString VCLXFixedText::getText() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::rtl::OUString aText; + Window* pWindow = GetWindow(); + if ( pWindow ) + aText = pWindow->GetText(); + return aText; +} + +void VCLXFixedText::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + WinBits nNewBits = 0; + if ( nAlign == ::com::sun::star::awt::TextAlign::LEFT ) + nNewBits = WB_LEFT; + else if ( nAlign == ::com::sun::star::awt::TextAlign::CENTER ) + nNewBits = WB_CENTER; + else + nNewBits = WB_RIGHT; + + WinBits nStyle = pWindow->GetStyle(); + nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT); + pWindow->SetStyle( nStyle | nNewBits ); + } +} + +short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + short nAlign = 0; + Window* pWindow = GetWindow(); + if ( pWindow ) + { + WinBits nStyle = pWindow->GetStyle(); + if ( nStyle & WB_LEFT ) + nAlign = ::com::sun::star::awt::TextAlign::LEFT; + else if ( nStyle & WB_CENTER ) + nAlign = ::com::sun::star::awt::TextAlign::CENTER; + else + nAlign = ::com::sun::star::awt::TextAlign::RIGHT; + } + return nAlign; +} + +::com::sun::star::awt::Size VCLXFixedText::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + FixedText* pFixedText = (FixedText*)GetWindow(); + if ( pFixedText ) + aSz = pFixedText->CalcMinimumSize(); + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXFixedText::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return getMinimumSize(); +} + +::com::sun::star::awt::Size VCLXFixedText::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::awt::Size aSz = rNewSize; + ::com::sun::star::awt::Size aMinSz = getMinimumSize(); + if ( aSz.Height != aMinSz.Height ) + aSz.Height = aMinSz.Height; + + return aSz; +} + +// ---------------------------------------------------- +// class VCLXScrollBar +// ---------------------------------------------------- +VCLXScrollBar::VCLXScrollBar() : maAdjustmentListeners( *this ) +{ +} + +VCLXScrollBar::~VCLXScrollBar() +{ + ScrollBar* pBox = (ScrollBar*) GetWindow(); + if ( pBox ) + pBox->SetScrollHdl( Link() ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXScrollBar::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::awt::XScrollBar*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXScrollBar ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XScrollBar>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXScrollBar::SetWindow( Window* pWindow ) +{ + ScrollBar* pPrevScrollBar = (ScrollBar*) GetWindow(); + if ( pPrevScrollBar ) + pPrevScrollBar->SetScrollHdl( Link() ); + + ScrollBar* pNewScrollBar = (ScrollBar*) pWindow; + if ( pNewScrollBar ) + pNewScrollBar->SetScrollHdl( LINK( this, VCLXScrollBar, ScrollHdl ) ); + + VCLXWindow::SetWindow( pWindow ); +} + +void VCLXScrollBar::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aObj; + aObj.Source = (::cppu::OWeakObject*)this; + maAdjustmentListeners.disposeAndClear( aObj ); + VCLXWindow::dispose(); +} + +void VCLXScrollBar::addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maAdjustmentListeners.addInterface( l ); +} + +void VCLXScrollBar::removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maAdjustmentListeners.removeInterface( l ); +} + +void VCLXScrollBar::setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + if ( pScrollBar ) + pScrollBar->SetThumbPos( n ); +} + +void VCLXScrollBar::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + if ( pScrollBar ) + { + pScrollBar->SetThumbPos( nValue ); + pScrollBar->SetVisibleSize( nVisible ); + pScrollBar->SetRangeMax( nMax ); + } +} + +sal_Int32 VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + return pScrollBar ? pScrollBar->GetThumbPos() : 0; +} + +void VCLXScrollBar::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + if ( pScrollBar ) + pScrollBar->SetRangeMax( n ); +} + +sal_Int32 VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + return pScrollBar ? pScrollBar->GetRangeMax() : 0; +} + +void VCLXScrollBar::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + if ( pScrollBar ) + pScrollBar->SetLineSize( n ); +} + +sal_Int32 VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + return pScrollBar ? pScrollBar->GetLineSize() : 0; +} + +void VCLXScrollBar::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + if ( pScrollBar ) + pScrollBar->SetPageSize( n ); +} + +sal_Int32 VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + return pScrollBar ? pScrollBar->GetPageSize() : 0; +} + +void VCLXScrollBar::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + if ( pScrollBar ) + pScrollBar->SetVisibleSize( n ); +} + +sal_Int32 VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); + return pScrollBar ? pScrollBar->GetVisibleSize() : 0; +} + +void VCLXScrollBar::setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + WinBits nStyle = pWindow->GetStyle(); + nStyle &= ~(WB_HORZ|WB_VERT); + if ( n == ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL ) + nStyle |= WB_HORZ; + else + nStyle |= WB_VERT; + + if ( pWindow->IsVisible() ) + pWindow->Resize(); + } +} + +sal_Int32 VCLXScrollBar::getOrientation() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 n = 0; + Window* pWindow = GetWindow(); + if ( pWindow ) + { + WinBits nStyle = pWindow->GetStyle(); + if ( nStyle & WB_HORZ ) + n = ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL; + else + n = ::com::sun::star::awt::ScrollBarOrientation::VERTICAL; + } + return n; + +} + +IMPL_LINK( VCLXScrollBar, ScrollHdl, ScrollBar*, EMPTYARG ) +{ + ScrollBar* pScrollBar = (ScrollBar*)GetWindow(); + if ( pScrollBar && maAdjustmentListeners.getLength() ) + { + ::com::sun::star::awt::AdjustmentEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.Value = pScrollBar->GetThumbPos(); + maAdjustmentListeners.adjustmentValueChanged( aEvent ); + } + return 1; +} + +// ---------------------------------------------------- +// class VCLXEdit +// ---------------------------------------------------- + +VCLXEdit::VCLXEdit() : maTextListeners( *this ) +{ +} + +VCLXEdit::~VCLXEdit() +{ + Edit* pBox = (Edit*) GetWindow(); + if ( pBox ) + pBox->SetModifyHdl( Link() ); +} + +void VCLXEdit::SetWindow( Window* pWindow ) +{ + Edit* pPrevEdit = (Edit*) GetWindow(); + if ( pPrevEdit ) + pPrevEdit->SetModifyHdl( Link() ); + + Edit* pNewEdit = (Edit*) pWindow; + if ( pNewEdit ) + pNewEdit->SetModifyHdl( LINK( this, VCLXEdit, ModifyHdl ) ); + + VCLXWindow::SetWindow( pWindow ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXEdit::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::awt::XTextComponent*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XTextEditField*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXEdit ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextEditField>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXEdit::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aObj; + aObj.Source = (::cppu::OWeakObject*)this; + maTextListeners.disposeAndClear( aObj ); + VCLXWindow::dispose(); +} + +void VCLXEdit::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + GetTextListeners().addInterface( l ); +} + +void VCLXEdit::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + GetTextListeners().removeInterface( l ); +} + +void VCLXEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + pWindow->SetText( aText ); + + // In JAVA wird auch ein textChanged ausgeloest, in VCL nicht. + // ::com::sun::star::awt::Toolkit soll JAVA-komform sein... + ModifyHdl( NULL ); + } +} + +void VCLXEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Edit* pEdit = (Edit*)GetWindow(); + if ( pEdit ) + { + pEdit->SetSelection( Selection( rSel.Min, rSel.Max ) ); + pEdit->ReplaceSelected( aText ); + } +} + +::rtl::OUString VCLXEdit::getText() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::rtl::OUString aText; + Window* pWindow = GetWindow(); + if ( pWindow ) + aText = pWindow->GetText(); + return aText; +} + +::rtl::OUString VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::rtl::OUString aText; + Edit* pEdit = (Edit*) GetWindow(); + if ( pEdit) + aText = pEdit->GetSelected(); + return aText; + +} + +void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Edit* pEdit = (Edit*) GetWindow(); + if ( pEdit ) + pEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) ); +} + +::com::sun::star::awt::Selection VCLXEdit::getSelection() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Selection aSel; + Edit* pEdit = (Edit*) GetWindow(); + if ( pEdit ) + aSel = pEdit->GetSelection(); + return ::com::sun::star::awt::Selection( aSel.Min(), aSel.Max() ); +} + +sal_Bool VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Edit* pEdit = (Edit*) GetWindow(); + return ( pEdit && !pEdit->IsReadOnly() && pEdit->IsEnabled() ) ? sal_True : sal_False; +} + +void VCLXEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Edit* pEdit = (Edit*) GetWindow(); + if ( pEdit ) + pEdit->SetReadOnly( !bEditable ); +} + + +void VCLXEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Edit* pEdit = (Edit*) GetWindow(); + if ( pEdit ) + pEdit->SetMaxTextLen( nLen ); +} + +sal_Int16 VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Edit* pEdit = (Edit*) GetWindow(); + return pEdit ? pEdit->GetMaxTextLen() : 0; +} + +void VCLXEdit::setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Edit* pEdit = (Edit*) GetWindow(); + if ( pEdit ) + pEdit->SetEchoChar( cEcho ); +} + +void VCLXEdit::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Edit* pEdit = (Edit*)GetWindow(); + if ( pEdit ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_READONLY: + { + sal_Bool b; + if ( Value >>= b ) + pEdit->SetReadOnly( b ); + } + break; + case BASEPROPERTY_ECHOCHAR: + { + sal_Int16 n; + if ( Value >>= n ) + pEdit->SetEchoChar( n ); + } + break; + case BASEPROPERTY_MAXTEXTLEN: + { + sal_Int16 n; + if ( Value >>= n ) + pEdit->SetMaxTextLen( n ); + } + break; + default: + { + VCLXWindow::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXEdit::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + Edit* pEdit = (Edit*)GetWindow(); + if ( pEdit ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_READONLY: + { + aProp <<= (sal_Bool) pEdit->IsReadOnly(); + } + break; + case BASEPROPERTY_ECHOCHAR: + { + aProp <<= (sal_Int16) pEdit->GetEchoChar(); + } + break; + case BASEPROPERTY_MAXTEXTLEN: + { + aProp <<= (sal_Int16) pEdit->GetMaxTextLen(); + } + break; + default: + { + aProp <<= VCLXWindow::getProperty( PropertyName ); + } + } + } + return aProp; +} + +::com::sun::star::awt::Size VCLXEdit::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + Edit* pEdit = (Edit*) GetWindow(); + if ( pEdit ) + aSz = pEdit->CalcMinimumSize(); + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXEdit::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + Edit* pEdit = (Edit*) GetWindow(); + if ( pEdit ) + { + aSz = pEdit->CalcMinimumSize(); + aSz.Height() += 4; + } + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXEdit::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::awt::Size aSz = rNewSize; + ::com::sun::star::awt::Size aMinSz = getMinimumSize(); + if ( aSz.Height != aMinSz.Height ) + aSz.Height = aMinSz.Height; + + return aSz; +} + +::com::sun::star::awt::Size VCLXEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + Edit* pEdit = (Edit*) GetWindow(); + if ( pEdit ) + { + if ( nCols ) + aSz = pEdit->CalcSize( nCols ); + else + aSz = pEdit->CalcMinimumSize(); + } + return AWTSize(aSz); +} + +void VCLXEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + nLines = 1; + nCols = 0; + Edit* pEdit = (Edit*) GetWindow(); + if ( pEdit ) + nCols = pEdit->GetMaxVisChars(); +} + +IMPL_LINK( VCLXEdit, ModifyHdl, Edit*, EMPTYARG ) +{ + Edit* pEdit = (Edit*)GetWindow(); + if ( pEdit && GetTextListeners().getLength() ) + { + ::com::sun::star::awt::TextEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + GetTextListeners().textChanged( aEvent ); + } + return 1; +} + +// ---------------------------------------------------- +// class VCLXComboBox +// ---------------------------------------------------- +VCLXComboBox::VCLXComboBox() + : maItemListeners( *this ), + maActionListeners( *this ) +{ +} + +VCLXComboBox::~VCLXComboBox() +{ + ComboBox* pBox = (ComboBox*) GetWindow(); + if ( pBox ) + { + pBox->SetSelectHdl( Link() ); + pBox->SetDoubleClickHdl( Link() ); + } +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXComboBox::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::awt::XComboBox*, this ) ); + return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXComboBox ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XComboBox>* ) NULL ), + VCLXEdit::getTypes() +IMPL_XTYPEPROVIDER_END + + +void VCLXComboBox::SetWindow( Window* pWindow ) +{ + ComboBox* pPrevComboBox = (ComboBox*) GetWindow(); + if ( pPrevComboBox ) + { + pPrevComboBox->SetSelectHdl( Link() ); + pPrevComboBox->SetDoubleClickHdl( Link() ); + } + + ComboBox* pNewComboBox = (ComboBox*) pWindow; + if ( pNewComboBox ) + { + pNewComboBox->SetSelectHdl( LINK( this, VCLXComboBox, SelectHdl ) ); + pNewComboBox->SetDoubleClickHdl( LINK( this, VCLXComboBox, DoubleClickHdl ) ); + } + + VCLXEdit::SetWindow( pWindow ); +} + +void VCLXComboBox::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aObj; + aObj.Source = (::cppu::OWeakObject*)this; + maItemListeners.disposeAndClear( aObj ); + maActionListeners.disposeAndClear( aObj ); + VCLXEdit::dispose(); +} + + +void VCLXComboBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maItemListeners.addInterface( l ); +} + +void VCLXComboBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maItemListeners.removeInterface( l ); +} + +void VCLXComboBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maActionListeners.addInterface( l ); +} + +void VCLXComboBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + maActionListeners.removeInterface( l ); +} + +void VCLXComboBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pBox = (ComboBox*) GetWindow(); + if ( pBox ) + pBox->InsertEntry( aItem, nPos ); +} + +void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pBox = (ComboBox*) GetWindow(); + if ( pBox ) + { + sal_uInt16 nP = nPos; + for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ ) + { + pBox->InsertEntry( aItems.getConstArray()[n], nP ); + if ( nPos < 0xFFFF ) // Nicht wenn 0xFFFF, weil LIST_APPEND + nP++; + } + } +} + +void VCLXComboBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pBox = (ComboBox*) GetWindow(); + if ( pBox ) + { + for ( sal_uInt16 n = nCount; n; ) + pBox->RemoveEntry( nPos + (--n) ); + } +} + +sal_Int16 VCLXComboBox::getItemCount() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pBox = (ComboBox*) GetWindow(); + return pBox ? pBox->GetEntryCount() : 0; +} + +::rtl::OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::rtl::OUString aItem; + ComboBox* pBox = (ComboBox*) GetWindow(); + if ( pBox ) + aItem = pBox->GetEntry( nPos ); + return aItem; +} + +::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXComboBox::getItems() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + ComboBox* pBox = (ComboBox*) GetWindow(); + if ( pBox ) + { + sal_uInt16 nEntries = pBox->GetEntryCount(); + aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries ); + for ( sal_uInt16 n = nEntries; n; ) + { + --n; + aSeq.getArray()[n] = pBox->GetEntry( n ); + } + } + return aSeq; +} + +void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pBox = (ComboBox*) GetWindow(); + if ( pBox ) + pBox->SetDropDownLineCount( nLines ); +} + +sal_Int16 VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int16 nLines = 0; + ComboBox* pBox = (ComboBox*) GetWindow(); + if ( pBox ) + nLines = pBox->GetDropDownLineCount(); + return nLines; +} + +void VCLXComboBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pComboBox = (ComboBox*)GetWindow(); + if ( pComboBox ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_LINECOUNT: + { + sal_Int16 n; + if ( Value >>= n ) + pComboBox->SetDropDownLineCount( n ); + } + break; + case BASEPROPERTY_AUTOCOMPLETE: + { + sal_Int16 n; + if ( Value >>= n ) + pComboBox->EnableAutocomplete( n ); + } + break; + case BASEPROPERTY_STRINGITEMLIST: + { + ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems; + if ( Value >>= aItems ) + { + sal_Bool bUpdate = pComboBox->IsUpdateMode(); + pComboBox->SetUpdateMode( sal_False ); + pComboBox->Clear(); + const ::rtl::OUString* pStrings = aItems.getConstArray(); + sal_Int32 nItems = aItems.getLength(); + for ( sal_Int32 n = 0; n < nItems; n++ ) + pComboBox->InsertEntry( pStrings[n], LISTBOX_APPEND ); + pComboBox->SetUpdateMode( bUpdate ); + } + } + break; + default: + { + VCLXEdit::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXComboBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + ComboBox* pComboBox = (ComboBox*)GetWindow(); + if ( pComboBox ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_LINECOUNT: + { + aProp <<= (sal_Int16) pComboBox->GetDropDownLineCount(); + } + break; + case BASEPROPERTY_AUTOCOMPLETE: + { + aProp <<= (sal_Bool) pComboBox->IsAutocompleteEnabled(); + } + break; + case BASEPROPERTY_STRINGITEMLIST: + { + sal_uInt16 nItems = pComboBox->GetEntryCount(); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems ); + ::rtl::OUString* pStrings = aSeq.getArray(); + for ( sal_uInt16 n = 0; n < nItems; n++ ) + pStrings[n] = pComboBox->GetEntry( n ); + aProp <<= aSeq; + + } + break; + default: + { + aProp <<= VCLXEdit::getProperty( PropertyName ); + } + } + } + return aProp; +} + +IMPL_LINK( VCLXComboBox, SelectHdl, ComboBox*, EMPTYARG ) +{ + ComboBox* pComboBox = (ComboBox*)GetWindow(); + if ( pComboBox && !pComboBox->IsTravelSelect() && maItemListeners.getLength() ) + { + ::com::sun::star::awt::ItemEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.Highlighted = sal_False; + + // Bei Mehrfachselektion 0xFFFF, sonst die ID + aEvent.Selected = pComboBox->GetEntryPos( pComboBox->GetText() ); + + maItemListeners.itemStateChanged( aEvent ); + } + return 1; +} + +IMPL_LINK( VCLXComboBox, DoubleClickHdl, ComboBox*, EMPTYARG ) +{ + ComboBox* pComboBox = (ComboBox*)GetWindow(); + if ( pComboBox && maActionListeners.getLength() ) + { + ::com::sun::star::awt::ActionEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; +// aEvent.ActionCommand = ...; + maActionListeners.actionPerformed( aEvent ); + } + return 1; +} + +::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + ComboBox* pComboBox = (ComboBox*) GetWindow(); + if ( pComboBox ) + aSz = pComboBox->CalcMinimumSize(); + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXComboBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + ComboBox* pComboBox = (ComboBox*) GetWindow(); + if ( pComboBox ) + { + aSz = pComboBox->CalcMinimumSize(); + if ( pComboBox->GetStyle() & WB_DROPDOWN ) + aSz.Height() += 4; + } + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXComboBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz = VCLSize(rNewSize); + ComboBox* pComboBox = (ComboBox*) GetWindow(); + if ( pComboBox ) + aSz = pComboBox->CalcAdjustedSize( aSz ); + return AWTSize(aSz); +} + +::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Size aSz; + ComboBox* pComboBox = (ComboBox*) GetWindow(); + if ( pComboBox ) + aSz = pComboBox->CalcSize( nCols, nLines ); + return AWTSize(aSz); +} + +void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + nCols = nLines = 0; + ComboBox* pComboBox = (ComboBox*) GetWindow(); + if ( pComboBox ) + { + sal_uInt16 nC, nL; + pComboBox->GetMaxVisColumnsAndLines( nC, nL ); + nCols = nC; + nLines = nL; + } +} + +// ---------------------------------------------------- +// class VCLXFormattedSpinField +// ---------------------------------------------------- +VCLXFormattedSpinField::VCLXFormattedSpinField() +{ +} + +VCLXFormattedSpinField::~VCLXFormattedSpinField() +{ +} + +void VCLXFormattedSpinField::setStrictFormat( sal_Bool bStrict ) +{ + ::vos::OGuard aGuard( GetMutex() ); + + FormatterBase* pFormatter = GetFormatter(); + if ( pFormatter ) + pFormatter->SetStrictFormat( bStrict ); +} + +sal_Bool VCLXFormattedSpinField::isStrictFormat() +{ + FormatterBase* pFormatter = GetFormatter(); + return pFormatter ? pFormatter->IsStrictFormat() : sal_False; +} + + +void VCLXFormattedSpinField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + FormatterBase* pFormatter = GetFormatter(); + if ( pFormatter ) + { + International aInternational( pFormatter->GetInternational() ); + sal_Bool bInternationalChanged = sal_True; + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_SPIN: + { + sal_Bool b; + if ( Value >>= b ) + { + WinBits nStyle = GetWindow()->GetStyle() | WB_SPIN; + if ( !b ) + nStyle &= ~WB_SPIN; + GetWindow()->SetStyle( nStyle ); + } + } + break; + case BASEPROPERTY_STRICTFORMAT: + { + sal_Bool b; + if ( Value >>= b ) + { + pFormatter->SetStrictFormat( b ); + bInternationalChanged = sal_False; + } + } + break; + case BASEPROPERTY_DATESHOWCENTURY: + { + sal_Bool b; + if ( Value >>= b ) + aInternational.SetDateCentury( b ); + } + break; + case BASEPROPERTY_NUMSHOWTHOUSANDSEP: + { + sal_Bool b; + if ( Value >>= b ) + aInternational.EnableNumThousandSep( b ); + } + break; + case BASEPROPERTY_CURRENCYSYMBOL: + { + ::rtl::OUString aString; + if ( Value >>= aString ) + aInternational.SetCurrSymbol( aString ); + } + break; + default: + { + bInternationalChanged = sal_False; + VCLXSpinField::setProperty( PropertyName, Value ); + } + } + if ( bInternationalChanged ) + pFormatter->SetInternational( aInternational ); + } +} + +::com::sun::star::uno::Any VCLXFormattedSpinField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + FormatterBase* pFormatter = GetFormatter(); + if ( pFormatter ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_TABSTOP: + { + aProp <<= (sal_Bool) ( ( GetWindow()->GetStyle() & WB_SPIN ) ? sal_True : sal_False ); + } + break; + case BASEPROPERTY_STRICTFORMAT: + { + aProp <<= (sal_Bool) pFormatter->IsStrictFormat(); + } + break; + case BASEPROPERTY_DATESHOWCENTURY: + { + aProp <<= (sal_Bool) pFormatter->GetInternational().IsDateCentury(); + } + break; + case BASEPROPERTY_NUMSHOWTHOUSANDSEP: + { + aProp <<= (sal_Bool) pFormatter->GetInternational().IsNumThousandSep(); + } + break; + case BASEPROPERTY_CURRENCYSYMBOL: + { + aProp <<= ::rtl::OUString( pFormatter->GetInternational().GetCurrSymbol() ); + } + break; + default: + { + aProp <<= VCLXSpinField::getProperty( PropertyName ); + } + } + } + return aProp; +} + + +// ---------------------------------------------------- +// class VCLXDateField +// ---------------------------------------------------- +VCLXDateField::VCLXDateField() +{ +} + +VCLXDateField::~VCLXDateField() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXDateField::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::awt::XDateField*, this ) ); + return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXDateField ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDateField>* ) NULL ), + VCLXFormattedSpinField::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXDateField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_DATE: + { + if ( bVoid ) + { + ((DateField*)GetWindow())->EnableEmptyFieldValue( sal_True ); + ((DateField*)GetWindow())->SetEmptyFieldValue(); + } + else + { + sal_Int32 n; + if ( Value >>= n ) + setDate( n ); + } + } + break; + case BASEPROPERTY_DATEMIN: + { + sal_Int32 n; + if ( Value >>= n ) + setMin( n ); + } + break; + case BASEPROPERTY_DATEMAX: + { + sal_Int32 n; + if ( Value >>= n ) + setMax( n ); + } + break; + case BASEPROPERTY_EXTDATEFORMAT: + { + sal_Int16 n; + if ( Value >>= n ) + ((DateField*)GetWindow())->SetExtFormat( (ExtDateFieldFormat) n ); + } + break; + default: + { + VCLXFormattedSpinField::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXDateField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + FormatterBase* pFormatter = GetFormatter(); + if ( pFormatter ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_DATE: + { + aProp <<= (sal_Int32) getDate(); + } + break; + case BASEPROPERTY_DATEMIN: + { + aProp <<= (sal_Int32) getMin(); + } + break; + case BASEPROPERTY_DATEMAX: + { + aProp <<= (sal_Int32) getMax(); + } + break; + default: + { + aProp <<= VCLXFormattedSpinField::getProperty( PropertyName ); + } + } + } + return aProp; +} + + +void VCLXDateField::setDate( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + pDateField->SetDate( nDate ); +} + +sal_Int32 VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 nDate = 0; + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + nDate = pDateField->GetDate().GetDate(); + + return nDate; +} + +void VCLXDateField::setMin( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + pDateField->SetMin( nDate ); +} + +sal_Int32 VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 nDate = 0; + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + nDate = pDateField->GetMin().GetDate(); + + return nDate; +} + +void VCLXDateField::setMax( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + pDateField->SetMax( nDate ); +} + +sal_Int32 VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 nDate = 0; + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + nDate = pDateField->GetMax().GetDate(); + + return nDate; +} + +void VCLXDateField::setFirst( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + pDateField->SetFirst( nDate ); +} + +sal_Int32 VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 nDate = 0; + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + nDate = pDateField->GetFirst().GetDate(); + + return nDate; +} + +void VCLXDateField::setLast( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + pDateField->SetLast( nDate ); +} + +sal_Int32 VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 nDate = 0; + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + nDate = pDateField->GetLast().GetDate(); + + return nDate; +} + +void VCLXDateField::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + pDateField->SetLongFormat( bLong ); +} + +sal_Bool VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + DateField* pDateField = (DateField*) GetWindow(); + return pDateField ? pDateField->IsLongFormat() : sal_False; +} + +void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + DateField* pDateField = (DateField*) GetWindow(); + if ( pDateField ) + pDateField->SetEmptyDate(); +} + +sal_Bool VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + DateField* pDateField = (DateField*) GetWindow(); + return pDateField ? pDateField->IsEmptyDate() : sal_False; +} + +void VCLXDateField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) +{ + VCLXFormattedSpinField::setStrictFormat( bStrict ); +} + +sal_Bool VCLXDateField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) +{ + return VCLXFormattedSpinField::isStrictFormat(); +} + + +// ---------------------------------------------------- +// class VCLXTimeField +// ---------------------------------------------------- +VCLXTimeField::VCLXTimeField() +{ +} + +VCLXTimeField::~VCLXTimeField() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXTimeField::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::awt::XTimeField*, this ) ); + return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXTimeField ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTimeField>* ) NULL ), + VCLXFormattedSpinField::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXTimeField::setTime( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + pTimeField->SetTime( nTime ); +} + +sal_Int32 VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 nTime = 0; + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + nTime = pTimeField->GetTime().GetTime(); + + return nTime; +} + +void VCLXTimeField::setMin( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + pTimeField->SetMin( nTime ); +} + +sal_Int32 VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 nTime = 0; + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + nTime = pTimeField->GetMin().GetTime(); + + return nTime; +} + +void VCLXTimeField::setMax( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + pTimeField->SetMax( nTime ); +} + +sal_Int32 VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 nTime = 0; + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + nTime = pTimeField->GetMax().GetTime(); + + return nTime; +} + +void VCLXTimeField::setFirst( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + pTimeField->SetFirst( nTime ); +} + +sal_Int32 VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 nTime = 0; + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + nTime = pTimeField->GetFirst().GetTime(); + + return nTime; +} + +void VCLXTimeField::setLast( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + pTimeField->SetLast( nTime ); +} + +sal_Int32 VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int32 nTime = 0; + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + nTime = pTimeField->GetLast().GetTime(); + + return nTime; +} + +void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + TimeField* pTimeField = (TimeField*) GetWindow(); + if ( pTimeField ) + pTimeField->SetEmptyTime(); +} + +sal_Bool VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + TimeField* pTimeField = (TimeField*) GetWindow(); + return pTimeField ? pTimeField->IsEmptyTime() : sal_False; +} + +void VCLXTimeField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) +{ + VCLXFormattedSpinField::setStrictFormat( bStrict ); +} + +sal_Bool VCLXTimeField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) +{ + return VCLXFormattedSpinField::isStrictFormat(); +} + + +void VCLXTimeField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_TIME: + { + if ( bVoid ) + { + ((TimeField*)GetWindow())->EnableEmptyFieldValue( sal_True ); + ((TimeField*)GetWindow())->SetEmptyFieldValue(); + } + else + { + sal_Int32 n; + if ( Value >>= n ) + setTime( n ); + } + } + break; + case BASEPROPERTY_TIMEMIN: + { + sal_Int32 n; + if ( Value >>= n ) + setMin( n ); + } + break; + case BASEPROPERTY_TIMEMAX: + { + sal_Int32 n; + if ( Value >>= n ) + setMax( n ); + } + break; + case BASEPROPERTY_EXTTIMEFORMAT: + { + sal_Int16 n; + if ( Value >>= n ) + ((TimeField*)GetWindow())->SetExtFormat( (ExtTimeFieldFormat) n ); + } + break; + default: + { + VCLXFormattedSpinField::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXTimeField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + if ( GetWindow() ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_TIME: + { + aProp <<= (sal_Int32) getTime(); + } + break; + case BASEPROPERTY_TIMEMIN: + { + aProp <<= (sal_Int32) getMin(); + } + break; + case BASEPROPERTY_TIMEMAX: + { + aProp <<= (sal_Int32) getMax(); + } + break; + default: + { + aProp <<= VCLXFormattedSpinField::getProperty( PropertyName ); + } + } + } + return aProp; +} + +// ---------------------------------------------------- +// class VCLXNumericField +// ---------------------------------------------------- +VCLXNumericField::VCLXNumericField() +{ +} + +VCLXNumericField::~VCLXNumericField() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXNumericField::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::awt::XNumericField*, this ) ); + return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXNumericField ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ), + VCLXFormattedSpinField::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXNumericField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); + if ( pNumericFormatter ) + { + // z.B. 105, 2 Digits => 1,05 + // ein float 1,05 muss also eine 105 einstellen... + pNumericFormatter->SetValue( + ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) ); + } +} + +double VCLXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); + return pNumericFormatter + ? ImplCalcDoubleValue( (double)pNumericFormatter->GetValue(), pNumericFormatter->GetDecimalDigits() ) + : 0; +} + +void VCLXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); + if ( pNumericFormatter ) + pNumericFormatter->SetMin( + ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) ); +} + +double VCLXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); + return pNumericFormatter + ? ImplCalcDoubleValue( (double)pNumericFormatter->GetMin(), pNumericFormatter->GetDecimalDigits() ) + : 0; +} + +void VCLXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); + if ( pNumericFormatter ) + pNumericFormatter->SetMax( + ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) ); +} + +double VCLXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); + return pNumericFormatter + ? ImplCalcDoubleValue( (double)pNumericFormatter->GetMax(), pNumericFormatter->GetDecimalDigits() ) + : 0; +} + +void VCLXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericField* pNumericField = (NumericField*) GetWindow(); + if ( pNumericField ) + pNumericField->SetFirst( + ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) ); +} + +double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericField* pNumericField = (NumericField*) GetWindow(); + return pNumericField + ? ImplCalcDoubleValue( (double)pNumericField->GetFirst(), pNumericField->GetDecimalDigits() ) + : 0; +} + +void VCLXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericField* pNumericField = (NumericField*) GetWindow(); + if ( pNumericField ) + pNumericField->SetLast( + ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) ); +} + +double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericField* pNumericField = (NumericField*) GetWindow(); + return pNumericField + ? ImplCalcDoubleValue( (double)pNumericField->GetLast(), pNumericField->GetDecimalDigits() ) + : 0; +} + +void VCLXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) +{ + VCLXFormattedSpinField::setStrictFormat( bStrict ); +} + +sal_Bool VCLXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) +{ + return VCLXFormattedSpinField::isStrictFormat(); +} + + +void VCLXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericField* pNumericField = (NumericField*) GetWindow(); + if ( pNumericField ) + pNumericField->SetSpinSize( + ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) ); +} + +double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericField* pNumericField = (NumericField*) GetWindow(); + return pNumericField + ? ImplCalcDoubleValue( (double)pNumericField->GetSpinSize(), pNumericField->GetDecimalDigits() ) + : 0; +} + +void VCLXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); + if ( pNumericFormatter ) + { + double n = getValue(); + pNumericFormatter->SetDecimalDigits( Value ); + setValue( n ); + } +} + +sal_Int16 VCLXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); + return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0; +} + +void VCLXNumericField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_VALUE_DOUBLE: + { + if ( bVoid ) + { + ((NumericField*)GetWindow())->EnableEmptyFieldValue( sal_True ); + ((NumericField*)GetWindow())->SetEmptyFieldValue(); + } + else + { + double d; + if ( Value >>= d ) + setValue( d ); + } + } + break; + case BASEPROPERTY_VALUEMIN_DOUBLE: + { + double d; + if ( Value >>= d ) + setMin( d ); + } + break; + case BASEPROPERTY_VALUEMAX_DOUBLE: + { + double d; + if ( Value >>= d ) + setMax( d ); + } + break; + case BASEPROPERTY_VALUESTEP_DOUBLE: + { + double d; + if ( Value >>= d ) + setSpinSize( d ); + } + break; + case BASEPROPERTY_DECIMALACCURACY: + { + sal_Int16 n; + if ( Value >>= n ) + setDecimalDigits( n ); + } + break; + default: + { + VCLXFormattedSpinField::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXNumericField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + FormatterBase* pFormatter = GetFormatter(); + if ( pFormatter ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_VALUE_DOUBLE: + { + aProp <<= (double) getValue(); + } + break; + case BASEPROPERTY_VALUEMIN_DOUBLE: + { + aProp <<= (double) getMin(); + } + break; + case BASEPROPERTY_VALUEMAX_DOUBLE: + { + aProp <<= (double) getMax(); + } + break; + case BASEPROPERTY_VALUESTEP_DOUBLE: + { + aProp <<= (double) getSpinSize(); + } + break; + default: + { + aProp <<= VCLXFormattedSpinField::getProperty( PropertyName ); + } + } + } + return aProp; +} + + +// ---------------------------------------------------- +// class VCLXCurrencyField +// ---------------------------------------------------- +VCLXCurrencyField::VCLXCurrencyField() +{ +} + +VCLXCurrencyField::~VCLXCurrencyField() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXCurrencyField::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::awt::XCurrencyField*, this ) ); + return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXCurrencyField ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ), + VCLXFormattedSpinField::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); + if ( pCurrencyFormatter ) + { + // z.B. 105, 2 Digits => 1,05 + // ein float 1,05 muss also eine 105 einstellen... + pCurrencyFormatter->SetValue( + ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) ); + } +} + +double VCLXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); + return pCurrencyFormatter + ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetValue(), pCurrencyFormatter->GetDecimalDigits() ) + : 0; +} + +void VCLXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); + if ( pCurrencyFormatter ) + pCurrencyFormatter->SetMin( + ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) ); +} + +double VCLXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); + return pCurrencyFormatter + ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMin(), pCurrencyFormatter->GetDecimalDigits() ) + : 0; +} + +void VCLXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); + if ( pCurrencyFormatter ) + pCurrencyFormatter->SetMax( + ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) ); +} + +double VCLXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); + return pCurrencyFormatter + ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMax(), pCurrencyFormatter->GetDecimalDigits() ) + : 0; +} + +void VCLXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); + if ( pCurrencyField ) + pCurrencyField->SetFirst( + ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) ); +} + +double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); + return pCurrencyField + ? ImplCalcDoubleValue( (double)pCurrencyField->GetFirst(), pCurrencyField->GetDecimalDigits() ) + : 0; +} + +void VCLXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); + if ( pCurrencyField ) + pCurrencyField->SetLast( + ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) ); +} + +double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); + return pCurrencyField + ? ImplCalcDoubleValue( (double)pCurrencyField->GetLast(), pCurrencyField->GetDecimalDigits() ) + : 0; +} + +void VCLXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); + if ( pCurrencyField ) + pCurrencyField->SetSpinSize( + ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) ); +} + +double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); + return pCurrencyField + ? ImplCalcDoubleValue( (double)pCurrencyField->GetSpinSize(), pCurrencyField->GetDecimalDigits() ) + : 0; +} + +void VCLXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) +{ + VCLXFormattedSpinField::setStrictFormat( bStrict ); +} + +sal_Bool VCLXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) +{ + return VCLXFormattedSpinField::isStrictFormat(); +} + + +void VCLXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); + if ( pCurrencyFormatter ) + { + double n = getValue(); + pCurrencyFormatter->SetDecimalDigits( Value ); + setValue( n ); + } +} + +sal_Int16 VCLXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); + return pCurrencyFormatter ? pCurrencyFormatter->GetDecimalDigits() : 0; +} + +void VCLXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_VALUE_DOUBLE: + { + if ( bVoid ) + { + ((LongCurrencyField*)GetWindow())->EnableEmptyFieldValue( sal_True ); + ((LongCurrencyField*)GetWindow())->SetEmptyFieldValue(); + } + else + { + double d; + if ( Value >>= d ) + setValue( d ); + } + } + break; + case BASEPROPERTY_VALUEMIN_DOUBLE: + { + double d; + if ( Value >>= d ) + setMin( d ); + } + break; + case BASEPROPERTY_VALUEMAX_DOUBLE: + { + double d; + if ( Value >>= d ) + setMax( d ); + } + break; + case BASEPROPERTY_VALUESTEP_DOUBLE: + { + double d; + if ( Value >>= d ) + setSpinSize( d ); + } + break; + case BASEPROPERTY_DECIMALACCURACY: + { + sal_Int16 n; + if ( Value >>= n ) + setDecimalDigits( n ); + } + break; + default: + { + VCLXFormattedSpinField::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXCurrencyField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + FormatterBase* pFormatter = GetFormatter(); + if ( pFormatter ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_VALUE_DOUBLE: + { + aProp <<= (double) getValue(); + } + break; + case BASEPROPERTY_VALUEMIN_DOUBLE: + { + aProp <<= (double) getMin(); + } + break; + case BASEPROPERTY_VALUEMAX_DOUBLE: + { + aProp <<= (double) getMax(); + } + break; + case BASEPROPERTY_VALUESTEP_DOUBLE: + { + aProp <<= (double) getSpinSize(); + } + break; + default: + { + aProp <<= VCLXFormattedSpinField::getProperty( PropertyName ); + } + } + } + return aProp; +} + +// ---------------------------------------------------- +// class VCLXPatternField +// ---------------------------------------------------- +VCLXPatternField::VCLXPatternField() +{ +} + +VCLXPatternField::~VCLXPatternField() +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any VCLXPatternField::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::awt::XPatternField*, this ) ); + return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( VCLXPatternField ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPatternField>* ) NULL ), + VCLXFormattedSpinField::getTypes() +IMPL_XTYPEPROVIDER_END + +void VCLXPatternField::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + PatternField* pPatternField = (PatternField*) GetWindow(); + if ( pPatternField ) + { + pPatternField->SetMask( ByteString( UniString( EditMask ), RTL_TEXTENCODING_ASCII_US ), LiteralMask ); + } +} + +void VCLXPatternField::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + PatternField* pPatternField = (PatternField*) GetWindow(); + if ( pPatternField ) + { + EditMask = String( pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US ); + LiteralMask = pPatternField->GetLiteralMask(); + } +} + +void VCLXPatternField::setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + PatternField* pPatternField = (PatternField*) GetWindow(); + if ( pPatternField ) + { + pPatternField->SetString( Str ); + } +} + +::rtl::OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::rtl::OUString aString; + PatternField* pPatternField = (PatternField*) GetWindow(); + if ( pPatternField ) + aString = pPatternField->GetString(); + return aString; +} + +void VCLXPatternField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) +{ + VCLXFormattedSpinField::setStrictFormat( bStrict ); +} + +sal_Bool VCLXPatternField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) +{ + return VCLXFormattedSpinField::isStrictFormat(); +} + +void VCLXPatternField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_EDITMASK: + case BASEPROPERTY_LITERALMASK: + { + ::rtl::OUString aString; + if ( Value >>= aString ) + { + ::rtl::OUString aEditMask, aLiteralMask; + getMasks( aEditMask, aLiteralMask ); + if ( nPropType == BASEPROPERTY_EDITMASK ) + aEditMask = aString; + else + aLiteralMask = aString; + setMasks( aEditMask, aLiteralMask ); + } + } + break; + default: + { + VCLXFormattedSpinField::setProperty( PropertyName, Value ); + } + } + } +} + +::com::sun::star::uno::Any VCLXPatternField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aProp; + if ( GetWindow() ) + { + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) + { + case BASEPROPERTY_EDITMASK: + case BASEPROPERTY_LITERALMASK: + { + ::rtl::OUString aEditMask, aLiteralMask; + getMasks( aEditMask, aLiteralMask ); + if ( nPropType == BASEPROPERTY_EDITMASK ) + aProp <<= aEditMask; + else + aProp <<= aLiteralMask; + } + break; + default: + { + aProp <<= VCLXFormattedSpinField::getProperty( PropertyName ); + } + } + } + return aProp; +} + + + diff --git a/toolkit/source/controls/makefile.mk b/toolkit/source/controls/makefile.mk new file mode 100644 index 000000000000..e2f5d805655a --- /dev/null +++ b/toolkit/source/controls/makefile.mk @@ -0,0 +1,90 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=toolkit +TARGET=controls + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/stdtabcontroller.obj \ + $(SLO)$/stdtabcontrollermodel.obj \ + $(SLO)$/unocontrol.obj \ + $(SLO)$/unocontrolbase.obj \ + $(SLO)$/unocontrolcontainer.obj \ + $(SLO)$/unocontrolcontainermodel.obj \ + $(SLO)$/unocontrolmodel.obj \ + $(SLO)$/unocontrols.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx new file mode 100644 index 000000000000..6d36fdd6b567 --- /dev/null +++ b/toolkit/source/controls/stdtabcontroller.cxx @@ -0,0 +1,440 @@ +/************************************************************************* + * + * $RCSfile: stdtabcontroller.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_ +#include <com/sun/star/awt/XVclContainerPeer.hpp> +#endif + +#include <toolkit/controls/stdtabcontroller.hxx> +#include <toolkit/controls/stdtabcontrollermodel.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/helper/macros.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <tools/debug.hxx> +#include <vcl/window.hxx> + +#include <unotools/sequence.hxx> + +// ---------------------------------------------------- +// class StdTabController +// ---------------------------------------------------- +StdTabController::StdTabController() +{ +} + +StdTabController::~StdTabController() +{ +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > StdTabController::ImplFindControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rCtrls, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & rxCtrlModel ) const +{ + +/* + // MT: Funktioniert nicht mehr, weil ich nicht mehr bei mir angemeldet bin, + // weil DG das abfaengt. + + // #54677# Beim Laden eines HTML-Dokuments wird nach jedem Control ein + // activateTabOrder gerufen und jede Menge Zeit in dieser Methode verbraten. + // Die Anzahl dieser Schleifendurchlaufe steigt quadratisch, also versuchen + // das Control direkt vom Model zu erhalten. + // => Wenn genau ein Control als PropertyChangeListener angemeldet ist, + // dann muss das auch das richtige sein. + + UnoControlModel* pUnoCtrlModel = UnoControlModel::GetImplementation( rxCtrlModel ); + + + if ( pUnoCtrlModel ) + { + ListenerIterator aIt( pUnoCtrlModel->maPropertiesListeners ); + while( aIt.hasMoreElements() ) + { + XEventListener* pL = aIt.next(); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xC( pL, ::com::sun::star::uno::UNO_QUERY ); + if ( xC.is() ) + { + if( xC->getContext() == mxControlContainer ) + { + xCtrl = xC; + break; + } + } + } + } + if ( !xCtrl.is() && rxCtrlModel.is()) +*/ + DBG_ASSERT( rxCtrlModel.is(), "ImplFindControl - welches ?!" ); + + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pCtrls = rCtrls.getConstArray(); + sal_uInt32 nCtrls = rCtrls.getLength(); + for ( sal_uInt32 n = 0; n < nCtrls; n++ ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xModel(pCtrls[n].is() ? pCtrls[n]->getModel() : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ()); + if ( (::com::sun::star::awt::XControlModel*)xModel.get() == (::com::sun::star::awt::XControlModel*)rxCtrlModel.get() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl( pCtrls[n] ); + ::utl::removeElementAt( rCtrls, n ); + return xCtrl; + } + } + return ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > (); +} + +sal_Bool StdTabController::ImplCreateComponentSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rControls, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rModels, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& rComponents, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>* pTabStops, sal_Bool bPeerComponent ) const +{ + sal_Bool bOK = sal_True; + + // nur die wirklich geforderten Controls + sal_uInt32 nModels = rModels.getLength(); + if (nModels != rControls.getLength()) + { + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >(nModels); + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pModels = rModels.getConstArray(); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCurrentModel; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCurrentControl; + + sal_uInt32 nRealControls = 0; + for (sal_uInt32 n = 0; n < nModels; ++n) + { + xCurrentModel = pModels[n]; + xCurrentControl = ImplFindControl(rControls, xCurrentModel); + if (xCurrentControl.is()) + aSeq.getArray()[nRealControls++] = xCurrentControl; + } + aSeq.realloc(nRealControls); + rControls = aSeq; + } + + + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pControls = rControls.getConstArray(); + sal_uInt32 nCtrls = rControls.getLength(); + rComponents = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >( nCtrls ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComps = rComponents.getArray(); + ::com::sun::star::uno::Any* pTabs = NULL; + + + if ( pTabStops ) + { + *pTabStops = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>( nCtrls ); + pTabs = pTabStops->getArray(); + } + + for ( sal_uInt32 n = 0; bOK && ( n < nCtrls ); n++ ) + { + // Zum Model passendes Control suchen + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl(pControls[n]); + if ( xCtrl.is() ) + { + if (bPeerComponent) + pComps[n] = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > (xCtrl->getPeer(), ::com::sun::star::uno::UNO_QUERY); + else + pComps[n] = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > (xCtrl, ::com::sun::star::uno::UNO_QUERY); + + // TabStop-::com::sun::star::beans::Property + if ( pTabs ) + { + // opt: String fuer TabStop als Konstante + static const ::rtl::OUString aTabStopName( ::rtl::OUString::createFromAscii( "Tabstop" ) ); + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( xCtrl->getModel(), ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = xPSet->getPropertySetInfo(); + if( xInfo->hasPropertyByName( aTabStopName ) ) + pTabs[n] = xPSet->getPropertyValue( aTabStopName ); + } + } + else + { + DBG_TRACE( "ImplCreateComponentSequence: Control not found" ); + bOK = sal_False; + } + } + return bOK; +} + +void StdTabController::ImplActivateControl( sal_Bool bFirst ) const +{ + // HACK wegen #53688#, muss auf ein Interface abgebildet werden, wenn Controls Remote liegen koennen. + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > xTabController(const_cast< ::cppu::OWeakObject* >(static_cast< const ::cppu::OWeakObject* >(this)), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = xTabController->getControls(); + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pControls = aCtrls.getConstArray(); + sal_uInt32 nCount = aCtrls.getLength(); + + for ( sal_uInt32 n = bFirst ? 0 : nCount; bFirst ? ( n < nCount ) : n; ) + { + sal_uInt32 nCtrl = bFirst ? n++ : --n; + DBG_ASSERT( pControls[nCtrl].is(), "Control nicht im ::com::sun::star::sdbcx::Container!" ); + if ( pControls[nCtrl].is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xCP = pControls[nCtrl]->getPeer(); + if ( xCP.is() ) + { + VCLXWindow* pC = VCLXWindow::GetImplementation( xCP ); + if ( pC && pC->GetWindow() && ( pC->GetWindow()->GetStyle() & WB_TABSTOP ) ) + { + pC->GetWindow()->GrabFocus(); + break; + } + } + } + } +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any StdTabController::queryAggregation( 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::awt::XTabController*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( StdTabController ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController>* ) NULL ) +IMPL_XTYPEPROVIDER_END + +void StdTabController::setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& Model ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mxModel = Model; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > StdTabController::getModel( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mxModel; +} + +void StdTabController::setContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& Container ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mxControlContainer = Container; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > StdTabController::getContainer( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mxControlContainer; +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > StdTabController::getControls( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aSeq; + + if ( mxControlContainer.is() ) + { + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aModels = mxModel->getControlModels(); + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pModels = aModels.getConstArray(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > xCtrls = mxControlContainer->getControls(); + + sal_uInt32 nCtrls = aModels.getLength(); + aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >( nCtrls ); + for ( sal_uInt32 n = 0; n < nCtrls; n++ ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrlModel = pModels[n]; + // Zum Model passendes Control suchen + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl = ImplFindControl( xCtrls, xCtrlModel ); + aSeq.getArray()[n] = xCtrl; + } + } + return aSeq; +} + +void StdTabController::autoTabOrder( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + DBG_ASSERT( mxControlContainer.is(), "autoTabOrder: No ControlContainer!" ); + if ( !mxControlContainer.is() ) + return; + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = mxModel->getControlModels(); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aCompSeq; + + // vieleicht erhalte ich hier einen TabController, + // der schneller die Liste meiner Controls ermittelt + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aControls = xTabController->getControls(); + + // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im ::com::sun::star::sdbcx::Container, + // dann kommt spaeter nochmal ein autoTabOrder... + if( !ImplCreateComponentSequence( aControls, aSeq, aCompSeq, NULL, sal_False ) ) + return; + + sal_uInt32 nCtrls = aCompSeq.getLength(); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComponents = aCompSeq.getArray(); + + ComponentEntryList aCtrls; + sal_uInt32 n; + for ( n = 0; n < nCtrls; n++ ) + { + ::com::sun::star::awt::XWindow* pC = (::com::sun::star::awt::XWindow*)pComponents[n].get(); + ComponentEntry* pE = new ComponentEntry; + pE->pComponent = pC; + ::com::sun::star::awt::Rectangle aPosSize = pC->getPosSize(); + pE->aPos.X() = aPosSize.X; + pE->aPos.Y() = aPosSize.Y; + + sal_uInt16 nPos; + for ( nPos = 0; nPos < aCtrls.Count(); nPos++ ) + { + ComponentEntry* pEntry = aCtrls.GetObject( nPos ); + if ( pEntry->aPos.Y() >= pE->aPos.Y() ) + { + while ( pEntry && ( pEntry->aPos.Y() == pE->aPos.Y() ) + && ( pEntry->aPos.X() < pE->aPos.X() ) ) + { + pEntry = aCtrls.GetObject( ++nPos ); + } + break; + } + } + aCtrls.Insert( pE, nPos ); + } + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aNewSeq( nCtrls ); + for ( n = 0; n < nCtrls; n++ ) + { + ComponentEntry* pE = aCtrls.GetObject( n ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xUC( pE->pComponent, ::com::sun::star::uno::UNO_QUERY ); + aNewSeq.getArray()[n] = xUC->getModel(); + delete pE; + } + aCtrls.Clear(); + + mxModel->setControlModels( aNewSeq ); +} + +void StdTabController::activateTabOrder( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + // Am ::com::sun::star::sdbcx::Container die Tab-Reihenfolge aktivieren... + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xC( mxControlContainer, ::com::sun::star::uno::UNO_QUERY ); + if ( !xC.is() || !xC->getPeer().is() ) + return; + + // vieleicht erhalte ich hier einen TabController, + // der schneller die Liste meiner Controls ermittelt + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), ::com::sun::star::uno::UNO_QUERY); + + // Flache Liste besorgen... + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = mxModel->getControlModels(); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aCompSeq; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aTabSeq; + + // DG: Aus Optimierungsgruenden werden die Controls mittels getControls() geholt, + // dieses hoert sich zwar wiedersinning an, fuehrt aber im konkreten Fall (Forms) zu sichtbaren + // Geschwindigkeitsvorteilen + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = xTabController->getControls(); + + // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im ::com::sun::star::sdbcx::Container, + // dann kommt spaeter nochmal ein activateTabOrder... + if( !ImplCreateComponentSequence( aCtrls, aSeq, aCompSeq, &aTabSeq, sal_True ) ) + return; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerPeer > xVclContainerPeer( xC->getPeer(), ::com::sun::star::uno::UNO_QUERY ); + + xVclContainerPeer->setTabOrder( aCompSeq, aTabSeq, mxModel->getGroupControl() ); + + // Gruppen... + aCtrls = xTabController->getControls(); + + ::rtl::OUString aName; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aGroupSeq; + sal_uInt32 nGroups = mxModel->getGroupCount(); + for ( sal_uInt32 nG = 0; nG < nGroups; nG++ ) + { + mxModel->getGroup( nG, aGroupSeq, aName ); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aCompSeq; + ImplCreateComponentSequence( aCtrls, aGroupSeq, aCompSeq, NULL, sal_True ); + xVclContainerPeer->setGroup( aCompSeq ); + } +} + +void StdTabController::activateFirst( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ImplActivateControl( sal_True ); +} + +void StdTabController::activateLast( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ImplActivateControl( sal_False ); +} + diff --git a/toolkit/source/controls/stdtabcontrollermodel.cxx b/toolkit/source/controls/stdtabcontrollermodel.cxx new file mode 100644 index 000000000000..4d5661be940c --- /dev/null +++ b/toolkit/source/controls/stdtabcontrollermodel.cxx @@ -0,0 +1,442 @@ +/************************************************************************* + * + * $RCSfile: stdtabcontrollermodel.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_ +#include <com/sun/star/io/XMarkableStream.hpp> +#endif + +#include <toolkit/controls/stdtabcontrollermodel.hxx> +#include <toolkit/helper/macros.hxx> +#include <toolkit/helper/servicenames.hxx> +#include <toolkit/helper/property.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <tools/debug.hxx> + +#define UNOCONTROL_STREAMVERSION (short)2 + +// ---------------------------------------------------- +// class UnoControlModelEntryList +// ---------------------------------------------------- +UnoControlModelEntryList::UnoControlModelEntryList() +{ +} + +UnoControlModelEntryList::~UnoControlModelEntryList() +{ + Reset(); +} + +void UnoControlModelEntryList::Reset() +{ + for ( sal_uInt32 n = Count(); n; ) + DestroyEntry( --n ); +} + +void UnoControlModelEntryList::DestroyEntry( sal_uInt32 nEntry ) +{ + UnoControlModelEntry* pEntry = GetObject( nEntry ); + + if ( pEntry->bGroup ) + delete pEntry->pGroup; + else + delete pEntry->pxControl; + + Remove( nEntry ); + delete pEntry; +} + +// ---------------------------------------------------- +// class StdTabControllerModel +// ---------------------------------------------------- +StdTabControllerModel::StdTabControllerModel() +{ + mbGroupControl = sal_True; +} + +StdTabControllerModel::~StdTabControllerModel() +{ +} + +sal_uInt32 StdTabControllerModel::ImplGetControlCount( const UnoControlModelEntryList& rList ) const +{ + sal_uInt32 nCount = 0; + sal_uInt32 nEntries = rList.Count(); + for ( sal_uInt32 n = 0; n < nEntries; n++ ) + { + UnoControlModelEntry* pEntry = rList.GetObject( n ); + if ( pEntry->bGroup ) + nCount += ImplGetControlCount( *pEntry->pGroup ); + else + nCount++; + } + return nCount; +} + +void StdTabControllerModel::ImplGetControlModels( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ** ppRefs, const UnoControlModelEntryList& rList ) const +{ + sal_uInt32 nEntries = rList.Count(); + for ( sal_uInt32 n = 0; n < nEntries; n++ ) + { + UnoControlModelEntry* pEntry = rList.GetObject( n ); + if ( pEntry->bGroup ) + ImplGetControlModels( ppRefs, *pEntry->pGroup ); + else + { + **ppRefs = *pEntry->pxControl; + (*ppRefs)++; + } + } +} + +void StdTabControllerModel::ImplSetControlModels( UnoControlModelEntryList& rList, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) const +{ + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = Controls.getConstArray(); + sal_uInt32 nControls = Controls.getLength(); + for ( sal_uInt32 n = 0; n < nControls; n++ ) + { + UnoControlModelEntry* pNewEntry = new UnoControlModelEntry; + pNewEntry->bGroup = sal_False; + pNewEntry->pxControl = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ; + *pNewEntry->pxControl = pRefs[n]; + rList.Insert( pNewEntry, LIST_APPEND ); + } +} + +sal_uInt32 StdTabControllerModel::ImplGetControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrl, const UnoControlModelEntryList& rList ) const +{ + for ( sal_uInt32 n = rList.Count(); n; ) + { + UnoControlModelEntry* pEntry = rList.GetObject( --n ); + if ( !pEntry->bGroup && ( *pEntry->pxControl == xCtrl ) ) + return n; + } + return CONTROLPOS_NOTFOUND; +} + +void ImplWriteControls( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rCtrls ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY ); + DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" ); + + sal_uInt32 nStoredControls = 0; + sal_Int32 nDataBeginMark = xMark->createMark(); + + OutStream->writeLong( 0L ); // DataLen + OutStream->writeLong( 0L ); // nStoredControls + + sal_uInt32 nCtrls = rCtrls.getLength(); + for ( sal_uInt32 n = 0; n < nCtrls; n++ ) + { + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xI = rCtrls.getConstArray()[n]; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xPO( xI, ::com::sun::star::uno::UNO_QUERY ); + DBG_ASSERT( xPO.is(), "write: Control doesn't support XPersistObject" ); + if ( xPO.is() ) + { + OutStream->writeObject( xPO ); + nStoredControls++; + } + } + sal_Int32 nDataLen = xMark->offsetToMark( nDataBeginMark ); + xMark->jumpToMark( nDataBeginMark ); + OutStream->writeLong( nDataLen ); + OutStream->writeLong( nStoredControls ); + xMark->jumpToFurthest(); + xMark->deleteMark(nDataBeginMark); +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > ImplReadControls( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > & InStream ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( InStream, ::com::sun::star::uno::UNO_QUERY ); + DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" ); + + sal_Int32 nDataBeginMark = xMark->createMark(); + + sal_Int32 nDataLen = InStream->readLong(); + sal_uInt32 nCtrls = InStream->readLong(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq( nCtrls ); + for ( sal_uInt32 n = 0; n < nCtrls; n++ ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xObj = InStream->readObject(); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xI( xObj, ::com::sun::star::uno::UNO_QUERY ); + aSeq.getArray()[n] = xI; + } + + // Falls bereits mehr drinsteht als diese Version kennt: + xMark->jumpToMark( nDataBeginMark ); + InStream->skipBytes( nDataLen ); + xMark->deleteMark(nDataBeginMark); + return aSeq; +} + + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any StdTabControllerModel::queryAggregation( 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::awt::XTabControllerModel*, this ), + SAL_STATIC_CAST( ::com::sun::star::io::XPersistObject*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( StdTabControllerModel ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject>* ) NULL ) +IMPL_XTYPEPROVIDER_END + +sal_Bool StdTabControllerModel::getGroupControl( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mbGroupControl; +} + +void StdTabControllerModel::setGroupControl( sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mbGroupControl = GroupControl; +} + +void StdTabControllerModel::setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maControls.Reset(); + ImplSetControlModels( maControls, Controls ); +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > StdTabControllerModel::getControlModels( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq( ImplGetControlCount( maControls ) ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = aSeq.getArray(); + ImplGetControlModels( &pRefs, maControls ); + return aSeq; +} + +void StdTabControllerModel::setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + // Die Controls stehen eventuel flach in der Liste und werden jetzt gruppiert. + // Verschachtelte Gruppen sind erstmal nicht moeglich... + // Das erste Element der Gruppe welches auch schon in der flachen Liste + // stand bestimmt die Position der Gruppe. + + UnoControlModelEntry* pNewEntry = new UnoControlModelEntry; + pNewEntry->bGroup = sal_True; + pNewEntry->pGroup = new UnoControlModelEntryList; + pNewEntry->pGroup->SetName( GroupName ); + ImplSetControlModels( *pNewEntry->pGroup, Group ); + + sal_Bool bInserted = sal_False; + sal_uInt32 nElements = pNewEntry->pGroup->Count(); + for ( sal_uInt32 n = 0; n < nElements; n++ ) + { + UnoControlModelEntry* pEntry = pNewEntry->pGroup->GetObject( n ); + if ( !pEntry->bGroup ) + { + sal_uInt32 nPos = ImplGetControlPos( *pEntry->pxControl, maControls ); + // Eigentlich sollten alle Controls vorher in der flachen Liste stehen + DBG_ASSERT( nPos != CONTROLPOS_NOTFOUND, "setGroup - Element not found" ); + if ( nPos != CONTROLPOS_NOTFOUND ) + { + maControls.DestroyEntry( nPos ); + if ( !bInserted ) + { + maControls.Insert( pNewEntry, nPos ); + bInserted = sal_True; + } + } + } + } + if ( !bInserted ) + maControls.Insert( pNewEntry, LIST_APPEND ); +} + +sal_Int32 StdTabControllerModel::getGroupCount( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + // erstmal nur eine Ebene... + // Das Model und die Impl-Methoden arbeiten zwar rekursiv, aber das wird + // erstmal nich nach aussen gegeben. + + sal_Int32 nGroups = 0; + sal_uInt32 nEntries = maControls.Count(); + for ( sal_uInt32 n = 0; n < nEntries; n++ ) + { + UnoControlModelEntry* pEntry = maControls.GetObject( n ); + if ( pEntry->bGroup ) + nGroups++; + } + return nGroups; +} + +void StdTabControllerModel::getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rGroup, ::rtl::OUString& rName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq; + sal_uInt32 nG = 0; + sal_uInt32 nEntries = maControls.Count(); + for ( sal_uInt32 n = 0; n < nEntries; n++ ) + { + UnoControlModelEntry* pEntry = maControls.GetObject( n ); + if ( pEntry->bGroup ) + { + if ( nG == nGroup ) + { + sal_uInt32 nCount = ImplGetControlCount( *pEntry->pGroup ); + aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >( nCount ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = aSeq.getArray(); + ImplGetControlModels( &pRefs, *pEntry->pGroup ); + rName = pEntry->pGroup->GetName(); + break; + } + nG++; + } + } + rGroup = aSeq; +} + +void StdTabControllerModel::getGroupByName( const ::rtl::OUString& rName, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rGroup ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_uInt32 nGroup = 0; + sal_uInt32 nEntries = maControls.Count(); + for ( sal_uInt32 n = 0; n < nEntries; n++ ) + { + UnoControlModelEntry* pEntry = maControls.GetObject( n ); + if ( pEntry->bGroup ) + { + if ( pEntry->pGroup->GetName() == rName ) + { + ::rtl::OUString Dummy; + getGroup( nGroup, rGroup, Dummy ); + break; + } + nGroup++; + } + } +} + + +// ::com::sun::star::io::XPersistObject +::rtl::OUString StdTabControllerModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException) +{ + return ::rtl::OUString::createFromAscii( szServiceName_TabControllerModel ); +} + +void StdTabControllerModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY ); + DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" ); + + OutStream->writeShort( UNOCONTROL_STREAMVERSION ); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aCtrls = getControlModels(); + ImplWriteControls( OutStream, aCtrls ); + + sal_uInt32 nGroups = getGroupCount(); + OutStream->writeLong( nGroups ); + for ( sal_uInt32 n = 0; n < nGroups; n++ ) + { + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aGroupCtrls; + ::rtl::OUString aGroupName; + getGroup( n, aGroupCtrls, aGroupName ); + OutStream->writeUTF( aGroupName ); + ImplWriteControls( OutStream, aGroupCtrls ); + } +} + +void StdTabControllerModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + short nVersion = InStream->readShort(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = ImplReadControls( InStream ); + setControlModels( aSeq ); + + sal_uInt32 nGroups = InStream->readLong(); + for ( sal_uInt32 n = 0; n < nGroups; n++ ) + { + ::rtl::OUString aGroupName = InStream->readUTF(); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aCtrlSeq = ImplReadControls( InStream ); + setGroup( aCtrlSeq, aGroupName ); + } +} + + + + + diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx new file mode 100644 index 000000000000..823be57cc4f3 --- /dev/null +++ b/toolkit/source/controls/unocontrol.cxx @@ -0,0 +1,916 @@ +/************************************************************************* + * + * $RCSfile: unocontrol.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_ +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_ +#include <com/sun/star/awt/XControlContainer.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_WINDOWATTRIBUTE_HPP_ +#include <com/sun/star/awt/WindowAttribute.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_ +#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> +#endif + +#ifndef _COM_SUN_STAR_LAN_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +#include <toolkit/controls/unocontrol.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <tools/string.hxx> +#include <tools/table.hxx> +#include <tools/date.hxx> +#include <tools/time.hxx> +#include <tools/urlobj.hxx> +#include <tools/debug.hxx> + +#include <vcl/svapp.hxx> +#include <vcl/wrkwin.hxx> + +#include <toolkit/helper/property.hxx> +#include <toolkit/helper/servicenames.hxx> + +WorkWindow* lcl_GetDefaultWindow() +{ + static WorkWindow* pW = NULL; + if ( !pW ) + pW = new WorkWindow( NULL, 0 ); + return pW; +} + +static ::com::sun::star::uno::Sequence< ::rtl::OUString> lcl_ImplGetPropertyNames( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > & rxModel ) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString> aNames; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xPSInf = rxModel->getPropertySetInfo(); + DBG_ASSERT( xPSInf.is(), "UpdateFromModel: No PropertySetInfo!" ); + if ( xPSInf.is() ) + { + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aProps = xPSInf->getProperties(); + sal_Int32 nLen = aProps.getLength(); + aNames = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nLen ); + ::rtl::OUString* pNames = aNames.getArray() + nLen - 1; + const ::com::sun::star::beans::Property* pProps = aProps.getConstArray() + nLen - 1; + for ( sal_uInt32 n = nLen; n; --n, --pProps, --pNames) + *pNames = pProps->Name; + } + return aNames; +} + +// ---------------------------------------------------- +// class UnoControl +// ---------------------------------------------------- +UnoControl::UnoControl() + : maDisposeListeners( *this ) + , maWindowListeners( *this ) + , maFocusListeners( *this ) + , maKeyListeners( *this ) + , maMouseListeners( *this ) + , maMouseMotionListeners( *this ) + , maPaintListeners( *this ) +{ + mbUpdatingModel = sal_False; + mbDisposePeer = sal_True; + mbRefeshingPeer = sal_False; + mbDesignMode = sal_False; +} + +UnoControl::~UnoControl() +{ +} + +::rtl::OUString UnoControl::GetComponentServiceName() +{ + return ::rtl::OUString(); +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP; + + if ( bAcceptExistingPeer ) + xP = mxPeer; + + if ( !xP.is() ) + { + // Peer unsichtbar erzeugen... + sal_Bool bVis = maComponentInfos.bVisible; + if( bVis ) + maComponentInfos.bVisible = sal_False; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xCurrentPeer = mxPeer; + mxPeer = NULL; + + // Ueber queryInterface, wegen Aggregation... + ::com::sun::star::uno::Any aAny = OWeakAggObject::queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>*)0) ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xMe; + aAny >>= xMe; + + xMe->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >(), lcl_GetDefaultWindow()->GetComponentInterface( sal_True ) ); + xP = mxPeer; + mxPeer = xCurrentPeer; + + if( bVis ) + maComponentInfos.bVisible = sal_True; + } + return xP; +} + +void UnoControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->setProperty( rPropName, rVal ); +} + +void UnoControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc ) +{ +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > UnoControl::getParentPeer() const +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xPeer; + if( mxContext.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xContComp( mxContext, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = xContComp->getPeer(); + if ( xP.is() ) + xP->queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >*)0) ) >>= xPeer; + } + return xPeer; +} + +void UnoControl::updateFromModel() +{ + // Alle standard Properties werden ausgelesen und in das Peer uebertragen + if( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > xPropSet( mxModel, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet ); + xPropSet->firePropertiesChangeEvent( aNames, this ); + } +} + + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoControl::queryAggregation( 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::awt::XControl*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XWindow*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XComponent*, SAL_STATIC_CAST( ::com::sun::star::awt::XControl*, this ) ), + SAL_STATIC_CAST( ::com::sun::star::awt::XView*, this ), + SAL_STATIC_CAST( ::com::sun::star::beans::XPropertiesChangeListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoControl ) +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>* ) NULL ), +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>* ) NULL ), +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView>* ) NULL ), +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener>* ) NULL ), +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) +IMPL_XTYPEPROVIDER_END + +void UnoControl::dispose( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if( mxPeer.is() && mbDisposePeer ) + { + mxPeer->dispose(); + mxPeer = NULL; + } + + ::com::sun::star::lang::EventObject aEvt; + aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this; + + maDisposeListeners.disposeAndClear(aEvt); + maWindowListeners.disposeAndClear(aEvt); + maFocusListeners.disposeAndClear(aEvt); + maKeyListeners.disposeAndClear(aEvt); + maMouseListeners.disposeAndClear(aEvt); + maMouseMotionListeners.disposeAndClear(aEvt); + maPaintListeners.disposeAndClear(aEvt); + + // Model wieder freigeben + setModel( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > () ); + setContext( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > () ); +} + +void UnoControl::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maDisposeListeners.addInterface( rxListener ); +} + +void UnoControl::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maDisposeListeners.removeInterface( rxListener ); +} + +// ::com::sun::star::beans::XPropertiesChangeListener +void UnoControl::propertiesChange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + // kommt von xModel + if( !IsUpdatingModel() && mxPeer.is() ) + { + Table aDependingValues; + sal_Int32 nLen = rEvents.getLength(); + for( sal_Int32 i = 0; i < nLen; i++ ) + { + const ::com::sun::star::beans::PropertyChangeEvent& rEvt = rEvents.getConstArray()[i]; + sal_uInt16 nPType = GetPropertyId( rEvt.PropertyName ); + if ( nPType && mbDesignMode && mbDisposePeer && !mbRefeshingPeer ) + { + // Im Design-Mode koennen sich Props aendern, die eine + // Neuerzeugung der Peer erfordern... + if ( ( nPType == BASEPROPERTY_BORDER ) || + ( nPType == BASEPROPERTY_MULTILINE ) || + ( nPType == BASEPROPERTY_DROPDOWN ) || + ( nPType == BASEPROPERTY_HSCROLL ) || + ( nPType == BASEPROPERTY_VSCROLL ) || + ( nPType == BASEPROPERTY_SPIN ) || + ( nPType == BASEPROPERTY_ALIGN ) ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xParent = getParentPeer(); + if ( xParent.is() ) + { + // Funktioniert beim Container nicht! + mxPeer->dispose(); + mxPeer = NULL; + mbRefeshingPeer = sal_True; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP( xParent, ::com::sun::star::uno::UNO_QUERY ); + // createPeer ueber Interface rufen, damit aggrigierende Klasse es mitbekommt + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xThis( (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this, ::com::sun::star::uno::UNO_QUERY ); + xThis->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), xP ); + mbRefeshingPeer = sal_False; + break; + } + } + } + if ( nPType && ( nLen > 1 ) && DoesDependOnOthers( nPType ) ) + { + // Properties die von anderen abhaengen erst hinterher einstellen, + // weil sie von anderen Properties abhaengig sind, die aber erst spaeter + // eingestellt werden, z.B. VALUE nach VALUEMIN/MAX. + aDependingValues.Insert( nPType, new ::com::sun::star::uno::Any( rEvt.NewValue ) ); + } + else + { + ImplSetPeerProperty( rEvt.PropertyName, rEvt.NewValue ); + } + } + + sal_uInt16 nDependings = aDependingValues.Count(); + if ( nDependings ) + { + for ( sal_uInt16 n = 0; n < nDependings; n++ ) + { + ::com::sun::star::uno::Any* pAny = (::com::sun::star::uno::Any*) aDependingValues.GetObject( n ); + sal_Int32 nPropId = aDependingValues.GetObjectKey( n ); + ::rtl::OUString aPropName = GetPropertyName( nPropId ); + ImplSetPeerProperty( aPropName, *pAny ); + delete pAny; + } + } + } +} + +void UnoControl::disposing( const ::com::sun::star::lang::EventObject& rEvt ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + // kommt von xModel, bei "Multible Inheritance" nicht unterschiedliche + // Typen vergleichen. + + if( mxModel == rEvt.Source ) + { + mxModel = NULL; + + // #62337# Ohne Model wollen wir nicht weiterleben + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xThis = this; + xThis->dispose(); + } +} + + +// ::com::sun::star::awt::XWindow +void UnoControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maComponentInfos.nX = X; + maComponentInfos.nY = Y; + maComponentInfos.nWidth = Width; + maComponentInfos.nHeight = Height; + maComponentInfos.nFlags = Flags; + + if( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->setPosSize( X, Y, Width, Height, Flags ); + } +} + +::com::sun::star::awt::Rectangle UnoControl::getPosSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return ::com::sun::star::awt::Rectangle( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight); +} + +void UnoControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + // Visible status ist Sache der ::com::sun::star::sdbcx::View + maComponentInfos.bVisible = bVisible; + if( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->setVisible( maComponentInfos.bVisible ); + } +} + +void UnoControl::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + // Enable status ist Sache der ::com::sun::star::sdbcx::View + maComponentInfos.bEnable = bEnable; + if( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->setEnable( maComponentInfos.bEnable ); + } +} + +void UnoControl::setFocus( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->setFocus(); + } +} + +void UnoControl::addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maWindowListeners.addInterface( rxListener ); + if( mxPeer.is() && maWindowListeners.getLength() == 1 ) + { + // erster Focus Listener, also am Peer anmelden + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->addWindowListener( &maWindowListeners ); + } +} + +void UnoControl::removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if( mxPeer.is() && maWindowListeners.getLength() == 1 ) + { + // letzter Focus Listener, also am Peer abmelden + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->removeWindowListener( &maWindowListeners ); + } + maWindowListeners.removeInterface( rxListener ); +} + +void UnoControl::addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maFocusListeners.addInterface( rxListener ); + if( mxPeer.is() && maFocusListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->addFocusListener( &maFocusListeners ); + } +} + +void UnoControl::removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if( mxPeer.is() && maFocusListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->removeFocusListener( &maFocusListeners ); + } + maFocusListeners.removeInterface( rxListener ); +} + +void UnoControl::addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maKeyListeners.addInterface( rxListener ); + if( mxPeer.is() && maKeyListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->addKeyListener( &maKeyListeners); + } +} + +void UnoControl::removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if( mxPeer.is() && maKeyListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->removeKeyListener( &maKeyListeners); + } + maKeyListeners.removeInterface( rxListener ); +} + +void UnoControl::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maMouseListeners.addInterface( rxListener ); + if( mxPeer.is() && maMouseListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );; + xW->addMouseListener( &maMouseListeners); + } +} + +void UnoControl::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if( mxPeer.is() && maMouseListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->removeMouseListener( &maMouseListeners); + } + maMouseListeners.removeInterface( rxListener ); +} + +void UnoControl::addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maMouseMotionListeners.addInterface( rxListener ); + if( mxPeer.is() && maMouseMotionListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->addMouseMotionListener( &maMouseMotionListeners); + } +} + +void UnoControl::removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if( mxPeer.is() && maMouseMotionListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->removeMouseMotionListener( &maMouseMotionListeners); + } + maMouseMotionListeners.removeInterface( rxListener ); +} + +void UnoControl::addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maPaintListeners.addInterface( rxListener ); + if( mxPeer.is() && maPaintListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->addPaintListener( &maPaintListeners ); + } +} + +void UnoControl::removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if( mxPeer.is() && maPaintListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->removePaintListener( &maPaintListeners ); + } + maPaintListeners.removeInterface( rxListener ); +} + +// ::com::sun::star::awt::XView +sal_Bool UnoControl::setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& rDevice ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mxGraphics = rDevice; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > xV( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + if ( xV.is() ) + xV->setGraphics( mxGraphics ); + } + return sal_True; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > UnoControl::getGraphics( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mxGraphics; +} + +::com::sun::star::awt::Size UnoControl::getSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + return ::com::sun::star::awt::Size( maComponentInfos.nWidth, maComponentInfos.nHeight ); +} + +void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True ); + DBG_ASSERT( xP.is(), "Layout: No Peer!" ); + if ( xP.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > xV( xP, ::com::sun::star::uno::UNO_QUERY ); + xV->draw( x, y ); + + if ( !mxPeer.is() || ( mxPeer != xP ) ) + xP->dispose(); + } +} + +void UnoControl::setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maComponentInfos.nZoomX = fZoomX; + maComponentInfos.nZoomY = fZoomY; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > xV( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xV->setZoom( fZoomX, fZoomY ); + } +} + +// ::com::sun::star::awt::XControl +void UnoControl::setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxContext ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mxContext = rxContext; +} + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > UnoControl::getContext( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mxContext; +} + +void UnoControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParentPeer ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if( !mxPeer.is() ) + { + ::com::sun::star::awt::WindowClass eType; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > xToolkit = rxToolkit; + if( rParentPeer.is() && mxContext.is() ) + { + // kein TopWindow + if ( !xToolkit.is() ) + xToolkit = rParentPeer->getToolkit(); + ::com::sun::star::uno::Any aAny = OWeakAggObject::queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer>*)0) ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > xC; + aAny >>= xC; + if( xC.is() ) + // Es ist ein Container + eType = ::com::sun::star::awt::WindowClass_CONTAINER; + else + eType = ::com::sun::star::awt::WindowClass_SIMPLE; + } + else + { // Nur richtig, wenn es sich um ein Top Window handelt + if( rParentPeer.is() ) + { + if ( !xToolkit.is() ) + xToolkit = rParentPeer->getToolkit(); + eType = ::com::sun::star::awt::WindowClass_CONTAINER; + } + else + { + if ( !xToolkit.is() ) + xToolkit = VCLUnoHelper::CreateToolkit(); + eType = ::com::sun::star::awt::WindowClass_TOP; + } + } + ::com::sun::star::awt::WindowDescriptor aDescr; + aDescr.Type = eType; + aDescr.WindowServiceName = GetComponentServiceName(); + aDescr.Parent = rParentPeer; + aDescr.Bounds = getPosSize(); + aDescr.WindowAttributes = 0; + + // ::com::sun::star::sheet::Border + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = xPSet->getPropertySetInfo(); + + ::com::sun::star::uno::Any aVal; + ::rtl::OUString aPropName = GetPropertyName( BASEPROPERTY_BORDER ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + sal_Int16 n; + if ( aVal >>= n ) + { + if ( n ) + aDescr.WindowAttributes |= ::com::sun::star::awt::WindowAttribute::BORDER; + else + aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::NOBORDER; + } + } + + // Dropdown + aPropName = GetPropertyName( BASEPROPERTY_DROPDOWN ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + sal_Bool b; + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::DROPDOWN; + } + + // Spin + aPropName = GetPropertyName( BASEPROPERTY_SPIN ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + sal_Bool b; + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::SPIN; + } + + // HScroll + aPropName = GetPropertyName( BASEPROPERTY_HSCROLL ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + sal_Bool b; + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL; + } + + // VScroll + aPropName = GetPropertyName( BASEPROPERTY_VSCROLL ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + sal_Bool b; + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL; + } + + // Align + aPropName = GetPropertyName( BASEPROPERTY_ALIGN ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + sal_Int16 n; + if ( aVal >>= n ) + { + if ( n == PROPERTY_ALIGN_LEFT ) + aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::LEFT; + else if ( n == PROPERTY_ALIGN_CENTER ) + aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::CENTER; + else + aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::RIGHT; + } + } + + // Ableitungen die Moeglichkeit geben die Attribute zu manipulieren + PrepareWindowDescriptor(aDescr); + + // Jetzt die Peer erzeugen + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xWP = xToolkit->createWindow( aDescr ); + + // mxPeer initialisieren... + mxPeer = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >( xWP, ::com::sun::star::uno::UNO_QUERY ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > xV( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xV->setZoom( maComponentInfos.nZoomX, maComponentInfos.nZoomY ); + + updateFromModel(); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + + if( maComponentInfos.bVisible && !mbDesignMode ) + // Erst nach dem setzen der Daten anzeigen + xW->setVisible( maComponentInfos.bVisible ); + + if( !maComponentInfos.bEnable ) + xW->setEnable( maComponentInfos.bEnable ); + + if ( maWindowListeners.getLength() ) + xW->addWindowListener( &maWindowListeners ); + + if ( maFocusListeners.getLength() ) + xW->addFocusListener( &maFocusListeners ); + + if ( maKeyListeners.getLength() ) + xW->addKeyListener( &maKeyListeners ); + + if ( maMouseListeners.getLength() ) + xW->addMouseListener( &maMouseListeners ); + + if ( maMouseMotionListeners.getLength() ) + xW->addMouseMotionListener( &maMouseMotionListeners ); + + if ( maPaintListeners.getLength() ) + xW->addPaintListener( &maPaintListeners ); + + xV->setGraphics( mxGraphics ); + } +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > UnoControl::getPeer( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mxPeer; +} + +sal_Bool UnoControl::setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > xPropSet( mxModel, ::com::sun::star::uno::UNO_QUERY ); + + if( xPropSet.is() ) + xPropSet->removePropertiesChangeListener( this ); + + mxModel = rxModel; + if( mxModel.is() ) + { + xPropSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > ( mxModel, ::com::sun::star::uno::UNO_QUERY ); + if( xPropSet.is() ) + { + ::com::sun::star::uno::Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet ); + xPropSet->addPropertiesChangeListener( aNames, this ); + } + } + return mxModel.is(); +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > UnoControl::getModel( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mxModel; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > UnoControl::getView( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return (::com::sun::star::awt::XView*)this; +} + +void UnoControl::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + mbDesignMode = bOn; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->setVisible( !bOn ); + } +} + +sal_Bool UnoControl::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return mbDesignMode; +} + +sal_Bool UnoControl::isTransparent( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return sal_False; +} + +// ::com::sun::star::lang::XServiceInfo +::rtl::OUString UnoControl::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + DBG_ERROR( "This method should be overloaded!" ); + return ::rtl::OUString(); +} + +sal_Bool UnoControl::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames(); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == rServiceName ) + return sal_True; + return sal_False; +} + +::com::sun::star::uno::Sequence< ::rtl::OUString > UnoControl::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + DBG_ERROR( "This method should be overloaded!" ); + return ::com::sun::star::uno::Sequence< ::rtl::OUString >(); +} + + + diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx new file mode 100644 index 000000000000..3bfead451907 --- /dev/null +++ b/toolkit/source/controls/unocontrolbase.cxx @@ -0,0 +1,266 @@ +/************************************************************************* + * + * $RCSfile: unocontrolbase.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_ +#include <com/sun/star/awt/XLayoutConstrains.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XTEXTLAYOUTCONSTRAINS_HPP_ +#include <com/sun/star/awt/XTextLayoutConstrains.hpp> +#endif + +#include <toolkit/controls/unocontrolbase.hxx> +#include <toolkit/helper/property.hxx> + +#include <tools/debug.hxx> + +// ---------------------------------------------------- +// class UnoControlBase +// ---------------------------------------------------- + +sal_Bool UnoControlBase::ImplHasProperty( const ::rtl::OUString& aPropertyName ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = xPSet->getPropertySetInfo(); + return xInfo->hasPropertyByName( aPropertyName ); +} + +void UnoControlBase::ImplSetPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Bool bUpdateThis ) +{ + // Model ggf. schon abgemeldet, aber ein Event schlaegt noch zu... + if ( mxModel.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY ); + if ( !bUpdateThis ) + StartUpdatingModel(); + xPSet->setPropertyValue( aPropertyName, aValue ); + if ( !bUpdateThis ) + EndUpdatingModel(); + } +} + +::com::sun::star::uno::Any UnoControlBase::ImplGetPropertyValue( const ::rtl::OUString& aPropertyName ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY ); + return xPSet->getPropertyValue( aPropertyName ); +} + +sal_Bool UnoControlBase::ImplGetPropertyValue_BOOL( sal_uInt16 nProp ) +{ + sal_Bool b = sal_False; + if ( mxModel.is() ) + { + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) ); + aVal >>= b; + } + return b; +} + +sal_Int16 UnoControlBase::ImplGetPropertyValue_INT16( sal_uInt16 nProp ) +{ + sal_Int16 n = 0; + if ( mxModel.is() ) + { + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) ); + aVal >>= n; + } + return n; +} + +sal_uInt16 UnoControlBase::ImplGetPropertyValue_UINT16( sal_uInt16 nProp ) +{ + sal_uInt16 n = 0; + if ( mxModel.is() ) + { + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) ); + aVal >>= n; + } + return n; +} + +sal_Int32 UnoControlBase::ImplGetPropertyValue_INT32( sal_uInt16 nProp ) +{ + sal_Int32 n = 0; + if ( mxModel.is() ) + { + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) ); + aVal >>= n; + } + return n; +} + +sal_uInt32 UnoControlBase::ImplGetPropertyValue_UINT32( sal_uInt16 nProp ) +{ + sal_uInt32 n = 0; + if ( mxModel.is() ) + { + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) ); + aVal >>= n; + } + return n; +} + +double UnoControlBase::ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp ) +{ + double n = 0; + if ( mxModel.is() ) + { + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) ); + aVal >>= n; + } + return n; +} + +::rtl::OUString UnoControlBase::ImplGetPropertyValue_UString( sal_uInt16 nProp ) +{ + ::rtl::OUString aStr; + if ( mxModel.is() ) + { + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) ); + aVal >>= aStr; + } + return aStr; +} + +::com::sun::star::awt::Size UnoControlBase::Impl_getMinimumSize() +{ + ::com::sun::star::awt::Size aSz; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True ); + DBG_ASSERT( xP.is(), "Layout: No Peer!" ); + if ( xP.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY ); + if ( xL.is() ) + aSz = xL->getMinimumSize(); + + if ( !mxPeer.is() || ( mxPeer != xP ) ) + xP->dispose(); + } + return aSz; +} + +::com::sun::star::awt::Size UnoControlBase::Impl_getPreferredSize() +{ + ::com::sun::star::awt::Size aSz; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True ); + DBG_ASSERT( xP.is(), "Layout: No Peer!" ); + if ( xP.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY ); + if ( xL.is() ) + aSz = xL->getPreferredSize(); + + if ( !mxPeer.is() || ( mxPeer != xP ) ) + xP->dispose(); + } + return aSz; +} + +::com::sun::star::awt::Size UnoControlBase::Impl_calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) +{ + ::com::sun::star::awt::Size aSz; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True ); + DBG_ASSERT( xP.is(), "Layout: No Peer!" ); + if ( xP.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY ); + if ( xL.is() ) + aSz = xL->calcAdjustedSize( rNewSize ); + + if ( !mxPeer.is() || ( mxPeer != xP ) ) + xP->dispose(); + } + return aSz; +} + +::com::sun::star::awt::Size UnoControlBase::Impl_getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) +{ + ::com::sun::star::awt::Size aSz; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True ); + DBG_ASSERT( xP.is(), "Layout: No Peer!" ); + if ( xP.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY ); + if ( xL.is() ) + aSz = xL->getMinimumSize( nCols, nLines ); + + if ( !mxPeer.is() || ( mxPeer != xP ) ) + xP->dispose(); + } + return aSz; +} + +void UnoControlBase::Impl_getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True ); + DBG_ASSERT( xP.is(), "Layout: No Peer!" ); + if ( xP.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY ); + if ( xL.is() ) + xL->getColumnsAndLines( nCols, nLines ); + + if ( !mxPeer.is() || ( mxPeer != xP ) ) + xP->dispose(); + } +} + + + diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx new file mode 100644 index 000000000000..86041d144d19 --- /dev/null +++ b/toolkit/source/controls/unocontrolcontainer.cxx @@ -0,0 +1,417 @@ +/************************************************************************* + * + * $RCSfile: unocontrolcontainer.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_ +#include <com/sun/star/awt/XVclContainerPeer.hpp> +#endif + +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <toolkit/controls/unocontrolcontainer.hxx> +#include <toolkit/helper/property.hxx> +#include <toolkit/helper/servicenames.hxx> + +#include <unotools/sequence.hxx> + +#include <tools/debug.hxx> +#include <tools/list.hxx> + +// ---------------------------------------------------- +// class UnoControlHolder +// ---------------------------------------------------- +struct UnoControlHolder +{ +public: + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl; + ::rtl::OUString aName; + + UnoControlHolder( const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > & rControl ) + : aName( rName ) + { + xCtrl = rControl; + + } +}; + +DECLARE_LIST( UnoControlHolderList, UnoControlHolder* ); + + +// ---------------------------------------------------- +// class UnoControlContainer +// ---------------------------------------------------- +UnoControlContainer::UnoControlContainer(): maCListeners( *this ) +{ + mpControls = new UnoControlHolderList; +} + +UnoControlContainer::UnoControlContainer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP ) + : maCListeners( *this ) +{ + mxPeer = xP; + mbDisposePeer = sal_False; + mpControls = new UnoControlHolderList; +} + +UnoControlContainer::~UnoControlContainer() +{ + for ( sal_uInt32 n = mpControls->Count(); n; ) + { + UnoControlHolder* pHolder = mpControls->GetObject( --n ); + delete pHolder; + } + mpControls->Clear(); + delete mpControls; +} + +void UnoControlContainer::ImplActivateTabControllers() +{ + sal_uInt32 nCount = maTabControllers.getLength(); + for ( sal_uInt32 n = 0; n < nCount; n++ ) + { + maTabControllers.getArray()[n]->setContainer( this ); + maTabControllers.getArray()[n]->activateTabOrder(); + } +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoControlContainer::queryAggregation( 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::awt::XUnoControlContainer*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XControlContainer*, this ), + SAL_STATIC_CAST( ::com::sun::star::container::XContainer*, this ) ); + return (aRet.hasValue() ? aRet : UnoControl::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoControlContainer ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView>* ) NULL ), + UnoControl::getTypes() +IMPL_XTYPEPROVIDER_END + +// ::com::sun::star::lang::XComponent +void UnoControlContainer::dispose( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + // DG: zuerst der Welt mitteilen, daß der Container wegfliegt. Dieses ist um einiges + // schneller wenn die Welt sowohl an den Controls als auch am Container horcht + ::com::sun::star::lang::EventObject aEvt; + aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this; + maDisposeListeners.disposeAndClear(aEvt); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = getControls(); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pCtrls = aCtrls.getArray(); + sal_uInt32 nCtrls = aCtrls.getLength(); + + // alle Strukturen entfernen + sal_uInt32 n; + for ( n = mpControls->Count(); n; ) + delete mpControls->GetObject( --n ); + mpControls->Clear(); + + for( n = 0; n < nCtrls; n++ ) + { + pCtrls[n]->removeEventListener(this); + + // Control wegwerfen + pCtrls[n]->dispose(); + } + + UnoControl::dispose(); +} + +void UnoControlContainer::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + +} + +void UnoControlContainer::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + +} + + +// ::com::sun::star::lang::XEventListener +void UnoControlContainer::disposing( const ::com::sun::star::lang::EventObject& rEvt ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl(rEvt.Source, ::com::sun::star::uno::UNO_QUERY ); + if (xControl.is()) + removeControl(xControl); +} + +// ::com::sun::star::container::XContainer +void UnoControlContainer::addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maCListeners.addInterface( rxListener ); +} + +void UnoControlContainer::removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maCListeners.removeInterface( rxListener ); +} + + +// ::com::sun::star::awt::XControlContainer +void UnoControlContainer::setStatusText( const ::rtl::OUString& rStatusText ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + // In der Parenthierarchie nach unten gehen + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > xContainer( mxContext, ::com::sun::star::uno::UNO_QUERY ); + if( xContainer.is() ) + xContainer->setStatusText( rStatusText ); +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > UnoControlContainer::getControls( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_uInt32 nCtrls = mpControls->Count(); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aD( nCtrls ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pDest = aD.getArray(); + for( sal_uInt32 n = 0; n < nCtrls; n++ ) + { + UnoControlHolder* pHolder= mpControls->GetObject( n ); + pDest[n] = pHolder->xCtrl; + } + + return aD; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > UnoControlContainer::getControl( const ::rtl::OUString& rName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl; + + sal_uInt32 nCtrls = mpControls->Count(); + for( sal_uInt32 n = 0; n < nCtrls; n++ ) + { + UnoControlHolder* pHolder = mpControls->GetObject( n ); + if ( pHolder->aName == rName ) + { + xCtrl = pHolder->xCtrl; + break; + } + } + return xCtrl; +} + +void UnoControlContainer::addControl( const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rControl ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + UnoControlHolder* pHolder = new UnoControlHolder( rName, rControl ); + mpControls->Insert( pHolder, LIST_APPEND ); + + ::com::sun::star::uno::Any aAny = OWeakAggObject::queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)0) ); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis; + aAny >>= xThis; + rControl->setContext( xThis ); + rControl->addEventListener(this); + + if( mxPeer.is() ) + { + // Hat der Container ein Peer, dann auch gleich im Child erzeugen + rControl->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), mxPeer ); + ImplActivateTabControllers(); + } + + if ( maCListeners.getLength() ) + { + ::com::sun::star::container::ContainerEvent aEvent; + aEvent.Source = *this; + aEvent.Element <<= rControl; + maCListeners.elementInserted( aEvent ); + } +} + +void UnoControlContainer::removeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rControl ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( rControl.is() ) + { + sal_uInt32 nCtrls = mpControls->Count(); + for( sal_uInt32 n = 0; n < nCtrls; n++ ) + { + UnoControlHolder* pHolder = mpControls->GetObject( n ); + if ( (::com::sun::star::awt::XControl*)rControl.get() == (::com::sun::star::awt::XControl*)pHolder->xCtrl.get() ) + { + rControl->removeEventListener(this); + rControl->setContext( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > () ); + + delete pHolder; + mpControls->Remove( n ); + if ( maCListeners.getLength() ) + { + ::com::sun::star::container::ContainerEvent aEvent; + aEvent.Source = *this; + aEvent.Element <<= rControl; + maCListeners.elementRemoved( aEvent ); + } + break; + } + } + } +} + + + +// ::com::sun::star::awt::XUnoControlContainer +void UnoControlContainer::setTabControllers( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > >& TabControllers ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maTabControllers = TabControllers; +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > UnoControlContainer::getTabControllers( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return maTabControllers; +} + +void UnoControlContainer::addTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_uInt32 nOldCount = maTabControllers.getLength(); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > aNewSeq( nOldCount + 1 ); + for ( sal_uInt32 n = 0; n < nOldCount; n++ ) + aNewSeq.getArray()[n] = maTabControllers.getConstArray()[n]; + aNewSeq.getArray()[nOldCount] = TabController; + maTabControllers = aNewSeq; +} + +void UnoControlContainer::removeTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_uInt32 nCount = maTabControllers.getLength(); + for ( sal_uInt32 n = 0; n < nCount; n++ ) + { + if( maTabControllers.getConstArray()[n] == TabController ) + { + ::utl::removeElementAt( maTabControllers, n ); + break; + } + } +} + +// ::com::sun::star::awt::XControl +void UnoControlContainer::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if( !mxPeer.is() ) + { + sal_Bool bVis = maComponentInfos.bVisible; + if( bVis ) + UnoControl::setVisible( sal_False ); + // eigenes Peer erzeugen + UnoControl::createPeer( rxToolkit, rParent ); + + // alle Peers der Childs erzeugen + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = getControls(); + sal_uInt32 nCtrls = aCtrls.getLength(); + for( sal_uInt32 n = 0; n < nCtrls; n++ ) + aCtrls.getArray()[n]->createPeer( rxToolkit, mxPeer ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerPeer > xC( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + + xC->enableDialogControl( sal_True ); + ImplActivateTabControllers(); + + if( bVis ) + UnoControl::setVisible( sal_True ); + } +} + + +// ::com::sun::star::awt::XWindow +void UnoControlContainer::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + UnoControl::setVisible( bVisible ); + if( !mxContext.is() && bVisible ) + // Es ist ein TopWindow, also automatisch anzeigen + createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > () ); +} + + + diff --git a/toolkit/source/controls/unocontrolcontainermodel.cxx b/toolkit/source/controls/unocontrolcontainermodel.cxx new file mode 100644 index 000000000000..3d37e5939c74 --- /dev/null +++ b/toolkit/source/controls/unocontrolcontainermodel.cxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * $RCSfile: unocontrolcontainermodel.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <toolkit/controls/unocontrolcontainermodel.hxx> +#include <toolkit/helper/property.hxx> +#include <toolkit/helper/servicenames.hxx> +#include <toolkit/helper/unopropertyarrayhelper.hxx> + +// ---------------------------------------------------- +// class UnoControlContainerModel +// ---------------------------------------------------- +UnoControlContainerModel::UnoControlContainerModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_TEXT ); +} + +::rtl::OUString UnoControlContainerModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel ); +} + +::com::sun::star::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + ::com::sun::star::uno::Any aDefault; + if ( nPropId == BASEPROPERTY_BORDER ) + aDefault <<= (sal_Int16) 0; + else + aDefault <<= UnoControlModel::ImplGetDefaultValue( nPropId ); + return aDefault; +} + + +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + +::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper() +{ + ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlContainerModel*)this)->GetMutex() ); + + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + + + + diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx new file mode 100644 index 000000000000..4c26018cc10c --- /dev/null +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -0,0 +1,1110 @@ +/************************************************************************* + * + * $RCSfile: unocontrolmodel.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_ +#include <com/sun/star/beans/PropertyState.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_ +#include <com/sun/star/awt/FontDescriptor.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTWIDTH_HPP_ +#include <com/sun/star/awt/FontWidth.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_ +#include <com/sun/star/awt/FontWeight.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_ +#include <com/sun/star/awt/FontSlant.hpp> +#endif + + +#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_ +#include <com/sun/star/io/XMarkableStream.hpp> +#endif + +#include <toolkit/controls/unocontrolmodel.hxx> +#include <toolkit/helper/macros.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/memory.h> +#include <rtl/uuid.h> + +#include <tools/string.hxx> +#include <tools/table.hxx> +#include <tools/date.hxx> +#include <tools/time.hxx> +#include <tools/urlobj.hxx> +#include <tools/debug.hxx> + +#include <toolkit/helper/property.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <toolkit/helper/emptyfontdescriptor.hxx> + +#include <unotools/sequence.hxx> + +#include <vcl/svapp.hxx> +#include <tools/intn.hxx> + +struct ImplPropertyInfo +{ +private: + sal_uInt16 nId; + ::com::sun::star::uno::Any aValue; + +public: + ImplPropertyInfo( sal_uInt16 nT ) + { + nId = nT; + } + + ImplPropertyInfo( sal_uInt16 nT, const ::com::sun::star::uno::Any& rValue ) : aValue( rValue ) + { + nId = nT; + } + + sal_uInt16 GetId() const { return nId; } + const ::com::sun::star::uno::Any& GetValue() const { return aValue; } + void SetValue( const ::com::sun::star::uno::Any& rValue ) { aValue = rValue; } +}; + +DECLARE_TABLE( ImplPropertyTable, ImplPropertyInfo* ); + +#define UNOCONTROL_STREAMVERSION (short)2 + +static void lcl_ImplMergeFontProperty( ::com::sun::star::awt::FontDescriptor& rFD, sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rValue ) +{ + switch ( nPropId ) + { + case BASEPROPERTY_FONTDESCRIPTORPART_NAME: rValue >>= rFD.Name; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: rValue >>= rFD.StyleName; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: rValue >>= rFD.Family; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: rValue >>= rFD.CharSet; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: rValue >>= rFD.Height; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue >>= rFD.Weight; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: rValue >>= rFD.Slant; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue >>= rFD.Underline; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: rValue >>= rFD.Strikeout; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: rValue >>= rFD.Width; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: rValue >>= rFD.Pitch; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: rValue >>= rFD.CharacterWidth; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: rValue >>= rFD.Orientation; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: rValue >>= rFD.Kerning; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: rValue >>= rFD.WordLineMode; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: rValue >>= rFD.Type; + break; + default: DBG_ERROR( "FontProperty?!" ); + } +} + +// ---------------------------------------------------- +// class UnoControlModel +// ---------------------------------------------------- +UnoControlModel::UnoControlModel() + : OPropertySetHelper( BrdcstHelper ), maDisposeListeners( *this ) +{ + // Die Properties muessen vom Model in die Tabelle gestopft werden, + // nur vorhandene Properties sind gueltige Properties, auch wenn VOID. + mpData = new ImplPropertyTable; +} + +UnoControlModel::~UnoControlModel() +{ + for ( sal_uInt32 n = mpData->Count(); n--; ) + delete mpData->GetObject( n ); + delete mpData; +} + +::com::sun::star::uno::Sequence<sal_Int32> UnoControlModel::ImplGetPropertyIds() const +{ + sal_uInt32 nIDs = mpData->Count(); + ::com::sun::star::uno::Sequence<sal_Int32> aIDs( nIDs ); + sal_Int32* pIDs = aIDs.getArray(); + for ( sal_uInt32 n = 0; n < nIDs; n++ ) + pIDs[n] = mpData->GetObjectKey( n ); + return aIDs; +} + +sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const +{ + if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) ) + nPropId = BASEPROPERTY_FONTDESCRIPTOR; + + return mpData->Get( nPropId ) ? sal_True : sal_False; +} + +void UnoControlModel::ImplPropertyChanged( sal_uInt16 nPropId ) +{ +} + +::com::sun::star::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + ::com::sun::star::uno::Any aDefault; + + if ( ( nPropId == BASEPROPERTY_FONTDESCRIPTOR ) || + ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) ) + { + EmptyFontDescriptor aFD; + switch ( nPropId ) + { + case BASEPROPERTY_FONTDESCRIPTOR: aDefault <<= aFD; break; + case BASEPROPERTY_FONTDESCRIPTORPART_NAME: aDefault <<= aFD.Name; break; + case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: aDefault <<= aFD.StyleName; break; + case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: aDefault <<= aFD.Family; break; + case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: aDefault <<= aFD.CharSet; break; + case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: aDefault <<= (float)aFD.Height; break; + case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: aDefault <<= aFD.Weight; break; + case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: aDefault <<= (sal_Int16)aFD.Slant; break; + case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: aDefault <<= aFD.Underline; break; + case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: aDefault <<= aFD.Strikeout; break; + case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: aDefault <<= aFD.Width; break; + case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: aDefault <<= aFD.Pitch; break; + case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: aDefault <<= aFD.CharacterWidth; break; + case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: aDefault <<= aFD.Orientation; break; + case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: aDefault <<= aFD.Kerning; break; + case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: aDefault <<= aFD.WordLineMode; break; + case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: aDefault <<= aFD.Type; break; + default: DBG_ERROR( "FontProperty?!" ); + } + } + else + { + switch ( nPropId ) + { + case BASEPROPERTY_TABSTOP: + case BASEPROPERTY_TEXTCOLOR: + case BASEPROPERTY_DATE: + case BASEPROPERTY_DATESHOWCENTURY: + case BASEPROPERTY_TIME: + case BASEPROPERTY_VALUE_DOUBLE: + case BASEPROPERTY_BACKGROUNDCOLOR: break; + + case BASEPROPERTY_MAXTEXTLEN: + case BASEPROPERTY_STATE: + case BASEPROPERTY_EXTDATEFORMAT: + case BASEPROPERTY_EXTTIMEFORMAT: + case BASEPROPERTY_ECHOCHAR: aDefault <<= (sal_Int16) 0; break; + case BASEPROPERTY_BORDER: aDefault <<= (sal_Int16) 1; break; + case BASEPROPERTY_DECIMALACCURACY: aDefault <<= (sal_Int16) 2; break; + case BASEPROPERTY_LINECOUNT: aDefault <<= (sal_Int16) 5; break; + case BASEPROPERTY_ALIGN: aDefault <<= (sal_Int16) PROPERTY_ALIGN_LEFT; break; + + case BASEPROPERTY_DATEMAX: aDefault <<= (sal_Int32) Date( 31, 12, 2200 ).GetDate(); break; + case BASEPROPERTY_DATEMIN: aDefault <<= (sal_Int32) Date( 1, 1, 1900 ).GetDate(); break; + case BASEPROPERTY_TIMEMAX: aDefault <<= (sal_Int32) Time( 23, 59 ).GetTime(); break; + case BASEPROPERTY_TIMEMIN: aDefault <<= (sal_Int32) 0; break; + case BASEPROPERTY_VALUEMAX_DOUBLE: aDefault <<= (double) 1000000; break; + case BASEPROPERTY_VALUEMIN_DOUBLE: aDefault <<= (double) -1000000; break; + case BASEPROPERTY_VALUESTEP_DOUBLE: aDefault <<= (double ) 1; break; + case BASEPROPERTY_DEFAULTCONTROL: aDefault <<= ((UnoControlModel*)this)->getServiceName(); break; + + case BASEPROPERTY_HSCROLL: + case BASEPROPERTY_DEFAULTBUTTON: + case BASEPROPERTY_MULTILINE: + case BASEPROPERTY_MULTISELECTION: + case BASEPROPERTY_TRISTATE: + case BASEPROPERTY_DROPDOWN: + case BASEPROPERTY_SPIN: + case BASEPROPERTY_READONLY: + case BASEPROPERTY_VSCROLL: + case BASEPROPERTY_NUMSHOWTHOUSANDSEP: + case BASEPROPERTY_STRICTFORMAT: + case BASEPROPERTY_HARDLINEBREAKS: aDefault <<= (sal_Bool) sal_False; break; + + case BASEPROPERTY_AUTOCOMPLETE: + case BASEPROPERTY_ENABLED: + case BASEPROPERTY_PRINTABLE: aDefault <<= (sal_Bool) sal_True; break; + + case BASEPROPERTY_HELPURL: + case BASEPROPERTY_IMAGEURL: + case BASEPROPERTY_EDITMASK: + case BASEPROPERTY_LITERALMASK: + case BASEPROPERTY_LABEL: + case BASEPROPERTY_TEXT: aDefault <<= ::rtl::OUString(); break; + + case BASEPROPERTY_STRINGITEMLIST: + { + ::com::sun::star::uno::Sequence< ::rtl::OUString> aStringSeq; + aDefault <<= aStringSeq; + + } + break; + case BASEPROPERTY_SELECTEDITEMS: + { + ::com::sun::star::uno::Sequence<sal_Int16> aINT16Seq; + aDefault <<= aINT16Seq; + } + break; + case BASEPROPERTY_CURRENCYSYMBOL: + { + XubString aSymbol = Application::GetAppInternational().GetCurrSymbol(); + aDefault <<= ::rtl::OUString( aSymbol ); + } + break; + default: DBG_ERROR( "ImplGetDefaultValue - unknown Property" ); + } + } + + return aDefault; +} + +void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault ) +{ + ImplPropertyInfo* pProp = new ImplPropertyInfo( nPropId, rDefault ); + mpData->Insert( nPropId, pProp ); +} + +void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId ) +{ + ImplRegisterProperty( nPropId, ImplGetDefaultValue( nPropId ) ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoControlModel::queryAggregation( 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::awt::XControlModel*, this ), + SAL_STATIC_CAST( ::com::sun::star::io::XPersistObject*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XComponent*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ), + SAL_STATIC_CAST( ::com::sun::star::beans::XPropertyState*, this ), + SAL_STATIC_CAST( ::com::sun::star::beans::XMultiPropertySet*, this ), + SAL_STATIC_CAST( ::com::sun::star::beans::XFastPropertySet*, this ), + SAL_STATIC_CAST( ::com::sun::star::beans::XPropertySet*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) ); + return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XUnoTunnel +IMPL_XUNOTUNNEL( UnoControlModel ) + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoControlModel ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>* ) NULL ) +IMPL_XTYPEPROVIDER_END + +// ::com::sun::star::lang::XComponent +void UnoControlModel::dispose( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aEvt; + aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this; + maDisposeListeners.disposeAndClear( aEvt ); +} + +void UnoControlModel::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maDisposeListeners.addInterface( rxListener ); +} + +void UnoControlModel::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + maDisposeListeners.removeInterface( rxListener ); +} + + +// ::com::sun::star::beans::XPropertyState +::com::sun::star::beans::PropertyState UnoControlModel::getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_uInt16 nPropId = GetPropertyId( PropertyName ); + + ::com::sun::star::uno::Any aValue = getPropertyValue( PropertyName ); + ::com::sun::star::uno::Any aDefault = ImplGetDefaultValue( nPropId ); + + return CompareProperties( aValue, aDefault ) ? ::com::sun::star::beans::PropertyState_DEFAULT_VALUE : ::com::sun::star::beans::PropertyState_DIRECT_VALUE; +} + +::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > UnoControlModel::getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_uInt32 nNames = PropertyNames.getLength(); + const ::rtl::OUString* pNames = PropertyNames.getConstArray(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > aStates( nNames ); + ::com::sun::star::beans::PropertyState* pStates = aStates.getArray(); + + for ( sal_uInt32 n = 0; n < nNames; n++ ) + pStates[n] = getPropertyState( pNames[n] ); + + return aStates; +} + +void UnoControlModel::setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + setPropertyValue( PropertyName, ImplGetDefaultValue( GetPropertyId( PropertyName ) ) ); +} + +::com::sun::star::uno::Any UnoControlModel::getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return ImplGetDefaultValue( GetPropertyId( rPropertyName ) ); +} + + +// ::com::sun::star::io::XPersistObjec +::rtl::OUString UnoControlModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + DBG_ERROR( "ServiceName von UnoControlModel ?!" ); + return ::rtl::OUString(); +} + +void UnoControlModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY ); + DBG_ASSERT( xMark.is(), "write: no ::com::sun::star::io::XMarkableStream!" ); + + OutStream->writeShort( UNOCONTROL_STREAMVERSION ); + + ImplPropertyTable aProps; + sal_uInt32 n; + for ( n = mpData->Count(); n; ) + { + ImplPropertyInfo* pProp = mpData->GetObject( --n ); + if ( ( ( GetPropertyAttribs( pProp->GetId() ) & ::com::sun::star::beans::PropertyAttribute::TRANSIENT ) == 0 ) + && ( getPropertyState( GetPropertyName( pProp->GetId() ) ) != ::com::sun::star::beans::PropertyState_DEFAULT_VALUE ) ) + { + aProps.Insert( pProp->GetId(), pProp ); + } + } + + sal_uInt32 nProps = aProps.Count(); + + // FontProperty wegen fehlender Unterscheidung zwischen 5.0 / 5.1 + // immer im alten Format mitspeichern. + OutStream->writeLong( (long) aProps.IsKeyValid( BASEPROPERTY_FONTDESCRIPTOR ) ? ( nProps + 3 ) : nProps ); + for ( n = 0; n < nProps; n++ ) + { + sal_Int32 nPropDataBeginMark = xMark->createMark(); + OutStream->writeLong( 0L ); // DataLen + + ImplPropertyInfo* pProp = aProps.GetObject( n ); + OutStream->writeShort( pProp->GetId() ); + + sal_Bool bVoid = pProp->GetValue().getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + + OutStream->writeBoolean( bVoid ); + + if ( !bVoid ) + { + const ::com::sun::star::uno::Any& rValue = pProp->GetValue(); + const ::com::sun::star::uno::Type& rType = rValue.getValueType(); + + if ( rType == ::getBooleanCppuType() ) + { + sal_Bool b; + rValue >>= b; + OutStream->writeBoolean( b ); + } + else if ( rType == ::getCppuType((const ::rtl::OUString*)0) ) + { + // #HACK 52041# Pfade relativ speichern + ::rtl::OUString aUString; + rValue >>= aUString; + if ( pProp->GetId() == BASEPROPERTY_IMAGEURL ) + aUString= INetURLObject::AbsToRel( aUString ); + OutStream->writeUTF( aUString ); + } + else if ( rType == ::getCppuType((const sal_uInt16*)0) ) + { + sal_uInt16 n; + rValue >>= n; + OutStream->writeShort( n ); + } + else if ( rType == ::getCppuType((const sal_Int16*)0) ) + { + sal_Int16 n; + rValue >>= n; + OutStream->writeShort( n ); + } + else if ( rType == ::getCppuType((const sal_uInt32*)0) ) + { + sal_uInt32 n; + rValue >>= n; + OutStream->writeLong( n ); + } + else if ( rType == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 n; + rValue >>= n; + OutStream->writeLong( n ); + } + else if ( rType == ::getCppuType((const double*)0) ) + { + double n; + rValue >>= n; + OutStream->writeDouble( n ); + } + else if ( rType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) ) + { + ::com::sun::star::awt::FontDescriptor aFD; + rValue >>= aFD; + OutStream->writeUTF( aFD.Name ); + OutStream->writeShort( aFD.Height ); + OutStream->writeShort( aFD.Width ); + OutStream->writeUTF( aFD.StyleName ); + OutStream->writeShort( aFD.Family ); + OutStream->writeShort( aFD.CharSet ); + OutStream->writeShort( aFD.Pitch ); + OutStream->writeDouble( aFD.CharacterWidth ); + OutStream->writeDouble( aFD.Weight ); + OutStream->writeShort( aFD.Slant ); + OutStream->writeShort( aFD.Underline ); + OutStream->writeShort( aFD.Strikeout ); + OutStream->writeDouble( aFD.Orientation ); + OutStream->writeBoolean( aFD.Kerning ); + OutStream->writeBoolean( aFD.WordLineMode ); + OutStream->writeShort( aFD.Type ); + } + else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) ) + { + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + rValue >>= aSeq; + long nEntries = aSeq.getLength(); + OutStream->writeLong( nEntries ); + for ( long n = 0; n < nEntries; n++ ) + OutStream->writeUTF( aSeq.getConstArray()[n] ); + } + else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) ) + { + ::com::sun::star::uno::Sequence<sal_uInt16> aSeq; + rValue >>= aSeq; + long nEntries = aSeq.getLength(); + OutStream->writeLong( nEntries ); + for ( long n = 0; n < nEntries; n++ ) + OutStream->writeShort( aSeq.getConstArray()[n] ); + } + else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) ) + { + ::com::sun::star::uno::Sequence<sal_Int16> aSeq; + rValue >>= aSeq; + long nEntries = aSeq.getLength(); + OutStream->writeLong( nEntries ); + for ( long n = 0; n < nEntries; n++ ) + OutStream->writeShort( aSeq.getConstArray()[n] ); + } + else + { + DBG_ERROR( "write: unknown Property!" ); + } + } + + sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark ); + xMark->jumpToMark( nPropDataBeginMark ); + OutStream->writeLong( nPropDataLen ); + xMark->jumpToFurthest(); + xMark->deleteMark(nPropDataBeginMark); + } + + ImplPropertyInfo* pProp = aProps.Get( BASEPROPERTY_FONTDESCRIPTOR ); + if ( pProp ) + { + // Solange wir keinen 5.0-Export haben, muss das alte + // Format mit rausgeschrieben werden... + ::com::sun::star::awt::FontDescriptor aFD; + pProp->GetValue() >>= aFD; + + for ( sal_uInt16 n = BASEPROPERTY_FONT_TYPE; n <= BASEPROPERTY_FONT_ATTRIBS; n++ ) + { + sal_Int32 nPropDataBeginMark = xMark->createMark(); + OutStream->writeLong( 0L ); // DataLen + OutStream->writeShort( n ); // PropId + OutStream->writeBoolean( sal_False ); // Void + + if ( n == BASEPROPERTY_FONT_TYPE ) + { + OutStream->writeUTF( aFD.Name ); + OutStream->writeUTF( aFD.StyleName ); + OutStream->writeShort( aFD.Family ); + OutStream->writeShort( aFD.CharSet ); + OutStream->writeShort( aFD.Pitch ); + } + else if ( n == BASEPROPERTY_FONT_SIZE ) + { + OutStream->writeLong( aFD.Width ); + OutStream->writeLong( aFD.Height ); + OutStream->writeShort( VCLUnoHelper::ConvertFontWidth( aFD.CharacterWidth ) ); + } + else if ( n == BASEPROPERTY_FONT_ATTRIBS ) + { + OutStream->writeShort( VCLUnoHelper::ConvertFontWeight( aFD.Weight ) ); + OutStream->writeShort( aFD.Slant ); + OutStream->writeShort( aFD.Underline ); + OutStream->writeShort( aFD.Strikeout ); + OutStream->writeShort( aFD.Orientation * 10 ); + OutStream->writeBoolean( aFD.Kerning ); + OutStream->writeBoolean( aFD.WordLineMode ); + } + else + { + DBG_ERROR( "Property?!" ); + } + + sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark ); + xMark->jumpToMark( nPropDataBeginMark ); + OutStream->writeLong( nPropDataLen ); + xMark->jumpToFurthest(); + xMark->deleteMark(nPropDataBeginMark); + } + } +} + +void UnoControlModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( InStream, ::com::sun::star::uno::UNO_QUERY ); + DBG_ASSERT( xMark.is(), "read: no ::com::sun::star::io::XMarkableStream!" ); + + short nVersion = InStream->readShort(); + sal_uInt32 nProps = (sal_uInt32)InStream->readLong(); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aProps( nProps ); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aValues( nProps ); + sal_Bool bInvalidEntries = sal_False; + + // Dummerweise kein Mark fuer den gesamten Block, es koennen also + // nur Properties geaendert werden, es koennen aber nicht spaeter mal Daten + // fuer das Model hinter den Properties geschrieben werden. + + // Fuer den Import der alten ::com::sun::star::awt::FontDescriptor-Teile + ::com::sun::star::awt::FontDescriptor* pFD = NULL; + + sal_uInt32 n; + for ( n = 0; n < nProps; n++ ) + { + sal_Int32 nPropDataBeginMark = xMark->createMark(); + sal_Int32 nPropDataLen = InStream->readLong(); + + sal_uInt16 nPropId = (sal_uInt16)InStream->readShort(); + + ::com::sun::star::uno::Any aValue; + sal_Bool bIsVoid = InStream->readBoolean(); + if ( !bIsVoid ) + { + const ::com::sun::star::uno::Type* pType = mpData->Get( nPropId ) ? GetPropertyType( nPropId ) : NULL; + if ( pType ) + { + if ( *pType == ::getBooleanCppuType() ) + { + sal_Bool b = InStream->readBoolean(); + aValue <<= b; + } + else if ( *pType == ::getCppuType((const ::rtl::OUString*)0) ) + { + ::rtl::OUString aUTF = InStream->readUTF(); + // #HACK 52041# Pfade relativ speichern + if ( nPropId == BASEPROPERTY_IMAGEURL ) + aUTF = INetURLObject::RelToAbs( aUTF ); + aValue <<= aUTF; + } + else if ( *pType == ::getCppuType((const sal_uInt16*)0) ) + { + sal_uInt16 n = InStream->readShort(); + aValue <<= n; + } + else if ( *pType == ::getCppuType((const sal_Int16*)0) ) + { + sal_Int16 n = InStream->readShort(); + aValue <<= n; + } + else if ( *pType == ::getCppuType((const sal_uInt32*)0) ) + { + sal_uInt32 n = InStream->readLong(); + aValue <<= n; + } + else if ( *pType == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 n = InStream->readLong(); + aValue <<= n; + } + else if ( *pType == ::getCppuType((const Double*)0) ) + { + double n = InStream->readDouble(); + aValue <<= n; + } + else if ( *pType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) ) + { + ::com::sun::star::awt::FontDescriptor aFD; + aFD.Name = InStream->readUTF(); + aFD.Height = InStream->readShort(); + aFD.Width = InStream->readShort(); + aFD.StyleName = InStream->readUTF(); + aFD.Family = InStream->readShort(); + aFD.CharSet = InStream->readShort(); + aFD.Pitch = InStream->readShort(); + aFD.CharacterWidth = InStream->readDouble(); + aFD.Weight = InStream->readDouble(); + aFD.Slant = (::com::sun::star::awt::FontSlant)InStream->readShort(); + aFD.Underline = InStream->readShort(); + aFD.Strikeout = InStream->readShort(); + aFD.Orientation = InStream->readDouble(); + aFD.Kerning = InStream->readBoolean(); + aFD.WordLineMode = InStream->readBoolean(); + aFD.Type = InStream->readShort(); + aValue <<= aFD; + } + else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) ) + { + long nEntries = InStream->readLong(); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nEntries ); + for ( long n = 0; n < nEntries; n++ ) + aSeq.getArray()[n] = InStream->readUTF(); + aValue <<= aSeq; + + } + else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) ) + + { + long nEntries = InStream->readLong(); + ::com::sun::star::uno::Sequence<sal_uInt16> aSeq( nEntries ); + for ( long n = 0; n < nEntries; n++ ) + aSeq.getArray()[n] = (sal_uInt16)InStream->readShort(); + aValue <<= aSeq; + } + else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) ) + { + long nEntries = InStream->readLong(); + ::com::sun::star::uno::Sequence<sal_Int16> aSeq( nEntries ); + for ( long n = 0; n < nEntries; n++ ) + aSeq.getArray()[n] = (sal_Int16)InStream->readShort(); + aValue <<= aSeq; + } + } + else + { + // Altes Geraffel aus 5.0 + if ( nPropId == BASEPROPERTY_FONT_TYPE ) + { + // Sonst ist es nur die redundante Info fuer alte Versionen + // Daten werden durch MarkableStream geskippt. + if ( nVersion < 2 ) + { + if ( !pFD ) + { + pFD = new ::com::sun::star::awt::FontDescriptor; + ImplPropertyInfo* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR ); + if ( pProp ) // wegen den Defaults... + { + pFD = new ::com::sun::star::awt::FontDescriptor; + pProp->GetValue() >>= *pFD; + } + } + pFD->Name = InStream->readUTF(); + pFD->StyleName = InStream->readUTF(); + pFD->Family = InStream->readShort(); + pFD->CharSet = InStream->readShort(); + pFD->Pitch = InStream->readShort(); + } + } + else if ( nPropId == BASEPROPERTY_FONT_SIZE ) + { + if ( nVersion < 2 ) + { + if ( !pFD ) + { + pFD = new ::com::sun::star::awt::FontDescriptor; + ImplPropertyInfo* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR ); + if ( pProp ) // wegen den Defaults... + pProp->GetValue() >>= *pFD; + } + pFD->Width = InStream->readLong(); + pFD->Height = InStream->readLong(); + InStream->readShort(); // ::com::sun::star::awt::FontWidth ignorieren - wurde mal falsch geschrieben und wird nicht gebraucht. + pFD->CharacterWidth = ::com::sun::star::awt::FontWidth::DONTKNOW; + } + } + else if ( nPropId == BASEPROPERTY_FONT_ATTRIBS ) + { + if ( nVersion < 2 ) + { + if ( !pFD ) + { + pFD = new ::com::sun::star::awt::FontDescriptor; + ImplPropertyInfo* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR ); + if ( pProp ) // wegen den Defaults... + pProp->GetValue() >>= *pFD; + } + pFD->Weight = VCLUnoHelper::ConvertFontWeight( (FontWeight) InStream->readShort() ); + pFD->Slant = (::com::sun::star::awt::FontSlant)InStream->readShort(); + pFD->Underline = InStream->readShort(); + pFD->Strikeout = InStream->readShort(); + pFD->Orientation = ( (double)InStream->readShort() ) / 10; + pFD->Kerning = InStream->readBoolean(); + pFD->WordLineMode = InStream->readBoolean(); + } + } + else + { + DBG_ERROR( "read: unknown Property!" ); + } + } + } + else // bVoid + { + if ( nPropId == BASEPROPERTY_FONTDESCRIPTOR ) + { + EmptyFontDescriptor aFD; + aValue <<= aFD; + } + } + + if ( mpData->Get( nPropId ) ) + { + aProps.getArray()[n] = GetPropertyName( nPropId ); + aValues.getArray()[n] = aValue; + } + else + { + bInvalidEntries = sal_True; + } + + // Falls bereits mehr drinsteht als diese Version kennt: + xMark->jumpToMark( nPropDataBeginMark ); + InStream->skipBytes( nPropDataLen ); + xMark->deleteMark(nPropDataBeginMark); + } + if ( bInvalidEntries ) + { + for ( n = 0; n < aProps.getLength(); n++ ) + { + if ( !aProps.getConstArray()[n].len() ) + { + ::utl::removeElementAt( aProps, n ); + ::utl::removeElementAt( aValues, n ); + n--; + } + } + } + + setPropertyValues( aProps, aValues ); + + if ( pFD ) + { + ::com::sun::star::uno::Any aValue; + aValue <<= *pFD; + setPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ), aValue ); + delete pFD; + } +} + + +// ::com::sun::star::lang::XServiceInfo +::rtl::OUString UnoControlModel::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_ERROR( "This method should be overloaded!" ); + return ::rtl::OUString(); + +} + +sal_Bool UnoControlModel::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames(); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == rServiceName ) + return sal_True; + return sal_False; +} + +::com::sun::star::uno::Sequence< ::rtl::OUString > UnoControlModel::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + DBG_ERROR( "This method should be overloaded!" ); + return ::com::sun::star::uno::Sequence< ::rtl::OUString >(); +} + +// ::cppu::OPropertySetHelper +::cppu::IPropertyArrayHelper& UnoControlModel::getInfoHelper() +{ + DBG_ERROR( "UnoControlModel::getInfoHelper() not possible!" ); + return *(::cppu::IPropertyArrayHelper*) NULL; +} + +sal_Bool UnoControlModel::convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_Bool bVoid = rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + if ( bVoid ) + { + rConvertedValue.clear(); + } + else + { + const ::com::sun::star::uno::Type* pDestType = GetPropertyType( nPropId ); + if ( pDestType->getTypeClass() == ::com::sun::star::uno::TypeClass_ANY ) + { + rConvertedValue = rValue; + } + else + { + rConvertedValue.setValue( rValue.getValue(), *pDestType ); + } + } + getFastPropertyValue( rOldValue, nPropId ); + return !CompareProperties( rConvertedValue, rOldValue ); +} + +void UnoControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + // Fehlt: Die gefakten Einzelproperties des FontDescriptors... + + ImplPropertyInfo* pProp = mpData->Get( nPropId ); + if ( pProp ) + { + sal_Bool bVoid = rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + + DBG_ASSERT( !bVoid || ( GetPropertyAttribs( nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" ); + ImplPropertyChanged( nPropId ); + pProp->SetValue( rValue ); + } + else + { + // exception... + DBG_ERROR( "SetPropertyValues: Invalid Property!" ); + } +} + +void UnoControlModel::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nPropId ) const +{ + ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlModel*)this)->GetMutex() ); + + ImplPropertyInfo* pProp = mpData->Get( nPropId ); + + if ( pProp ) + rValue = pProp->GetValue(); + else if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) ) + { + pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR ); + ::com::sun::star::awt::FontDescriptor aFD; + pProp->GetValue() >>= aFD; + switch ( nPropId ) + { + case BASEPROPERTY_FONTDESCRIPTORPART_NAME: rValue <<= aFD.Name; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: rValue <<= aFD.StyleName; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: rValue <<= aFD.Family; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: rValue <<= aFD.CharSet; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: rValue <<= (float)aFD.Height; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue <<= aFD.Weight; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: rValue <<= (sal_Int16)aFD.Slant; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue <<= aFD.Underline; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: rValue <<= aFD.Strikeout; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: rValue <<= aFD.Width; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: rValue <<= aFD.Pitch; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: rValue <<= aFD.CharacterWidth; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: rValue <<= aFD.Orientation; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: rValue <<= aFD.Kerning; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: rValue <<= aFD.WordLineMode; + break; + case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: rValue <<= aFD.Type; + break; + default: DBG_ERROR( "FontProperty?!" ); + } + } + else + { + DBG_ERROR( "getFastPropertyValue - invalid Property!" ); + } +} + +// ::com::sun::star::beans::XPropertySet +void UnoControlModel::setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_Int32 nPropId = (sal_Int32) GetPropertyId( rPropertyName ); + DBG_ASSERT( nPropId, "Invalid ID in UnoControlModel::setPropertyValue" ); + setFastPropertyValue( nPropId, rValue ); +} + +// ::com::sun::star::beans::XFastPropertySet +void UnoControlModel::setFastPropertyValue( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) ) + { + ImplPropertyInfo* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR ); + ::com::sun::star::awt::FontDescriptor aFD; + pProp->GetValue() >>= aFD; + lcl_ImplMergeFontProperty( aFD, nPropId, rValue ); + + ::com::sun::star::uno::Any aFDValue; + aFDValue <<= aFD; + nPropId = BASEPROPERTY_FONTDESCRIPTOR; + setFastPropertyValues( 1, &nPropId, &aFDValue, 1 ); + } + else + setFastPropertyValues( 1, &nPropId, &rValue, 1 ); +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_ERROR( "UnoControlModel::getPropertySetInfo() not possible!" ); + return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >(); +} + +void UnoControlModel::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_uInt16 nProps = rPropertyNames.getLength(); + sal_Int32* pHandles = new sal_Int32[nProps]; + const ::com::sun::star::uno::Any* pValues = Values.getConstArray(); + sal_uInt16 nValidHandles = getInfoHelper().fillHandles( pHandles, rPropertyNames ); + + if ( nValidHandles ) + { + // Einzelproperties vom ::com::sun::star::awt::FontDescriptor rausfischen... + ::com::sun::star::awt::FontDescriptor* pFD = NULL; + for ( sal_uInt16 n = 0; n < nProps; n++ ) + { + if ( ( pHandles[n] >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( pHandles[n] <= BASEPROPERTY_FONTDESCRIPTORPART_END ) ) + { + if ( !pFD ) + { + ImplPropertyInfo* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR ); + pFD = new ::com::sun::star::awt::FontDescriptor; + pProp->GetValue() >>= *pFD; + } + lcl_ImplMergeFontProperty( *pFD, pHandles[n], pValues[n] ); + pHandles[n] = -1; + nValidHandles--; + } + } + + if ( nValidHandles ) + setFastPropertyValues( nProps, pHandles, pValues, nValidHandles ); + + // FD-Propertie nicht in das Array mergen, weil sortiert... + if ( pFD ) + { + ::com::sun::star::uno::Any aValue; + aValue <<= *pFD; + sal_Int32 nHandle = BASEPROPERTY_FONTDESCRIPTOR; + setFastPropertyValues( 1, &nHandle, &aValue, 1 ); + delete pFD; + } + } + + delete pHandles; +} + + + diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx new file mode 100644 index 000000000000..561b1b77a0f0 --- /dev/null +++ b/toolkit/source/controls/unocontrols.cxx @@ -0,0 +1,3090 @@ +/************************************************************************* + * + * $RCSfile: unocontrols.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_AWT_XTEXTAREA_HPP_ +#include <com/sun/star/awt/XTextArea.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_ +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + + +#include <toolkit/controls/unocontrols.hxx> +#include <toolkit/helper/property.hxx> +#include <toolkit/helper/unopropertyarrayhelper.hxx> +#include <toolkit/helper/unomemorystream.hxx> +#include <toolkit/helper/servicenames.hxx> +#include <toolkit/helper/macros.hxx> + +#include <cppuhelper/typeprovider.hxx> + +#include <unotools/processfactory.hxx> + +#include <vcl/wrkwin.hxx> +#include <vcl/svapp.hxx> + +#include <vcl/edit.hxx> +#include <vcl/button.hxx> +#include <vcl/group.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/combobox.hxx> + +#include <tools/debug.hxx> + +// ---------------------------------------------------- +// class UnoControlEditModel +// ---------------------------------------------------- +UnoControlEditModel::UnoControlEditModel() +{ + ImplRegisterProperty( BASEPROPERTY_ALIGN ); + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ECHOCHAR ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HARDLINEBREAKS ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_HSCROLL ); + ImplRegisterProperty( BASEPROPERTY_MAXTEXTLEN ); + ImplRegisterProperty( BASEPROPERTY_MULTILINE ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_READONLY ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXT ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); + ImplRegisterProperty( BASEPROPERTY_VSCROLL ); +} + +::rtl::OUString UnoControlEditModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlEditModel ); +} + +::com::sun::star::uno::Any UnoControlEditModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlEdit ); + return aAny; + } + + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + +::cppu::IPropertyArrayHelper& UnoControlEditModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlEditModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + +// ---------------------------------------------------- +// class UnoEditControl +// ---------------------------------------------------- +UnoEditControl::UnoEditControl() + : maTextListeners( *this ) +{ + maComponentInfos.nWidth = 100; + maComponentInfos.nHeight = 12; +} + +::rtl::OUString UnoEditControl::GetComponentServiceName() +{ + ::rtl::OUString aName( ::rtl::OUString::createFromAscii( "Edit" ) ); + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_MULTILINE ) ); + sal_Bool b; + if ( ( aVal >>= b ) && b ) + aName= ::rtl::OUString::createFromAscii( "MultiLineEdit" ); + return aName; +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoEditControl::queryAggregation( 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::awt::XTextComponent*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XTextListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, SAL_STATIC_CAST( ::com::sun::star::awt::XTextListener*, this ) ), + SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) ); + return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoEditControl ) +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ), +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener>* ) NULL ), +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ), +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ), +UnoControlBase::getTypes() +IMPL_XTYPEPROVIDER_END + + +void UnoEditControl::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::lang::EventObject aEvt; + aEvt.Source = (::cppu::OWeakObject*)this; + maTextListeners.disposeAndClear( aEvt ); + UnoControl::dispose(); +} + +void UnoEditControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException) +{ + UnoControl::createPeer( rxToolkit, rParentPeer ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xText->addTextListener( this ); +} + +void UnoEditControl::textChanged(const ::com::sun::star::awt::TextEvent& e) throw(::com::sun::star::uno::RuntimeException) +{ + // Neuen Text als ::com::sun::star::beans::Property ins Model treten. + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + DBG_ASSERT( xText.is(), "TextComponentInterface?" ); + + ::com::sun::star::uno::Any aAny; + aAny <<= xText->getText(); + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_False ); + + if ( maTextListeners.getLength() ) + maTextListeners.textChanged( e ); +} + +void UnoEditControl::addTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maTextListeners.addInterface( l ); +} + +void UnoEditControl::removeTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maTextListeners.removeInterface( l ); +} + +void UnoEditControl::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= aText; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_True ); +} + +void UnoEditControl::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= aText; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_True ); + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xText->insertText( rSel, aText ); + } +} + +::rtl::OUString UnoEditControl::getText() throw(::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString aText; + ::rtl::OUString aLineBreakProp( GetPropertyName( BASEPROPERTY_HARDLINEBREAKS ) ); + if ( mxPeer.is() && ImplHasProperty( aLineBreakProp ) && ImplGetPropertyValue_BOOL( BASEPROPERTY_HARDLINEBREAKS ) ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextArea > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + aText = xText->getTextLines(); + } + else if ( mxPeer.is() ) + { + // Peer fragen, weil es die ::com::sun::star::beans::Property "Text" nicht geben muss... + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + aText = xText->getText(); + } + else + { + aText = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT ); + } + + return aText; +} + +::rtl::OUString UnoEditControl::getSelectedText( void ) throw(::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString aSelected; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + aSelected = xText->getSelectedText(); + } + return aSelected; +} + +void UnoEditControl::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xText->setSelection( aSelection ); + } +} + +::com::sun::star::awt::Selection UnoEditControl::getSelection( void ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::awt::Selection aSel; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + aSel = xText->getSelection(); + } + return aSel; +} + +sal_Bool UnoEditControl::isEditable( void ) throw(::com::sun::star::uno::RuntimeException) +{ + return !ImplGetPropertyValue_BOOL( BASEPROPERTY_READONLY ); +} + +void UnoEditControl::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= (sal_Bool)!bEditable; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_READONLY ), aAny, sal_True ); +} + +sal_Int16 UnoEditControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException) +{ + return !ImplGetPropertyValue_INT16( BASEPROPERTY_MAXTEXTLEN ); +} + +void UnoEditControl::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= (sal_Int16)nLen; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MAXTEXTLEN ), aAny, sal_True ); +} + +::com::sun::star::awt::Size UnoEditControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getMinimumSize(); +} + +::com::sun::star::awt::Size UnoEditControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getPreferredSize(); +} + +::com::sun::star::awt::Size UnoEditControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_calcAdjustedSize( rNewSize ); +} + +::com::sun::star::awt::Size UnoEditControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getMinimumSize( nCols, nLines ); +} + +void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + Impl_getColumnsAndLines( nCols, nLines ); +} + +// ---------------------------------------------------- +// class UnoControlFormattedFieldModel +// ---------------------------------------------------- +UnoControlFormattedFieldModel::UnoControlFormattedFieldModel() +{ + ImplRegisterProperty( BASEPROPERTY_ALIGN ); + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_DEFAULT ); + ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_VALUE ); + ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MAX ); + ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MIN ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_FORMATKEY ); + ImplRegisterProperty( BASEPROPERTY_FORMATSSUPPLIER ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_MAXTEXTLEN ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_READONLY ); + ImplRegisterProperty( BASEPROPERTY_SPIN ); + ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); + + ::com::sun::star::uno::Any aTreatAsNumber; + aTreatAsNumber <<= (sal_Bool) sal_True; + ImplRegisterProperty( BASEPROPERTY_TREATASNUMBER, aTreatAsNumber ); +} + +::rtl::OUString UnoControlFormattedFieldModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedFieldModel ); +} + +::com::sun::star::uno::Any UnoControlFormattedFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + ::com::sun::star::uno::Any aReturn; + switch (nPropId) + { + case BASEPROPERTY_DEFAULTCONTROL: aReturn <<= ::rtl::OUString( ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedField ) ); + + case BASEPROPERTY_TREATASNUMBER: aReturn <<= (sal_Bool)sal_True; break; + + case BASEPROPERTY_EFFECTIVE_DEFAULT: + case BASEPROPERTY_EFFECTIVE_VALUE: + case BASEPROPERTY_EFFECTIVE_MAX: + case BASEPROPERTY_EFFECTIVE_MIN: + case BASEPROPERTY_FORMATKEY: + case BASEPROPERTY_FORMATSSUPPLIER: + // (void) + break; + + default : aReturn = UnoControlModel::ImplGetDefaultValue( nPropId ); break; + } + + return aReturn; +} + +::cppu::IPropertyArrayHelper& UnoControlFormattedFieldModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlFormattedFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + +// ---------------------------------------------------- +// class UnoFormattedFieldControl +// ---------------------------------------------------- +UnoFormattedFieldControl::UnoFormattedFieldControl() +{ +} + +::rtl::OUString UnoFormattedFieldControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "FormattedField" ); +} + +void UnoFormattedFieldControl::textChanged(const ::com::sun::star::awt::TextEvent& e) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > xPeer(mxPeer, ::com::sun::star::uno::UNO_QUERY); + DBG_ASSERT(xPeer.is(), "UnoFormattedFieldControl::textChanged : what kind of peer do I have ?"); + ::rtl::OUString sEffectiveValue = GetPropertyName( BASEPROPERTY_EFFECTIVE_VALUE ); + ImplSetPropertyValue( sEffectiveValue, xPeer->getProperty( sEffectiveValue ), sal_False ); + + if ( GetTextListeners().getLength() ) + GetTextListeners().textChanged( e ); +} + +// ---------------------------------------------------- +// class UnoControlFileControlModel +// ---------------------------------------------------- +UnoControlFileControlModel::UnoControlFileControlModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXT ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); +} + +::rtl::OUString UnoControlFileControlModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControlModel ); +} + +::com::sun::star::uno::Any UnoControlFileControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControl ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + +::cppu::IPropertyArrayHelper& UnoControlFileControlModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlFileControlModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + +// ---------------------------------------------------- +// class UnoFileControl +// ---------------------------------------------------- +UnoFileControl::UnoFileControl() +{ +} + +::rtl::OUString UnoFileControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "filecontrol" ); +} + +// ---------------------------------------------------- +// class UnoControlButtonModel +// ---------------------------------------------------- +UnoControlButtonModel::UnoControlButtonModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTBUTTON ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_IMAGEURL ); + ImplRegisterProperty( BASEPROPERTY_LABEL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); +} + +::rtl::OUString UnoControlButtonModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlButtonModel ); +} + +::com::sun::star::uno::Any UnoControlButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlButton ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + + +::cppu::IPropertyArrayHelper& UnoControlButtonModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlButtonModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + + +// ---------------------------------------------------- +// class UnoButtonControl +// ---------------------------------------------------- +UnoButtonControl::UnoButtonControl() + : maActionListeners( *this ) +{ + maComponentInfos.nWidth = 50; + maComponentInfos.nHeight = 14; +} + +::rtl::OUString UnoButtonControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "pushbutton" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoButtonControl::queryAggregation( 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::awt::XButton*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XImageConsumer*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XImageProducer*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ) ); + return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoButtonControl ) +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ), +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer>* ) NULL ), +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer>* ) NULL ), +getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ), +UnoControlBase::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoButtonControl::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::lang::EventObject aEvt; + aEvt.Source = (::cppu::OWeakObject*)this; + maActionListeners.disposeAndClear( aEvt ); + UnoControl::dispose(); +} + +void UnoButtonControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException) +{ + UnoControl::createPeer( rxToolkit, rParentPeer ); + + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XButton > xButton( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + if ( maActionListeners.getLength() ) + xButton->addActionListener( &maActionListeners ); +} + +void UnoButtonControl::addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maActionListeners.addInterface( l ); + if( mxPeer.is() && maActionListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XButton > xButton( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xButton->addActionListener( &maActionListeners ); + } +} + +void UnoButtonControl::removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + if( mxPeer.is() && maActionListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XButton > xButton( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xButton->removeActionListener( &maActionListeners ); + } + maActionListeners.removeInterface( l ); +} + +void UnoButtonControl::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= rLabel; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True ); +} + +void UnoButtonControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException) +{ + maActionCommand = rCommand; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XButton > xButton( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xButton->setActionCommand( rCommand ); + } +} + +::com::sun::star::awt::Size UnoButtonControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getMinimumSize(); +} + +::com::sun::star::awt::Size UnoButtonControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getPreferredSize(); +} + +::com::sun::star::awt::Size UnoButtonControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_calcAdjustedSize( rNewSize ); +} + +void UnoButtonControl::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException) +{ + maImageConsumer.Init( Width, Height ); +} + +void UnoButtonControl::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException) +{ + maImageConsumer.SetColorModel( BitCount, RGBAPal.getLength(), (const unsigned long*)RGBAPal.getConstArray(), RedMask, GreenMask, BlueMask, AlphaMask ); +} + +void UnoButtonControl::setPixelsByBytes( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException) +{ + maImageConsumer.SetPixelsByBytes( X, Y, Width, Height, (const unsigned char*)ProducerData.getConstArray(), Offset, Scansize ); + ImplUpdateImage( sal_True ); +} + +void UnoButtonControl::setPixelsByLongs( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int32 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException) +{ + maImageConsumer.SetPixelsByLongs( X, Y, Width, Height, (const unsigned long*)ProducerData.getConstArray(), Offset, Scansize ); + ImplUpdateImage( sal_True ); +} + +void UnoButtonControl::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageProducer > & Producer ) throw(::com::sun::star::uno::RuntimeException) +{ + maImageConsumer.Completed( Status ); + + // MT: Controls sollen angemeldet bleiben... +// Producer->removeConsumer( this ); + + ImplUpdateImage( sal_True ); +} + +void UnoButtonControl::addConsumer( const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > & Consumer ) throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxImageProducer.is() ) + mxImageProducer->addConsumer( Consumer ); +} + +void UnoButtonControl::removeConsumer( const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > & Consumer ) throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxImageProducer.is() ) + mxImageProducer->removeConsumer( Consumer ); +} + +void UnoButtonControl::startProduction() throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxImageProducer.is() ) + { + UnoMemoryStream* pStrm = new UnoMemoryStream( 0x3FFF, 0x3FFF ); + (*pStrm) << maBitmap; + + ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xIn = pStrm; +// mxImageProducer->setImage( xIn ); + mxImageProducer->startProduction(); + } +} + +void UnoButtonControl::ImplUpdateImage( sal_Bool bGetNewImage ) +{ + sal_Bool bOK = bGetNewImage ? maImageConsumer.GetData( maBitmap ) : sal_True; + if ( bOK && mxPeer.is() && mxImageProducer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > xC( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + addConsumer( xC ); + startProduction(); + removeConsumer( xC ); + } +} + +// ---------------------------------------------------- +// class UnoControlImageControlModel +// ---------------------------------------------------- +UnoControlImageControlModel::UnoControlImageControlModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_IMAGEURL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); +} + +::rtl::OUString UnoControlImageControlModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControlModel ); +} + +::com::sun::star::uno::Any UnoControlImageControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControl ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + + +::cppu::IPropertyArrayHelper& UnoControlImageControlModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlImageControlModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + + +// ---------------------------------------------------- +// class UnoImageControlControl +// ---------------------------------------------------- +UnoImageControlControl::UnoImageControlControl() + : maActionListeners( *this ) +{ + // Woher die Defaults nehmen? + maComponentInfos.nWidth = 100; + maComponentInfos.nHeight = 100; + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory(); + ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( szServiceName_ImageProducer ) ); + if ( xI.is() ) + mxImageProducer = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >( xI, ::com::sun::star::uno::UNO_QUERY ); +} + +::rtl::OUString UnoImageControlControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "fixedimage" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoImageControlControl::queryAggregation( 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::awt::XImageConsumer*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XImageProducer*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ) ); + return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoImageControlControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ), + UnoControlBase::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoImageControlControl::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::lang::EventObject aEvt; + aEvt.Source = (::cppu::OWeakObject*)this; + maActionListeners.disposeAndClear( aEvt ); + UnoControl::dispose(); +} + +sal_Bool UnoImageControlControl::isTransparent() throw(::com::sun::star::uno::RuntimeException) +{ + return sal_True; +} + +::com::sun::star::awt::Size UnoImageControlControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getMinimumSize(); +} + +::com::sun::star::awt::Size UnoImageControlControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getPreferredSize(); +} + +::com::sun::star::awt::Size UnoImageControlControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_calcAdjustedSize( rNewSize ); +} + +void UnoImageControlControl::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException) +{ + maImageConsumer.Init( Width, Height ); +} + +void UnoImageControlControl::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException) +{ + maImageConsumer.SetColorModel( BitCount, RGBAPal.getLength(), (const unsigned long*)RGBAPal.getConstArray(), RedMask, GreenMask, BlueMask, AlphaMask ); +} + +void UnoImageControlControl::setPixelsByBytes( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException) +{ + maImageConsumer.SetPixelsByBytes( X, Y, Width, Height, (const unsigned char*)ProducerData.getConstArray(), Offset, Scansize ); + ImplUpdateImage( sal_True ); +} + +void UnoImageControlControl::setPixelsByLongs( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int32 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException) +{ + maImageConsumer.SetPixelsByLongs( X, Y, Width, Height, (const unsigned long*)ProducerData.getConstArray(), Offset, Scansize ); + ImplUpdateImage( sal_True ); +} + +void UnoImageControlControl::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageProducer > & Producer ) throw(::com::sun::star::uno::RuntimeException) +{ + maImageConsumer.Completed( Status ); + + // MT: Controls sollen angemeldet bleiben... +// Producer->removeConsumer( this ); + + ImplUpdateImage( sal_True ); +} + +void UnoImageControlControl::addConsumer( const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > & Consumer ) throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxImageProducer.is() ) + mxImageProducer->addConsumer( Consumer ); +} + +void UnoImageControlControl::removeConsumer( const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > & Consumer ) throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxImageProducer.is() ) + mxImageProducer->removeConsumer( Consumer ); +} + +void UnoImageControlControl::startProduction() throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxImageProducer.is() ) + { + UnoMemoryStream* pStrm = new UnoMemoryStream( 0x3FFF, 0x3FFF ); + (*pStrm) << maBitmap; + + ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xIn = pStrm; +// mxImageProducer->setImage( xIn ); + mxImageProducer->startProduction(); + } +} + +void UnoImageControlControl::ImplUpdateImage( sal_Bool bGetNewImage ) +{ + sal_Bool bOK = bGetNewImage ? maImageConsumer.GetData( maBitmap ) : sal_True; + if ( bOK && mxPeer.is() && mxImageProducer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > xC( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + addConsumer( xC ); + startProduction(); + removeConsumer( xC ); + } +} + +// ---------------------------------------------------- +// class UnoControlRadioButtonModel +// ---------------------------------------------------- +UnoControlRadioButtonModel::UnoControlRadioButtonModel() +{ + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_LABEL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_STATE ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); +} + +::rtl::OUString UnoControlRadioButtonModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButtonModel ); +} + +::com::sun::star::uno::Any UnoControlRadioButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButton ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + +::cppu::IPropertyArrayHelper& UnoControlRadioButtonModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlRadioButtonModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + + +// ---------------------------------------------------- +// class UnoRadioButtonControl +// ---------------------------------------------------- +UnoRadioButtonControl::UnoRadioButtonControl() + : maItemListeners( *this ) +{ + maComponentInfos.nWidth = 100; + maComponentInfos.nHeight = 12; +} + +::rtl::OUString UnoRadioButtonControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "radiobutton" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoRadioButtonControl::queryAggregation( 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::awt::XRadioButton*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ) ), + SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ) ); + return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoRadioButtonControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ), + UnoControlBase::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoRadioButtonControl::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::lang::EventObject aEvt; + aEvt.Source = (::cppu::OWeakObject*)this; + maItemListeners.disposeAndClear( aEvt ); + UnoControl::dispose(); +} + + +sal_Bool UnoRadioButtonControl::isTransparent() throw(::com::sun::star::uno::RuntimeException) +{ + return sal_True; +} + +void UnoRadioButtonControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException) +{ + UnoControl::createPeer( rxToolkit, rParentPeer ); + + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XRadioButton > xRadioButton( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xRadioButton->addItemListener( this ); + + // Toggle-Verhalten abklemmen, macht DG + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > xVclWindowPeer( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Any aAny; + aAny <<= (sal_Bool)sal_False; + xVclWindowPeer->setProperty( GetPropertyName( BASEPROPERTY_AUTOTOGGLE ), aAny ); +} + +void UnoRadioButtonControl::addItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maItemListeners.addInterface( l ); +} + +void UnoRadioButtonControl::removeItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maItemListeners.removeInterface( l ); +} + +void UnoRadioButtonControl::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= rLabel; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True ); +} + +void UnoRadioButtonControl::setState( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int16 nState = bOn ? 1 : 0; + ::com::sun::star::uno::Any aAny; + aAny <<= nState; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_True ); +} + +sal_Bool UnoRadioButtonControl::getState() throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int16 nState = 0; + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) ); + aVal >>= nState; + return nState ? sal_True : sal_False; +} + +void UnoRadioButtonControl::itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= (sal_Int16)rEvent.Selected; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False ); + + if ( maItemListeners.getLength() ) + maItemListeners.itemStateChanged( rEvent ); +} + +::com::sun::star::awt::Size UnoRadioButtonControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getMinimumSize(); +} + +::com::sun::star::awt::Size UnoRadioButtonControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getPreferredSize(); +} + +::com::sun::star::awt::Size UnoRadioButtonControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_calcAdjustedSize( rNewSize ); +} + +// ---------------------------------------------------- +// class UnoControlCheckBoxModel +// ---------------------------------------------------- +UnoControlCheckBoxModel::UnoControlCheckBoxModel() +{ + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_LABEL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_STATE ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); + ImplRegisterProperty( BASEPROPERTY_TRISTATE ); +} + +::rtl::OUString UnoControlCheckBoxModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBoxModel ); +} + +::com::sun::star::uno::Any UnoControlCheckBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBox ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + + +::cppu::IPropertyArrayHelper& UnoControlCheckBoxModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlCheckBoxModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + + +// ---------------------------------------------------- +// class UnoCheckBoxControl +// ---------------------------------------------------- +UnoCheckBoxControl::UnoCheckBoxControl() + : maItemListeners( *this ) +{ + maComponentInfos.nWidth = 100; + maComponentInfos.nHeight = 12; +} + +::rtl::OUString UnoCheckBoxControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "checkbox" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoCheckBoxControl::queryAggregation( 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::awt::XCheckBox*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ) ), + SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ) ); + return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoCheckBoxControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ), + UnoControlBase::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoCheckBoxControl::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::lang::EventObject aEvt; + aEvt.Source = (::cppu::OWeakObject*)this; + maItemListeners.disposeAndClear( aEvt ); + UnoControl::dispose(); +} + +sal_Bool UnoCheckBoxControl::isTransparent() throw(::com::sun::star::uno::RuntimeException) +{ + return sal_True; +} + +void UnoCheckBoxControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException) +{ + UnoControl::createPeer( rxToolkit, rParentPeer ); + + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XCheckBox > xCheckBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xCheckBox->addItemListener( this ); +} + +void UnoCheckBoxControl::addItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maItemListeners.addInterface( l ); +} + +void UnoCheckBoxControl::removeItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maItemListeners.removeInterface( l ); +} + +void UnoCheckBoxControl::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= rLabel; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True ); +} + +void UnoCheckBoxControl::setState( short n ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= (sal_Int16)n; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_True ); +} + +short UnoCheckBoxControl::getState() throw(::com::sun::star::uno::RuntimeException) +{ + short nState = 0; + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) ); + aVal >>= nState; + return nState; +} + +void UnoCheckBoxControl::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= b; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TRISTATE ), aAny, sal_True ); +} + +void UnoCheckBoxControl::itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= (sal_Int16)rEvent.Selected; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False ); + + if ( maItemListeners.getLength() ) + maItemListeners.itemStateChanged( rEvent ); +} + +::com::sun::star::awt::Size UnoCheckBoxControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getMinimumSize(); +} + +::com::sun::star::awt::Size UnoCheckBoxControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getPreferredSize(); +} + +::com::sun::star::awt::Size UnoCheckBoxControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_calcAdjustedSize( rNewSize ); +} + +// ---------------------------------------------------- +// class UnoControlFixedTextModel +// ---------------------------------------------------- +UnoControlFixedTextModel::UnoControlFixedTextModel() +{ + ImplRegisterProperty( BASEPROPERTY_ALIGN ); + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_LABEL ); + ImplRegisterProperty( BASEPROPERTY_MULTILINE ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); +} + +::rtl::OUString UnoControlFixedTextModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedTextModel ); +} + +::com::sun::star::uno::Any UnoControlFixedTextModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedText ); + return aAny; + } + else if ( nPropId == BASEPROPERTY_BORDER ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= (sal_Int16)0; + return aAny; + } + + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + +::cppu::IPropertyArrayHelper& UnoControlFixedTextModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlFixedTextModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + +// ---------------------------------------------------- +// class UnoFixedTextControl +// ---------------------------------------------------- +UnoFixedTextControl::UnoFixedTextControl() +{ + maComponentInfos.nWidth = 100; + maComponentInfos.nHeight = 12; +} + +::rtl::OUString UnoFixedTextControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "fixedtext" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoFixedTextControl::queryAggregation( 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::awt::XFixedText*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ) ); + return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoFixedTextControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ), + UnoControlBase::getTypes() +IMPL_XTYPEPROVIDER_END + +sal_Bool UnoFixedTextControl::isTransparent() throw(::com::sun::star::uno::RuntimeException) +{ + return sal_True; +} + +void UnoFixedTextControl::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Text; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True ); +} + +::rtl::OUString UnoFixedTextControl::getText() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL ); +} + +void UnoFixedTextControl::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= (sal_Int16)nAlign; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True ); +} + +short UnoFixedTextControl::getAlignment() throw(::com::sun::star::uno::RuntimeException) +{ + short nAlign = 0; + if ( mxModel.is() ) + { + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) ); + aVal >>= nAlign; + } + return nAlign; +} + +::com::sun::star::awt::Size UnoFixedTextControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getMinimumSize(); +} + +::com::sun::star::awt::Size UnoFixedTextControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getPreferredSize(); +} + +::com::sun::star::awt::Size UnoFixedTextControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_calcAdjustedSize( rNewSize ); +} + +// ---------------------------------------------------- +// class UnoControlGroupBoxModel +// ---------------------------------------------------- +UnoControlGroupBoxModel::UnoControlGroupBoxModel() +{ + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_LABEL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); +} + +::rtl::OUString UnoControlGroupBoxModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBoxModel ); +} + +::com::sun::star::uno::Any UnoControlGroupBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + +::cppu::IPropertyArrayHelper& UnoControlGroupBoxModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlGroupBoxModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + +// ---------------------------------------------------- +// class UnoGroupBoxControl +// ---------------------------------------------------- +UnoGroupBoxControl::UnoGroupBoxControl() +{ + maComponentInfos.nWidth = 100; + maComponentInfos.nHeight = 100; +} + +::rtl::OUString UnoGroupBoxControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "groupbox" ); +} + +sal_Bool UnoGroupBoxControl::isTransparent() throw(::com::sun::star::uno::RuntimeException) +{ + return sal_True; +} + +// ---------------------------------------------------- +// class UnoControlListBoxModel +// ---------------------------------------------------- +UnoControlListBoxModel::UnoControlListBoxModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_DROPDOWN ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_LINECOUNT ); + ImplRegisterProperty( BASEPROPERTY_MULTISELECTION ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_SELECTEDITEMS ); + ImplRegisterProperty( BASEPROPERTY_STRINGITEMLIST ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); + ImplRegisterProperty( BASEPROPERTY_READONLY ); +} + +::rtl::OUString UnoControlListBoxModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel ); +} + +::com::sun::star::uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBox ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + +::cppu::IPropertyArrayHelper& UnoControlListBoxModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + +void UnoControlListBoxModel::ImplPropertyChanged( sal_uInt16 nPropId ) +{ + if ( nPropId == BASEPROPERTY_STRINGITEMLIST ) + { + ::com::sun::star::uno::Sequence<sal_Int16> aSeq; + ::com::sun::star::uno::Any aAny; + aAny <<= aSeq; + setPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny ); + } +} + +// ---------------------------------------------------- +// class UnoListBoxControl +// ---------------------------------------------------- +UnoListBoxControl::UnoListBoxControl() + : maActionListeners( *this ), + maItemListeners( *this ) +{ + maComponentInfos.nWidth = 100; + maComponentInfos.nHeight = 12; +} + +::rtl::OUString UnoListBoxControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "listbox" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoListBoxControl::queryAggregation( 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::awt::XListBox*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ) ), + SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) ); + return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoListBoxControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ), + UnoControlBase::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoListBoxControl::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::lang::EventObject aEvt; + aEvt.Source = (::cppu::OWeakObject*)this; + maActionListeners.disposeAndClear( aEvt ); + maItemListeners.disposeAndClear( aEvt ); + UnoControl::dispose(); +} + +void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ) +{ + UnoControl::ImplSetPeerProperty( rPropName, rVal ); + + // Wenn die SelectedItems vor der StringItemList gesetzt werden, + // hat das keine Auswirkung... + if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ) + { + ::rtl::OUString aSelPropName = GetPropertyName( BASEPROPERTY_SELECTEDITEMS ); + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( aSelPropName ); + if ( !( aVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID ) ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xW->setProperty( aSelPropName, aVal ); + } + } +} + +void UnoListBoxControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException) +{ + UnoControl::createPeer( rxToolkit, rParentPeer ); + + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xListBox->addItemListener( this ); + + if ( maActionListeners.getLength() ) + xListBox->addActionListener( &maActionListeners ); +} + +void UnoListBoxControl::addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maActionListeners.addInterface( l ); + if( mxPeer.is() && maActionListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xListBox->addActionListener( &maActionListeners ); + } +} + +void UnoListBoxControl::removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + if( mxPeer.is() && maActionListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xListBox->removeActionListener( &maActionListeners ); + } + maActionListeners.removeInterface( l ); +} + +void UnoListBoxControl::addItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maItemListeners.addInterface( l ); +} + +void UnoListBoxControl::removeItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maItemListeners.removeInterface( l ); +} + +void UnoListBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( 1 ); + aSeq.getArray()[0] = aItem; + addItems( aSeq, nPos ); +} + +void UnoListBoxControl::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + aVal >>= aSeq; + sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength(); + sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength(); + sal_uInt16 nNewLen = nOldLen + nNewItems; + + ::com::sun::star::uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen ); + ::rtl::OUString* pNewData = aNewSeq.getArray(); + ::rtl::OUString* pOldData = aSeq.getArray(); + + if ( nPos > nOldLen ) + nPos = (sal_uInt16) nOldLen; + + sal_uInt16 n; + // Items vor der Einfuege-Position + for ( n = 0; n < nPos; n++ ) + pNewData[n] = pOldData[n]; + + // Neue Items + for ( n = 0; n < nNewItems; n++ ) + pNewData[nPos+n] = aItems.getConstArray()[n]; + + // Rest der alten Items + for ( n = nPos; n < nOldLen; n++ ) + pNewData[nNewItems+n] = pOldData[n]; + + ::com::sun::star::uno::Any aAny; + aAny <<= aNewSeq; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True ); +} + +void UnoListBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + aVal >>= aSeq; + sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength(); + if ( nOldLen && ( nPos < nOldLen ) ) + { + if ( nCount > ( nOldLen-nPos ) ) + nCount = nOldLen-nPos; + + sal_uInt16 nNewLen = nOldLen - nCount; + + ::com::sun::star::uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen ); + ::rtl::OUString* pNewData = aNewSeq.getArray(); + ::rtl::OUString* pOldData = aSeq.getArray(); + + sal_uInt16 n; + // Items vor der Entfern-Position + for ( n = 0; n < nPos; n++ ) + pNewData[n] = pOldData[n]; + + // Rest der Items + for ( n = nPos; n < (nOldLen-nCount); n++ ) + pNewData[n] = pOldData[n+nCount]; + + ::com::sun::star::uno::Any aAny; + aAny <<= aNewSeq; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True ); + } +} + +sal_Int16 UnoListBoxControl::getItemCount() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + aVal >>= aSeq; + return (sal_Int16)aSeq.getLength(); +} + +::rtl::OUString UnoListBoxControl::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString aItem; + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + aVal >>= aSeq; + if ( nPos < aSeq.getLength() ) + aItem = aSeq.getConstArray()[nPos]; + return aItem; +} + +::com::sun::star::uno::Sequence< ::rtl::OUString> UnoListBoxControl::getItems() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + aVal >>= aSeq; + return aSeq; +} + +sal_Int16 UnoListBoxControl::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int16 n = -1; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + n = xListBox->getSelectedItemPos(); + } + return n; +} + +::com::sun::star::uno::Sequence<sal_Int16> UnoListBoxControl::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence<sal_Int16> aSeq; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + aSeq = xListBox->getSelectedItemsPos(); + } + return aSeq; +} + +::rtl::OUString UnoListBoxControl::getSelectedItem() throw(::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString aItem; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + aItem = xListBox->getSelectedItem(); + } + return aItem; +} + +::com::sun::star::uno::Sequence< ::rtl::OUString> UnoListBoxControl::getSelectedItems() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + aSeq = xListBox->getSelectedItems(); + } + return aSeq; +} + +void UnoListBoxControl::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xListBox->selectItemPos( nPos, bSelect ); + } +} + +void UnoListBoxControl::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xListBox->selectItemsPos( aPositions, bSelect ); + } +} + +void UnoListBoxControl::selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xListBox->selectItem( aItem, bSelect ); + } +} + +void UnoListBoxControl::makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xListBox->makeVisible( nEntry ); + } +} + +void UnoListBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= (sal_Int16)nLines; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, sal_True ); +} + +sal_Int16 UnoListBoxControl::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT ); +} + +sal_Bool UnoListBoxControl::isMutipleMode() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRINGITEMLIST ); +} + +void UnoListBoxControl::setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= bMulti; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTISELECTION ), aAny, sal_True ); +} + +void UnoListBoxControl::itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +{ + // Neue ::com::sun::star::uno::Sequence als ::com::sun::star::beans::Property ins Model treten. + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + DBG_ASSERT( xListBox.is(), "XListBox?" ); + + ::com::sun::star::uno::Sequence<sal_Int16> aSeq = xListBox->getSelectedItemsPos(); + ::com::sun::star::uno::Any aAny; + aAny <<= aSeq; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny, sal_False ); + + if ( maItemListeners.getLength() ) + maItemListeners.itemStateChanged( rEvent ); +} + +::com::sun::star::awt::Size UnoListBoxControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getMinimumSize(); +} + +::com::sun::star::awt::Size UnoListBoxControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getPreferredSize(); +} + +::com::sun::star::awt::Size UnoListBoxControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_calcAdjustedSize( rNewSize ); +} + +::com::sun::star::awt::Size UnoListBoxControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + return Impl_getMinimumSize( nCols, nLines ); +} + +void UnoListBoxControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + Impl_getColumnsAndLines( nCols, nLines ); +} + +// ---------------------------------------------------- +// class UnoControlComboBoxModel +// ---------------------------------------------------- +UnoControlComboBoxModel::UnoControlComboBoxModel() +{ + ImplRegisterProperty( BASEPROPERTY_AUTOCOMPLETE ); + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_DROPDOWN ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_LINECOUNT ); + ImplRegisterProperty( BASEPROPERTY_MAXTEXTLEN ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_READONLY ); + ImplRegisterProperty( BASEPROPERTY_STRINGITEMLIST ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXT ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); +} + +::rtl::OUString UnoControlComboBoxModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel ); +} + +::com::sun::star::uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + + +::cppu::IPropertyArrayHelper& UnoControlComboBoxModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlComboBoxModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + + +// ---------------------------------------------------- +// class UnoComboBoxControl +// ---------------------------------------------------- +UnoComboBoxControl::UnoComboBoxControl() + : maActionListeners( *this ), + maItemListeners( *this ) +{ + maComponentInfos.nWidth = 100; + maComponentInfos.nHeight = 12; +} + +::rtl::OUString UnoComboBoxControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "combobox" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoComboBoxControl::queryAggregation( 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::awt::XComboBox*, this ) ); + return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoComboBoxControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XComboBox>* ) NULL ), + UnoEditControl::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoComboBoxControl::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::lang::EventObject aEvt; + aEvt.Source = (::cppu::OWeakObject*)this; + maActionListeners.disposeAndClear( aEvt ); + maItemListeners.disposeAndClear( aEvt ); + UnoControl::dispose(); +} + +void UnoComboBoxControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException) +{ + UnoEditControl::createPeer( rxToolkit, rParentPeer ); + + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XComboBox > xComboBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + if ( maActionListeners.getLength() ) + xComboBox->addActionListener( &maActionListeners ); + if ( maItemListeners.getLength() ) + xComboBox->addItemListener( &maItemListeners ); +} + +void UnoComboBoxControl::addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maActionListeners.addInterface( l ); + if( mxPeer.is() && maActionListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XComboBox > xComboBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xComboBox->addActionListener( &maActionListeners ); + } +} + +void UnoComboBoxControl::removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + if( mxPeer.is() && maActionListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XComboBox > xComboBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xComboBox->removeActionListener( &maActionListeners ); + } + maActionListeners.removeInterface( l ); +} + +void UnoComboBoxControl::addItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + maItemListeners.addInterface( l ); + if( mxPeer.is() && maItemListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XComboBox > xComboBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xComboBox->addItemListener( &maItemListeners ); + } +} + +void UnoComboBoxControl::removeItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException) +{ + if( mxPeer.is() && maItemListeners.getLength() == 1 ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XComboBox > xComboBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); // MT: Mal alles so umstellen, schoener als Ref anlegen und query rufen + xComboBox->removeItemListener( &maItemListeners ); + } + maItemListeners.removeInterface( l ); +} + +void UnoComboBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( 1 ); + aSeq.getArray()[0] = aItem; + addItems( aSeq, nPos ); +} + +void UnoComboBoxControl::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + aVal >>= aSeq; + sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength(); + sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength(); + sal_uInt16 nNewLen = nOldLen + nNewItems; + + ::com::sun::star::uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen ); + ::rtl::OUString* pNewData = aNewSeq.getArray(); + const ::rtl::OUString* pOldData = aSeq.getConstArray(); + + if ( nPos > nOldLen ) + nPos = (sal_uInt16) nOldLen; + + sal_uInt16 n; + // Items vor der Einfuege-Position + for ( n = 0; n < nPos; n++ ) + pNewData[n] = pOldData[n]; + + // Neue Items + for ( n = 0; n < nNewItems; n++ ) + pNewData[nPos+n] = aItems.getConstArray()[n]; + + // Rest der alten Items + for ( n = nPos; n < nOldLen; n++ ) + pNewData[nNewItems+n] = pOldData[n]; + + ::com::sun::star::uno::Any aAny; + aAny <<= aNewSeq; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True ); +} + +void UnoComboBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + aVal >>= aSeq; + sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength(); + if ( nOldLen && ( nPos < nOldLen ) ) + { + if ( nCount > ( nOldLen-nPos ) ) + nCount = nOldLen-nPos; + + sal_uInt16 nNewLen = nOldLen - nCount; + + ::com::sun::star::uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen ); + ::rtl::OUString* pNewData = aNewSeq.getArray(); + ::rtl::OUString* pOldData = aSeq.getArray(); + + sal_uInt16 n; + // Items vor der Entfern-Position + for ( n = 0; n < nPos; n++ ) + pNewData[n] = pOldData[n]; + + // Rest der Items + for ( n = nPos; n < (nOldLen-nCount); n++ ) + pNewData[n] = pOldData[n+nCount]; + + ::com::sun::star::uno::Any aAny; + aAny <<= aNewSeq; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True ); + } +} + +sal_Int16 UnoComboBoxControl::getItemCount() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + aVal >>= aSeq; + return (sal_Int16)aSeq.getLength(); +} + +::rtl::OUString UnoComboBoxControl::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString aItem; + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + aVal >>= aSeq; + if ( nPos < aSeq.getLength() ) + aItem = aSeq.getConstArray()[nPos]; + return aItem; +} + +::com::sun::star::uno::Sequence< ::rtl::OUString> UnoComboBoxControl::getItems() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); + ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq; + aVal >>= aSeq; + return aSeq; +} + +void UnoComboBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= nLines; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, sal_True ); +} + +sal_Int16 UnoComboBoxControl::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT ); +} + +// ---------------------------------------------------- +// class UnoControlDateFieldModel +// ---------------------------------------------------- +UnoControlDateFieldModel::UnoControlDateFieldModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DATE ); + ImplRegisterProperty( BASEPROPERTY_DATEMAX ); + ImplRegisterProperty( BASEPROPERTY_DATEMIN ); + ImplRegisterProperty( BASEPROPERTY_DATESHOWCENTURY ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_DROPDOWN ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_EXTDATEFORMAT ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_READONLY ); + ImplRegisterProperty( BASEPROPERTY_SPIN ); + ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); +} + +::rtl::OUString UnoControlDateFieldModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateFieldModel ); +} + +::com::sun::star::uno::Any UnoControlDateFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateField ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + + +::cppu::IPropertyArrayHelper& UnoControlDateFieldModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlDateFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + + +// ---------------------------------------------------- +// class UnoDateFieldControl +// ---------------------------------------------------- +UnoDateFieldControl::UnoDateFieldControl() +{ +} + +::rtl::OUString UnoDateFieldControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "datefield" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoDateFieldControl::queryAggregation( 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::awt::XDateField*, this ) ); + return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoDateFieldControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDateField>* ) NULL ), + UnoEditControl::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoDateFieldControl::textChanged( const ::com::sun::star::awt::TextEvent& e ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDateField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Any aValue; + if ( !xField->isEmpty() ) + aValue <<= xField->getDate(); + + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aValue, sal_False ); + + if ( GetTextListeners().getLength() ) + GetTextListeners().textChanged( e ); +} + +void UnoDateFieldControl::setDate( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Date; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aAny, sal_True ); +} + +sal_Int32 UnoDateFieldControl::getDate() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_INT32( BASEPROPERTY_DATE ); +} + +void UnoDateFieldControl::setMin( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Date; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMIN ), aAny, sal_True ); +} + +sal_Int32 UnoDateFieldControl::getMin() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMIN ); +} + +void UnoDateFieldControl::setMax( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Date; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMAX ), aAny, sal_True ); +} + +sal_Int32 UnoDateFieldControl::getMax() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMAX ); +} + +void UnoDateFieldControl::setFirst( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoDateFieldControl::setFirst not supported" ); +} + +sal_Int32 UnoDateFieldControl::getFirst() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoDateFieldControl::getFirst not supported" ); + return 0; +} + +void UnoDateFieldControl::setLast( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoDateFieldControl::setLast not supported" ); +} + +sal_Int32 UnoDateFieldControl::getLast() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoDateFieldControl::getLast not supported" ); + return 0; +} + +void UnoDateFieldControl::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoDateFieldControl::setLongFormat not supported" ); +} + +sal_Bool UnoDateFieldControl::isLongFormat() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoDateFieldControl::getLongFormat not supported" ); + return sal_False; +} + +void UnoDateFieldControl::setEmpty() throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDateField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xField->setEmpty(); + } +} + +sal_Bool UnoDateFieldControl::isEmpty() throw(::com::sun::star::uno::RuntimeException) +{ + sal_Bool bEmpty = sal_False; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDateField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + bEmpty = xField->isEmpty(); + } + return bEmpty; +} + +void UnoDateFieldControl::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= bStrict; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True ); +} + +sal_Bool UnoDateFieldControl::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT ); +} + +// ---------------------------------------------------- +// class UnoControlTimeFieldModel +// ---------------------------------------------------- +UnoControlTimeFieldModel::UnoControlTimeFieldModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED); + ImplRegisterProperty( BASEPROPERTY_EXTTIMEFORMAT ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_READONLY ); + ImplRegisterProperty( BASEPROPERTY_SPIN ); + ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); + ImplRegisterProperty( BASEPROPERTY_TIME ); + ImplRegisterProperty( BASEPROPERTY_TIMEMAX ); + ImplRegisterProperty( BASEPROPERTY_TIMEMIN ); +} + +::rtl::OUString UnoControlTimeFieldModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeFieldModel ); +} + +::com::sun::star::uno::Any UnoControlTimeFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeField ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + + +::cppu::IPropertyArrayHelper& UnoControlTimeFieldModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlTimeFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + + +// ---------------------------------------------------- +// class UnoTimeFieldControl +// ---------------------------------------------------- +UnoTimeFieldControl::UnoTimeFieldControl() +{ +} + +::rtl::OUString UnoTimeFieldControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "timefield" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoTimeFieldControl::queryAggregation( 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::awt::XTimeField*, this ) ); + return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoTimeFieldControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTimeField>* ) NULL ), + UnoEditControl::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoTimeFieldControl::textChanged( const ::com::sun::star::awt::TextEvent& e ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XTimeField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Any aValue; + if ( !xField->isEmpty() ) + xField->getTime(); + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aValue, sal_False ); + + if ( GetTextListeners().getLength() ) + GetTextListeners().textChanged( e ); +} + +void UnoTimeFieldControl::setTime( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Time; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aAny, sal_True ); +} + +sal_Int32 UnoTimeFieldControl::getTime() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_INT32( BASEPROPERTY_TIME ); +} + +void UnoTimeFieldControl::setMin( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Time; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMIN ), aAny, sal_True ); +} + +sal_Int32 UnoTimeFieldControl::getMin() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMIN ); +} + +void UnoTimeFieldControl::setMax( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Time; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMAX ), aAny, sal_True ); +} + +sal_Int32 UnoTimeFieldControl::getMax() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMAX ); +} + +void UnoTimeFieldControl::setFirst( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoTimeFieldControl::setFirst not supported" ); +} + +sal_Int32 UnoTimeFieldControl::getFirst() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoTimeFieldControl::getFirst not supported" ); + return 0; +} + +void UnoTimeFieldControl::setLast( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoTimeFieldControl::setLast not supported" ); +} + +sal_Int32 UnoTimeFieldControl::getLast() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoTimeFieldControl::getLast not supported" ); + return 0; +} + +void UnoTimeFieldControl::setEmpty() throw(::com::sun::star::uno::RuntimeException) +{ + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XTimeField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xField->setEmpty(); + } +} + +sal_Bool UnoTimeFieldControl::isEmpty() throw(::com::sun::star::uno::RuntimeException) +{ + sal_Bool bEmpty = sal_False; + if ( mxPeer.is() ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XTimeField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + bEmpty = xField->isEmpty(); + } + return bEmpty; +} + +void UnoTimeFieldControl::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= bStrict; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True ); +} + +sal_Bool UnoTimeFieldControl::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT ); +} + +// ---------------------------------------------------- +// class UnoControlNumericFieldModel +// ---------------------------------------------------- +UnoControlNumericFieldModel::UnoControlNumericFieldModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DECIMALACCURACY ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_NUMSHOWTHOUSANDSEP ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_READONLY ); + ImplRegisterProperty( BASEPROPERTY_SPIN ); + ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); + ImplRegisterProperty( BASEPROPERTY_VALUEMAX_DOUBLE ); + ImplRegisterProperty( BASEPROPERTY_VALUEMIN_DOUBLE ); + ImplRegisterProperty( BASEPROPERTY_VALUESTEP_DOUBLE ); + ImplRegisterProperty( BASEPROPERTY_VALUE_DOUBLE ); +} + +::rtl::OUString UnoControlNumericFieldModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericFieldModel ); +} + +::com::sun::star::uno::Any UnoControlNumericFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericField ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + + +::cppu::IPropertyArrayHelper& UnoControlNumericFieldModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlNumericFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + + +// ---------------------------------------------------- +// class UnoNumericFieldControl +// ---------------------------------------------------- +UnoNumericFieldControl::UnoNumericFieldControl() +{ +} + +::rtl::OUString UnoNumericFieldControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "numericfield" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoNumericFieldControl::queryAggregation( 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::awt::XNumericField*, this ) ); + return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoNumericFieldControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ), + UnoEditControl::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoNumericFieldControl::textChanged( const ::com::sun::star::awt::TextEvent& e ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XNumericField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Any aAny; + aAny <<= xField->getValue(); + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False ); + + if ( GetTextListeners().getLength() ) + GetTextListeners().textChanged( e ); +} + +void UnoNumericFieldControl::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Value; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_True ); +} + +double UnoNumericFieldControl::getValue() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE ); +} + +void UnoNumericFieldControl::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Value; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, sal_True ); +} + +double UnoNumericFieldControl::getMin() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE ); +} + +void UnoNumericFieldControl::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Value; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, sal_True ); +} + +double UnoNumericFieldControl::getMax() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE ); +} + +void UnoNumericFieldControl::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoNumericFieldControl::setFirst not supported" ); +} + +double UnoNumericFieldControl::getFirst() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoNumericFieldControl::getFirst not supported" ); + return 0; +} + +void UnoNumericFieldControl::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoNumericFieldControl::setLast not supported" ); +} + +double UnoNumericFieldControl::getLast() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoNumericFieldControl::getLast not supported" ); + return 0; +} + +void UnoNumericFieldControl::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= bStrict; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True ); +} + +sal_Bool UnoNumericFieldControl::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT ); +} + +void UnoNumericFieldControl::setSpinSize( double Digits ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Digits; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, sal_True ); +} + +double UnoNumericFieldControl::getSpinSize() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE ); +} + +void UnoNumericFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoNumericFieldControl::setDecimalDigits not supported" ); +} + +sal_Int16 UnoNumericFieldControl::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoNumericFieldControl::getDecimalDigits not supported" ); + return 0; +} + +// ---------------------------------------------------- +// class UnoControlCurrencyFieldModel +// ---------------------------------------------------- +UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_CURRENCYSYMBOL ); + ImplRegisterProperty( BASEPROPERTY_CURSYM_POSITION ); + ImplRegisterProperty( BASEPROPERTY_DECIMALACCURACY ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_NUMSHOWTHOUSANDSEP ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_READONLY ); + ImplRegisterProperty( BASEPROPERTY_SPIN ); + ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); + ImplRegisterProperty( BASEPROPERTY_VALUEMAX_DOUBLE ); + ImplRegisterProperty( BASEPROPERTY_VALUEMIN_DOUBLE ); + ImplRegisterProperty( BASEPROPERTY_VALUESTEP_DOUBLE ); + ImplRegisterProperty( BASEPROPERTY_VALUE_DOUBLE ); +} + +::rtl::OUString UnoControlCurrencyFieldModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyFieldModel ); +} + +::com::sun::star::uno::Any UnoControlCurrencyFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyField ); + return aAny; + } + if ( nPropId == BASEPROPERTY_CURSYM_POSITION ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= (sal_Bool)sal_False; + return aAny; + } + + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + +::cppu::IPropertyArrayHelper& UnoControlCurrencyFieldModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlCurrencyFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + +// ---------------------------------------------------- +// class UnoCurrencyFieldControl +// ---------------------------------------------------- +UnoCurrencyFieldControl::UnoCurrencyFieldControl() +{ +} + +::rtl::OUString UnoCurrencyFieldControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "longcurrencyfield" ); +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoCurrencyFieldControl::queryAggregation( 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::awt::XCurrencyField*, this ) ); + return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoCurrencyFieldControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ), + UnoEditControl::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoCurrencyFieldControl::textChanged( const ::com::sun::star::awt::TextEvent& e ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XCurrencyField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Any aAny; + aAny <<= xField->getValue(); + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False ); + + if ( GetTextListeners().getLength() ) + GetTextListeners().textChanged( e ); +} + +void UnoCurrencyFieldControl::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Value; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_True ); +} + +double UnoCurrencyFieldControl::getValue() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE ); +} + +void UnoCurrencyFieldControl::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Value; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, sal_True ); +} + +double UnoCurrencyFieldControl::getMin() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE ); +} + +void UnoCurrencyFieldControl::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Value; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, sal_True ); +} + +double UnoCurrencyFieldControl::getMax() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE ); +} + +void UnoCurrencyFieldControl::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoCurrencyFieldControl::setFirst not supported" ); +} + +double UnoCurrencyFieldControl::getFirst() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoCurrencyFieldControl::getFirst not supported" ); + return 0; +} + +void UnoCurrencyFieldControl::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoCurrencyFieldControl::setLast not supported" ); +} + +double UnoCurrencyFieldControl::getLast() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoCurrencyFieldControl::getLast not supported" ); + return 0; +} + +void UnoCurrencyFieldControl::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= bStrict; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True ); +} + +sal_Bool UnoCurrencyFieldControl::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT ); +} + +void UnoCurrencyFieldControl::setSpinSize( double Digits ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= Digits; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, sal_True ); +} + +double UnoCurrencyFieldControl::getSpinSize() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE ); +} + +void UnoCurrencyFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoCurrencyFieldControl::setDecimalDigits not supported" ); +} + +sal_Int16 UnoCurrencyFieldControl::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException) +{ + DBG_WARNING( "UnoCurrencyFieldControl::getDecimalDigits not supported" ); + return 0; +} + +// ---------------------------------------------------- +// class UnoControlPatternFieldModel +// ---------------------------------------------------- +UnoControlPatternFieldModel::UnoControlPatternFieldModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_EDITMASK ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_LITERALMASK ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_READONLY ); + ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_TEXT ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); +} + +::rtl::OUString UnoControlPatternFieldModel::getServiceName() const +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternFieldModel ); +} + +::com::sun::star::uno::Any UnoControlPatternFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + ::com::sun::star::uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternField ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + +::cppu::IPropertyArrayHelper& UnoControlPatternFieldModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// ::com::sun::star::beans::XMultiPropertySet +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlPatternFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + +// ---------------------------------------------------- +// class UnoPatternFieldControl +// ---------------------------------------------------- +UnoPatternFieldControl::UnoPatternFieldControl() +{ +} + +::rtl::OUString UnoPatternFieldControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "patternfield" ); +} + +void UnoPatternFieldControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ) +{ + sal_uInt16 nType = GetPropertyId( rPropName ); + if ( ( nType == BASEPROPERTY_TEXT ) || ( nType == BASEPROPERTY_EDITMASK ) || ( nType == BASEPROPERTY_LITERALMASK ) ) + { + // Die Masken koennen nicht nacheinander gesetzt werden. + ::rtl::OUString Text = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT ); + ::rtl::OUString EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK ); + ::rtl::OUString LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK ); + + ::com::sun::star::uno::Reference < ::com::sun::star::awt::XPatternField > xPF( mxPeer, ::com::sun::star::uno::UNO_QUERY ); + xPF->setString( Text ); + xPF->setMasks( EditMask, LiteralMask ); + } + else + UnoControl::ImplSetPeerProperty( rPropName, rVal ); +} + + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoPatternFieldControl::queryAggregation( 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::awt::XPatternField*, this ) ); + return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( UnoPatternFieldControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPatternField>* ) NULL ), + UnoEditControl::getTypes() +IMPL_XTYPEPROVIDER_END + +void UnoPatternFieldControl::setString( const ::rtl::OUString& rString ) throw(::com::sun::star::uno::RuntimeException) +{ + setText( rString ); +} + +::rtl::OUString UnoPatternFieldControl::getString() throw(::com::sun::star::uno::RuntimeException) +{ + return getText(); +} + +void UnoPatternFieldControl::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= EditMask; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_EDITMASK ), aAny, sal_True ); + aAny <<= LiteralMask; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LITERALMASK ), aAny, sal_True ); +} + +void UnoPatternFieldControl::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException) +{ + EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK ); + LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK ); +} + +void UnoPatternFieldControl::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aAny; + aAny <<= bStrict; + ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True ); +} + +sal_Bool UnoPatternFieldControl::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) +{ + return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT ); +} + + + diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx new file mode 100644 index 000000000000..f96f5945f813 --- /dev/null +++ b/toolkit/source/helper/listenermultiplexer.cxx @@ -0,0 +1,215 @@ +/************************************************************************* + * + * $RCSfile: listenermultiplexer.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <toolkit/helper/listenermultiplexer.hxx> + +// ---------------------------------------------------- +// class ListenerMultiplexerBase +// ---------------------------------------------------- +ListenerMultiplexerBase::ListenerMultiplexerBase( ::cppu::OWeakObject& rSource ) + : ::cppu::OInterfaceContainerHelper( GetMutex() ), mrContext( rSource ) +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any ListenerMultiplexerBase::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +{ + return ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, this ) ); +} + + +// ---------------------------------------------------- +// class EventListenerMultiplexer +// ---------------------------------------------------- +EventListenerMultiplexer::EventListenerMultiplexer( ::cppu::OWeakObject& rSource ) + : ListenerMultiplexerBase( rSource ) +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any EventListenerMultiplexer::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 ) ); + return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType )); +} + +// ::com::sun::star::lang::XEventListener +void EventListenerMultiplexer::disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException) +{ +} + +// ---------------------------------------------------- +// class FocusListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener, focusGained, ::com::sun::star::awt::FocusEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener, focusLost, ::com::sun::star::awt::FocusEvent ) + +// ---------------------------------------------------- +// class WindowListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowResized, ::com::sun::star::awt::WindowEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowMoved, ::com::sun::star::awt::WindowEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowShown, ::com::sun::star::lang::EventObject ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowHidden, ::com::sun::star::lang::EventObject ) + +// ---------------------------------------------------- +// class VclContainerListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener, windowAdded, ::com::sun::star::awt::VclContainerEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener, windowRemoved, ::com::sun::star::awt::VclContainerEvent ) + +// ---------------------------------------------------- +// class KeyListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener, keyPressed, ::com::sun::star::awt::KeyEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener, keyReleased, ::com::sun::star::awt::KeyEvent ) + +// ---------------------------------------------------- +// class MouseListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mousePressed, ::com::sun::star::awt::MouseEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseReleased, ::com::sun::star::awt::MouseEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseEntered, ::com::sun::star::awt::MouseEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseExited, ::com::sun::star::awt::MouseEvent ) + +// ---------------------------------------------------- +// class MouseMotionListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener, mouseDragged, ::com::sun::star::awt::MouseEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener, mouseMoved, ::com::sun::star::awt::MouseEvent ) + +// ---------------------------------------------------- +// class PaintListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener, windowPaint, ::com::sun::star::awt::PaintEvent ) + +// ---------------------------------------------------- +// class TopWindowListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowOpened, ::com::sun::star::lang::EventObject ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowClosing, ::com::sun::star::lang::EventObject ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowClosed, ::com::sun::star::lang::EventObject ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowMinimized, ::com::sun::star::lang::EventObject ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowNormalized, ::com::sun::star::lang::EventObject ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowActivated, ::com::sun::star::lang::EventObject ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowDeactivated, ::com::sun::star::lang::EventObject ) + +// ---------------------------------------------------- +// class TextListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener, textChanged, ::com::sun::star::awt::TextEvent ) + +// ---------------------------------------------------- +// class ActionListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener, actionPerformed, ::com::sun::star::awt::ActionEvent ) + +// ---------------------------------------------------- +// class ItemListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener, itemStateChanged, ::com::sun::star::awt::ItemEvent ) + +// ---------------------------------------------------- +// class ContainerListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementInserted, ::com::sun::star::container::ContainerEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementRemoved, ::com::sun::star::container::ContainerEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementReplaced, ::com::sun::star::container::ContainerEvent ) + +// ---------------------------------------------------- +// class SpinListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, up, ::com::sun::star::awt::SpinEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, down, ::com::sun::star::awt::SpinEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, first, ::com::sun::star::awt::SpinEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, last, ::com::sun::star::awt::SpinEvent ) + +// ---------------------------------------------------- +// class AdjustmentListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener, adjustmentValueChanged, ::com::sun::star::awt::AdjustmentEvent ) + +// ---------------------------------------------------- +// class MenuListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, highlight, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, select, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, activate, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, deactivate, ::com::sun::star::awt::MenuEvent ) + + + diff --git a/toolkit/source/helper/makefile.mk b/toolkit/source/helper/makefile.mk new file mode 100644 index 000000000000..924801991862 --- /dev/null +++ b/toolkit/source/helper/makefile.mk @@ -0,0 +1,90 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=toolkit +TARGET=helper + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/listenermultiplexer.obj \ + $(SLO)$/property.obj \ + $(SLO)$/registerservices.obj \ + $(SLO)$/servicenames.obj \ + $(SLO)$/unomemorystream.obj \ + $(SLO)$/unopropertyarrayhelper.obj \ + $(SLO)$/unowrapper.obj \ + $(SLO)$/vclunohelper.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx new file mode 100644 index 000000000000..613ba62f3ea3 --- /dev/null +++ b/toolkit/source/helper/property.cxx @@ -0,0 +1,345 @@ +/************************************************************************* + * + * $RCSfile: property.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <toolkit/helper/property.hxx> +#include <toolkit/helper/macros.hxx> + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <stdlib.h> // qsort/bsearch +#include <tools/debug.hxx> + +#ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_ +#include <com/sun/star/awt/FontWeight.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_ +#include <com/sun/star/awt/FontSlant.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_CHARSET_HPP_ +#include <com/sun/star/awt/CharSet.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_ +#include <com/sun/star/awt/FontDescriptor.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTWIDTH_HPP_ +#include <com/sun/star/awt/FontWidth.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTTYPE_HPP_ +#include <com/sun/star/awt/FontType.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTUNDERLINE_HPP_ +#include <com/sun/star/awt/FontUnderline.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTSTRIKEOUT_HPP_ +#include <com/sun/star/awt/FontStrikeout.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTPITCH_HPP_ +#include <com/sun/star/awt/FontPitch.hpp> +#endif + +#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_ +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif + +#include <unotools/types.hxx> + +#include <toolkit/helper/property.hxx> + +struct ImplPropertyInfo +{ + ::rtl::OUString aName; + sal_uInt16 nPropId; + ::com::sun::star::uno::Type aType; + sal_Int16 nAttribs; + sal_Bool bDependsOnOthers; // eg. VALUE depends on MIN/MAX and must be set after MIN/MAX. + + ImplPropertyInfo() + { + nPropId = 0; + nAttribs = 0; + bDependsOnOthers = sal_False; + } + + ImplPropertyInfo( const sal_Unicode* pName, sal_uInt16 nId, const ::com::sun::star::uno::Type& rType, + sal_Int16 nAttrs, sal_Bool bDepends = sal_False ) + : aName( pName ) + { + nPropId = nId; + aType = rType; + nAttribs = nAttrs; + bDependsOnOthers = bDepends; + } + +}; + +ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) +{ + static ImplPropertyInfo* pPropertyInfos = NULL; + static sal_uInt16 nElements = 0; + if( !pPropertyInfos ) + { + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pPropertyInfos ) + { + static ImplPropertyInfo __FAR_DATA aImplPropertyInfos [] = + { + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Align" ), BASEPROPERTY_ALIGN, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Autocomplete" ), BASEPROPERTY_AUTOCOMPLETE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "AutoToggle" ), BASEPROPERTY_AUTOTOGGLE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "BackgroundColor" ), BASEPROPERTY_BACKGROUNDCOLOR, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Border" ), BASEPROPERTY_BORDER, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "CurrencySymbol" ), BASEPROPERTY_CURRENCYSYMBOL, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Date" ), BASEPROPERTY_DATE, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID, sal_True ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DateFormat" ), BASEPROPERTY_EXTDATEFORMAT, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DateMax" ), BASEPROPERTY_DATEMAX, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DateMin" ), BASEPROPERTY_DATEMIN, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DateShowCentury" ), BASEPROPERTY_DATESHOWCENTURY, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DecimalAccuracy" ), BASEPROPERTY_DECIMALACCURACY, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DefaultButton" ), BASEPROPERTY_DEFAULTBUTTON, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DefaultControl" ), BASEPROPERTY_DEFAULTCONTROL, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Dropdown" ), BASEPROPERTY_DROPDOWN, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EchoChar" ), BASEPROPERTY_ECHOCHAR, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EditMask" ), BASEPROPERTY_EDITMASK, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EffectiveDefault" ), BASEPROPERTY_EFFECTIVE_DEFAULT, ::getCppuType((const ::com::sun::star::uno::Any*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EffectiveMax" ), BASEPROPERTY_EFFECTIVE_MAX, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EffectiveMin" ), BASEPROPERTY_EFFECTIVE_MIN, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EffectiveValue" ), BASEPROPERTY_EFFECTIVE_VALUE, ::getCppuType((const ::com::sun::star::uno::Any*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID, sal_True ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Enabled" ), BASEPROPERTY_ENABLED, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FillColor" ), BASEPROPERTY_FILLCOLOR, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FocusSelectionHide" ), BASEPROPERTY_FOCUSSELECTIONHIDE,::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontDescriptor" ), BASEPROPERTY_FONTDESCRIPTOR, ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + + // Teile des ::com::sun::star::awt::FontDescriptor + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontName" ), BASEPROPERTY_FONTDESCRIPTORPART_NAME, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontStyleName" ), BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontFamily" ), BASEPROPERTY_FONTDESCRIPTORPART_FAMILY, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontCharset" ), BASEPROPERTY_FONTDESCRIPTORPART_CHARSET, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontHeight" ), BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT, ::getCppuType((const Float*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontWidth" ), BASEPROPERTY_FONTDESCRIPTORPART_WIDTH, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontPitch" ), BASEPROPERTY_FONTDESCRIPTORPART_PITCH, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontWeight" ), BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT, ::getCppuType((const Float*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontCharWidth" ), BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH, ::getCppuType((const Float*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontOrientation" ), BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION, ::getCppuType((const Float*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontSlant" ), BASEPROPERTY_FONTDESCRIPTORPART_SLANT, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontUnderline" ), BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontStrikeout" ), BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontKerning" ), BASEPROPERTY_FONTDESCRIPTORPART_KERNING, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontWordLineMode" ), BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontType" ), BASEPROPERTY_FONTDESCRIPTORPART_TYPE, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ), + + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FormatKey" ), BASEPROPERTY_FORMATKEY, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEVOID|::com::sun::star::beans::PropertyAttribute::TRANSIENT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FormatsSupplier" ), BASEPROPERTY_FORMATSSUPPLIER, ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEVOID|::com::sun::star::beans::PropertyAttribute::TRANSIENT ), + + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "HelpURL" ), BASEPROPERTY_HELPURL, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "HScroll" ), BASEPROPERTY_HSCROLL, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "HardLineBreaks" ), BASEPROPERTY_HARDLINEBREAKS, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ImageURL" ), BASEPROPERTY_IMAGEURL, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Label" ), BASEPROPERTY_LABEL, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "LineColor" ), BASEPROPERTY_LINECOLOR, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "LineCount" ), BASEPROPERTY_LINECOUNT, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "LiteralMask" ), BASEPROPERTY_LITERALMASK, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "MaxTextLen" ), BASEPROPERTY_MAXTEXTLEN, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "MultiLine" ), BASEPROPERTY_MULTILINE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "MultiSelection" ), BASEPROPERTY_MULTISELECTION, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "PrependCurrencySymbol" ), BASEPROPERTY_CURSYM_POSITION, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Printable" ), BASEPROPERTY_PRINTABLE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ReadOnly" ), BASEPROPERTY_READONLY, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "SelectedItems" ), BASEPROPERTY_SELECTEDITEMS, ::getCppuType((::com::sun::star::uno::Sequence<sal_Int16>*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ShowThousandsSeparator" ), BASEPROPERTY_NUMSHOWTHOUSANDSEP,::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Spin" ), BASEPROPERTY_SPIN, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "State" ), BASEPROPERTY_STATE, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "StrictFormat" ), BASEPROPERTY_STRICTFORMAT, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "StringItemList" ), BASEPROPERTY_STRINGITEMLIST, ::getCppuType((::com::sun::star::uno::Sequence< ::rtl::OUString >*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Tabstop" ), BASEPROPERTY_TABSTOP, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Text" ), BASEPROPERTY_TEXT, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TextColor" ), BASEPROPERTY_TEXTCOLOR, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Time" ), BASEPROPERTY_TIME, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID, sal_True ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TimeFormat" ), BASEPROPERTY_EXTTIMEFORMAT, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TimeMax" ), BASEPROPERTY_TIMEMAX, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TimeMin" ), BASEPROPERTY_TIMEMIN, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TreatAsNumber" ), BASEPROPERTY_TREATASNUMBER, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::TRANSIENT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TriState" ), BASEPROPERTY_TRISTATE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "VScroll" ), BASEPROPERTY_VSCROLL, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Value" ), BASEPROPERTY_VALUE_DOUBLE, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID, sal_True ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ValueMax" ), BASEPROPERTY_VALUEMAX_DOUBLE, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ValueMin" ), BASEPROPERTY_VALUEMIN_DOUBLE, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ValueStep" ), BASEPROPERTY_VALUESTEP_DOUBLE, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ), + }; + pPropertyInfos = aImplPropertyInfos; + nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo ); + } + } + rElementCount = nElements; + return pPropertyInfos; +} + +static int +#if defined( WNT ) + __cdecl +#endif +#if defined( ICC ) && defined( OS2 ) +_Optlink +#endif + ImplPropertyInfoCompare( const void* pFirst, const void* pSecond) +{ + return ((ImplPropertyInfo*)pFirst)->aName.compareTo( ((ImplPropertyInfo*)pSecond)->aName ); +} + +void ImplAssertValidPropertyArray() +{ + static sal_Bool bSorted = sal_False; + if( !bSorted ) + { + sal_uInt16 nElements; + ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements ); + qsort( pInfos, nElements, sizeof( ImplPropertyInfo ), ImplPropertyInfoCompare ); + bSorted = sal_True; + } +} + +sal_uInt16 GetPropertyId( const ::rtl::OUString& rPropertyName ) +{ + ImplAssertValidPropertyArray(); + + ImplPropertyInfo aSearch; + aSearch.aName = rPropertyName; + + sal_uInt16 nElements; + ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements ); + ImplPropertyInfo* pInf = (ImplPropertyInfo*) + bsearch( &aSearch, pInfos, nElements, sizeof( ImplPropertyInfo ), ImplPropertyInfoCompare ); + + return pInf ? pInf->nPropId: 0; +} + +const ImplPropertyInfo* ImplGetImplPropertyInfo( sal_uInt16 nPropertyId ) +{ + ImplAssertValidPropertyArray(); + + const ImplPropertyInfo* pImplPropertyInfo = NULL; + + sal_uInt16 nElements; + ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements ); + for ( sal_uInt16 n = nElements; n && !pImplPropertyInfo; ) + { + if ( pInfos[--n].nPropId == nPropertyId ) + pImplPropertyInfo = &pInfos[n]; + } + + return pImplPropertyInfo; +} + +sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId ) +{ + ImplAssertValidPropertyArray(); + + sal_uInt16 nElements; + ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements ); + for ( sal_uInt16 n = nElements; n; ) + { + if ( pInfos[--n].nPropId == nPropertyId ) + return n; + } + return 0xFFFF; +} + +const ::rtl::OUString& GetPropertyName( sal_uInt16 nPropertyId ) +{ + const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId ); + DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" ); + return pImplPropertyInfo->aName; +} + +const ::com::sun::star::uno::Type* GetPropertyType( sal_uInt16 nPropertyId ) +{ + const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId ); + DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" ); + return pImplPropertyInfo ? &pImplPropertyInfo->aType : NULL; +} + +sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId ) +{ + const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId ); + DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" ); + return pImplPropertyInfo ? pImplPropertyInfo->nAttribs : NULL; +} + +sal_Bool DoesDependOnOthers( sal_uInt16 nPropertyId ) +{ + const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId ); + DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" ); + return pImplPropertyInfo ? pImplPropertyInfo->bDependsOnOthers : sal_False; +} + +sal_Bool CompareProperties( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) +{ + return ::utl::compare( r1, r2 ); +} + + + diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx new file mode 100644 index 000000000000..d56e75df00c9 --- /dev/null +++ b/toolkit/source/helper/registerservices.cxx @@ -0,0 +1,285 @@ +/************************************************************************* + * + * $RCSfile: registerservices.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ +#include <com/sun/star/registry/XRegistryKey.hpp> +#endif + +#include <cppuhelper/factory.hxx> + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <toolkit/helper/servicenames.hxx> +#include <toolkit/helper/macros.hxx> + +#include <toolkit/awt/vclxtoolkit.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <toolkit/awt/vclxpointer.hxx> +#include <toolkit/awt/vclxprinter.hxx> + +#include <toolkit/controls/unocontrols.hxx> +#include <toolkit/controls/unocontrolcontainer.hxx> +#include <toolkit/controls/unocontrolcontainermodel.hxx> +#include <toolkit/controls/stdtabcontroller.hxx> +#include <toolkit/controls/stdtabcontrollermodel.hxx> + + +#define REGISTER_SERVICES( ImplName, ServiceName1, ServiceName2 ) \ + xNewKey = pRegistryKey->createKey( ::rtl::OUString::createFromAscii( "/stardiv.Toolkit." #ImplName "/UNO/SERVICES" ) ); \ + xNewKey->createKey( ServiceName1 ); \ + xNewKey->createKey( ServiceName2 ); + + +#define IMPL_CREATEINSTANCE( ImplName ) \ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) \ + { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName ); } + +#define CHECKANDCREATEFACTORY( ImplName, ServiceName1, ServiceName2 ) \ + if ( rtl_str_compare( sImplementationName, "stardiv.Toolkit." #ImplName ) == 0 ) \ + { \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames(2); \ + aServiceNames.getArray()[0] = ServiceName1; \ + aServiceNames.getArray()[1] = ServiceName2; \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory( ::cppu::createSingleFactory( pServiceManager, \ + ::rtl::OUString::createFromAscii( sImplementationName ), ImplName##_CreateInstance, aServiceNames ) ); \ + if ( xFactory.is() ) \ + { \ + xFactory->acquire(); \ + pRet = xFactory.get(); \ + } \ + } + + +IMPL_CREATEINSTANCE( VCLXToolkit ) +IMPL_CREATEINSTANCE( StdTabController ) +IMPL_CREATEINSTANCE( StdTabControllerModel ) +IMPL_CREATEINSTANCE( UnoButtonControl ) +IMPL_CREATEINSTANCE( UnoCheckBoxControl ) +IMPL_CREATEINSTANCE( UnoComboBoxControl ) +IMPL_CREATEINSTANCE( UnoControlButtonModel ) +IMPL_CREATEINSTANCE( UnoControlCheckBoxModel ) +IMPL_CREATEINSTANCE( UnoControlComboBoxModel ) +IMPL_CREATEINSTANCE( UnoControlContainer ) +IMPL_CREATEINSTANCE( UnoControlContainerModel ) +IMPL_CREATEINSTANCE( UnoControlCurrencyFieldModel ) +IMPL_CREATEINSTANCE( UnoControlDateFieldModel ) +IMPL_CREATEINSTANCE( UnoControlEditModel ) +IMPL_CREATEINSTANCE( UnoControlFileControlModel ) +IMPL_CREATEINSTANCE( UnoControlFixedTextModel ) +IMPL_CREATEINSTANCE( UnoControlFormattedFieldModel ) +IMPL_CREATEINSTANCE( UnoControlGroupBoxModel ) +IMPL_CREATEINSTANCE( UnoControlImageControlModel ) +IMPL_CREATEINSTANCE( UnoControlListBoxModel ) +IMPL_CREATEINSTANCE( UnoControlNumericFieldModel ) +IMPL_CREATEINSTANCE( UnoControlPatternFieldModel ) +IMPL_CREATEINSTANCE( UnoControlRadioButtonModel ) +IMPL_CREATEINSTANCE( UnoControlTimeFieldModel ) +IMPL_CREATEINSTANCE( UnoCurrencyFieldControl ) +IMPL_CREATEINSTANCE( UnoDateFieldControl ) +IMPL_CREATEINSTANCE( UnoEditControl ) +IMPL_CREATEINSTANCE( UnoFileControl ) +IMPL_CREATEINSTANCE( UnoFixedTextControl ) +IMPL_CREATEINSTANCE( UnoFormattedFieldControl ) +IMPL_CREATEINSTANCE( UnoGroupBoxControl ) +IMPL_CREATEINSTANCE( UnoImageControlControl ) +IMPL_CREATEINSTANCE( UnoListBoxControl ) +IMPL_CREATEINSTANCE( UnoNumericFieldControl ) +IMPL_CREATEINSTANCE( UnoPatternFieldControl ) +IMPL_CREATEINSTANCE( UnoRadioButtonControl ) +IMPL_CREATEINSTANCE( UnoTimeFieldControl ) +IMPL_CREATEINSTANCE( VCLXMenuBar ) +IMPL_CREATEINSTANCE( VCLXPointer ) +IMPL_CREATEINSTANCE( VCLXPopupMenu ) +IMPL_CREATEINSTANCE( VCLXPrinterServer ) + + +extern "C" +{ + +void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** ppEnv ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager, void* _pRegistryKey ) +{ + if (_pRegistryKey) + { + ::com::sun::star::registry::XRegistryKey * pRegistryKey = reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( _pRegistryKey ); + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xNewKey; + + REGISTER_SERVICES( VCLXToolkit, ::rtl::OUString::createFromAscii( szServiceName_Toolkit ), ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) ); + REGISTER_SERVICES( VCLXPopupMenu, ::rtl::OUString::createFromAscii( szServiceName_PopupMenu ), ::rtl::OUString::createFromAscii( szServiceName2_PopupMenu ) ); + REGISTER_SERVICES( VCLXMenuBar, ::rtl::OUString::createFromAscii( szServiceName_MenuBar ), ::rtl::OUString::createFromAscii( szServiceName2_MenuBar ) ); + REGISTER_SERVICES( VCLXPointer, ::rtl::OUString::createFromAscii( szServiceName_Pointer ), ::rtl::OUString::createFromAscii( szServiceName2_Pointer ) ); + REGISTER_SERVICES( UnoControlContainer, ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainer ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlContainer ) ); + REGISTER_SERVICES( UnoControlContainerModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlContainerModel ) ); + REGISTER_SERVICES( StdTabController, ::rtl::OUString::createFromAscii( szServiceName_TabController ), ::rtl::OUString::createFromAscii( szServiceName2_TabController ) ); + REGISTER_SERVICES( StdTabControllerModel, ::rtl::OUString::createFromAscii( szServiceName_TabControllerModel ), ::rtl::OUString::createFromAscii( szServiceName2_TabControllerModel ) ); + REGISTER_SERVICES( UnoEditControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlEdit ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEdit ) ); + REGISTER_SERVICES( UnoControlEditModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlEditModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel ) ); + REGISTER_SERVICES( UnoDateFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateField ) ); + REGISTER_SERVICES( UnoControlDateFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel ) ); + REGISTER_SERVICES( UnoTimeFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeField ) ); + REGISTER_SERVICES( UnoControlTimeFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel ) ); + REGISTER_SERVICES( UnoNumericFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericField ) ); + REGISTER_SERVICES( UnoControlNumericFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel ) ); + REGISTER_SERVICES( UnoCurrencyFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyField ) ); + REGISTER_SERVICES( UnoControlCurrencyFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel ) ); + REGISTER_SERVICES( UnoPatternFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternField ) ); + REGISTER_SERVICES( UnoControlPatternFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel ) ); + REGISTER_SERVICES( UnoFormattedFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedField ) ); + REGISTER_SERVICES( UnoControlFormattedFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel ) ); + REGISTER_SERVICES( UnoFileControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControl ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControl ) ); + REGISTER_SERVICES( UnoControlFileControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControlModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel ) ); + REGISTER_SERVICES( UnoButtonControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButton ) ); + REGISTER_SERVICES( UnoControlButtonModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel ) ); + REGISTER_SERVICES( UnoImageControlControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageButton ) ); + REGISTER_SERVICES( UnoControlImageControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageButtonModel ) ); + REGISTER_SERVICES( UnoImageControlControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControl ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControl ) ); + REGISTER_SERVICES( UnoControlImageControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControlModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel ) ); + REGISTER_SERVICES( UnoRadioButtonControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButton ) ); + REGISTER_SERVICES( UnoControlRadioButtonModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) ); + REGISTER_SERVICES( UnoCheckBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBox ) ); + REGISTER_SERVICES( UnoControlCheckBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel ) ); + REGISTER_SERVICES( UnoListBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBox ) ); + REGISTER_SERVICES( UnoControlListBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel ) ); + REGISTER_SERVICES( UnoComboBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBox ) ); + REGISTER_SERVICES( UnoControlComboBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel ) ); + REGISTER_SERVICES( UnoFixedTextControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedText ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedText ) ); + REGISTER_SERVICES( UnoControlFixedTextModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedTextModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel ) ); + REGISTER_SERVICES( UnoGroupBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBox ) ); + REGISTER_SERVICES( UnoControlGroupBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel ) ); + REGISTER_SERVICES( VCLXPrinterServer, ::rtl::OUString::createFromAscii( szServiceName_PrinterServer ), ::rtl::OUString::createFromAscii( szServiceName2_PrinterServer ) ); + return sal_True; + } + return sal_False; +} + +void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey ) +{ + void* pRet = 0; + + if ( _pServiceManager ) + { + ::com::sun::star::lang::XMultiServiceFactory* pServiceManager = reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( _pServiceManager ); + + CHECKANDCREATEFACTORY( VCLXToolkit, ::rtl::OUString::createFromAscii( szServiceName_Toolkit ), ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) ) + else CHECKANDCREATEFACTORY( VCLXPopupMenu, ::rtl::OUString::createFromAscii( szServiceName_PopupMenu ), ::rtl::OUString::createFromAscii( szServiceName2_PopupMenu ) ) + else CHECKANDCREATEFACTORY( VCLXMenuBar, ::rtl::OUString::createFromAscii( szServiceName_MenuBar ), ::rtl::OUString::createFromAscii( szServiceName2_MenuBar ) ) + else CHECKANDCREATEFACTORY( VCLXPointer, ::rtl::OUString::createFromAscii( szServiceName_Pointer ), ::rtl::OUString::createFromAscii( szServiceName2_Pointer ) ) + else CHECKANDCREATEFACTORY( UnoControlContainer, ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainer ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlContainer ) ) + else CHECKANDCREATEFACTORY( UnoControlContainerModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlContainerModel ) ) + else CHECKANDCREATEFACTORY( StdTabController, ::rtl::OUString::createFromAscii( szServiceName_TabController ), ::rtl::OUString::createFromAscii( szServiceName2_TabController ) ) + else CHECKANDCREATEFACTORY( StdTabControllerModel, ::rtl::OUString::createFromAscii( szServiceName_TabControllerModel ), ::rtl::OUString::createFromAscii( szServiceName2_TabControllerModel ) ) + else CHECKANDCREATEFACTORY( UnoEditControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlEdit ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEdit ) ) + else CHECKANDCREATEFACTORY( UnoControlEditModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlEditModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel ) ) + else CHECKANDCREATEFACTORY( UnoDateFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateField ) ) + else CHECKANDCREATEFACTORY( UnoControlDateFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel ) ) + else CHECKANDCREATEFACTORY( UnoTimeFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeField ) ) + else CHECKANDCREATEFACTORY( UnoControlTimeFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel ) ) + else CHECKANDCREATEFACTORY( UnoNumericFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericField ) ) + else CHECKANDCREATEFACTORY( UnoControlNumericFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel ) ) + else CHECKANDCREATEFACTORY( UnoCurrencyFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyField ) ) + else CHECKANDCREATEFACTORY( UnoControlCurrencyFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel ) ) + else CHECKANDCREATEFACTORY( UnoPatternFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternField ) ) + else CHECKANDCREATEFACTORY( UnoControlPatternFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel ) ) + else CHECKANDCREATEFACTORY( UnoFormattedFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedField ) ) + else CHECKANDCREATEFACTORY( UnoControlFormattedFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel ) ) + else CHECKANDCREATEFACTORY( UnoFileControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControl ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControl ) ) + else CHECKANDCREATEFACTORY( UnoControlFileControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControlModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel ) ) + else CHECKANDCREATEFACTORY( UnoButtonControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButton ) ) + else CHECKANDCREATEFACTORY( UnoControlButtonModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel ) ) + else CHECKANDCREATEFACTORY( UnoImageControlControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageButton ) ) + else CHECKANDCREATEFACTORY( UnoControlImageControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageButtonModel ) ) + else CHECKANDCREATEFACTORY( UnoImageControlControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControl ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControl ) ) + else CHECKANDCREATEFACTORY( UnoControlImageControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControlModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel ) ) + else CHECKANDCREATEFACTORY( UnoRadioButtonControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButton ) ) + else CHECKANDCREATEFACTORY( UnoControlRadioButtonModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) ) + else CHECKANDCREATEFACTORY( UnoCheckBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBox ) ) + else CHECKANDCREATEFACTORY( UnoControlCheckBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel ) ) + else CHECKANDCREATEFACTORY( UnoListBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBox ) ) + else CHECKANDCREATEFACTORY( UnoControlListBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel ) ) + else CHECKANDCREATEFACTORY( UnoComboBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBox ) ) + else CHECKANDCREATEFACTORY( UnoControlComboBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel ) ) + else CHECKANDCREATEFACTORY( UnoFixedTextControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedText ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedText ) ) + else CHECKANDCREATEFACTORY( UnoControlFixedTextModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedTextModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel ) ) + else CHECKANDCREATEFACTORY( UnoGroupBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBox ) ) + else CHECKANDCREATEFACTORY( UnoControlGroupBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel ) ) + else CHECKANDCREATEFACTORY( VCLXPrinterServer, ::rtl::OUString::createFromAscii( szServiceName_PrinterServer ), ::rtl::OUString::createFromAscii( szServiceName2_PrinterServer ) ) + } + return pRet; +} +} + + + diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx new file mode 100644 index 000000000000..449878844764 --- /dev/null +++ b/toolkit/source/helper/servicenames.cxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * $RCSfile: servicenames.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif + +#include <toolkit/helper/servicenames.hxx> + +const sal_Char __FAR_DATA szServiceName_Toolkit[] = "stardiv.vcl.VclToolkit", szServiceName2_Toolkit[] = "com.sun.star.awt.Toolkit"; +const sal_Char __FAR_DATA szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", szServiceName2_PopupMenu[] = "com.sun.star.awt.PopupMenu"; +const sal_Char __FAR_DATA szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar"; +const sal_Char __FAR_DATA szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer"; +const sal_Char __FAR_DATA szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer"; +const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel"; +const sal_Char __FAR_DATA szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController"; +const sal_Char __FAR_DATA szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlEdit[] = "stardiv.vcl.control.Edit", szServiceName2_UnoControlEdit[] = "com.sun.star.awt.UnoControlEdit"; +const sal_Char __FAR_DATA szServiceName_UnoControlEditModel[] = "stardiv.vcl.controlmodel.Edit", szServiceName2_UnoControlEditModel[] = "com.sun.star.awt.UnoControlEditModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlFileControl[] = "stardiv.vcl.control.FileControl", szServiceName2_UnoControlFileControl[] = "com.sun.star.awt.UnoControlFileControl"; +const sal_Char __FAR_DATA szServiceName_UnoControlFileControlModel[] = "stardiv.vcl.controlmodel.FileControl", szServiceName2_UnoControlFileControlModel[] = "com.sun.star.awt.UnoControlFileControlModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlButton[] = "stardiv.vcl.control.Button", szServiceName2_UnoControlButton[] = "com.sun.star.awt.UnoControlButton"; +const sal_Char __FAR_DATA szServiceName_UnoControlButtonModel[] = "stardiv.vcl.controlmodel.Button", szServiceName2_UnoControlButtonModel[] = "com.sun.star.awt.UnoControlButtonModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlImageButton[] = "stardiv.vcl.control.ImageButton", szServiceName2_UnoControlImageButton[] = "com.sun.star.awt.UnoControlImageButton"; +const sal_Char __FAR_DATA szServiceName_UnoControlImageButtonModel[] = "stardiv.vcl.controlmodel.ImageButton", szServiceName2_UnoControlImageButtonModel[] = "com.sun.star.awt.UnoControlImageButtonModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlImageControl[] = "stardiv.vcl.control.ImageControl", szServiceName2_UnoControlImageControl[] = "com.sun.star.awt.UnoControlImageControl"; +const sal_Char __FAR_DATA szServiceName_UnoControlImageControlModel[] = "stardiv.vcl.controlmodel.ImageControl", szServiceName2_UnoControlImageControlModel[] = "com.sun.star.awt.UnoControlImageControlModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlRadioButton[] = "stardiv.vcl.control.RadioButton", szServiceName2_UnoControlRadioButton[] = "com.sun.star.awt.UnoControlRadioButton"; +const sal_Char __FAR_DATA szServiceName_UnoControlRadioButtonModel[] = "stardiv.vcl.controlmodel.RadioButton", szServiceName2_UnoControlRadioButtonModel[] = "com.sun.star.awt.UnoControlRadioButtonModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlCheckBox[] = "stardiv.vcl.control.CheckBox", szServiceName2_UnoControlCheckBox[] = "com.sun.star.awt.UnoControlCheckBox"; +const sal_Char __FAR_DATA szServiceName_UnoControlCheckBoxModel[] = "stardiv.vcl.controlmodel.CheckBox", szServiceName2_UnoControlCheckBoxModel[] = "com.sun.star.awt.UnoControlCheckBoxModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlListBox[] = "stardiv.vcl.control.ListBox", szServiceName2_UnoControlListBox[] = "com.sun.star.awt.UnoControlListBox"; +const sal_Char __FAR_DATA szServiceName_UnoControlListBoxModel[] = "stardiv.vcl.controlmodel.ListBox", szServiceName2_UnoControlListBoxModel[] = "com.sun.star.awt.UnoControlListBoxModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlComboBox[] = "stardiv.vcl.control.ComboBox", szServiceName2_UnoControlComboBox[] = "com.sun.star.awt.UnoControlComboBox"; +const sal_Char __FAR_DATA szServiceName_UnoControlComboBoxModel[] = "stardiv.vcl.controlmodel.ComboBox", szServiceName2_UnoControlComboBoxModel[] = "com.sun.star.awt.UnoControlComboBoxModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlFixedText[] = "stardiv.vcl.control.FixedText", szServiceName2_UnoControlFixedText[] = "com.sun.star.awt.UnoControlFixedText"; +const sal_Char __FAR_DATA szServiceName_UnoControlFixedTextModel[] = "stardiv.vcl.controlmodel.FixedText", szServiceName2_UnoControlFixedTextModel[] = "com.sun.star.awt.UnoControlFixedTextModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlGroupBox[] = "stardiv.vcl.control.GroupBox", szServiceName2_UnoControlGroupBox[] = "com.sun.star.awt.UnoControlGroupBox"; +const sal_Char __FAR_DATA szServiceName_UnoControlGroupBoxModel[] = "stardiv.vcl.controlmodel.GroupBox", szServiceName2_UnoControlGroupBoxModel[] = "com.sun.star.awt.UnoControlGroupBoxModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlDateField[] = "stardiv.vcl.control.DateField", szServiceName2_UnoControlDateField[] = "com.sun.star.awt.UnoControlDateField"; +const sal_Char __FAR_DATA szServiceName_UnoControlDateFieldModel[] = "stardiv.vcl.controlmodel.DateField", szServiceName2_UnoControlDateFieldModel[] = "com.sun.star.awt.UnoControlDateFieldModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlTimeField[] = "stardiv.vcl.control.TimeField", szServiceName2_UnoControlTimeField[] = "com.sun.star.awt.UnoControlTimeField"; +const sal_Char __FAR_DATA szServiceName_UnoControlTimeFieldModel[] = "stardiv.vcl.controlmodel.TimeField", szServiceName2_UnoControlTimeFieldModel[] = "com.sun.star.awt.UnoControlTimeFieldModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlNumericField[] = "stardiv.vcl.control.NumericField", szServiceName2_UnoControlNumericField[] = "com.sun.star.awt.UnoControlNumericField"; +const sal_Char __FAR_DATA szServiceName_UnoControlNumericFieldModel[] = "stardiv.vcl.controlmodel.NumericField", szServiceName2_UnoControlNumericFieldModel[] = "com.sun.star.awt.UnoControlNumericFieldModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyField[] = "stardiv.vcl.control.CurrencyField", szServiceName2_UnoControlCurrencyField[] = "com.sun.star.awt.UnoControlCurrencyField"; +const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyFieldModel[] = "stardiv.vcl.controlmodel.CurrencyField", szServiceName2_UnoControlCurrencyFieldModel[] = "com.sun.star.awt.UnoControlCurrencyFieldModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlPatternField[] = "stardiv.vcl.control.PatternField", szServiceName2_UnoControlPatternField[] = "com.sun.star.awt.UnoControlPatternField"; +const sal_Char __FAR_DATA szServiceName_UnoControlPatternFieldModel[] = "stardiv.vcl.controlmodel.PatternField", szServiceName2_UnoControlPatternFieldModel[] = "com.sun.star.awt.UnoControlPatternFieldModel"; +const sal_Char __FAR_DATA szServiceName_UnoControlFormattedField[] = "stardiv.vcl.control.FormattedField", szServiceName2_UnoControlFormattedField[] = "com.sun.star.awt.UnoControlFormattedField"; +const sal_Char __FAR_DATA szServiceName_UnoControlFormattedFieldModel[] = "stardiv.vcl.controlmodel.FormattedField", szServiceName2_UnoControlFormattedFieldModel[] = "com.sun.star.awt.UnoControlFormattedFieldModel"; +const sal_Char __FAR_DATA szServiceName_MVCIntrospection[] = "stardiv.vcl.MVCIntrospection", szServiceName2_MVCIntrospection[] = "com.sun.star.awt.MVCIntrospection"; +const sal_Char __FAR_DATA szServiceName_ImageProducer[] = "stardiv.vcl.ImageProducer", szServiceName2_ImageProducer[] = "com.sun.star.awt.ImageProducer"; +const sal_Char __FAR_DATA szServiceName_PrinterServer[] = "stardiv.vcl.PrinterServer", szServiceName2_PrinterServer[] = "com.sun.star.awt.PrinterServer"; + + diff --git a/toolkit/source/helper/unomemorystream.cxx b/toolkit/source/helper/unomemorystream.cxx new file mode 100644 index 000000000000..5550ca2fc03c --- /dev/null +++ b/toolkit/source/helper/unomemorystream.cxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * $RCSfile: unomemorystream.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <toolkit/helper/unomemorystream.hxx> + +// ---------------------------------------------------- +// class UnoMemoryStream +// ---------------------------------------------------- +UnoMemoryStream::UnoMemoryStream( sal_uInt32 nInitSize, sal_uInt32 nResize ) + : SvMemoryStream( nInitSize, nResize ) +{ +} + +// ::com::sun::star::uno::XInterface +::com::sun::star::uno::Any UnoMemoryStream::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::io::XInputStream*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); +} + + +// ::com::sun::star::io::XInputStream +sal_Int32 UnoMemoryStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_Int32 nRead = available(); + if ( nRead > nBytesToRead ) + nRead = nBytesToRead; + + rData = ::com::sun::star::uno::Sequence< sal_Int8 >( nRead ); + Read( rData.getArray(), nRead ); + + return nRead; +} + +sal_Int32 UnoMemoryStream::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_Int32 nAvailable = available(); + if( nAvailable ) + { + return readBytes( rData, min( nMaxBytesToRead , nAvailable ) ); + } + else + { + // Not the most effective method, but it sticks to the specification + return readBytes( rData, 1 ); + } +} + +void UnoMemoryStream::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) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + SeekRel( nBytesToSkip ); +} + +sal_Int32 UnoMemoryStream::available() throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_uInt32 nPos = Tell(); + sal_uInt32 nEnd = Seek( STREAM_SEEK_TO_END ); + Seek( nPos ); + return nEnd - nPos; +} + +void UnoMemoryStream::closeInput() throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + // nothing to do +} + + + + + diff --git a/toolkit/source/helper/unopropertyarrayhelper.cxx b/toolkit/source/helper/unopropertyarrayhelper.cxx new file mode 100644 index 000000000000..733b9578cacc --- /dev/null +++ b/toolkit/source/helper/unopropertyarrayhelper.cxx @@ -0,0 +1,182 @@ +/************************************************************************* + * + * $RCSfile: unopropertyarrayhelper.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <toolkit/helper/unopropertyarrayhelper.hxx> +#include <toolkit/helper/property.hxx> + +// ---------------------------------------------------- +// class UnoPropertyArrayHelper +// ---------------------------------------------------- + +UnoPropertyArrayHelper::UnoPropertyArrayHelper( const ::com::sun::star::uno::Sequence<sal_Int32>& rIDs ) +{ + sal_Int32 nIDs = rIDs.getLength(); + const sal_Int32* pIDs = rIDs.getConstArray(); + for ( sal_Int32 n = 0; n < nIDs; n++ ) + maIDs.Insert( pIDs[n], (void*)1L ); +} + +sal_Bool UnoPropertyArrayHelper::ImplHasProperty( sal_uInt16 nPropId ) const +{ + if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) ) + nPropId = BASEPROPERTY_FONTDESCRIPTOR; + + return maIDs.Get( nPropId ) ? sal_True : sal_False; +} + +// ::cppu::IPropertyArrayHelper +sal_Bool UnoPropertyArrayHelper::fillPropertyMembersByHandle( ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nPropId ) +{ + sal_Bool bValid = ImplHasProperty( nPropId ); + if ( bValid ) + { + if ( pPropName ) + *pPropName = GetPropertyName( nPropId ); + if ( pAttributes ) + *pAttributes = GetPropertyAttribs( nPropId ); + } + return bValid; +} + +::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > UnoPropertyArrayHelper::getProperties() +{ + // Sortiert nach Namen... + + Table aSortedPropsIds; + sal_uInt32 nProps = maIDs.Count(); + for ( sal_uInt32 s = 0; s < nProps; s++ ) + { + sal_uInt32 nId = maIDs.GetObjectKey( s ); + aSortedPropsIds.Insert( 1+GetPropertyOrderNr( nId ), (void*)(sal_uInt32)nId ); + + if ( nId == BASEPROPERTY_FONTDESCRIPTOR ) + { + // Einzelproperties... + for ( sal_uInt32 i = BASEPROPERTY_FONTDESCRIPTORPART_START; i <= BASEPROPERTY_FONTDESCRIPTORPART_END; i++ ) + aSortedPropsIds.Insert( 1+GetPropertyOrderNr( i ), (void*)(sal_uInt32)i ); + } + } + + nProps = aSortedPropsIds.Count(); // koennen jetzt mehr sein + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aProps( nProps ); + ::com::sun::star::beans::Property* pProps = aProps.getArray(); + + for ( sal_uInt32 n = 0; n < nProps; n++ ) + { + sal_uInt16 nId = (sal_uInt16)(sal_uInt32)aSortedPropsIds.GetObject( n ); + pProps[n].Name = GetPropertyName( nId ); + pProps[n].Handle = nId; + pProps[n].Type = *GetPropertyType( nId ); + pProps[n].Attributes = GetPropertyAttribs( nId ); + } + + return aProps; +} + +::com::sun::star::beans::Property UnoPropertyArrayHelper::getPropertyByName(const ::rtl::OUString& rPropertyName) throw (::com::sun::star::beans::UnknownPropertyException) +{ + ::com::sun::star::beans::Property aProp; + sal_uInt16 nId = GetPropertyId( rPropertyName ); + if ( ImplHasProperty( nId ) ) + { + aProp.Name = rPropertyName; + aProp.Handle = -1; + aProp.Type = *GetPropertyType( nId ); + aProp.Attributes = GetPropertyAttribs( nId ); + } + + return aProp; +} + +sal_Bool UnoPropertyArrayHelper::hasPropertyByName(const ::rtl::OUString& rPropertyName) +{ + return ImplHasProperty( GetPropertyId( rPropertyName ) ); +} + +sal_Int32 UnoPropertyArrayHelper::getHandleByName( const ::rtl::OUString & rPropertyName ) +{ + sal_Int32 nId = (sal_Int32 ) GetPropertyId( rPropertyName ); + return nId ? nId : (-1); +} + +sal_Int32 UnoPropertyArrayHelper::fillHandles( sal_Int32* pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames ) +{ + const ::rtl::OUString* pNames = rPropNames.getConstArray(); + sal_Int32 nValues = rPropNames.getLength(); + sal_Int32 nValidHandles = 0; + + for ( sal_Int32 n = 0; n < nValues; n++ ) + { + sal_uInt16 nPropId = GetPropertyId( pNames[n] ); + if ( nPropId && ImplHasProperty( nPropId ) ) + { + pHandles[n] = nPropId; + nValidHandles++; + } + else + { + pHandles[n] = -1; + } + } + return nValidHandles; +} + + diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx new file mode 100644 index 000000000000..de1edb563922 --- /dev/null +++ b/toolkit/source/helper/unowrapper.cxx @@ -0,0 +1,572 @@ +/************************************************************************* + * + * $RCSfile: unowrapper.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_AWT_WINDOWEVENT_HPP_ +#include <com/sun/star/awt/WindowEvent.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_KEYEVENT_HPP_ +#include <com/sun/star/awt/KeyEvent.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_KEYMODIFIER_HPP_ +#include <com/sun/star/awt/KeyModifier.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_ +#include <com/sun/star/awt/MouseEvent.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_ +#include <com/sun/star/awt/MouseButton.hpp> +#endif + +#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ +#include <unotools/processfactory.hxx> +#endif + +#include <toolkit/helper/unowrapper.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <toolkit/helper/convert.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/awt/vclxwindows.hxx> +#include <toolkit/awt/vclxcontainer.hxx> +#include <toolkit/awt/vclxtopwindow.hxx> +#include <toolkit/awt/vclxgraphics.hxx> + +#include <vcl/svapp.hxx> + +#include <tools/debug.hxx> + +// ---------------------------------------------------- +// class UnoWrapper +// ---------------------------------------------------- + +// Mit Out-Parameter besser als Rueckgabewert, wegen Ref-Objekt... + +void ImplInitWindowEvent( ::com::sun::star::awt::WindowEvent& rEvent, Window* pWindow ) +{ + Point aPos = pWindow->GetPosPixel(); + Size aSz = pWindow->GetSizePixel(); + + rEvent.X = aPos.X(); + rEvent.Y = aPos.Y(); + + rEvent.Width = aSz.Width(); + rEvent.Height = aSz.Height(); + + pWindow->GetBorder( rEvent.LeftInset, rEvent.TopInset, rEvent.RightInset, rEvent.BottomInset ); +} + +void ImplInitKeyEvent( ::com::sun::star::awt::KeyEvent& rEvent, const KeyEvent& rEvt ) +{ + rEvent.Modifiers = 0; + if ( rEvt.GetKeyCode().IsShift() ) + rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT; + if ( rEvt.GetKeyCode().IsMod1() ) + rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1; + if ( rEvt.GetKeyCode().IsMod2() ) + rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2; + + rEvent.KeyCode = rEvt.GetKeyCode().GetCode(); + rEvent.KeyChar = (unsigned char)rEvt.GetCharCode(); + rEvent.KeyFunc = rEvt.GetKeyCode().GetFunction(); +} + +void ImplInitMouseEvent( ::com::sun::star::awt::MouseEvent& rEvent, const MouseEvent& rEvt ) +{ + rEvent.Modifiers = 0; + if ( rEvt.IsShift() ) + rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT; + if ( rEvt.IsMod1() ) + rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1; + if ( rEvt.IsMod2() ) + rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2; + + rEvent.Buttons = 0; + if ( rEvt.IsLeft() ) + rEvent.Buttons |= ::com::sun::star::awt::MouseButton::LEFT; + if ( rEvt.IsRight() ) + rEvent.Buttons |= ::com::sun::star::awt::MouseButton::RIGHT; + if ( rEvt.IsMiddle() ) + rEvent.Buttons |= ::com::sun::star::awt::MouseButton::MIDDLE; + + rEvent.X = rEvt.GetPosPixel().X(); + rEvent.Y = rEvt.GetPosPixel().Y(); + rEvent.ClickCount = rEvt.GetClicks(); + rEvent.PopupTrigger = sal_False; +} + +// ---------------------------------------------------- +// class UnoWrapper +// ---------------------------------------------------- + +UnoWrapper::UnoWrapper() +{ +} + +void UnoWrapper::Destroy() +{ + delete this; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> UnoWrapper::GetVCLToolkit() +{ + if ( !mxToolkit.is() ) + mxToolkit = VCLUnoHelper::CreateToolkit(); + return mxToolkit.get(); +} + +void UnoWrapper::RegisterUnoServices() +{ + // Sollte nicht megr nötig sein! +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> UnoWrapper::GetWindowInterface( Window* pWindow, BOOL bCreate ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer(); + if ( !xPeer.is() && bCreate ) + { + ::com::sun::star::awt::XWindowPeer* pPeer = NULL; + // Basis-Component erzeugen... + WindowType eType = pWindow->GetType(); + if ( ( eType == WINDOW_TABPAGE ) || + ( eType == WINDOW_WINDOW ) || + ( eType == WINDOW_FLOATINGWINDOW ) ) + { + pPeer = new VCLXContainer; + } + else if ( ( eType == WINDOW_SYSWINDOW ) || ( eType == WINDOW_WORKWINDOW ) || eType == WINDOW_DOCKINGWINDOW ) + { + pPeer = new VCLXTopWindow; + } + else if ( ( eType == WINDOW_DIALOG ) || ( eType == WINDOW_MODALDIALOG ) || ( eType == WINDOW_MODELESSDIALOG ) ) + { + pPeer = new VCLXDialog; + } + else + { + pPeer = new VCLXWindow; + } + xPeer = pPeer; + SetWindowInterface( pWindow, xPeer ); + } + return xPeer; +} + +void UnoWrapper::SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xIFace ) +{ + VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( xIFace ); + + DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" ); + if ( pVCLXWindow ) + { + pVCLXWindow->SetWindow( pWindow ); + pWindow->SetWindowPeer( xIFace, pVCLXWindow ); + } +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> UnoWrapper::CreateGraphics( OutputDevice* pOutDev ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> xGrf; + VCLXGraphics* pGrf = new VCLXGraphics; + xGrf = pGrf; + pGrf->Init( pOutDev ); + return xGrf; +} + +void UnoWrapper::ReleaseAllGraphics( OutputDevice* pOutDev ) +{ + List* pLst = pOutDev->GetUnoGraphicsList(); + if ( pLst ) + { + for ( sal_uInt32 n = 0; n < pLst->Count(); n++ ) + { + VCLXGraphics* pGrf = (VCLXGraphics*)pLst->GetObject( n ); + pGrf->SetOutputDevice( NULL ); + } + } + +} + +// MT: Wurde im Window-CTOR gerufen, damit Container-Listener +// vom Parent reagieren, aber hat sowieso nicht richtig funktioniert, +// weil im Window-CTOR das Interface noch nicht da ist! +// => Nur Listener rufen, wenn ueber das ::com::sun::star::awt::Toolkit erzeugt + +/* +void ImplSmartWindowCreated( Window* pNewWindow ) +{ + UNOWindowData* pParentUNOData = pNewWindow->GetParent() ? + pNewWindow->GetParent()->GetUNOData() : NULL; + + if ( pParentUNOData && pParentUNOData->GetListeners( EL_CONTAINER ) ) + { + UNOWindowData* pUNOData = pNewWindow->GetUNOData(); + if ( !pUNOData ) + pUNOData = ImplSmartCreateUNOData( pNewWindow ); + + ::com::sun::star::awt::VclContainerEvent aEvent; + aEvent.Source = (UsrObject*)pParentUNOData->GetWindowPeer(); + aEvent.Id = VCLCOMPONENT_ADDED; + aEvent.Child = (UsrObject*)pUNOData->GetWindowPeer(); + + EventList* pLst = pParentUNOData->GetListeners( EL_CONTAINER ); + for ( sal_uInt32 n = 0; n < pLst->Count(); n++ ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > * pRef = pLst->GetObject( n ); + ((::com::sun::star::awt::XVclContainerListener*)(::com::sun::star::lang::XEventListener*)*pRef)->windowAdded( aEvent ); + } + } +} +*/ + +sal_Bool lcl_ImplIsParent( Window* pParentWindow, Window* pPossibleChild ) +{ + Window* pWindow = pPossibleChild; + while ( pWindow && ( pWindow != pParentWindow ) ) + pWindow = pWindow->GetParent(); + + return pWindow ? sal_True : sal_False; +} + +void UnoWrapper::WindowDestroyed( Window* pWindow ) +{ + // ggf. existieren noch von ::com::sun::star::loader::Java erzeugte Childs, die sonst erst + // im Garbage-Collector zerstoert werden... + Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD ); + while ( pChild ) + { + Window* pNextChild = pChild->GetWindow( WINDOW_NEXT ); + + Window* pClient = pChild->GetWindow( WINDOW_CLIENT ); + if ( pClient->GetWindowPeer() ) + pClient->GetWindowPeer()->dispose(); + + pChild = pNextChild; + } + + // ::com::sun::star::chaos::System-Windows suchen... + Window* pOverlap = pWindow->GetWindow( WINDOW_OVERLAP ); + pOverlap = pOverlap->GetWindow( WINDOW_FIRSTOVERLAP ); + while ( pOverlap ) + { + Window* pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT ); + Window* pClient = pOverlap->GetWindow( WINDOW_CLIENT ); + + if ( pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) ) + pClient->GetWindowPeer()->dispose(); + + pOverlap = pNextOverlap; + } + + Window* pParent = pWindow->GetParent(); + if ( pParent && pParent->GetWindowPeer() && pParent->GetWindowPeer()->GetContainerListeners().getLength() ) + { + ::com::sun::star::awt::VclContainerEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pParent->GetWindowPeer(); + aEvent.Child = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + pParent->GetWindowPeer()->GetContainerListeners().windowRemoved( aEvent ); + } + + if ( pWindow && pWindow->GetWindowPeer() ) + { + pWindow->GetWindowPeer()->SetWindow( NULL ); + pWindow->SetWindowPeer( NULL, NULL ); + } +} + +void UnoWrapper::WindowEvent_Move( Window* pWindow ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetWindowListeners().getLength() ) + { + ::com::sun::star::awt::WindowEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + ImplInitWindowEvent( aEvent, pWindow ); + pWindow->GetWindowPeer()->GetWindowListeners().windowMoved( aEvent ); + } +} + +void UnoWrapper::WindowEvent_Resize( Window* pWindow ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetWindowListeners().getLength() ) + { + ::com::sun::star::awt::WindowEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + ImplInitWindowEvent( aEvent, pWindow ); + pWindow->GetWindowPeer()->GetWindowListeners().windowResized( aEvent ); + } +} + +void UnoWrapper::WindowEvent_Show( Window* pWindow, sal_Bool bShow ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetWindowListeners().getLength() ) + { + ::com::sun::star::awt::WindowEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + ImplInitWindowEvent( aEvent, pWindow ); + + if ( bShow ) + pWindow->GetWindowPeer()->GetWindowListeners().windowShown( aEvent ); + else + pWindow->GetWindowPeer()->GetWindowListeners().windowHidden( aEvent ); + } + + // Bei TopWindows hat das die Bedeutung von Opened, Closed... + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetTopWindowListeners().getLength() ) + { + ::com::sun::star::lang::EventObject aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + + if ( bShow ) + pWindow->GetWindowPeer()->GetTopWindowListeners().windowOpened( aEvent ); + else + pWindow->GetWindowPeer()->GetTopWindowListeners().windowClosed( aEvent ); + } +} + +void UnoWrapper::WindowEvent_Activate( Window* pWindow, sal_Bool bActivated ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetTopWindowListeners().getLength() ) + { + ::com::sun::star::lang::EventObject aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + + if ( bActivated ) + pWindow->GetWindowPeer()->GetTopWindowListeners().windowActivated( aEvent ); + else + pWindow->GetWindowPeer()->GetTopWindowListeners().windowDeactivated( aEvent ); + } +} + +void UnoWrapper::WindowEvent_MouseButtonDown( Window* pWindow, const MouseEvent& rEvt ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetMouseListeners().getLength() ) + { + ::com::sun::star::awt::MouseEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + ImplInitMouseEvent( aEvent, rEvt ); + pWindow->GetWindowPeer()->GetMouseListeners().mousePressed( aEvent ); + } +} + +void UnoWrapper::WindowEvent_MouseButtonUp( Window* pWindow, const MouseEvent& rEvt ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetMouseListeners().getLength() ) + { + ::com::sun::star::awt::MouseEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + ImplInitMouseEvent( aEvent, rEvt ); + pWindow->GetWindowPeer()->GetMouseListeners().mouseReleased( aEvent ); + } +} + +void UnoWrapper::WindowEvent_Command( Window* pWindow, const CommandEvent& rEvt ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetMouseListeners().getLength() && + rEvt.IsMouseEvent() && ( rEvt.GetCommand() == COMMAND_CONTEXTMENU ) ) + { + // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden... + MouseEvent aMEvt( rEvt.GetMousePosPixel(), 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 ); + ::com::sun::star::awt::MouseEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + ImplInitMouseEvent( aEvent, aMEvt ); + aEvent.PopupTrigger = sal_True; + pWindow->GetWindowPeer()->GetMouseListeners().mousePressed( aEvent ); + } +} + +void UnoWrapper::WindowEvent_MouseMove( Window* pWindow, const MouseEvent& rEvt ) +{ + if ( pWindow->GetWindowPeer() ) + { + if ( pWindow->GetWindowPeer()->GetMouseListeners().getLength() && ( rEvt.IsEnterWindow() || rEvt.IsLeaveWindow() ) ) + { + ::com::sun::star::awt::MouseEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + ImplInitMouseEvent( aEvent, rEvt ); + + if ( rEvt.IsEnterWindow() ) + pWindow->GetWindowPeer()->GetMouseListeners().mouseEntered( aEvent ); + else + pWindow->GetWindowPeer()->GetMouseListeners().mouseExited( aEvent ); + } + + if ( pWindow->GetWindowPeer()->GetMouseMotionListeners().getLength() && !rEvt.IsEnterWindow() && !rEvt.IsLeaveWindow() ) + { + ::com::sun::star::awt::MouseEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + ImplInitMouseEvent( aEvent, rEvt ); + + if ( rEvt.GetMode() & MOUSE_SIMPLEMOVE ) + pWindow->GetWindowPeer()->GetMouseMotionListeners().mouseMoved( aEvent ); + else + pWindow->GetWindowPeer()->GetMouseMotionListeners().mouseDragged( aEvent ); + } + } +} + +void UnoWrapper::WindowEvent_KeyInput( Window* pWindow, const KeyEvent& rEvt ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetKeyListeners().getLength() ) + { + ::com::sun::star::awt::KeyEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + ImplInitKeyEvent( aEvent, rEvt ); + pWindow->GetWindowPeer()->GetKeyListeners().keyPressed( aEvent ); + } +} + +void UnoWrapper::WindowEvent_KeyUp( Window* pWindow, const KeyEvent& rEvt ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetKeyListeners().getLength() ) + { + ::com::sun::star::awt::KeyEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + ImplInitKeyEvent( aEvent, rEvt ); + pWindow->GetWindowPeer()->GetKeyListeners().keyReleased( aEvent ); + } +} + +void UnoWrapper::WindowEvent_GetFocus( Window* pWindow ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetFocusListeners().getLength() ) + { + ::com::sun::star::awt::FocusEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + aEvent.FocusFlags = pWindow->GetGetFocusFlags(); + aEvent.Temporary = sal_False; + pWindow->GetWindowPeer()->GetFocusListeners().focusGained( aEvent ); + } +} + +void UnoWrapper::WindowEvent_LoseFocus( Window* pWindow ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetFocusListeners().getLength() ) + { + ::com::sun::star::awt::FocusEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + aEvent.FocusFlags = pWindow->GetGetFocusFlags(); + aEvent.Temporary = sal_False; + + Window* pNext = Application::GetFocusWindow(); + if ( pNext ) + { + // Bei zusammengesetzten Controls interessiert sich keiner fuer das Innenleben: + Window* pNextC = pNext; + while ( pNextC && !pNextC->IsCompoundControl() ) + pNextC = pNextC->GetParent(); + if ( pNextC ) + pNext = pNextC; + + pNext->GetComponentInterface( sal_True ); + aEvent.NextFocus = (::cppu::OWeakObject*)pNext->GetWindowPeer(); + } + pWindow->GetWindowPeer()->GetFocusListeners().focusLost( aEvent ); + } +} + +void UnoWrapper::WindowEvent_Paint( Window* pWindow, const Rectangle& rRect ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetPaintListeners().getLength() ) + { + ::com::sun::star::awt::PaintEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + aEvent.UpdateRect = AWTRectangle( rRect ); + aEvent.Count = 0; + pWindow->GetWindowPeer()->GetPaintListeners().windowPaint( aEvent ); + } +} + +void UnoWrapper::WindowEvent_Close( Window* pWindow ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetTopWindowListeners().getLength() ) + { + ::com::sun::star::lang::EventObject aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + pWindow->GetWindowPeer()->GetTopWindowListeners().windowClosing( aEvent ); + } +} + +void UnoWrapper::WindowEvent_Minimize( Window* pWindow ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetTopWindowListeners().getLength() ) + { + ::com::sun::star::lang::EventObject aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + pWindow->GetWindowPeer()->GetTopWindowListeners().windowMinimized( aEvent ); + } +} + +void UnoWrapper::WindowEvent_Normalize( Window* pWindow ) +{ + if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetTopWindowListeners().getLength() ) + { + ::com::sun::star::lang::EventObject aEvent; + aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); + pWindow->GetWindowPeer()->GetTopWindowListeners().windowNormalized( aEvent ); + } +} + +::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > UnoWrapper::getNewUnoServiceManager() +{ + return ::utl::getProcessServiceFactory(); +} + + + + diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx new file mode 100644 index 000000000000..9e9108918be1 --- /dev/null +++ b/toolkit/source/helper/vclunohelper.cxx @@ -0,0 +1,455 @@ +/************************************************************************* + * + * $RCSfile: vclunohelper.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#define SMART_UNO_GENERATION // Fuer Methoden an der FontMetric + +#include <tools/debug.hxx> +#include <tools/stream.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/window.hxx> + +#ifndef _COM_SUN_STAR_AWT_XBITMAP_HPP_ +#include <com/sun/star/awt/XBitmap.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ +#include <com/sun/star/awt/XWindow.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XDEVICE_HPP_ +#include <com/sun/star/awt/XDevice.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XPOINTER_HPP_ +#include <com/sun/star/awt/XPointer.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_SIMPLEFONTMETRIC_HPP_ +#include <com/sun/star/awt/SimpleFontMetric.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_ +#include <com/sun/star/awt/FontDescriptor.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_ +#include <com/sun/star/awt/XControlContainer.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_ +#include <com/sun/star/awt/FontWeight.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_FONTWIDTH_HPP_ +#include <com/sun/star/awt/FontWidth.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +#pragma hdrstop + +#include <toolkit/helper/vclunohelper.hxx> +#include <toolkit/helper/convert.hxx> +#include <toolkit/awt/vclxbitmap.hxx> +#include <toolkit/awt/vclxregion.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/awt/vclxgraphics.hxx> +#include <toolkit/awt/vclxpointer.hxx> +#include <toolkit/awt/vclxfont.hxx> +#include <toolkit/controls/unocontrolcontainer.hxx> +#include <toolkit/controls/unocontrolcontainermodel.hxx> + +#include <unotools/processfactory.hxx> + +// ---------------------------------------------------- +// class VCLUnoHelper +// ---------------------------------------------------- + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> VCLUnoHelper::CreateToolkit() +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory(); + ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.awt.ExtToolkit" ) ); + if ( !xI.is() ) + xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> xToolkit; + if ( xI.is() ) + xToolkit = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>( xI, ::com::sun::star::uno::UNO_QUERY ); + + return xToolkit; +} + +BitmapEx VCLUnoHelper::GetBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>& rxBitmap ) +{ + BitmapEx aBmp; + + VCLXBitmap* pVCLBitmap = VCLXBitmap::GetImplementation( rxBitmap ); + if ( pVCLBitmap ) + aBmp = pVCLBitmap->GetBitmap(); + else + { + Bitmap aDIB, aMask; + { + ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getDIB(); + SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ ); + aMem >> aDIB; + } + { + ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getMaskDIB(); + SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ ); + aMem >> aMask; + } + aBmp = BitmapEx( aDIB, aMask ); + } + return aBmp; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> VCLUnoHelper::CreateBitmap( const BitmapEx& rBitmap ) +{ + VCLXBitmap* pBmp = new VCLXBitmap; + pBmp->SetBitmap( rBitmap ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> xBmp = pBmp; + return xBmp; +} + +Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow ) +{ + VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow ); + return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL; +} + +Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow ) +{ + VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow ); + return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL; +} + +Region VCLUnoHelper::GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) +{ + Region aRegion; + VCLXRegion* pVCLRegion = VCLXRegion::GetImplementation( rxRegion ); + if ( pVCLRegion ) + aRegion = pVCLRegion->GetRegion(); + else + { + ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > aRects = rxRegion->getRectangles(); + sal_Int32 nRects = aRects.getLength(); + for ( sal_Int32 n = 0; n < nRects; n++ ) + aRegion.Union( VCLRectangle( aRects.getArray()[n] ) ); + } + return aRegion; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> VCLUnoHelper::GetInterface( Window* pWindow ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetComponentInterface(); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> xWin( xPeer, ::com::sun::star::uno::UNO_QUERY ); + return xWin; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> VCLUnoHelper::CreatePointer() +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> xPointer = new VCLXPointer; + return xPointer; +} + +OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>& rxDevice ) +{ + OutputDevice* pOutDev = NULL; + VCLXDevice* pDev = VCLXDevice::GetImplementation( rxDevice ); + if ( pDev ) + pOutDev = pDev->GetOutputDevice(); + return pOutDev; +} + +OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>& rxGraphics ) +{ + OutputDevice* pOutDev = NULL; + VCLXGraphics* pGrf = VCLXGraphics::GetImplementation( rxGraphics ); + if ( pGrf ) + pOutDev = pGrf->GetOutputDevice(); + return pOutDev; +} + +Polygon VCLUnoHelper::CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) +{ + sal_uInt32 nLen = DataX.getLength(); + const sal_Int32* pDataX = DataX.getConstArray(); + const sal_Int32* pDataY = DataY.getConstArray(); + Polygon aPoly( (sal_uInt16) nLen ); + for ( sal_uInt16 n = 0; n < nLen; n++ ) + { + Point aPnt; + aPnt.X() = pDataX[n]; + aPnt.Y() = pDataY[n]; + aPoly[n] = aPnt; + } + return aPoly; +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> VCLUnoHelper::CreateControlContainer( Window* pWindow ) +{ + UnoControlContainer* pContainer = new UnoControlContainer( pWindow->GetComponentInterface( sal_True ) ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > x = pContainer; + + UnoControlModel* pContainerModel = new UnoControlContainerModel; + pContainer->setModel( (::com::sun::star::awt::XControlModel*)pContainerModel ); + + return x; +} + +float VCLUnoHelper::ConvertFontWidth( FontWidth eWidth ) +{ + if( eWidth == WIDTH_DONTKNOW ) + return ::com::sun::star::awt::FontWidth::DONTKNOW; + else if( eWidth == WIDTH_ULTRA_CONDENSED ) + return ::com::sun::star::awt::FontWidth::ULTRACONDENSED; + else if( eWidth == WIDTH_EXTRA_CONDENSED ) + return ::com::sun::star::awt::FontWidth::EXTRACONDENSED; + else if( eWidth == WIDTH_CONDENSED ) + return ::com::sun::star::awt::FontWidth::CONDENSED; + else if( eWidth == WIDTH_SEMI_CONDENSED ) + return ::com::sun::star::awt::FontWidth::SEMICONDENSED; + else if( eWidth == WIDTH_NORMAL ) + return ::com::sun::star::awt::FontWidth::NORMAL; + else if( eWidth == WIDTH_SEMI_EXPANDED ) + return ::com::sun::star::awt::FontWidth::SEMIEXPANDED; + else if( eWidth == WIDTH_EXPANDED ) + return ::com::sun::star::awt::FontWidth::EXPANDED; + else if( eWidth == WIDTH_EXTRA_EXPANDED ) + return ::com::sun::star::awt::FontWidth::EXTRAEXPANDED; + else if( eWidth == WIDTH_ULTRA_EXPANDED ) + return ::com::sun::star::awt::FontWidth::ULTRAEXPANDED; + + DBG_ERROR( "Unknown FontWidth" ); + return ::com::sun::star::awt::FontWidth::DONTKNOW; +} + +FontWidth VCLUnoHelper::ConvertFontWidth( float f ) +{ + if( f <= ::com::sun::star::awt::FontWidth::DONTKNOW ) + return WIDTH_DONTKNOW; + else if( f <= ::com::sun::star::awt::FontWidth::ULTRACONDENSED ) + return WIDTH_ULTRA_CONDENSED; + else if( f <= ::com::sun::star::awt::FontWidth::EXTRACONDENSED ) + return WIDTH_EXTRA_CONDENSED; + else if( f <= ::com::sun::star::awt::FontWidth::CONDENSED ) + return WIDTH_CONDENSED; + else if( f <= ::com::sun::star::awt::FontWidth::SEMICONDENSED ) + return WIDTH_SEMI_CONDENSED; + else if( f <= ::com::sun::star::awt::FontWidth::NORMAL ) + return WIDTH_NORMAL; + else if( f <= ::com::sun::star::awt::FontWidth::SEMIEXPANDED ) + return WIDTH_SEMI_EXPANDED; + else if( f <= ::com::sun::star::awt::FontWidth::EXPANDED ) + return WIDTH_EXPANDED; + else if( f <= ::com::sun::star::awt::FontWidth::EXTRAEXPANDED ) + return WIDTH_EXTRA_EXPANDED; + else if( f <= ::com::sun::star::awt::FontWidth::ULTRAEXPANDED ) + return WIDTH_ULTRA_EXPANDED; + + DBG_ERROR( "Unknown FontWidth" ); + return WIDTH_DONTKNOW; +} + +float VCLUnoHelper::ConvertFontWeight( FontWeight eWeight ) +{ + if( eWeight == WEIGHT_DONTKNOW ) + return ::com::sun::star::awt::FontWeight::DONTKNOW; + else if( eWeight == WEIGHT_THIN ) + return ::com::sun::star::awt::FontWeight::THIN; + else if( eWeight == WEIGHT_ULTRALIGHT ) + return ::com::sun::star::awt::FontWeight::ULTRALIGHT; + else if( eWeight == WEIGHT_LIGHT ) + return ::com::sun::star::awt::FontWeight::LIGHT; + else if( eWeight == WEIGHT_SEMILIGHT ) + return ::com::sun::star::awt::FontWeight::SEMILIGHT; + else if( ( eWeight == WEIGHT_NORMAL ) || ( eWeight == WEIGHT_MEDIUM ) ) + return ::com::sun::star::awt::FontWeight::NORMAL; + else if( eWeight == WEIGHT_SEMIBOLD ) + return ::com::sun::star::awt::FontWeight::SEMIBOLD; + else if( eWeight == WEIGHT_BOLD ) + return ::com::sun::star::awt::FontWeight::BOLD; + else if( eWeight == WEIGHT_ULTRABOLD ) + return ::com::sun::star::awt::FontWeight::ULTRABOLD; + else if( eWeight == WEIGHT_BLACK ) + return ::com::sun::star::awt::FontWeight::BLACK; + + DBG_ERROR( "Unknown FontWeigth" ); + return ::com::sun::star::awt::FontWeight::DONTKNOW; +} + +FontWeight VCLUnoHelper::ConvertFontWeight( float f ) +{ + if( f <= ::com::sun::star::awt::FontWeight::DONTKNOW ) + return WEIGHT_DONTKNOW; + else if( f <= ::com::sun::star::awt::FontWeight::THIN ) + return WEIGHT_THIN; + else if( f <= ::com::sun::star::awt::FontWeight::ULTRALIGHT ) + return WEIGHT_ULTRALIGHT; + else if( f <= ::com::sun::star::awt::FontWeight::LIGHT ) + return WEIGHT_LIGHT; + else if( f <= ::com::sun::star::awt::FontWeight::SEMILIGHT ) + return WEIGHT_SEMILIGHT; + else if( f <= ::com::sun::star::awt::FontWeight::NORMAL ) + return WEIGHT_NORMAL; + else if( f <= ::com::sun::star::awt::FontWeight::SEMIBOLD ) + return WEIGHT_SEMIBOLD; + else if( f <= ::com::sun::star::awt::FontWeight::BOLD ) + return WEIGHT_BOLD; + else if( f <= ::com::sun::star::awt::FontWeight::ULTRABOLD ) + return WEIGHT_ULTRABOLD; + else if( f <= ::com::sun::star::awt::FontWeight::BLACK ) + return WEIGHT_BLACK; + + DBG_ERROR( "Unknown FontWeigth" ); + return WEIGHT_DONTKNOW; +} + + +::com::sun::star::awt::FontDescriptor VCLUnoHelper::CreateFontDescriptor( const Font& rFont ) +{ + ::com::sun::star::awt::FontDescriptor aFD; + aFD.Name = rFont.GetName(); + aFD.StyleName = rFont.GetStyleName(); + aFD.Height = rFont.GetSize().Height(); + aFD.Width = rFont.GetSize().Width(); + aFD.Family = rFont.GetFamily(); + aFD.CharSet = rFont.GetCharSet(); + aFD.Pitch = rFont.GetPitch(); + aFD.CharacterWidth = VCLUnoHelper::ConvertFontWidth( rFont.GetWidthType() ); + aFD.Weight= VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() ); + aFD.Slant = (::com::sun::star::awt::FontSlant)rFont.GetItalic(); + aFD.Underline = rFont.GetUnderline(); + aFD.Strikeout = rFont.GetStrikeout(); + aFD.Orientation = rFont.GetOrientation(); + aFD.Kerning = rFont.IsKerning(); + aFD.WordLineMode = rFont.IsWordLineMode(); + aFD.Type = 0; // ??? => Nur an Metric... + return aFD; +} + +Font VCLUnoHelper::CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont ) +{ + Font aFont( rInitFont ); + if ( rDescr.Name.len() ) + aFont.SetName( rDescr.Name ); + if ( rDescr.StyleName.len() ) + aFont.SetStyleName( rDescr.StyleName ); + if ( rDescr.Height ) + aFont.SetSize( Size( rDescr.Width, rDescr.Height ) ); + if ( (FontFamily)rDescr.Family != FAMILY_DONTKNOW ) + aFont.SetFamily( (FontFamily)rDescr.Family ); + if ( (CharSet)rDescr.CharSet != RTL_TEXTENCODING_DONTKNOW ) + aFont.SetCharSet( (CharSet)rDescr.CharSet ); + if ( (FontPitch)rDescr.Pitch != PITCH_DONTKNOW ) + aFont.SetPitch( (FontPitch)rDescr.Pitch ); + if ( rDescr.CharacterWidth ) + aFont.SetWidthType( VCLUnoHelper::ConvertFontWidth( rDescr.CharacterWidth ) ); + if ( rDescr.Weight ) + aFont.SetWeight( VCLUnoHelper::ConvertFontWeight( rDescr.Weight ) ); + if ( (FontItalic)rDescr.Slant != ITALIC_DONTKNOW ) + aFont.SetItalic( (FontItalic)rDescr.Slant ); + if ( (FontUnderline)rDescr.Underline != UNDERLINE_DONTKNOW ) + aFont.SetUnderline( (FontUnderline)rDescr.Underline ); + if ( (FontStrikeout)rDescr.Strikeout != STRIKEOUT_DONTKNOW ) + aFont.SetStrikeout( (FontStrikeout)rDescr.Strikeout ); + + // Kein DONTKNOW + aFont.SetOrientation( rDescr.Orientation ); + aFont.SetKerning( rDescr.Kerning ); + aFont.SetWordLineMode( rDescr.WordLineMode ); + + return aFont; +} + +Font VCLUnoHelper::CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont ) +{ + Font aFont; + VCLXFont* pVCLXFont = VCLXFont::GetImplementation( rxFont ); + if ( pVCLXFont ) + aFont = pVCLXFont->GetFont(); + return aFont; +} + + +::com::sun::star::awt::SimpleFontMetric VCLUnoHelper::CreateFontMetric( const FontMetric& rFontMetric ) +{ + ::com::sun::star::awt::SimpleFontMetric aFM; + aFM.Ascent = rFontMetric.GetAscent(); + aFM.Descent = rFontMetric.GetDescent(); + aFM.Leading = rFontMetric.GetLeading(); + aFM.Slant = rFontMetric.GetSlant(); + aFM.FirstChar = rFontMetric.getFirstChar(); + aFM.LastChar = rFontMetric.getLastChar(); + return aFM; +} + +sal_Bool VCLUnoHelper::IsZero( ::com::sun::star::awt::Rectangle rRect ) +{ + return ( !rRect.X && !rRect.Y && !rRect.Width && !rRect.Height ); +} + + + + diff --git a/toolkit/util/makefile.mk b/toolkit/util/makefile.mk new file mode 100644 index 000000000000..652409af0725 --- /dev/null +++ b/toolkit/util/makefile.mk @@ -0,0 +1,248 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=.. + +PRJNAME=toolkit +TARGET=tk +VERSION=$(UPD) +USE_LDUMP2=TRUE + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +LDUMP=ldump2.exe + +# --- Allgemein ---------------------------------------------------------- + +.IF "$(depend)" == "" + +.IF "$(HEADER)" == "" + +LIB1TARGET= $(SLB)$/$(TARGET).lib +LIB1FILES= $(SLB)$/awt.lib \ + $(SLB)$/controls.lib \ + $(SLB)$/helper.lib +SHL1TARGET= tk$(VERSION)$(DLLPOSTFIX) +SHL1IMPLIB= itk + +SHL1STDLIBS=\ + $(TOOLSLIB) \ + $(SOTLIB) \ + $(VOSLIB) \ + $(UNOTOOLSLIB) \ + $(VCLLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) + +SHL1LIBS= $(LIB1TARGET) +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1EXPORTFILE= tk.dxp + +.IF "$(COM)"=="ICC" +SHL1OBJS= $(SLO)$/unowrap.obj +.ENDIF + +.IF "$(COM)"=="WTC" +ALL: $(LIB1TARGET) \ + $(MISC)$/$(SHL1TARGET).flt \ + $(MISC)$/$(SHL1TARGET).def \ + $(BIN)$/$(SHL1TARGET).dll \ + ALLTAR +.ELSE +ALL: \ + $(LIB1TARGET) \ + ALLTAR +.ENDIF + + +# --- W32 ---------------------------------------------------------------- + +.IF "$(GUI)" == "WNT" + +# --- Def-File --- + +$(MISC)$/$(SHL1TARGET).def: $(MISC)$/$(SHL1TARGET).flt makefile.mk + @echo ------------------------------ + @echo Making: $@ + @+-attrib -r defs +.IF "$(COM)"!="WTC" + @echo LIBRARY $(SHL1TARGET) >$@ + @echo DESCRIPTION 'TK' >>$@ +.IF "$(COM)"!="ICC" + @echo DATA READWRITE NONSHARED >>$@ +.ENDIF + @echo EXPORTS >>$@ +.IF "$(COM)"!="BLC" +.IF "$(COM)"!="ICC" + $(LIBMGR) -EXTRACT:/ /OUT:$(TARGET).exp $(LIB1TARGET) + @$(LDUMP) -E20 -F$(MISC)$/$(SHL1TARGET).flt $(TARGET).exp >>$@ + +-del $(TARGET).exp +.ELSE + @$(LDUMP) -E3 -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>$@ +.ENDIF +.ELSE + @$(LDUMP) -E3 -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>$@ +.ENDIF +.ELSE + @echo option DESCRIPTION 'StarView DLL' >$@ + @echo name $(BIN)$/$(SHL1TARGET).dll >>$@ + @$(LDUMP) -A -E1 -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>tmp.def + @gawk -f s:\util\exp.awk tmp.def >>$@ + @+-del tmp.def +.ENDIF + +.ENDIF + +# --- OS2 ---------------------------------------------------------------- + +.IF "$(GUI)" == "OS2" + +.IF "$(debug)" != "" +.IF "$(COM)"=="BLC" +LIBFLAGS=$(LIBFLAGS) /P512 +.ENDIF +.ENDIF + +# --- Def-File --- + +$(MISC)$/$(SHL1TARGET).def: $(MISC)$/$(SHL1TARGET).flt makefile.mk + @echo ------------------------------ + @echo Making: $@ +.IF "$(COM)"!="WTC" + @echo LIBRARY $(SHL1TARGET) INITINSTANCE TERMINSTANCE >$@ + @echo DESCRIPTION 'VCL' >>$@ + @echo PROTMODE >>$@ + @echo CODE LOADONCALL >>$@ + @echo DATA PRELOAD MULTIPLE NONSHARED >>$@ + @echo EXPORTS >>$@ +.IF "$(COM)"!="ICC" + @$(LDUMP) -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>$@ +.ELSE + @cppfilt /b /p /p /n /o $(LIB1TARGET) >>tmp.cpf + @$(LDUMP) -A -E1 -F$(MISC)$/$(SHL1TARGET).flt tmp.cpf >>$@ + @+-del tmp.cpf +.ENDIF +.ELSE + @echo option DESCRIPTION 'StarView DLL' >$@ + @echo name $(BIN)$/$(SHL1TARGET).dll >>$@ +.IF "$(E2P)" != "" + @echo export e2_dll_begin_tag_.1 >>$@ +.ENDIF + @$(LDUMP) -A -E1 -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>tmp.def + @gawk -f s:\util\exp.awk tmp.def >>$@ + @+-del tmp.def +.ENDIF + +.ENDIF + +.IF "$(OS)"=="MACOSX" +SHL1STDLIBS += +.ELIF "$(GUI)"=="UNX" +SHL1STDLIBS +=\ + -lX11 -lXt -lXmu +.ENDIF + +# --- Allgemein ---------------------------------------------------------- + +# --- VCL-Filter-Datei --- + +$(MISC)$/$(SHL1TARGET).flt: makefile.mk + @echo ------------------------------ + @echo Making: $@ + @echo > $@ +# @echo Impl > $@ + @echo Provider>> $@ + @echo UnoEditControl>> $@ + @echo UnoControlEditModel>> $@ + @echo UnoFixedTextControl>> $@ + @echo UnoControlFixedTextModel>> $@ + @echo UnoButtonControl>> $@ + @echo UnoControlButtonModel>> $@ + @echo UnoListBoxControl>> $@ + @echo UnoControlListBoxModel>> $@ + @echo VCLXButton>> $@ + @echo VCLXCheckBox>> $@ + @echo VCLXComboBox>> $@ + @echo VCLXFixedText>> $@ + @echo VCLXFontMetric>> $@ + @echo VCLXGraphics>> $@ + @echo VCLXListBox>> $@ + @echo VCLXMenu>> $@ + @echo VCLXMessageBox>> $@ + @echo VCLXRadioButton>> $@ + @echo VCLXScrollBar>> $@ + @echo VCLXVirtualDevice>> $@ + @echo VCLXPopupMenu>> $@ + @echo VCLXMenuBar>> $@ + + +# --- Targets ------------------------------------------------------------ + +.ENDIF + +.ENDIF +.INCLUDE : target.mk diff --git a/toolkit/workben/controls.cxx b/toolkit/workben/controls.cxx new file mode 100644 index 000000000000..587a1a3c4272 --- /dev/null +++ b/toolkit/workben/controls.cxx @@ -0,0 +1,485 @@ +/************************************************************************* + * + * $RCSfile: controls.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 17:02:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#define NOOLDSV + +#include <tools/debug.hxx> + +#include <vcl/window.hxx> +#include <vcl/svapp.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/msgbox.hxx> + + +#include <stardiv/uno/awt/window.hxx> +#include <stardiv/uno/awt/vclwin.hxx> +#include <stardiv/uno/awt/printer.hxx> +#include <stardiv/uno/repos/serinfo.hxx> +#include <stardiv/uno/lang/factory.hxx> + + +#include <unoctrl.hxx> +// #include <unoctrl2.hxx> + +#include <svtools/unoiface.hxx> // InitExtToolkit + +UsrAny UsrAny_UINT16( UINT16 n ) +{ + UsrAny aVal; + aVal.setUINT16( n ); + return aVal; +} + +// ----------------------------------------------------------------------- + +class MyApp : public Application +{ +public: + void Main(); +}; + +MyApp aMyApp; + +// ----------------------------------------------------------------------- + +class MyWin : public WorkWindow +{ + XControlRef xCtrl; + XPropertySetRef xCtrlModel; + XControlContainerRef xCont; + XPropertySetRef xContModel; + XControlRef xDrawCtrl; + XGraphicsRef xG; + +public: + MyWin( Window* pParent, WinBits nWinStyle ); + ~MyWin(); + + void MouseButtonDown( const MouseEvent& rMEvt ); + void Resize(); + void Paint( const Rectangle& r ); +}; + +// ----------------------------------------------------------------------- + +void MyApp::Main() +{ + createAndSetDefaultServiceManager(); + // !!! + InitExtVclToolkit(); + Application::RegisterUnoServices(); + + MyWin aMainWin( NULL, WB_APP | WB_STDWORK ); + aMainWin.SetText( "Uno-Controls - Workbench" ); + aMainWin.Show(); + Execute(); +} + +// ----------------------------------------------------------------------- + +MyWin::MyWin( Window* pParent, WinBits nWinStyle ) : + WorkWindow( pParent, nWinStyle ) +{ +} + +// ----------------------------------------------------------------------- +MyWin::~MyWin() +{ + XComponentRef xC1( xCont, USR_QUERY ); + xC1->dispose(); + XComponentRef xC2( xContModel, USR_QUERY ); + xC2->dispose(); +} + +// ----------------------------------------------------------------------- + +void MyWin::MouseButtonDown( const MouseEvent& rMEvt ) +{ + if( rMEvt.GetClicks() == 2 ) + { + XViewRef xV( xDrawCtrl, USR_QUERY ); + XWindowRef xC( xDrawCtrl, USR_QUERY ); + xV->draw( xC->getPosSize().Left(), xC->getPosSize().Top() ); + + // Printer Testen... +/* + XServiceManagerRef xProv = getGlobalServiceManager(); + XServiceProviderRef xSSI = xProv->queryServiceProvider( L"stardiv.vcl.PrinterServer" ); + XPrinterServerRef xPrinterServer( xSSI->createInstance(), USR_QUERY ); + + Sequence< UString > aPrinterNames = xPrinterServer->getPrinterNames(); + USHORT nPrinters = aPrinterNames.getLen(); + String aInfo( "Printers: " ); + aInfo += nPrinters; + if ( nPrinters ) + { + for ( USHORT n = 0; n < nPrinters; n++ ) + { + aInfo += '\n'; + aInfo += OUStringToString( aPrinterNames.getConstArray()[n], CHARSET_SYSTEM ); + } + + XPrinterRef xPrinter = xPrinterServer->createPrinter( aPrinterNames.getConstArray()[0] ); + xPrinter->start( L"UNOPrinterTest", 1, TRUE ); + XDeviceRef xDev = xPrinter->startPage(); + XGraphicsRef xGraphics = xDev->createGraphics(); + xGraphics->drawText( 200, 200, L"Printed with UNO" ); + xPrinter->endPage(); + xPrinter->end(); + } + InfoBox( this, aInfo ).Execute(); +*/ + } + else if( rMEvt.GetClicks() == 1 ) + { + if( xContModel ) + { + static INT32 nColor = 0x001788ab; + xContModel->setPropertyValue( L"BackgroundColor", UsrAny( nColor ) ); + nColor += 0x00111111; + nColor &= 0xFFFFFF; + } + else + { + XServiceManagerRef xProv = getGlobalServiceManager(); + + XMultiServiceFactoryRef xMSF = NAMESPACE_USR( getProcessServiceManager )(); + + XServiceProviderRef xSSI = xProv->queryServiceProvider( L"stardiv.vcl.VclToolkit" ); + XToolkitRef xToolkit( xMSF->createInstance( L"stardiv.vcl.VclToolkit" ), USR_QUERY ); + DBG_ASSERT( xToolkit, "No Toolkit!" ); + + // Uno Container + Model erzeugen + XServiceProviderRef xModelProv; // = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.ControlContainer" ); + XInterfaceRef xCMRef( xMSF->createInstance(L"stardiv.vcl.controlmodel.ControlContainer") ); + xCMRef->queryInterface( XPropertySet::getSmartUik(), xContModel ); + xContModel->setPropertyValue( L"Border", UsrAny_UINT16( 1 ) ); + xContModel->setPropertyValue( L"BackgroundColor", UsrAny( (UINT32)0x00CCCCCC) ); + + xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.control.ControlContainer" ); + XInterfaceRef xCCRef( xModelProv->createInstance(), USR_QUERY ); + xCCRef->queryInterface( XControlContainer::getSmartUik(), xCont ); + + XControlModelRef xCM( xContModel, USR_QUERY ); + XControlRef xContControl( xCont, USR_QUERY ); + xContControl->setModel( xCM ); + XWindowRef xContComp( xCont, USR_QUERY ); + xContComp->setPosSize( 0, 0, 500, 600, PosSize_POSSIZE ); + + // Zwei EditControls auf einem Model... +// xModelProv = xProv->queryServiceProvider( L"stardiv.uno.awt.UnoControlEditModel" ); + XInterfaceRef xModel( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEditModel") ); + DBG_ASSERT( xModel, "No Model!" ); + + XPropertySetRef xPSet( xModel, USR_QUERY ); + xPSet->setPropertyValue( L"Text", UsrAny( UString( L"Hallo!" ) ) ); + xPSet->setPropertyValue( L"FontName", UsrAny( UString( L"Times New Roman" ) ) ); +// xPSet->setPropertyValue( L"FontWeight", UsrAny( 200 ) ); + + XServiceProviderRef xEditCtrlProv = xProv->queryServiceProvider( L"stardiv.uno.awt.UnoControlEdit" ); + // Edit1 + XControlRef xEdit1( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEdit"), USR_QUERY ); + xModel->queryInterface( XControlModel::getSmartUik(), xCM ); + xEdit1->setModel( xCM ); + XWindowRef xEditCmp1( xEdit1, USR_QUERY ); + xEditCmp1->setPosSize( 50, 50, 100, 60, PosSize_POSSIZE ); + xCont->addControl( L"", xEdit1 ); + // Edit2 + XControlRef xEdit2( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEdit"), USR_QUERY ); + xModel->queryInterface( XControlModel::getSmartUik(), xCM ); + xEdit2->setModel( xCM ); + XWindowRef xEditCmp2( xEdit2, USR_QUERY ); + XLayoutConstrainsRef xL( xEdit2, USR_QUERY ); + if ( xL.is() ) + { + Size aSz = xL->getPreferredSize(); + xEditCmp2->setPosSize( 100, 180, aSz.Width(), aSz.Height(), PosSize_POSSIZE ); + } + else + xEditCmp2->setPosSize( 100, 180, 100, 40, PosSize_POSSIZE ); + xCont->addControl( L"", xEdit2 ); + + xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.NumericField" ); + XInterfaceRef xNumModel( xModelProv->createInstance(), USR_QUERY ); + DBG_ASSERT( xNumModel, "No Model!" ); + + + XServiceProviderRef xNumFieldProv = xProv->queryServiceProvider( L"stardiv.vcl.control.NumericField" ); + XControlRef xNumField( xNumFieldProv->createInstance(), USR_QUERY ); + xNumModel->queryInterface( XControlModel::getSmartUik(), xCM ); + xNumField->setModel( xCM ); + XWindowRef xNumFieldWin( xNumField, USR_QUERY ); + xNumFieldWin->setPosSize( 50, 250, 100, 60, PosSize_POSSIZE ); + xCont->addControl( L"", xNumField ); + + XMultiPropertySetRef xPSet2( xNumModel, USR_QUERY ); + Sequence<UString> Names( 2 ); + Names.getArray()[0] = L"Value"; + Names.getArray()[1] = L"ValueMin"; + Sequence<UsrAny> Values( 2 ); + Values.getArray()[0] = UsrAny( -2000000.0 ); + Values.getArray()[1] = UsrAny( -2000000.0 ); + xPSet2->setPropertyValues( Names, Values ); + + + // Button... + xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.Button" ); + xModelProv->createInstance()->queryInterface( XInterface::getSmartUik(), xModel ); + DBG_ASSERT( xModel, "No Model!" ); + + xModel->queryInterface( XPropertySet::getSmartUik(), xPSet ); + xPSet->setPropertyValue( L"Label", UsrAny( L"Press!" ) ); + + XServiceProviderRef xButtonCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.Button" ); + XControlRef xButton1( xButtonCtrlProv->createInstance(), USR_QUERY ); + xModel->queryInterface( XControlModel::getSmartUik(), xCM ); + xButton1->setModel( xCM ); + XWindowRef xButtonCmp1( xButton1, USR_QUERY ); + xButtonCmp1->setPosSize( 170, 80, 80, 80, PosSize_POSSIZE ); + // Unsichtbar, nur im MBDown mit DrawRoutine bei Doppel-Klick... + xButtonCmp1->setVisible( FALSE ); + xDrawCtrl = xButton1; + + xCont->addControl( L"", xButton1 ); + +/* + + // ListBox... + xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.ListBox" ); + xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() ); + + xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() ); + Sequence<UString> aSeq( 7 ); + aSeq.getArray()[0] = L"Item1"; + aSeq.getArray()[1] = L"Item2"; + aSeq.getArray()[2] = L"Item3"; + aSeq.getArray()[3] = L"Item4"; + aSeq.getArray()[4] = L"Item5"; + aSeq.getArray()[5] = L"Item6"; + aSeq.getArray()[6] = L"Item7"; + xPSet->setPropertyValue( L"StringItemList", UsrAny( &aSeq, Sequence<UString>::getReflection() ) ); + xPSet->setPropertyValue( L"LineCount", UsrAny_UINT16( 4 ) ); + xPSet->setPropertyValue( L"Dropdown", UsrAny( (BOOL)TRUE ) ); + + XServiceProviderRef xListBoxCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.ListBox" ); + XControlRef xListBox1 = (XControl*)xListBoxCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() ); + xListBox1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) ); + XWindowRef xListBoxCmp1 = (XWindow*)xListBox1->queryInterface( XWindow::getSmartUik() ); + xListBoxCmp1->setPosSize( 20, 250, 200, 20, PosSize_POSSIZE ); + xCont->addControl( L"", xListBox1 ); + + // FixedText... + xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.FixedText" ); + xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() ); + DBG_ASSERT( xModel, "No Model!" ); + + xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() ); + xPSet->setPropertyValue( L"Label", UsrAny( L"Label:" ) ); + xPSet->setPropertyValue( L"BackgroundColor", UsrAny( (UINT32)0x00888888) ); + + Font_Attribs aFontAttrs; + aFontAttrs.Italic = ITALIC_NORMAL; + xPSet->setPropertyValue( L"Font_Attribs", UsrAny( &aFontAttrs, Font_Attribs_getReflection() ) ); + + XPropertyStateRef xState = (XPropertyState*)xPSet->queryInterface( XPropertyState::getSmartUik() ); + xState->getPropertyState( L"Font_Attribs" ); + xState->getPropertyState( L"Font_Size" ); + + XServiceProviderRef xFixedTextCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.FixedText" ); + XControlRef xFixedText1 = (XControl*)xFixedTextCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() ); + DBG_ASSERT( xFixedText1, "No FixedText!" ); + xFixedText1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) ); + XWindowRef xFixedTextCmp1 = (XWindow*)xFixedText1->queryInterface( XWindow::getSmartUik() ); + xFixedTextCmp1->setPosSize( 20, 20, 120, 20, PosSize_POSSIZE ); + xCont->addControl( L"", xFixedText1 ); + + // TabTest... + xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.GroupBox" ); + xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() ); + xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() ); + xPSet->setPropertyValue( L"Label", UsrAny( L"Radio-Test:" ) ); + XServiceProviderRef xGroupBoxCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.GroupBox" ); + XControlRef xGroupBox1 = (XControl*)xGroupBoxCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() ); + xGroupBox1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) ); + XWindowRef xGroupBoxCmp1 = (XWindow*)xGroupBox1->queryInterface( XWindow::getSmartUik() ); + xGroupBoxCmp1->setPosSize( 30, 410, 100, 130, PosSize_POSSIZE ); + xCont->addControl( L"", xGroupBox1 ); + + XServiceProviderRef xRadioButtonModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.RadioButton" ); + XServiceProviderRef xRadioButtonCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.RadioButton" ); + + xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() ); + XControlRef xT1 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() ); + xT1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) ); + XWindowRef xTC1 = (XWindow*)xT1->queryInterface( XWindow::getSmartUik() ); + xTC1->setPosSize( 40, 430, 80, 20, PosSize_POSSIZE ); + xCont->addControl( L"", xT1 ); + xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() ); + xPSet->setPropertyValue( L"Label", UsrAny( L"Radio1" ) ); + xPSet->setPropertyValue( L"State", UsrAny_UINT16( 1 ) ); + + xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() ); + XControlRef xT2 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() ); + xT2->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) ); + XWindowRef xTC2 = (XWindow*)xT2->queryInterface( XWindow::getSmartUik() ); + xTC2->setPosSize( 40, 470, 80, 20, PosSize_POSSIZE ); + xCont->addControl( L"", xT2 ); + xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() ); + xPSet->setPropertyValue( L"Label", UsrAny( L"Radio2" ) ); + + xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() ); + XControlRef xT3 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() ); + xT3->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) ); + XWindowRef xTC3 = (XWindow*)xT3->queryInterface( XWindow::getSmartUik() ); + xTC3->setPosSize( 40, 510, 80, 20, PosSize_POSSIZE ); + xCont->addControl( L"", xT3 ); + xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() ); + xPSet->setPropertyValue( L"Label", UsrAny( L"Radio3" ) ); + + xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() ); + XControlRef xT4 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() ); + xT4->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) ); + XWindowRef xTC4 = (XWindow*)xT4->queryInterface( XWindow::getSmartUik() ); + xTC4->setPosSize( 40, 550, 80, 20, PosSize_POSSIZE ); + xCont->addControl( L"", xT4 ); + xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() ); + xPSet->setPropertyValue( L"Label", UsrAny( L"Radio4 - no" ) ); + xPSet->setPropertyValue( L"Tabstop", UsrAny( (BOOL)TRUE ) ); + + // TabController: + xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.TabController" ); + xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() ); + XTabControllerModelRef xTCModel = (XTabControllerModel*)xModel->queryInterface( XTabControllerModel::getSmartUik() ); + + XServiceProviderRef xTCProv = xProv->queryServiceProvider( L"stardiv.vcl.control.TabController" ); + XTabControllerRef xTC = (XTabController*)xTCProv->createInstance()->queryInterface( XTabController::getSmartUik() ); + xTC->setModel( (XTabControllerModel*)xModel->queryInterface( XTabControllerModel::getSmartUik() ) ); + XUnoControlContainerRef xUCC = (XUnoControlContainer*)xCont->queryInterface( XUnoControlContainer::getSmartUik() ); + xUCC->addTabController( xTC ); + + Sequence<XControlModelRef> aControls( 5 ); + aControls.getArray()[0] = xGroupBox1->getModel(); + aControls.getArray()[1] = xT1->getModel(); + aControls.getArray()[2] = xT3->getModel(); + aControls.getArray()[3] = xT2->getModel(); + aControls.getArray()[4] = xT4->getModel(); + xTCModel->setControls( aControls ); + + Sequence<XControlModelRef> aGroup( 3 ); + aGroup.getArray()[0] = xT1->getModel(); + aGroup.getArray()[1] = xT3->getModel(); + aGroup.getArray()[2] = xT2->getModel(); + xTCModel->setGroup( aGroup, L"test" ); +*/ + // Container anzeigen... + // Als Child zu diesem Fenster + xContControl->createPeer( XToolkitRef(), GetComponentInterface( TRUE ) ); + + XDeviceRef xD( xContControl->getPeer(), USR_QUERY ); + xG = xD->createGraphics(); + XViewRef xV ( xDrawCtrl, USR_QUERY ); + xV->setGraphics( xG ); + +// ((UnoControl*)(XControl*)xNumField))->updateFromModel(); + +/* + // TEST: + WindowDecriptor aDescr; + aDescr.ComponentServiceName = "window"; + aDescr.Type = VCLCOMPONENTTYPE_CONTAINER; + aDescr.Parent = GetComponentInterface( TRUE ); + aDescr.WindowAttributes = WA_SHOW|WA_BORDER; + aDescr.Bounds = Rectangle( Point( 500, 50 ), Size( 300, 200 ) ); + XVclWindowPeerRef xSPWin = xToolkit->createComponent( aDescr ); + + WindowDecriptor aDescr2; + aDescr2.ComponentServiceName = "scrollbar"; + aDescr2.Type = VCLCOMPONENTTYPE_SIMPLE; + aDescr2.Parent = xSPWin; + aDescr2.WindowAttributes = WA_SHOW|WA_BORDER|WA_VSCROLL; + aDescr2.Bounds = Rectangle( Point( 250, 0 ), Size( 50, 200 ) ); + XVclWindowPeerRef xSB = xToolkit->createComponent( aDescr2 ); +*/ + } + return; + } + WorkWindow::MouseButtonDown( rMEvt ); +} + + +// ----------------------------------------------------------------------- + +void MyWin::Resize() +{ + WorkWindow::Resize(); +} + +void MyWin::Paint( const Rectangle& r ) +{ + // Muss ueber PaintListener geschehen... + if ( xDrawCtrl.is() ) + { + XViewRef xV( xDrawCtrl, USR_QUERY ); + XWindowRef xC( xDrawCtrl, USR_QUERY ); + xV->draw( xC->getPosSize().Left(), xC->getPosSize().Top() ); + } + +} + diff --git a/toolkit/workben/makefile.mk b/toolkit/workben/makefile.mk new file mode 100644 index 000000000000..ac0844979640 --- /dev/null +++ b/toolkit/workben/makefile.mk @@ -0,0 +1,175 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 17:02:10 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=.. + +PRJNAME=toolkit +TARGET=controls +LIBTARGET=NO + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +CXXFILES= controls.cxx \ + smartvcl.cxx + +OBJFILES= $(OBJ)$/controls.obj \ + $(OBJ)$/smartvcl.obj + + +APP2TARGET= controls +APP2OBJS= $(OBJ)$/controls.obj +APP2STDLIBS=$(TOOLSLIB) \ + $(SOTLIB) \ + $(SVTOOLLIB) \ + $(USRLIB) \ + $(ONELIB) \ + $(SVLIB) +APP2DEF= $(MISC)$/controls.def + +APP3TARGET= smartvcl +APP3OBJS= $(OBJ)$/smartvcl.obj +APP3STDLIBS=$(TOOLSLIB) \ + $(SOTLIB) \ + $(SVTOOLLIB) \ + $(USRLIB) \ + $(ONELIB) \ + $(SVLIB) +APP3DEF= $(MISC)$/smartvcl.def + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + +# ------------------------------------------------------------------ +# Windows +# ------------------------------------------------------------------ + +.IF "$(GUI)" == "WIN" + +$(MISC)$/controls.def: makefile + echo NAME controls >$@ + echo DESCRIPTION 'StarView - Testprogramm' >>$@ + echo EXETYPE WINDOWS >>$@ + echo STUB 'winSTUB.EXE' >>$@ + echo PROTMODE >>$@ + echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@ + echo DATA PRELOAD MOVEABLE MULTIPLE >>$@ + echo HEAPSIZE 8192 >>$@ + echo STACKSIZE 32768 >>$@ + +$(MISC)$/smartvcl.def: makefile + echo NAME smartvcl >$@ + echo DESCRIPTION 'StarView - Testprogramm' >>$@ + echo EXETYPE WINDOWS >>$@ + echo STUB 'winSTUB.EXE' >>$@ + echo PROTMODE >>$@ + echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@ + echo DATA PRELOAD MOVEABLE MULTIPLE >>$@ + echo HEAPSIZE 8192 >>$@ + echo STACKSIZE 32768 >>$@ + +.ENDIF + +# ------------------------------------------------------------------ +# OS2 +# ------------------------------------------------------------------ + +.IF "$(GUI)" == "OS2" + +$(MISC)$/controls.def: makefile + echo NAME controls WINDOWAPI >$@ + echo DESCRIPTION 'StarView - Testprogramm' >>$@ +.IF "$(COM)" != "BLC" + echo STUB 'os2STUB.EXE' >>$@ +.ENDIF +.IF "$(COM)"!="MTW" + echo EXETYPE OS2 >>$@ +.ENDIF + echo PROTMODE >>$@ + echo CODE LOADONCALL >>$@ + echo DATA PRELOAD MULTIPLE >>$@ + echo HEAPSIZE 16384 >>$@ + echo STACKSIZE 32768 >>$@ + +$(MISC)$/smartvcl.def: makefile + echo NAME smartvcl WINDOWAPI >$@ + echo DESCRIPTION 'StarView - Testprogramm' >>$@ +.IF "$(COM)" != "BLC" + echo STUB 'os2STUB.EXE' >>$@ +.ENDIF +.IF "$(COM)"!="MTW" + echo EXETYPE OS2 >>$@ +.ENDIF + echo PROTMODE >>$@ + echo CODE LOADONCALL >>$@ + echo DATA PRELOAD MULTIPLE >>$@ + echo HEAPSIZE 16384 >>$@ + echo STACKSIZE 32768 >>$@ + +.ENDIF |