diff options
Diffstat (limited to 'toolkit/source/awt')
45 files changed, 0 insertions, 21557 deletions
diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx deleted file mode 100644 index f6d501a9de..0000000000 --- a/toolkit/source/awt/animatedimagespeer.cxx +++ /dev/null @@ -1,542 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_toolkit.hxx" - -#include "toolkit/awt/animatedimagespeer.hxx" -#include "toolkit/helper/property.hxx" - -/** === begin UNO includes === **/ -#include <com/sun/star/awt/XAnimatedImages.hpp> -#include <com/sun/star/awt/Size.hpp> -#include <com/sun/star/graphic/XGraphicProvider.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/graphic/XGraphic.hpp> -#include <com/sun/star/awt/ImageScaleMode.hpp> -/** === end UNO includes === **/ - -#include <comphelper/componentcontext.hxx> -#include <comphelper/namedvaluecollection.hxx> -#include <comphelper/processfactory.hxx> -#include <rtl/ustrbuf.hxx> -#include <tools/diagnose_ex.h> -#include <tools/urlobj.hxx> -#include <vcl/throbber.hxx> -#include <vcl/svapp.hxx> - -#include <limits> - -//...................................................................................................................... -namespace toolkit -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::lang::EventObject; - using ::com::sun::star::container::ContainerEvent; - using ::com::sun::star::awt::XAnimatedImages; - using ::com::sun::star::awt::Size; - using ::com::sun::star::lang::XMultiServiceFactory; - using ::com::sun::star::graphic::XGraphicProvider; - using ::com::sun::star::beans::XPropertySet; - using ::com::sun::star::graphic::XGraphic; - /** === end UNO using === **/ - namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode; - - //================================================================================================================== - //= AnimatedImagesPeer_Data - //================================================================================================================== - struct CachedImage - { - ::rtl::OUString sImageURL; - mutable Reference< XGraphic > xGraphic; - - CachedImage() - :sImageURL() - ,xGraphic() - { - } - - CachedImage( ::rtl::OUString const& i_imageURL ) - :sImageURL( i_imageURL ) - ,xGraphic() - { - } - }; - - struct AnimatedImagesPeer_Data - { - AnimatedImagesPeer& rAntiImpl; - ::std::vector< ::std::vector< CachedImage > > aCachedImageSets; - - AnimatedImagesPeer_Data( AnimatedImagesPeer& i_antiImpl ) - :rAntiImpl( i_antiImpl ) - ,aCachedImageSets() - { - } - }; - - //================================================================================================================== - //= helper - //================================================================================================================== - namespace - { - //-------------------------------------------------------------------------------------------------------------- - ::rtl::OUString lcl_getHighContrastURL( ::rtl::OUString const& i_imageURL ) - { - INetURLObject aURL( i_imageURL ); - if ( aURL.GetProtocol() != INET_PROT_PRIV_SOFFICE ) - { - OSL_VERIFY( aURL.insertName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hicontrast" ) ), false, 0 ) ); - return aURL.GetMainURL( INetURLObject::NO_DECODE ); - } - // the private: scheme is not considered to be hierarchical by INetURLObject, so manually insert the - // segment - const sal_Int32 separatorPos = i_imageURL.indexOf( '/' ); - ENSURE_OR_RETURN( separatorPos != -1, "lcl_getHighContrastURL: unsipported URL scheme - cannot automatically determine HC version!", i_imageURL ); - - ::rtl::OUStringBuffer composer; - composer.append( i_imageURL.copy( 0, separatorPos ) ); - composer.appendAscii( "/hicontrast" ); - composer.append( i_imageURL.copy( separatorPos ) ); - return composer.makeStringAndClear(); - } - - //-------------------------------------------------------------------------------------------------------------- - bool lcl_ensureImage_throw( Reference< XGraphicProvider > const& i_graphicProvider, const bool i_isHighContrast, const CachedImage& i_cachedImage ) - { - if ( !i_cachedImage.xGraphic.is() ) - { - ::comphelper::NamedValueCollection aMediaProperties; - if ( i_isHighContrast ) - { - // try (to find) the high-contrast version of the graphic first - aMediaProperties.put( "URL", lcl_getHighContrastURL( i_cachedImage.sImageURL ) ); - i_cachedImage.xGraphic.set( i_graphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY ); - } - if ( !i_cachedImage.xGraphic.is() ) - { - aMediaProperties.put( "URL", i_cachedImage.sImageURL ); - i_cachedImage.xGraphic.set( i_graphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY ); - } - } - return i_cachedImage.xGraphic.is(); - } - - //-------------------------------------------------------------------------------------------------------------- - Size lcl_getGraphicSizePixel( Reference< XGraphic > const& i_graphic ) - { - Size aSizePixel; - try - { - if ( i_graphic.is() ) - { - const Reference< XPropertySet > xGraphicProps( i_graphic, UNO_QUERY_THROW ); - OSL_VERIFY( xGraphicProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SizePixel" ) ) ) >>= aSizePixel ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return aSizePixel; - } - - //-------------------------------------------------------------------------------------------------------------- - void lcl_init( Sequence< ::rtl::OUString > const& i_imageURLs, ::std::vector< CachedImage >& o_images ) - { - o_images.resize(0); - size_t count = size_t( i_imageURLs.getLength() ); - o_images.reserve( count ); - for ( size_t i = 0; i < count; ++i ) - { - o_images.push_back( CachedImage( i_imageURLs[i] ) ); - } - } - - //-------------------------------------------------------------------------------------------------------------- - void lcl_updateImageList_nothrow( AnimatedImagesPeer_Data& i_data ) - { - Throbber* pThrobber = dynamic_cast< Throbber* >( i_data.rAntiImpl.GetWindow() ); - if ( pThrobber == NULL ) - return; - - try - { - // collect the image sizes of the different image sets - const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); - - const bool isHighContrast = pThrobber->GetSettings().GetStyleSettings().GetHighContrastMode(); - - sal_Int32 nPreferredSet = -1; - const size_t nImageSetCount = i_data.aCachedImageSets.size(); - if ( nImageSetCount < 2 ) - { - nPreferredSet = sal_Int32( nImageSetCount ) - 1; - } - else - { - ::std::vector< Size > aImageSizes( nImageSetCount ); - for ( sal_Int32 nImageSet = 0; size_t( nImageSet ) < nImageSetCount; ++nImageSet ) - { - ::std::vector< CachedImage > const& rImageSet( i_data.aCachedImageSets[ nImageSet ] ); - if ( ( rImageSet.empty() ) - || ( !lcl_ensureImage_throw( xGraphicProvider, isHighContrast, rImageSet[0] ) ) - ) - { - aImageSizes[ nImageSet ] = Size( ::std::numeric_limits< long >::max(), ::std::numeric_limits< long >::max() ); - } - else - { - aImageSizes[ nImageSet ] = lcl_getGraphicSizePixel( rImageSet[0].xGraphic ); - } - } - - // find the set with the smallest difference between window size and image size - const ::Size aWindowSizePixel = pThrobber->GetSizePixel(); - long nMinimalDistance = ::std::numeric_limits< long >::max(); - for ( ::std::vector< Size >::const_iterator check = aImageSizes.begin(); - check != aImageSizes.end(); - ++check - ) - { - if ( ( check->Width > aWindowSizePixel.Width() ) - || ( check->Height > aWindowSizePixel.Height() ) - ) - // do not use an image set which doesn't fit into the window - continue; - - const sal_Int64 distance = - ( aWindowSizePixel.Width() - check->Width ) * ( aWindowSizePixel.Width() - check->Width ) - + ( aWindowSizePixel.Height() - check->Height ) * ( aWindowSizePixel.Height() - check->Height ); - if ( distance < nMinimalDistance ) - { - nMinimalDistance = distance; - nPreferredSet = check - aImageSizes.begin(); - } - } - } - - // found a set? - Sequence< Reference< XGraphic > > aImages; - if ( ( nPreferredSet >= 0 ) && ( size_t( nPreferredSet ) < nImageSetCount ) ) - { - // => set the images - ::std::vector< CachedImage > const& rImageSet( i_data.aCachedImageSets[ nPreferredSet ] ); - aImages.realloc( rImageSet.size() ); - sal_Int32 imageIndex = 0; - for ( ::std::vector< CachedImage >::const_iterator cachedImage = rImageSet.begin(); - cachedImage != rImageSet.end(); - ++cachedImage, ++imageIndex - ) - { - lcl_ensureImage_throw( xGraphicProvider, isHighContrast, *cachedImage ); - aImages[ imageIndex ] = cachedImage->xGraphic; - } - } - pThrobber->setImageList( aImages ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------------------------------------------------- - void lcl_updateImageList_nothrow( AnimatedImagesPeer_Data& i_data, const Reference< XAnimatedImages >& i_images ) - { - try - { - const sal_Int32 nImageSetCount = i_images->getImageSetCount(); - i_data.aCachedImageSets.resize(0); - for ( sal_Int32 set = 0; set < nImageSetCount; ++set ) - { - const Sequence< ::rtl::OUString > aImageURLs( i_images->getImageSet( set ) ); - ::std::vector< CachedImage > aImages; - lcl_init( aImageURLs, aImages ); - i_data.aCachedImageSets.push_back( aImages ); - } - - lcl_updateImageList_nothrow( i_data ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - - //================================================================================================================== - //= AnimatedImagesPeer - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - AnimatedImagesPeer::AnimatedImagesPeer() - :AnimatedImagesPeer_Base() - ,m_pData( new AnimatedImagesPeer_Data( *this ) ) - { - } - - //------------------------------------------------------------------------------------------------------------------ - AnimatedImagesPeer::~AnimatedImagesPeer() - { - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AnimatedImagesPeer::startAnimation( ) throw (RuntimeException) - { - SolarMutexGuard aGuard; - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber != NULL) - pThrobber->start(); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AnimatedImagesPeer::stopAnimation( ) throw (RuntimeException) - { - SolarMutexGuard aGuard; - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber != NULL) - pThrobber->stop(); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Bool SAL_CALL AnimatedImagesPeer::isAnimationRunning( ) throw (RuntimeException) - { - SolarMutexGuard aGuard; - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber != NULL) - return pThrobber->isRunning(); - return sal_False; - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AnimatedImagesPeer::setProperty( const ::rtl::OUString& i_propertyName, const Any& i_value ) throw(RuntimeException) - { - SolarMutexGuard aGuard; - - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber == NULL ) - { - VCLXWindow::setProperty( i_propertyName, i_value ); - return; - } - - const sal_uInt16 nPropertyId = GetPropertyId( i_propertyName ); - switch ( nPropertyId ) - { - case BASEPROPERTY_STEP_TIME: - { - sal_Int32 nStepTime( 0 ); - if ( i_value >>= nStepTime ) - pThrobber->setStepTime( nStepTime ); - break; - } - case BASEPROPERTY_AUTO_REPEAT: - { - sal_Bool bRepeat( sal_True ); - if ( i_value >>= bRepeat ) - pThrobber->setRepeat( bRepeat ); - break; - } - - case BASEPROPERTY_IMAGE_SCALE_MODE: - { - sal_Int16 nScaleMode( ImageScaleMode::Anisotropic ); - ImageControl* pImageControl = dynamic_cast< ImageControl* >( GetWindow() ); - if ( pImageControl && ( i_value >>= nScaleMode ) ) - { - pImageControl->SetScaleMode( nScaleMode ); - } - } - break; - - default: - AnimatedImagesPeer_Base::setProperty( i_propertyName, i_value ); - break; - } - } - - //------------------------------------------------------------------------------------------------------------------ - Any SAL_CALL AnimatedImagesPeer::getProperty( const ::rtl::OUString& i_propertyName ) throw(RuntimeException) - { - SolarMutexGuard aGuard; - - Any aReturn; - - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber == NULL ) - return VCLXWindow::getProperty( i_propertyName ); - - const sal_uInt16 nPropertyId = GetPropertyId( i_propertyName ); - switch ( nPropertyId ) - { - case BASEPROPERTY_STEP_TIME: - aReturn <<= pThrobber->getStepTime(); - break; - - case BASEPROPERTY_AUTO_REPEAT: - aReturn <<= pThrobber->getRepeat(); - break; - - case BASEPROPERTY_IMAGE_SCALE_MODE: - { - ImageControl const* pImageControl = dynamic_cast< ImageControl* >( GetWindow() ); - aReturn <<= ( pImageControl ? pImageControl->GetScaleMode() : ImageScaleMode::Anisotropic ); - } - break; - - default: - aReturn = AnimatedImagesPeer_Base::getProperty( i_propertyName ); - break; - } - - return aReturn; - } - - //------------------------------------------------------------------------------------------------------------------ - void AnimatedImagesPeer::ProcessWindowEvent( const VclWindowEvent& i_windowEvent ) - { - switch ( i_windowEvent.GetId() ) - { - case VCLEVENT_WINDOW_RESIZE: - lcl_updateImageList_nothrow( *m_pData ); - break; - } - - AnimatedImagesPeer_Base::ProcessWindowEvent( i_windowEvent ); - } - - //------------------------------------------------------------------------------------------------------------------ - void AnimatedImagesPeer::impl_updateImages_nolck( const Reference< XInterface >& i_animatedImages ) - { - SolarMutexGuard aGuard; - - lcl_updateImageList_nothrow( *m_pData, Reference< XAnimatedImages >( i_animatedImages, UNO_QUERY_THROW ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AnimatedImagesPeer::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException) - { - SolarMutexGuard aGuard; - Reference< XAnimatedImages > xAnimatedImages( i_event.Source, UNO_QUERY_THROW ); - - sal_Int32 nPosition(0); - OSL_VERIFY( i_event.Accessor >>= nPosition ); - size_t position = size_t( nPosition ); - if ( position > m_pData->aCachedImageSets.size() ) - { - OSL_ENSURE( false, "AnimatedImagesPeer::elementInserted: illegal accessor/index!" ); - lcl_updateImageList_nothrow( *m_pData, xAnimatedImages ); - } - - Sequence< ::rtl::OUString > aImageURLs; - OSL_VERIFY( i_event.Element >>= aImageURLs ); - ::std::vector< CachedImage > aImages; - lcl_init( aImageURLs, aImages ); - m_pData->aCachedImageSets.insert( m_pData->aCachedImageSets.begin() + position, aImages ); - lcl_updateImageList_nothrow( *m_pData ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AnimatedImagesPeer::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException) - { - SolarMutexGuard aGuard; - Reference< XAnimatedImages > xAnimatedImages( i_event.Source, UNO_QUERY_THROW ); - - sal_Int32 nPosition(0); - OSL_VERIFY( i_event.Accessor >>= nPosition ); - size_t position = size_t( nPosition ); - if ( position >= m_pData->aCachedImageSets.size() ) - { - OSL_ENSURE( false, "AnimatedImagesPeer::elementRemoved: illegal accessor/index!" ); - lcl_updateImageList_nothrow( *m_pData, xAnimatedImages ); - } - - m_pData->aCachedImageSets.erase( m_pData->aCachedImageSets.begin() + position ); - lcl_updateImageList_nothrow( *m_pData ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AnimatedImagesPeer::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException) - { - SolarMutexGuard aGuard; - Reference< XAnimatedImages > xAnimatedImages( i_event.Source, UNO_QUERY_THROW ); - - sal_Int32 nPosition(0); - OSL_VERIFY( i_event.Accessor >>= nPosition ); - size_t position = size_t( nPosition ); - if ( position >= m_pData->aCachedImageSets.size() ) - { - OSL_ENSURE( false, "AnimatedImagesPeer::elementReplaced: illegal accessor/index!" ); - lcl_updateImageList_nothrow( *m_pData, xAnimatedImages ); - } - - Sequence< ::rtl::OUString > aImageURLs; - OSL_VERIFY( i_event.Element >>= aImageURLs ); - ::std::vector< CachedImage > aImages; - lcl_init( aImageURLs, aImages ); - m_pData->aCachedImageSets[ position ] = aImages; - lcl_updateImageList_nothrow( *m_pData ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AnimatedImagesPeer::disposing( const EventObject& i_event ) throw (RuntimeException) - { - VCLXWindow::disposing( i_event ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AnimatedImagesPeer::modified( const EventObject& i_event ) throw (RuntimeException) - { - impl_updateImages_nolck( i_event.Source ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AnimatedImagesPeer::dispose( ) throw(RuntimeException) - { - AnimatedImagesPeer_Base::dispose(); - SolarMutexGuard aGuard; - m_pData->aCachedImageSets.resize(0); - } - -//...................................................................................................................... -} // namespace toolkit -//...................................................................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/asynccallback.cxx b/toolkit/source/awt/asynccallback.cxx deleted file mode 100644 index 1896b1e85f..0000000000 --- a/toolkit/source/awt/asynccallback.cxx +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - -#include "vcl/svapp.hxx" -#include "osl/mutex.hxx" -#include "sal/config.h" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implementationentry.hxx" -#include "cppuhelper/implbase2.hxx" -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/awt/XRequestCallback.hpp" - - -// component helper namespace -namespace comp_AsyncCallback { - -namespace css = ::com::sun::star; - -// component and service helper functions: -::rtl::OUString SAL_CALL _getImplementationName(); -css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames(); -css::uno::Reference< css::uno::XInterface > SAL_CALL _create( css::uno::Reference< css::uno::XComponentContext > const & context ); - -} // closing component helper namespace - - - -/// anonymous implementation namespace -namespace { - -namespace css = ::com::sun::star; - -class AsyncCallback: - public ::cppu::WeakImplHelper2< - css::lang::XServiceInfo, - css::awt::XRequestCallback> -{ -public: - explicit AsyncCallback(css::uno::Reference< css::uno::XComponentContext > const & context); - - // ::com::sun::star::lang::XServiceInfo: - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString & ServiceName) throw (css::uno::RuntimeException); - virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException); - - // ::com::sun::star::awt::XRequestCallback: - virtual void SAL_CALL addCallback(const css::uno::Reference< css::awt::XCallback > & xCallback, const ::com::sun::star::uno::Any & aData) throw (css::uno::RuntimeException); - -private: - - struct CallbackData - { - CallbackData( const css::uno::Reference< css::awt::XCallback >& rCallback, const css::uno::Any& rAny ) : - xCallback( rCallback ), aData( rAny ) {} - - css::uno::Reference< css::awt::XCallback > xCallback; - css::uno::Any aData; - }; - - DECL_STATIC_LINK( AsyncCallback, Notify_Impl, CallbackData* ); - - AsyncCallback(AsyncCallback &); // not defined - void operator =(AsyncCallback &); // not defined - - virtual ~AsyncCallback() {} - - css::uno::Reference< css::uno::XComponentContext > m_xContext; -}; - -AsyncCallback::AsyncCallback(css::uno::Reference< css::uno::XComponentContext > const & context) : - m_xContext(context) -{} - -// com.sun.star.uno.XServiceInfo: -::rtl::OUString SAL_CALL AsyncCallback::getImplementationName() throw (css::uno::RuntimeException) -{ - return comp_AsyncCallback::_getImplementationName(); -} - -::sal_Bool SAL_CALL AsyncCallback::supportsService(::rtl::OUString const & serviceName) throw (css::uno::RuntimeException) -{ - const css::uno::Sequence< ::rtl::OUString > serviceNames = comp_AsyncCallback::_getSupportedServiceNames(); - for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i) { - if (serviceNames[i] == serviceName) - return sal_True; - } - return sal_False; -} - -css::uno::Sequence< ::rtl::OUString > SAL_CALL AsyncCallback::getSupportedServiceNames() throw (css::uno::RuntimeException) -{ - return comp_AsyncCallback::_getSupportedServiceNames(); -} - -// ::com::sun::star::awt::XRequestCallback: -void SAL_CALL AsyncCallback::addCallback(const css::uno::Reference< css::awt::XCallback > & xCallback, const ::com::sun::star::uno::Any & aData) throw (css::uno::RuntimeException) -{ - if ( Application::IsInMain() ) - { - SolarMutexGuard aSolarGuard; - - CallbackData* pCallbackData = new CallbackData( xCallback, aData ); - Application::PostUserEvent( STATIC_LINK( this, AsyncCallback, Notify_Impl ), pCallbackData ); - } -} - -// private asynchronous link to call reference to the callback object -IMPL_STATIC_LINK_NOINSTANCE( AsyncCallback, Notify_Impl, CallbackData*, pCallbackData ) -{ - try - { - // Asynchronous execution - // Check pointer and reference before! - if ( pCallbackData && pCallbackData->xCallback.is() ) - pCallbackData->xCallback->notify( pCallbackData->aData ); - } - catch ( css::uno::Exception& ) - { - } - - delete pCallbackData; - return 0; -} - -} // closing anonymous implementation namespace - - - -// component helper namespace -namespace comp_AsyncCallback { - -::rtl::OUString SAL_CALL _getImplementationName() { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.awt.comp.AsyncCallback")); -} - -css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames() -{ - css::uno::Sequence< ::rtl::OUString > s(1); - s[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.awt.AsyncCallback")); - return s; -} - -css::uno::Reference< css::uno::XInterface > SAL_CALL _create( - const css::uno::Reference< css::uno::XComponentContext > & context) - SAL_THROW((css::uno::Exception)) -{ - return static_cast< ::cppu::OWeakObject * >(new AsyncCallback(context)); -} - -} // closing component helper namespace - -static ::cppu::ImplementationEntry const entries[] = { - { &comp_AsyncCallback::_create, - &comp_AsyncCallback::_getImplementationName, - &comp_AsyncCallback::_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } -}; - -void * SAL_CALL comp_AsyncCallback_component_getFactory( - const char * implName, void * serviceManager, void * registryKey) -{ - return ::cppu::component_getFactoryHelper( - implName, serviceManager, registryKey, entries); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/forward.hxx b/toolkit/source/awt/forward.hxx deleted file mode 100644 index 839e948fef..0000000000 --- a/toolkit/source/awt/forward.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef AWT_FORWARD_HXX -#define AWT_FORWARD_HXX - -#include <comphelper/uno3.hxx> - -#define IMPLEMENT_FORWARD_XTYPEPROVIDER1( classname, baseclass ) \ - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL classname::getTypes( ) throw (::com::sun::star::uno::RuntimeException) \ - { return baseclass::getTypes(); } \ - IMPLEMENT_GET_IMPLEMENTATION_ID( classname ) - -#define IMPLEMENT_2_FORWARD_XINTERFACE1( classname, refcountbase1, refcountbase2 ) \ - void SAL_CALL classname::acquire() throw() { refcountbase1::acquire(); refcountbase2::acquire(); } \ - void SAL_CALL classname::release() throw() { refcountbase1::release(); refcountbase2::release(); } \ - ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \ - { \ - ::com::sun::star::uno::Any aReturn = refcountbase1::queryInterface( _rType ); \ - if ( !aReturn.hasValue() ) \ - { \ - aReturn = refcountbase2::queryInterface( _rType ); \ - } \ - return aReturn; \ - } - -#define IMPLEMENT_2_FORWARD_XINTERFACE2( classname, refcountbase1, refcountbase2, baseclass3 ) \ - void SAL_CALL classname::acquire() throw() { refcountbase1::acquire(); refcountbase2::acquire(); } \ - void SAL_CALL classname::release() throw() { refcountbase1::release(); refcountbase2::release(); } \ - ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \ - { \ - ::com::sun::star::uno::Any aReturn = refcountbase1::queryInterface( _rType ); \ - if ( !aReturn.hasValue() ) \ - { \ - aReturn = refcountbase2::queryInterface( _rType ); \ - if ( !aReturn.hasValue() ) \ - aReturn = baseclass3::queryInterface( _rType ); \ - } \ - return aReturn; \ - } - -#if defined (_MSC_VER) && (_MSC_VER <= 1310) -// Windows .Net2003 build fix -#define W3K_EXPLICIT_CAST(x) static_cast <XWindow2*> (&x) -#else // !(defined (_MSC_VER) && (_MSC_VER <= 1310)) -#define W3K_EXPLICIT_CAST(x) x -#endif // !(defined (_MSC_VER) && (_MSC_VER <= 1310)) - -#endif /* AWT_FORWARD_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/non-interactable-containers.xml b/toolkit/source/awt/non-interactable-containers.xml deleted file mode 100644 index 0ffdb7e9d5..0000000000 --- a/toolkit/source/awt/non-interactable-containers.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<dialog xmlns="http://openoffice.org/2007/layout" - xmlns:cnt="http://openoffice.org/2007/layout/container" - title="Interactable Containers" optimumsize="true" - border="true" sizeable="true" moveable="true"> - <hbox> - <table columns="3" cnt:title="Page 1"> - <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" /> - <pushbutton cnt:y-expand="false" label="1,2" /> - <pushbutton cnt:y-expand="false" label="1,3" /> - <pushbutton cnt:col-span="2" label="2,1" /> - </table> - </hbox> -</dialog> diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx deleted file mode 100644 index 9e7494779f..0000000000 --- a/toolkit/source/awt/stylesettings.cxx +++ /dev/null @@ -1,987 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_toolkit.hxx" - -#include "stylesettings.hxx" -#include <toolkit/awt/vclxwindow.hxx> -#include <toolkit/helper/vclunohelper.hxx> - -/** === begin UNO includes === **/ -#include <com/sun/star/lang/DisposedException.hpp> -/** === end UNO includes === **/ - -#include <cppuhelper/interfacecontainer.hxx> -#include <osl/mutex.hxx> -#include <vcl/window.hxx> -#include <vcl/settings.hxx> -#include <vcl/svapp.hxx> - -//...................................................................................................................... -namespace toolkit -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::lang::EventObject; - using ::com::sun::star::awt::FontDescriptor; - using ::com::sun::star::awt::XStyleChangeListener; - using ::com::sun::star::awt::FontDescriptor; - /** === end UNO using === **/ - - //================================================================================================================== - //= WindowStyleSettings_Data - //================================================================================================================== - struct WindowStyleSettings_Data - { - VCLXWindow* pOwningWindow; - ::cppu::OInterfaceContainerHelper aStyleChangeListeners; - - WindowStyleSettings_Data( ::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow ) - : pOwningWindow( &i_rOwningWindow ) - ,aStyleChangeListeners( i_rListenerMutex ) - { - } - - DECL_LINK( OnWindowEvent, const VclWindowEvent* ); - }; - - //------------------------------------------------------------------------------------------------------------------ - IMPL_LINK( WindowStyleSettings_Data, OnWindowEvent, const VclWindowEvent*, i_pEvent ) - { - if ( !i_pEvent || ( i_pEvent->GetId() != VCLEVENT_WINDOW_DATACHANGED ) ) - return 0L; - const DataChangedEvent* pDataChangedEvent = static_cast< const DataChangedEvent* >( i_pEvent->GetData() ); - if ( !pDataChangedEvent || ( pDataChangedEvent->GetType() != DATACHANGED_SETTINGS ) ) - return 0L; - if ( ( pDataChangedEvent->GetFlags() & SETTINGS_STYLE ) == 0 ) - return 0L; - - EventObject aEvent( *pOwningWindow ); - aStyleChangeListeners.notifyEach( &XStyleChangeListener::styleSettingsChanged, aEvent ); - return 1L; - } - - //================================================================================================================== - //= StyleMethodGuard - //================================================================================================================== - class StyleMethodGuard - { - public: - StyleMethodGuard( WindowStyleSettings_Data& i_rData ) - { - if ( i_rData.pOwningWindow == NULL ) - throw DisposedException(); - } - - ~StyleMethodGuard() - { - } - - private: - SolarMutexGuard m_aGuard; - }; - - //================================================================================================================== - //= WindowStyleSettings - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - WindowStyleSettings::WindowStyleSettings(::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow ) - :m_pData( new WindowStyleSettings_Data(i_rListenerMutex, i_rOwningWindow ) ) - { - Window* pWindow = i_rOwningWindow.GetWindow(); - if ( !pWindow ) - throw new RuntimeException(); - pWindow->AddEventListener( LINK( m_pData.get(), WindowStyleSettings_Data, OnWindowEvent ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - WindowStyleSettings::~WindowStyleSettings() - { - } - - //------------------------------------------------------------------------------------------------------------------ - void WindowStyleSettings::dispose() - { - StyleMethodGuard aGuard( *m_pData ); - - Window* pWindow = m_pData->pOwningWindow->GetWindow(); - OSL_ENSURE( pWindow, "WindowStyleSettings::dispose: window has been reset before we could revoke the listener!" ); - if ( pWindow ) - pWindow->RemoveEventListener( LINK( m_pData.get(), WindowStyleSettings_Data, OnWindowEvent ) ); - - EventObject aEvent( *this ); - m_pData->aStyleChangeListeners.disposeAndClear( aEvent ); - - m_pData->pOwningWindow = NULL; - } - - //------------------------------------------------------------------------------------------------------------------ - namespace - { - sal_Int32 lcl_getStyleColor( WindowStyleSettings_Data& i_rData, Color const & (StyleSettings::*i_pGetter)() const ) - { - const Window* pWindow = i_rData.pOwningWindow->GetWindow(); - const AllSettings aAllSettings = pWindow->GetSettings(); - const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - return (aStyleSettings.*i_pGetter)().GetColor(); - } - - void lcl_setStyleColor( WindowStyleSettings_Data& i_rData, void (StyleSettings::*i_pSetter)( Color const & ), const sal_Int32 i_nColor ) - { - Window* pWindow = i_rData.pOwningWindow->GetWindow(); - AllSettings aAllSettings = pWindow->GetSettings(); - StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - (aStyleSettings.*i_pSetter)( Color( i_nColor ) ); - aAllSettings.SetStyleSettings( aStyleSettings ); - pWindow->SetSettings( aAllSettings ); - } - - FontDescriptor lcl_getStyleFont( WindowStyleSettings_Data& i_rData, Font const & (StyleSettings::*i_pGetter)() const ) - { - const Window* pWindow = i_rData.pOwningWindow->GetWindow(); - const AllSettings aAllSettings = pWindow->GetSettings(); - const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - return VCLUnoHelper::CreateFontDescriptor( (aStyleSettings.*i_pGetter)() ); - } - - void lcl_setStyleFont( WindowStyleSettings_Data& i_rData, void (StyleSettings::*i_pSetter)( Font const &), - Font const & (StyleSettings::*i_pGetter)() const, const FontDescriptor& i_rFont ) - { - Window* pWindow = i_rData.pOwningWindow->GetWindow(); - AllSettings aAllSettings = pWindow->GetSettings(); - StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - const Font aNewFont = VCLUnoHelper::CreateFont( i_rFont, (aStyleSettings.*i_pGetter)() ); - (aStyleSettings.*i_pSetter)( aNewFont ); - aAllSettings.SetStyleSettings( aStyleSettings ); - pWindow->SetSettings( aAllSettings ); - } - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveBorderColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveBorderColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setActiveBorderColor( ::sal_Int32 _activebordercolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveBorderColor, _activebordercolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setActiveColor( ::sal_Int32 _activecolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveColor, _activecolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveTabColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveTabColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setActiveTabColor( ::sal_Int32 _activetabcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveTabColor, _activetabcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setActiveTextColor( ::sal_Int32 _activetextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveTextColor, _activetextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getButtonRolloverTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetButtonRolloverTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetButtonRolloverTextColor, _buttonrollovertextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getButtonTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetButtonTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setButtonTextColor( ::sal_Int32 _buttontextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetButtonTextColor, _buttontextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getCheckedColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetCheckedColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setCheckedColor( ::sal_Int32 _checkedcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetCheckedColor, _checkedcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getDarkShadowColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetDarkShadowColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setDarkShadowColor( ::sal_Int32 _darkshadowcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetDarkShadowColor, _darkshadowcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveBorderColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveBorderColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setDeactiveBorderColor( ::sal_Int32 _deactivebordercolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveBorderColor, _deactivebordercolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setDeactiveColor( ::sal_Int32 _deactivecolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveColor, _deactivecolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setDeactiveTextColor( ::sal_Int32 _deactivetextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveTextColor, _deactivetextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getDialogColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetDialogColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setDialogColor( ::sal_Int32 _dialogcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetDialogColor, _dialogcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getDialogTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetDialogTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setDialogTextColor( ::sal_Int32 _dialogtextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetDialogTextColor, _dialogtextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getDisableColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetDisableColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setDisableColor( ::sal_Int32 _disablecolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetDisableColor, _disablecolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getFaceColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetFaceColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setFaceColor( ::sal_Int32 _facecolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetFaceColor, _facecolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getFaceGradientColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - const Window* pWindow = m_pData->pOwningWindow->GetWindow(); - const AllSettings aAllSettings = pWindow->GetSettings(); - const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - return aStyleSettings.GetFaceGradientColor().GetColor(); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setFieldColor( ::sal_Int32 _fieldcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldColor, _fieldcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldRolloverTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldRolloverTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setFieldRolloverTextColor( ::sal_Int32 _fieldrollovertextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldRolloverTextColor, _fieldrollovertextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setFieldTextColor( ::sal_Int32 _fieldtextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldTextColor, _fieldtextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getGroupTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetGroupTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setGroupTextColor( ::sal_Int32 _grouptextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetGroupTextColor, _grouptextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getHelpColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetHelpColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setHelpColor( ::sal_Int32 _helpcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetHelpColor, _helpcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getHelpTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetHelpTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setHelpTextColor( ::sal_Int32 _helptextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetHelpTextColor, _helptextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getHighlightColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetHighlightColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setHighlightColor( ::sal_Int32 _highlightcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetHighlightColor, _highlightcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getHighlightTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetHighlightTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setHighlightTextColor( ::sal_Int32 _highlighttextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetHighlightTextColor, _highlighttextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getInactiveTabColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetInactiveTabColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setInactiveTabColor( ::sal_Int32 _inactivetabcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetInactiveTabColor, _inactivetabcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getInfoTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetInfoTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setInfoTextColor( ::sal_Int32 _infotextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetInfoTextColor, _infotextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getLabelTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetLabelTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setLabelTextColor( ::sal_Int32 _labeltextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetLabelTextColor, _labeltextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getLightColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetLightColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setLightColor( ::sal_Int32 _lightcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetLightColor, _lightcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBarColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBarColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setMenuBarColor( ::sal_Int32 _menubarcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBarColor, _menubarcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBarTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBarTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setMenuBarTextColor( ::sal_Int32 _menubartextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBarTextColor, _menubartextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBorderColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBorderColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setMenuBorderColor( ::sal_Int32 _menubordercolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBorderColor, _menubordercolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setMenuColor( ::sal_Int32 _menucolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuColor, _menucolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuHighlightColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuHighlightColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setMenuHighlightColor( ::sal_Int32 _menuhighlightcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuHighlightColor, _menuhighlightcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuHighlightTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuHighlightTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setMenuHighlightTextColor( ::sal_Int32 _menuhighlighttextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuHighlightTextColor, _menuhighlighttextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setMenuTextColor( ::sal_Int32 _menutextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuTextColor, _menutextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getMonoColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetMonoColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setMonoColor( ::sal_Int32 _monocolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetMonoColor, _monocolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getRadioCheckTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetRadioCheckTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setRadioCheckTextColor( ::sal_Int32 _radiochecktextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetRadioCheckTextColor, _radiochecktextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getSeparatorColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - const Window* pWindow = m_pData->pOwningWindow->GetWindow(); - const AllSettings aAllSettings = pWindow->GetSettings(); - const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - return aStyleSettings.GetSeparatorColor().GetColor(); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getShadowColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetShadowColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setShadowColor( ::sal_Int32 _shadowcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetShadowColor, _shadowcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getWindowColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetWindowColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setWindowColor( ::sal_Int32 _windowcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetWindowColor, _windowcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getWindowTextColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetWindowTextColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setWindowTextColor( ::sal_Int32 _windowtextcolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetWindowTextColor, _windowtextcolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int32 SAL_CALL WindowStyleSettings::getWorkspaceColor() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleColor( *m_pData, &StyleSettings::GetWorkspaceColor ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setWorkspaceColor( ::sal_Int32 _workspacecolor ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleColor( *m_pData, &StyleSettings::SetWorkspaceColor, _workspacecolor ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Bool SAL_CALL WindowStyleSettings::getHighContrastMode() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - const Window* pWindow = m_pData->pOwningWindow->GetWindow(); - const AllSettings aAllSettings = pWindow->GetSettings(); - const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - return aStyleSettings.GetHighContrastMode(); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setHighContrastMode( ::sal_Bool _highcontrastmode ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - Window* pWindow = m_pData->pOwningWindow->GetWindow(); - AllSettings aAllSettings = pWindow->GetSettings(); - StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - aStyleSettings.SetHighContrastMode( _highcontrastmode ); - aAllSettings.SetStyleSettings( aStyleSettings ); - pWindow->SetSettings( aAllSettings ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getApplicationFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetAppFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setApplicationFont( const FontDescriptor& _applicationfont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetAppFont, &StyleSettings::GetAppFont, _applicationfont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getHelpFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetHelpFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setHelpFont( const FontDescriptor& _helpfont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetHelpFont, &StyleSettings::GetHelpFont, _helpfont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getTitleFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetTitleFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setTitleFont( const FontDescriptor& _titlefont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetTitleFont, &StyleSettings::GetTitleFont, _titlefont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getFloatTitleFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetFloatTitleFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setFloatTitleFont( const FontDescriptor& _floattitlefont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetFloatTitleFont, &StyleSettings::GetFloatTitleFont, _floattitlefont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getMenuFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetMenuFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setMenuFont( const FontDescriptor& _menufont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetMenuFont, &StyleSettings::GetMenuFont, _menufont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getToolFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetToolFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setToolFont( const FontDescriptor& _toolfont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetToolFont, &StyleSettings::GetToolFont, _toolfont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getGroupFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetGroupFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setGroupFont( const FontDescriptor& _groupfont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetGroupFont, &StyleSettings::GetGroupFont, _groupfont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getLabelFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetLabelFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setLabelFont( const FontDescriptor& _labelfont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetLabelFont, &StyleSettings::GetLabelFont, _labelfont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getInfoFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetInfoFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setInfoFont( const FontDescriptor& _infofont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetInfoFont, &StyleSettings::GetInfoFont, _infofont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getRadioCheckFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetRadioCheckFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setRadioCheckFont( const FontDescriptor& _radiocheckfont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetRadioCheckFont, &StyleSettings::GetRadioCheckFont, _radiocheckfont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getPushButtonFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetPushButtonFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setPushButtonFont( const FontDescriptor& _pushbuttonfont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetPushButtonFont, &StyleSettings::GetPushButtonFont, _pushbuttonfont ); - } - - //------------------------------------------------------------------------------------------------------------------ - FontDescriptor SAL_CALL WindowStyleSettings::getFieldFont() throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - return lcl_getStyleFont( *m_pData, &StyleSettings::GetFieldFont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::setFieldFont( const FontDescriptor& _fieldfont ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - lcl_setStyleFont( *m_pData, &StyleSettings::SetFieldFont, &StyleSettings::GetFieldFont, _fieldfont ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::addStyleChangeListener( const Reference< XStyleChangeListener >& i_rListener ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - if ( i_rListener.is() ) - m_pData->aStyleChangeListeners.addInterface( i_rListener ); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL WindowStyleSettings::removeStyleChangeListener( const Reference< XStyleChangeListener >& i_rListener ) throw (RuntimeException) - { - StyleMethodGuard aGuard( *m_pData ); - if ( i_rListener.is() ) - m_pData->aStyleChangeListeners.removeInterface( i_rListener ); - } - -//...................................................................................................................... -} // namespace toolkit -//...................................................................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/stylesettings.hxx b/toolkit/source/awt/stylesettings.hxx deleted file mode 100644 index b79969f455..0000000000 --- a/toolkit/source/awt/stylesettings.hxx +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef TOOLKIT_STYLESETTINGS_HXX -#define TOOLKIT_STYLESETTINGS_HXX - -/** === begin UNO includes === **/ -#include <com/sun/star/awt/XStyleSettings.hpp> -/** === end UNO includes === **/ - -#include <cppuhelper/implbase1.hxx> - -#include <boost/scoped_ptr.hpp> - -namespace osl -{ - class Mutex; -} - -class VCLXWindow; - -//...................................................................................................................... -namespace toolkit -{ -//...................................................................................................................... - - //================================================================================================================== - //= WindowStyleSettings - //================================================================================================================== - struct WindowStyleSettings_Data; - typedef ::cppu::WeakImplHelper1 < ::com::sun::star::awt::XStyleSettings - > WindowStyleSettings_Base; - class WindowStyleSettings : public WindowStyleSettings_Base - { - public: - WindowStyleSettings( ::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow ); - ~WindowStyleSettings(); - - void dispose(); - - // XStyleSettings - virtual ::sal_Int32 SAL_CALL getActiveBorderColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setActiveBorderColor( ::sal_Int32 _activebordercolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getActiveColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setActiveColor( ::sal_Int32 _activecolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getActiveTabColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setActiveTabColor( ::sal_Int32 _activetabcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getActiveTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setActiveTextColor( ::sal_Int32 _activetextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getButtonRolloverTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getButtonTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setButtonTextColor( ::sal_Int32 _buttontextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getCheckedColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setCheckedColor( ::sal_Int32 _checkedcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getDarkShadowColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDarkShadowColor( ::sal_Int32 _darkshadowcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getDeactiveBorderColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDeactiveBorderColor( ::sal_Int32 _deactivebordercolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getDeactiveColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDeactiveColor( ::sal_Int32 _deactivecolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getDeactiveTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDeactiveTextColor( ::sal_Int32 _deactivetextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getDialogColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDialogColor( ::sal_Int32 _dialogcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getDialogTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDialogTextColor( ::sal_Int32 _dialogtextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getDisableColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDisableColor( ::sal_Int32 _disablecolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getFaceColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFaceColor( ::sal_Int32 _facecolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getFaceGradientColor() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getFieldColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFieldColor( ::sal_Int32 _fieldcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getFieldRolloverTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFieldRolloverTextColor( ::sal_Int32 _fieldrollovertextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getFieldTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFieldTextColor( ::sal_Int32 _fieldtextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getGroupTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setGroupTextColor( ::sal_Int32 _grouptextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getHelpColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHelpColor( ::sal_Int32 _helpcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getHelpTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHelpTextColor( ::sal_Int32 _helptextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getHighlightColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHighlightColor( ::sal_Int32 _highlightcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getHighlightTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHighlightTextColor( ::sal_Int32 _highlighttextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getInactiveTabColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setInactiveTabColor( ::sal_Int32 _inactivetabcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getInfoTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setInfoTextColor( ::sal_Int32 _infotextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getLabelTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setLabelTextColor( ::sal_Int32 _labeltextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getLightColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setLightColor( ::sal_Int32 _lightcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMenuBarColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMenuBarColor( ::sal_Int32 _menubarcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMenuBarTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMenuBarTextColor( ::sal_Int32 _menubartextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMenuBorderColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMenuBorderColor( ::sal_Int32 _menubordercolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMenuColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMenuColor( ::sal_Int32 _menucolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMenuHighlightColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMenuHighlightColor( ::sal_Int32 _menuhighlightcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMenuHighlightTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMenuHighlightTextColor( ::sal_Int32 _menuhighlighttextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMenuTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMenuTextColor( ::sal_Int32 _menutextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMonoColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMonoColor( ::sal_Int32 _monocolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getRadioCheckTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setRadioCheckTextColor( ::sal_Int32 _radiochecktextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getSeparatorColor() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getShadowColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setShadowColor( ::sal_Int32 _shadowcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getWindowColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setWindowColor( ::sal_Int32 _windowcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getWindowTextColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setWindowTextColor( ::sal_Int32 _windowtextcolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getWorkspaceColor() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setWorkspaceColor( ::sal_Int32 _workspacecolor ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL getHighContrastMode() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHighContrastMode( ::sal_Bool _highcontrastmode ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getApplicationFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setApplicationFont( const ::com::sun::star::awt::FontDescriptor& _applicationfont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getHelpFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHelpFont( const ::com::sun::star::awt::FontDescriptor& _helpfont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getTitleFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTitleFont( const ::com::sun::star::awt::FontDescriptor& _titlefont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getFloatTitleFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFloatTitleFont( const ::com::sun::star::awt::FontDescriptor& _floattitlefont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getMenuFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMenuFont( const ::com::sun::star::awt::FontDescriptor& _menufont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getToolFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setToolFont( const ::com::sun::star::awt::FontDescriptor& _toolfont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getGroupFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setGroupFont( const ::com::sun::star::awt::FontDescriptor& _groupfont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getLabelFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setLabelFont( const ::com::sun::star::awt::FontDescriptor& _labelfont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getInfoFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setInfoFont( const ::com::sun::star::awt::FontDescriptor& _infofont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getRadioCheckFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setRadioCheckFont( const ::com::sun::star::awt::FontDescriptor& _radiocheckfont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getPushButtonFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPushButtonFont( const ::com::sun::star::awt::FontDescriptor& _pushbuttonfont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getFieldFont() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFieldFont( const ::com::sun::star::awt::FontDescriptor& _fieldfont ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addStyleChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleChangeListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeStyleChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleChangeListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); - - private: - ::boost::scoped_ptr< WindowStyleSettings_Data > m_pData; - }; - -//...................................................................................................................... -} // namespace toolkit -//...................................................................................................................... - -#endif // TOOLKIT_STYLESETTINGS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx deleted file mode 100644 index 1dd8d3cf7c..0000000000 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ /dev/null @@ -1,926 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - - -#include <com/sun/star/accessibility/AccessibleRole.hpp> -#include <com/sun/star/accessibility/AccessibleStateType.hpp> -#include <com/sun/star/accessibility/AccessibleEventId.hpp> -#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> -#include <com/sun/star/accessibility/AccessibleRelationType.hpp> -#include <toolkit/awt/vclxaccessiblecomponent.hxx> -#include <toolkit/helper/externallock.hxx> -#include <toolkit/awt/vclxwindow.hxx> -#include <toolkit/helper/convert.hxx> -#include <toolkit/awt/vclxfont.hxx> -#include <vcl/dialog.hxx> -#include <vcl/window.hxx> -#include <tools/debug.hxx> -#include <unotools/accessiblestatesethelper.hxx> -#include <unotools/accessiblerelationsethelper.hxx> -#include <vcl/svapp.hxx> -#include <vcl/menu.hxx> - -#ifndef VCLEVENT_WINDOW_FRAMETITLECHANGED -#define VCLEVENT_WINDOW_FRAMETITLECHANGED 1018 // pData = XubString* = oldTitle -#endif - -using namespace ::com::sun::star; -using namespace ::comphelper; - - -DBG_NAME(VCLXAccessibleComponent) - - -// ---------------------------------------------------- -// class VCLXAccessibleComponent -// ---------------------------------------------------- -VCLXAccessibleComponent::VCLXAccessibleComponent( VCLXWindow* pVCLXindow ) - : AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ) - , OAccessibleImplementationAccess( ) -{ - DBG_CTOR( VCLXAccessibleComponent, 0 ); - mpVCLXindow = pVCLXindow; - mxWindow = pVCLXindow; - - m_pSolarLock = static_cast< VCLExternalSolarLock* >( getExternalLock( ) ); - - DBG_ASSERT( pVCLXindow->GetWindow(), "VCLXAccessibleComponent - no window!" ); - if ( pVCLXindow->GetWindow() ) - { - pVCLXindow->GetWindow()->AddEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); - pVCLXindow->GetWindow()->AddChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) ); - } - - // announce the XAccessible of our creator to the base class - lateInit( pVCLXindow ); -} - -VCLXAccessibleComponent::~VCLXAccessibleComponent() -{ - DBG_DTOR( VCLXAccessibleComponent, 0 ); - - ensureDisposed(); - - if ( mpVCLXindow && mpVCLXindow->GetWindow() ) - { - mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); - mpVCLXindow->GetWindow()->RemoveChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) ); - } - - delete m_pSolarLock; - m_pSolarLock = NULL; - // This is not completely safe. If we assume that the base class dtor calls some method which - // uses this lock, the we crash. However, as the base class' dtor does not have a chance to call _out_ - // virtual methods, this is no problem as long as the base class is safe, i.e. does not use the external - // lock from within it's dtor. At the moment, we _know_ the base class is safe in this respect, so - // let's assume it keeps this way. - // @see OAccessibleContextHelper::OAccessibleContextHelper( IMutex* ) -} - -IMPLEMENT_FORWARD_XINTERFACE3( VCLXAccessibleComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleImplementationAccess, VCLXAccessibleComponent_BASE ) -IMPLEMENT_FORWARD_XTYPEPROVIDER3( VCLXAccessibleComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleImplementationAccess, VCLXAccessibleComponent_BASE ) - -::rtl::OUString VCLXAccessibleComponent::getImplementationName() throw (uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleWindow")); -} - -sal_Bool VCLXAccessibleComponent::supportsService( const ::rtl::OUString& rServiceName ) throw (uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; -} - -uno::Sequence< ::rtl::OUString > VCLXAccessibleComponent::getSupportedServiceNames() throw (uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleWindow")); - return aNames; -} - -IMPL_LINK( VCLXAccessibleComponent, WindowEventListener, VclSimpleEvent*, pEvent ) -{ - DBG_CHKTHIS(VCLXAccessibleComponent,0); - - DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" ); - - /* Ignore VCLEVENT_WINDOW_ENDPOPUPMODE, because the UNO accessibility wrapper - * might have been destroyed by the previous VCLEventListener (if no AT tool - * is running), e.g. sub-toolbars in impress. - */ - if ( pEvent && pEvent->ISA( VclWindowEvent ) && mxWindow.is() /* #122218# */ && (pEvent->GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) ) - { - DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" ); - if( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) ) - { - ProcessWindowEvent( *(VclWindowEvent*)pEvent ); - } - } - return 0; -} - -IMPL_LINK( VCLXAccessibleComponent, WindowChildEventListener, VclSimpleEvent*, pEvent ) -{ - DBG_CHKTHIS(VCLXAccessibleComponent,0); - - DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" ); - if ( pEvent && pEvent->ISA( VclWindowEvent ) && mxWindow.is() /* #i68079# */ ) - { - DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" ); - if( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() ) - { - // #103087# to prevent an early release of the component - uno::Reference< accessibility::XAccessibleContext > xTmp = this; - - ProcessWindowChildEvent( *(VclWindowEvent*)pEvent ); - } - } - return 0; -} - -uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::GetChildAccessible( const VclWindowEvent& rVclWindowEvent ) -{ - // checks if the data in the window event is our direct child - // and returns its accessible - - // MT: Change this later, normaly a show/hide event shouldn't have the Window* in pData. - Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); - if( pChildWindow && GetWindow() == pChildWindow->GetAccessibleParentWindow() ) - return pChildWindow->GetAccessible( rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW ); - else - return uno::Reference< accessibility::XAccessible > (); -} - -void VCLXAccessibleComponent::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) -{ - uno::Any aOldValue, aNewValue; - uno::Reference< accessibility::XAccessible > xAcc; - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children - { - xAcc = GetChildAccessible( rVclWindowEvent ); - if( xAcc.is() ) - { - aNewValue <<= xAcc; - NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } - break; - case VCLEVENT_WINDOW_HIDE: // send destroy on hide for direct accessible children - { - xAcc = GetChildAccessible( rVclWindowEvent ); - if( xAcc.is() ) - { - aOldValue <<= xAcc; - NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } - break; - } -} - -void VCLXAccessibleComponent::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - uno::Any aOldValue, aNewValue; - - Window* pAccWindow = rVclWindowEvent.GetWindow(); - DBG_ASSERT( pAccWindow, "VCLXAccessibleComponent::ProcessWindowEvent - Window?" ); - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_OBJECT_DYING: - { - pAccWindow->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); - pAccWindow->RemoveChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) ); - mxWindow.clear(); - mpVCLXindow = NULL; - } - break; - // - // dont handle CHILDCREATED events here - // they are handled separately as child events, see ProcessWindowChildEvent above - // - /* - case VCLEVENT_WINDOW_CHILDCREATED: - { - Window* pWindow = (Window*) rVclWindowEvent.GetData(); - DBG_ASSERT( pWindow, "VCLEVENT_WINDOW_CHILDCREATED - Window=?" ); - aNewValue <<= pWindow->GetAccessible(); - NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - break; - */ - case VCLEVENT_WINDOW_CHILDDESTROYED: - { - Window* pWindow = (Window*) rVclWindowEvent.GetData(); - DBG_ASSERT( pWindow, "VCLEVENT_WINDOW_CHILDDESTROYED - Window=?" ); - if ( pWindow->GetAccessible( sal_False ).is() ) - { - aOldValue <<= pWindow->GetAccessible( sal_False ); - NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } - break; - - // - // show and hide will be handled as child events only and are - // responsible for sending create/destroy events, see ProcessWindowChildEvent above - // - /* - case VCLEVENT_WINDOW_SHOW: - { - aNewValue <<= accessibility::AccessibleStateType::VISIBLE; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - - aNewValue <<= accessibility::AccessibleStateType::SHOWING; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - - aNewValue.clear(); - aOldValue <<= accessibility::AccessibleStateType::INVALID; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_HIDE: - { - aOldValue <<= accessibility::AccessibleStateType::VISIBLE; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - - aOldValue <<= accessibility::AccessibleStateType::SHOWING; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - - aOldValue.clear(); - aNewValue <<= accessibility::AccessibleStateType::INVALID; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - */ - case VCLEVENT_WINDOW_ACTIVATE: - { - // avoid notification if a child frame is already active - // only one frame may be active at a given time - if ( !pAccWindow->HasActiveChildFrame() && - ( getAccessibleRole() == accessibility::AccessibleRole::FRAME || - getAccessibleRole() == accessibility::AccessibleRole::ALERT || - getAccessibleRole() == accessibility::AccessibleRole::DIALOG ) ) // #i18891# - { - aNewValue <<= accessibility::AccessibleStateType::ACTIVE; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - } - break; - case VCLEVENT_WINDOW_DEACTIVATE: - { - if ( getAccessibleRole() == accessibility::AccessibleRole::FRAME || - getAccessibleRole() == accessibility::AccessibleRole::ALERT || - getAccessibleRole() == accessibility::AccessibleRole::DIALOG ) // #i18891# - { - aOldValue <<= accessibility::AccessibleStateType::ACTIVE; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - } - break; - case VCLEVENT_WINDOW_GETFOCUS: - case VCLEVENT_CONTROL_GETFOCUS: - { - if( (pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_GETFOCUS) || - (!pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS) ) - { - // if multiple listeners were registered it is possible that the - // focus was changed during event processing (eg SfxTopWindow ) - // #106082# allow ChildPathFocus only for CompoundControls, for windows the focus must be in the window itself - if( (pAccWindow->IsCompoundControl() && pAccWindow->HasChildPathFocus()) || - (!pAccWindow->IsCompoundControl() && pAccWindow->HasFocus()) ) - { - aNewValue <<= accessibility::AccessibleStateType::FOCUSED; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - } - } - break; - case VCLEVENT_WINDOW_LOSEFOCUS: - case VCLEVENT_CONTROL_LOSEFOCUS: - { - if( (pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_LOSEFOCUS) || - (!pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_LOSEFOCUS) ) - { - aOldValue <<= accessibility::AccessibleStateType::FOCUSED; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - } - break; - case VCLEVENT_WINDOW_FRAMETITLECHANGED: - { - ::rtl::OUString aOldName( *((::rtl::OUString*) rVclWindowEvent.GetData()) ); - ::rtl::OUString aNewName( getAccessibleName() ); - aOldValue <<= aOldName; - aNewValue <<= aNewName; - NotifyAccessibleEvent( accessibility::AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_ENABLED: - { - aNewValue <<= accessibility::AccessibleStateType::ENABLED; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - aNewValue <<= accessibility::AccessibleStateType::SENSITIVE; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_DISABLED: - { - aOldValue <<= accessibility::AccessibleStateType::SENSITIVE; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - - aOldValue <<= accessibility::AccessibleStateType::ENABLED; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_MOVE: - case VCLEVENT_WINDOW_RESIZE: - { - NotifyAccessibleEvent( accessibility::AccessibleEventId::BOUNDRECT_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_MENUBARADDED: - { - MenuBar* pMenuBar = (MenuBar*) rVclWindowEvent.GetData(); - if ( pMenuBar ) - { - uno::Reference< accessibility::XAccessible > xChild( pMenuBar->GetAccessible() ); - if ( xChild.is() ) - { - aNewValue <<= xChild; - NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } - } - break; - case VCLEVENT_WINDOW_MENUBARREMOVED: - { - MenuBar* pMenuBar = (MenuBar*) rVclWindowEvent.GetData(); - if ( pMenuBar ) - { - uno::Reference< accessibility::XAccessible > xChild( pMenuBar->GetAccessible() ); - if ( xChild.is() ) - { - aOldValue <<= xChild; - NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } - } - break; - case VCLEVENT_WINDOW_MINIMIZE: - { - aNewValue <<= accessibility::AccessibleStateType::ICONIFIED; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_NORMALIZE: - { - aOldValue <<= accessibility::AccessibleStateType::ICONIFIED; - NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - default: - { - } - break; - } -} - -void VCLXAccessibleComponent::disposing() -{ - if ( mpVCLXindow && mpVCLXindow->GetWindow() ) - { - mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); - mpVCLXindow->GetWindow()->RemoveChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) ); - } - - AccessibleExtendedComponentHelper_BASE::disposing(); - - mxWindow.clear(); - mpVCLXindow = NULL; -} - -Window* VCLXAccessibleComponent::GetWindow() const -{ - return GetVCLXWindow() ? GetVCLXWindow()->GetWindow() : NULL; -} - -void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ) -{ - Window* pWindow = GetWindow(); - if ( pWindow ) - { - Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy(); - if ( pLabeledBy && pLabeledBy != pWindow ) - { - uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); - aSequence[0] = pLabeledBy->GetAccessible(); - rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) ); - } - - Window* pLabelFor = pWindow->GetAccessibleRelationLabelFor(); - if ( pLabelFor && pLabelFor != pWindow ) - { - uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); - aSequence[0] = pLabelFor->GetAccessible(); - rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABEL_FOR, aSequence ) ); - } - } -} - -void VCLXAccessibleComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - Window* pWindow = GetWindow(); - if ( pWindow ) - { - if ( pWindow->IsVisible() ) - { - rStateSet.AddState( accessibility::AccessibleStateType::VISIBLE ); - rStateSet.AddState( accessibility::AccessibleStateType::SHOWING ); - } - else - { - rStateSet.AddState( accessibility::AccessibleStateType::INVALID ); - } - - if ( pWindow->IsEnabled() ) - { - rStateSet.AddState( accessibility::AccessibleStateType::ENABLED ); - rStateSet.AddState( accessibility::AccessibleStateType::SENSITIVE ); - } - - if ( pWindow->HasChildPathFocus() && - ( getAccessibleRole() == accessibility::AccessibleRole::FRAME || - getAccessibleRole() == accessibility::AccessibleRole::ALERT || - getAccessibleRole() == accessibility::AccessibleRole::DIALOG ) ) // #i18891# - rStateSet.AddState( accessibility::AccessibleStateType::ACTIVE ); - - // #104290# MT: This way, a ComboBox doesn't get state FOCUSED. - // I also don't understand - // a) why WINDOW_FIRSTCHILD is used here (which btw is a border window in the case of a combo box) - // b) why HasFocus() is nout "enough" for a compound control - /* - Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD ); - if ( ( !pWindow->IsCompoundControl() && pWindow->HasFocus() ) || - ( pWindow->IsCompoundControl() && pChild && pChild->HasFocus() ) ) - rStateSet.AddState( accessibility::AccessibleStateType::FOCUSED ); - */ - if ( pWindow->HasFocus() || ( pWindow->IsCompoundControl() && pWindow->HasChildPathFocus() ) ) - rStateSet.AddState( accessibility::AccessibleStateType::FOCUSED ); - - if ( pWindow->IsWait() ) - rStateSet.AddState( accessibility::AccessibleStateType::BUSY ); - - if ( pWindow->GetStyle() & WB_SIZEABLE ) - rStateSet.AddState( accessibility::AccessibleStateType::RESIZABLE ); - - if( pWindow->IsDialog() ) - { - Dialog *pDlg = static_cast< Dialog* >( pWindow ); - if( pDlg->IsInExecute() ) - rStateSet.AddState( accessibility::AccessibleStateType::MODAL ); - } - } - else - { - rStateSet.AddState( accessibility::AccessibleStateType::DEFUNC ); - } - -/* - -MUST BE SET FROM DERIVED CLASSES: - -CHECKED -COLLAPSED -EXPANDED -EXPANDABLE -EDITABLE -FOCUSABLE -HORIZONTAL -VERTICAL -ICONIFIED -MULTILINE -MULTI_SELECTABLE -PRESSED -SELECTABLE -SELECTED -SINGLE_LINE -TRANSIENT - - */ -} - - -// accessibility::XAccessibleContext -sal_Int32 VCLXAccessibleComponent::getAccessibleChildCount() throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nChildren = 0; - if ( GetWindow() ) - nChildren = GetWindow()->GetAccessibleChildWindowCount(); - - return nChildren; -} - -uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleChild( sal_Int32 i ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i >= getAccessibleChildCount() ) - throw lang::IndexOutOfBoundsException(); - - uno::Reference< accessibility::XAccessible > xAcc; - if ( GetWindow() ) - { - Window* pChild = GetWindow()->GetAccessibleChildWindow( (sal_uInt16)i ); - if ( pChild ) - xAcc = pChild->GetAccessible(); - } - - return xAcc; -} - -uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getVclParent() const -{ - uno::Reference< accessibility::XAccessible > xAcc; - if ( GetWindow() ) - { - Window* pParent = GetWindow()->GetAccessibleParentWindow(); - if ( pParent ) - xAcc = pParent->GetAccessible(); - } - return xAcc; -} - -uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleParent( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - uno::Reference< accessibility::XAccessible > xAcc( implGetForeignControlledParent() ); - if ( !xAcc.is() ) - // we do _not_ have a foreign-controlled parent -> default to our VCL parent - xAcc = getVclParent(); - - return xAcc; -} - -sal_Int32 VCLXAccessibleComponent::getAccessibleIndexInParent( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndex = -1; - - uno::Reference< accessibility::XAccessible > xAcc( implGetForeignControlledParent() ); - if ( xAcc.is() ) - { // we _do_ have a foreign-controlled parent -> use the base class' implementation, - // which goes the UNO way - nIndex = AccessibleExtendedComponentHelper_BASE::getAccessibleIndexInParent( ); - } - else - { - if ( GetWindow() ) - { - Window* pParent = GetWindow()->GetAccessibleParentWindow(); - if ( pParent ) - { - /* - for ( sal_uInt16 n = pParent->GetAccessibleChildWindowCount(); n; ) - { - Window* pChild = pParent->GetAccessibleChildWindow( --n ); - if ( pChild == GetWindow() ) - { - nIndex = n; - break; - } - } - */ - // Iterate over all the parent's children and search for this object. - // this should be compatible with the code in SVX - uno::Reference< accessibility::XAccessible > xParentAcc( pParent->GetAccessible() ); - if ( xParentAcc.is() ) - { - uno::Reference< accessibility::XAccessibleContext > xParentContext ( xParentAcc->getAccessibleContext() ); - if ( xParentContext.is() ) - { - sal_Int32 nChildCount = xParentContext->getAccessibleChildCount(); - for ( sal_Int32 i=0; i<nChildCount; i++ ) - { - uno::Reference< accessibility::XAccessible > xChild( xParentContext->getAccessibleChild(i) ); - if ( xChild.is() ) - { - uno::Reference< accessibility::XAccessibleContext > xChildContext = xChild->getAccessibleContext(); - if ( xChildContext == (accessibility::XAccessibleContext*) this ) - { - nIndex = i; - break; - } - } - } - } - } - } - } - } - return nIndex; -} - -sal_Int16 VCLXAccessibleComponent::getAccessibleRole( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int16 nRole = 0; - - if ( GetWindow() ) - nRole = GetWindow()->GetAccessibleRole(); - - return nRole; -} - -::rtl::OUString VCLXAccessibleComponent::getAccessibleDescription( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString aDescription; - - if ( GetWindow() ) - aDescription = GetWindow()->GetAccessibleDescription(); - - return aDescription; -} - -::rtl::OUString VCLXAccessibleComponent::getAccessibleName( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString aName; - if ( GetWindow() ) - { - aName = GetWindow()->GetAccessibleName(); -#if OSL_DEBUG_LEVEL > 1 - aName += String( RTL_CONSTASCII_USTRINGPARAM( " (Type = " ) ); - aName += String::CreateFromInt32( GetWindow()->GetType() ); - aName += String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ); -#endif - } - return aName; -} - -uno::Reference< accessibility::XAccessibleRelationSet > VCLXAccessibleComponent::getAccessibleRelationSet( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper; - FillAccessibleRelationSet( *pRelationSetHelper ); - return xSet; -} - -uno::Reference< accessibility::XAccessibleStateSet > VCLXAccessibleComponent::getAccessibleStateSet( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - uno::Reference< accessibility::XAccessibleStateSet > xSet = pStateSetHelper; - FillAccessibleStateSet( *pStateSetHelper ); - return xSet; -} - -lang::Locale VCLXAccessibleComponent::getLocale() throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLocale(); -} - -uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleAtPoint( const awt::Point& rPoint ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - uno::Reference< accessibility::XAccessible > xChild; - for ( sal_uInt32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) - { - uno::Reference< accessibility::XAccessible > xAcc = getAccessibleChild( i ); - if ( xAcc.is() ) - { - uno::Reference< accessibility::XAccessibleComponent > xComp( xAcc->getAccessibleContext(), uno::UNO_QUERY ); - if ( xComp.is() ) - { - Rectangle aRect = VCLRectangle( xComp->getBounds() ); - Point aPos = VCLPoint( rPoint ); - if ( aRect.IsInside( aPos ) ) - { - xChild = xAcc; - break; - } - } - } - } - - return xChild; -} - -// accessibility::XAccessibleComponent -awt::Rectangle VCLXAccessibleComponent::implGetBounds() throw (uno::RuntimeException) -{ - awt::Rectangle aBounds ( 0, 0, 0, 0 ); - - Window* pWindow = GetWindow(); - if ( pWindow ) - { - Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL ); - aBounds = AWTRectangle( aRect ); - Window* pParent = pWindow->GetAccessibleParentWindow(); - if ( pParent ) - { - Rectangle aParentRect = pParent->GetWindowExtentsRelative( NULL ); - awt::Point aParentScreenLoc = AWTPoint( aParentRect.TopLeft() ); - aBounds.X -= aParentScreenLoc.X; - aBounds.Y -= aParentScreenLoc.Y; - } - } - - uno::Reference< accessibility::XAccessible > xParent( implGetForeignControlledParent() ); - if ( xParent.is() ) - { // hmm, we can't rely on our VCL coordinates, as in the Accessibility Hierarchy, somebody gave - // us a parent which is different from our VCL parent - // (actually, we did not check if it's really different ...) - - // the screen location of the foreign parent - uno::Reference< accessibility::XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), uno::UNO_QUERY ); - DBG_ASSERT( xParentComponent.is(), "VCLXAccessibleComponent::implGetBounds: invalid (foreign) parent component!" ); - - awt::Point aScreenLocForeign( 0, 0 ); - if ( xParentComponent.is() ) - aScreenLocForeign = xParentComponent->getLocationOnScreen(); - - // the screen location of the VCL parent - xParent = getVclParent(); - if ( xParent.is() ) - xParentComponent = xParentComponent.query( xParent->getAccessibleContext() ); - - awt::Point aScreenLocVCL( 0, 0 ); - if ( xParentComponent.is() ) - aScreenLocVCL = xParentComponent->getLocationOnScreen(); - - // the difference between them - awt::Size aOffset( aScreenLocVCL.X - aScreenLocForeign.X, aScreenLocVCL.Y - aScreenLocForeign.Y ); - // move the bounds - aBounds.X += aOffset.Width; - aBounds.Y += aOffset.Height; - } - - return aBounds; -} - -awt::Point VCLXAccessibleComponent::getLocationOnScreen( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - awt::Point aPos; - if ( GetWindow() ) - { - Rectangle aRect = GetWindow()->GetWindowExtentsRelative( NULL ); - aPos.X = aRect.Left(); - aPos.Y = aRect.Top(); - } - - return aPos; -} - -void VCLXAccessibleComponent::grabFocus( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - uno::Reference< accessibility::XAccessibleStateSet > xStates = getAccessibleStateSet(); - if ( mxWindow.is() && xStates.is() && xStates->contains( accessibility::AccessibleStateType::FOCUSABLE ) ) - mxWindow->setFocus(); -} - -sal_Int32 SAL_CALL VCLXAccessibleComponent::getForeground( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Window* pWindow = GetWindow(); - if ( pWindow ) - { - if ( pWindow->IsControlForeground() ) - nColor = pWindow->GetControlForeground().GetColor(); - else - { - Font aFont; - if ( pWindow->IsControlFont() ) - aFont = pWindow->GetControlFont(); - else - aFont = pWindow->GetFont(); - nColor = aFont.GetColor().GetColor(); - } - } - - return nColor; -} - -sal_Int32 SAL_CALL VCLXAccessibleComponent::getBackground( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Window* pWindow = GetWindow(); - if ( pWindow ) - { - if ( pWindow->IsControlBackground() ) - nColor = pWindow->GetControlBackground().GetColor(); - else - nColor = pWindow->GetBackground().GetColor().GetColor(); - } - - return nColor; -} - -// XAccessibleExtendedComponent - -uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - uno::Reference< awt::XFont > xFont; - Window* pWindow = GetWindow(); - if ( pWindow ) - { - uno::Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), uno::UNO_QUERY ); - if ( xDev.is() ) - { - Font aFont; - if ( pWindow->IsControlFont() ) - aFont = pWindow->GetControlFont(); - else - aFont = pWindow->GetFont(); - VCLXFont* pVCLXFont = new VCLXFont; - pVCLXFont->Init( *xDev.get(), aFont ); - xFont = pVCLXFont; - } - } - - return xFont; -} - -::rtl::OUString SAL_CALL VCLXAccessibleComponent::getTitledBorderText( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sRet; - if ( GetWindow() ) - sRet = GetWindow()->GetText(); - - return sRet; -} - -::rtl::OUString SAL_CALL VCLXAccessibleComponent::getToolTipText( ) throw (uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sRet; - if ( GetWindow() ) - sRet = GetWindow()->GetQuickHelpText(); - - return sRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxbitmap.cxx b/toolkit/source/awt/vclxbitmap.cxx deleted file mode 100644 index d3dd104aa6..0000000000 --- a/toolkit/source/awt/vclxbitmap.cxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - - -#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() ); -} - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxbutton.cxx b/toolkit/source/awt/vclxbutton.cxx deleted file mode 100644 index 0e5c41605c..0000000000 --- a/toolkit/source/awt/vclxbutton.cxx +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "vclxbutton.hxx" - -#include <layout/core/helper.hxx> -#include <com/sun/star/awt/ImagePosition.hpp> -#include <vcl/button.hxx> - -namespace css = com::sun::star; - -namespace layoutimpl -{ - -VCLXIconButton::VCLXIconButton( Window *p, rtl::OUString aDefaultLabel, char const *pGraphName ) - : VCLXButton() -{ - /* FIXME: before Window is set, setLabel, setProperty->setImage - * are silent no-ops. */ - p->SetComponentInterface( this ); - - setLabel( aDefaultLabel ); - setProperty( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Graphic")), - css::uno::Any( layoutimpl::loadGraphic( pGraphName ) ) ); - setProperty( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImagePosition")), - css::uno::Any( css::awt::ImagePosition::LeftCenter ) ); - setProperty( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Align")), - css::uno::Any( (sal_Int16) 1 /* magic - center */ ) ); -} - -// FIXME: l10n/i18n of Reset & Apply - -VCLXOKButton::VCLXOKButton( Window *p ) - : VCLXIconButton( p, Button::GetStandardText( BUTTON_OK ), - "cmd/sc_ok.png" ) -{ -} - -VCLXCancelButton::VCLXCancelButton( Window *p ) - : VCLXIconButton( p, Button::GetStandardText( BUTTON_CANCEL ), -// : VCLXIconButton( xButton, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("~Cancel ")), - "cmd/sc_cancel.png" ) -{ -} - -VCLXYesButton::VCLXYesButton( Window *p ) - : VCLXIconButton( p, Button::GetStandardText( BUTTON_YES ), - "cmd/sc_yes.png" ) -{ -} - -VCLXNoButton::VCLXNoButton( Window *p ) - : VCLXIconButton( p, Button::GetStandardText( BUTTON_NO ), - "cmd/sc_no.png" ) -{ -} - -VCLXRetryButton::VCLXRetryButton( Window *p ) - : VCLXIconButton( p, Button::GetStandardText( BUTTON_RETRY ), - "cmd/sc_retry.png" ) -{ -} - -VCLXIgnoreButton::VCLXIgnoreButton( Window *p ) - : VCLXIconButton( p, Button::GetStandardText( BUTTON_IGNORE ), - "cmd/sc_ignore.png" ) -{ -} - -VCLXResetButton::VCLXResetButton( Window *p ) - : VCLXIconButton( p, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("~Reset ")), - "cmd/sc_reset.png" ) -{ -} - -VCLXApplyButton::VCLXApplyButton( Window *p ) - : VCLXIconButton( p, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Apply")), - "cmd/sc_apply.png" ) -{ -} - -VCLXHelpButton::VCLXHelpButton( Window *p ) - : VCLXIconButton( p, Button::GetStandardText( BUTTON_HELP ), - "cmd/sc_help.png" ) -{ -} - -VCLXMoreButton::VCLXMoreButton( Window *p ) - : VCLXIconButton( p, Button::GetStandardText( BUTTON_MORE ), -// : VCLXIconButton( p, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("More ")), - "cmd/sc_more.png" ) -{ -} - -VCLXAdvancedButton::VCLXAdvancedButton( Window *p ) -// : VCLXIconButton( p, Button::GetStandardText( BUTTON_ADVANCED ), - : VCLXIconButton( p, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Advanced ")), - "cmd/sc_advanced.png" ) -{ -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxbutton.hxx b/toolkit/source/awt/vclxbutton.hxx deleted file mode 100644 index facdd0f44a..0000000000 --- a/toolkit/source/awt/vclxbutton.hxx +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_AWT_VCLXBUTTON_HXX -#define LAYOUT_AWT_VCLXBUTTON_HXX - -#include <toolkit/awt/vclxwindows.hxx> - -/* Replacements for broken toolkit/ impls. of ok, cancel, help button, etc. */ - -namespace layoutimpl -{ - -class VCLXIconButton : public VCLXButton -{ -public: - VCLXIconButton( Window* p, rtl::OUString aDefaultLabel, const char *pGraphName ); - void Show (); -}; - -class VCLXOKButton : public VCLXIconButton -{ -public: - VCLXOKButton( Window *p ); -}; - -class VCLXCancelButton : public VCLXIconButton -{ -public: - VCLXCancelButton( Window *p ); -}; - -class VCLXYesButton : public VCLXIconButton -{ -public: - VCLXYesButton( Window *p ); -}; - -class VCLXNoButton : public VCLXIconButton -{ -public: - VCLXNoButton( Window *p ); -}; - -class VCLXRetryButton : public VCLXIconButton -{ -public: - VCLXRetryButton( Window *p ); -}; - -class VCLXIgnoreButton : public VCLXIconButton -{ -public: - VCLXIgnoreButton( Window *p ); -}; - -class VCLXResetButton : public VCLXIconButton -{ -public: - VCLXResetButton( Window *p ); -}; - -class VCLXApplyButton : public VCLXIconButton -{ -public: - VCLXApplyButton( Window *p ); -}; - -class VCLXHelpButton : public VCLXIconButton -{ -public: - VCLXHelpButton( Window *p ); -}; - -// TODO. Reuse vcl/Morebutton, or make AdvancedButton reuse me? -class VCLXMoreButton : public VCLXIconButton -{ -public: - VCLXMoreButton( Window *p ); -}; - -class VCLXAdvancedButton : public VCLXIconButton -{ -public: - VCLXAdvancedButton( Window *p ); -}; - -} // namespace layoutimpl - -#endif // LAYOUT_AWT_VCLXBUTTON_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxcontainer.cxx b/toolkit/source/awt/vclxcontainer.cxx deleted file mode 100644 index 935ae1b3bf..0000000000 --- a/toolkit/source/awt/vclxcontainer.cxx +++ /dev/null @@ -1,238 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - - -#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/svapp.hxx> -#include <vcl/window.hxx> -#include <tools/debug.hxx> - -// ---------------------------------------------------- -// class VCLXContainer -// ---------------------------------------------------- - -void VCLXContainer::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - VCLXWindow::ImplGetPropertyIds( rIds ); -} - -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) -{ - SolarMutexGuard aGuard; - - GetContainerListeners().addInterface( rxListener ); -} - -void VCLXContainer::removeVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - // 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - sal_uInt32 nCount = Components.getLength(); - DBG_ASSERT( nCount == (sal_uInt32)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 = false; - 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) -{ - SolarMutexGuard aGuard; - - 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 nLastStyle = pBehindLast->GetStyle(); - nLastStyle |= WB_GROUP; - pBehindLast->SetStyle( nLastStyle ); - } - } - - if ( bNewPrevWin ) - pPrevWin = pWin; - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx deleted file mode 100644 index 661d2376b9..0000000000 --- a/toolkit/source/awt/vclxdevice.cxx +++ /dev/null @@ -1,363 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" -#include <com/sun/star/awt/DeviceCapability.hpp> - -#include <com/sun/star/util/MeasureUnit.hpp> - -#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() -{ - mpOutputDevice = NULL; - nFlags = 0; -} - -VCLXDevice::~VCLXDevice() -{ -// Was thought for #88347#, but didn't help, because the interface will not be released -// But would be a good idea anyway, check after 6.0, it's a little bit dangerous now -// if( mpOutputDevice && IsCreatedWithToolkit() ) -// { -// delete mpOutputDevice; -// } -} - -void VCLXDevice::DestroyOutputDevice() -{ - delete mpOutputDevice; - mpOutputDevice = NULL; -} - -void VCLXDevice::SetCreatedWithToolkit( sal_Bool bCreatedWithToolkit ) -{ - if ( bCreatedWithToolkit ) - nFlags |= FLAGS_CREATEDWITHTOOLKIT; - else - nFlags &= ~FLAGS_CREATEDWITHTOOLKIT; -} - -sal_Bool VCLXDevice::IsCreatedWithToolkit() const -{ - return ( nFlags & FLAGS_CREATEDWITHTOOLKIT ) != 0; -} - -// ::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 ), - SAL_STATIC_CAST( ::com::sun::star::awt::XUnitConversion*, 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 ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnitConversion>* ) 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) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor> aFonts; - if( mpOutputDevice ) - { - int 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 ( int 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) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - 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; -} - - -VCLXVirtualDevice::~VCLXVirtualDevice() -{ - SolarMutexGuard aGuard; - - DestroyOutputDevice(); -} - - -// ----------------------------------------------------------------------------- -// Interface implementation of ::com::sun::star::awt::XUnitConversion -// ----------------------------------------------------------------------------- - -::com::sun::star::awt::Point SAL_CALL VCLXDevice::convertPointToLogic( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - (void)aPoint; - SolarMutexGuard aGuard; - if (TargetUnit == com::sun::star::util::MeasureUnit::PERCENT ) - { - // percentage not allowed here - throw ::com::sun::star::lang::IllegalArgumentException(); - } - - ::com::sun::star::awt::Point aAWTPoint(0,0); - // X,Y - - if( mpOutputDevice ) - { - MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(TargetUnit)); - ::Point aVCLPoint = VCLUnoHelper::ConvertToVCLPoint(aPoint); - ::Point aDevPoint = mpOutputDevice->PixelToLogic(aVCLPoint, aMode ); - aAWTPoint = VCLUnoHelper::ConvertToAWTPoint(aDevPoint); - } - - return aAWTPoint; -} - - -::com::sun::star::awt::Point SAL_CALL VCLXDevice::convertPointToPixel( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - (void)aPoint; - SolarMutexGuard aGuard; - if (SourceUnit == com::sun::star::util::MeasureUnit::PERCENT || - SourceUnit == com::sun::star::util::MeasureUnit::PIXEL ) - { - // pixel or percentage not allowed here - throw ::com::sun::star::lang::IllegalArgumentException(); - } - - ::com::sun::star::awt::Point aAWTPoint(0,0); - - if( mpOutputDevice ) - { - MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(SourceUnit)); - ::Point aVCLPoint = VCLUnoHelper::ConvertToVCLPoint(aPoint); - ::Point aDevPoint = mpOutputDevice->LogicToPixel(aVCLPoint, aMode ); - aAWTPoint = VCLUnoHelper::ConvertToAWTPoint(aDevPoint); - } - - return aAWTPoint; -} - -::com::sun::star::awt::Size SAL_CALL VCLXDevice::convertSizeToLogic( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - (void)aSize; - SolarMutexGuard aGuard; - if (TargetUnit == com::sun::star::util::MeasureUnit::PERCENT) - { - // percentage not allowed here - throw ::com::sun::star::lang::IllegalArgumentException(); - } - - ::com::sun::star::awt::Size aAWTSize(0,0); - // Width, Height - - - if( mpOutputDevice ) - { - MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(TargetUnit)); - ::Size aVCLSize = VCLUnoHelper::ConvertToVCLSize(aSize); - ::Size aDevSz = mpOutputDevice->PixelToLogic(aVCLSize, aMode ); - aAWTSize = VCLUnoHelper::ConvertToAWTSize(aDevSz); - } - - return aAWTSize; -} - -::com::sun::star::awt::Size SAL_CALL VCLXDevice::convertSizeToPixel( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - (void)aSize; - SolarMutexGuard aGuard; - if (SourceUnit == com::sun::star::util::MeasureUnit::PERCENT || - SourceUnit == com::sun::star::util::MeasureUnit::PIXEL) - { - // pixel or percentage not allowed here - throw ::com::sun::star::lang::IllegalArgumentException(); - } - - ::com::sun::star::awt::Size aAWTSize(0,0); - // Width, Height - if( mpOutputDevice ) - { - MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(SourceUnit)); - ::Size aVCLSize = VCLUnoHelper::ConvertToVCLSize(aSize); - ::Size aDevSz = mpOutputDevice->LogicToPixel(aVCLSize, aMode ); - aAWTSize = VCLUnoHelper::ConvertToAWTSize(aDevSz); - } - - return aAWTSize; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx deleted file mode 100644 index 3d301e362b..0000000000 --- a/toolkit/source/awt/vclxdialog.cxx +++ /dev/null @@ -1,274 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <boost/ptr_container/ptr_vector.hpp> -#include "vclxdialog.hxx" - -#include <com/sun/star/awt/PosSize.hpp> -#include <com/sun/star/awt/SystemDependentXWindow.hpp> -#include <com/sun/star/lang/SystemDependent.hpp> - -#include <cppuhelper/typeprovider.hxx> - -#include <toolkit/awt/vclxmenu.hxx> -#include <toolkit/helper/macros.hxx> -#include <toolkit/helper/property.hxx> - -#ifdef QUARTZ -#include "premac.h" -#include <Cocoa/Cocoa.h> -#include "postmac.h" -#endif - -#include <vcl/dialog.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/svapp.hxx> -#include <vcl/sysdata.hxx> -#include <vcl/wrkwin.hxx> - -#include "forward.hxx" - -namespace layoutimpl -{ - -DBG_NAME( VCLXDialog ) - -VCLXDialog::VCLXDialog() - : VCLXWindow() - , VCLXTopWindow_Base( true ) - , VCLXDialog_Base() - , Bin() - , bRealized( false ) - , bResizeSafeguard( false ) -{ - DBG_CTOR( VCLXDialog, NULL ); - -/* mxLayoutUnit = uno::Reference< awt::XLayoutUnit >( new LayoutUnit() ); - assert(mxLayoutUnit.is());*/ -} - -VCLXDialog::~VCLXDialog() -{ - DBG_DTOR( VCLXDialog, NULL ); -} - -Window* VCLXDialog::GetWindowImpl() -{ - return VCLXWindow::GetWindow(); -} - -::cppu::OInterfaceContainerHelper& VCLXDialog::GetTopWindowListenersImpl() -{ - return GetTopWindowListeners(); -} - -IMPLEMENT_2_FORWARD_XINTERFACE2( VCLXDialog, VCLXWindow, Bin, VCLXDialog_Base ); - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXDialog, VCLXWindow, VCLXDialog_Base ); - -void SAL_CALL VCLXDialog::dispose() throw(::com::sun::star::uno::RuntimeException) -{ - { - SolarMutexGuard aGuard; - - ::com::sun::star::lang::EventObject aDisposeEvent; - aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this); -// maTabListeners.disposeAndClear( aDisposeEvent ); - } - - VCLXWindow::dispose(); -} - -void VCLXDialog::resizedCb() -{ - queueResize(); -} - -void SAL_CALL VCLXDialog::allocateArea( const css::awt::Rectangle &rArea ) - throw (css::uno::RuntimeException) -{ - ::com::sun::star::awt::Size reqSize = Bin::getMinimumSize(); - reqSize.Height = getHeightForWidth( rArea.Width ); - - if ( !bRealized ) - { - setPosSize( 0, 0, reqSize.Width, reqSize.Height, ::com::sun::star::awt::PosSize::SIZE ); - bRealized = true; - setVisible( true ); - } - else - { - ::com::sun::star::awt::Size curSize = getSize(); - if ( reqSize.Width > curSize.Width ) - setPosSize( 0, 0, reqSize.Width, 0, ::com::sun::star::awt::PosSize::WIDTH ); - if ( reqSize.Height > curSize.Height ) - setPosSize( 0, 0, 0, reqSize.Height, ::com::sun::star::awt::PosSize::HEIGHT ); - } - - ::com::sun::star::awt::Size size = getSize(); - maAllocation.Width = size.Width; - maAllocation.Height = size.Height; - - Bin::allocateArea( maAllocation ); -} - -void VCLXDialog::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) -{ - SolarMutexClearableGuard aGuard; - - switch ( _rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_RESIZE: - resizedCb(); - default: - aGuard.clear(); - VCLXWindow::ProcessWindowEvent( _rVclWindowEvent ); - break; - } -} - -void SAL_CALL VCLXDialog::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any &Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( GetWindow() ) - { -/* sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); - switch ( nPropertyId ) - { - default: -*/ - VCLXWindow::setProperty( PropertyName, Value ); -/* } -*/ - } -} - -::com::sun::star::uno::Any SAL_CALL VCLXDialog::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aReturn; - if ( GetWindow() ) - { -/* - sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); - switch ( nPropertyId ) - { - default: -*/ - aReturn = VCLXWindow::getProperty( PropertyName ); -/* - } -*/ - } - return aReturn; -} - -void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - pWindow->SetText( Title ); -} - -void VCLXDialog::setHelpId( const rtl::OUString& rId ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - pWindow->SetHelpId( rtl::OUStringToOString( rId, RTL_TEXTENCODING_UTF8 ) ); -} - -::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::rtl::OUString aTitle; - Window* pWindow = GetWindow(); - if ( pWindow ) - aTitle = pWindow->GetText(); - return aTitle; -} - -sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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(); - Window* pFrame = pDlg->GetWindow( WINDOW_FRAME ); - if ( pFrame != pDlg ) - pDlg->SetParent( pFrame ); - } - nRet = pDlg->Execute(); - if ( pOldParent ) - pDlg->SetParent( pOldParent ); - } - return nRet; -} - -void VCLXDialog::endDialog( sal_Int32 nResult ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( nResult == BUTTONID_HELP ) - { - // UGH: c&p button.cxx - ::Window* pFocusWin = Application::GetFocusWindow(); - if ( !pFocusWin ) - pFocusWin = GetWindow(); - - HelpEvent aEvt( pFocusWin->GetPointerPosPixel(), HELPMODE_CONTEXT ); - pFocusWin->RequestHelp( aEvt ); - return; - } - - Dialog* pDlg = (Dialog*) GetWindow(); - if ( pDlg ) - pDlg->EndDialog( nResult ); -} - -void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException) -{ - endDialog( 0 ); -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxdialog.hxx b/toolkit/source/awt/vclxdialog.hxx deleted file mode 100644 index 2bd99fd0b8..0000000000 --- a/toolkit/source/awt/vclxdialog.hxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_AWT_VCLXDIALOG_HXX -#define LAYOUT_AWT_VCLXDIALOG_HXX - -#include <com/sun/star/awt/XDialog2.hpp> -#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> -#include <com/sun/star/awt/XTopWindow.hpp> -#include <comphelper/uno3.hxx> -#include <layout/core/bin.hxx> -#include <toolkit/awt/vclxtopwindow.hxx> - -namespace layoutimpl -{ - -typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XDialog2 > VCLXDialog_Base; - -class TOOLKIT_DLLPUBLIC VCLXDialog : public VCLXWindow - , public VCLXTopWindow_Base - , public VCLXDialog_Base - , public Bin -{ -private: - bool bRealized, bResizeSafeguard; - css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit; - - VCLXDialog( const VCLXDialog& ); // never implemented - VCLXDialog& operator=( const VCLXDialog& ); // never implemented - -protected: - Window* GetWindowImpl(); - ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl(); - - ~VCLXDialog(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XComponent - void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); - - // VclWindowPeer - virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); - - // VCLXWindow - void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); - - // ::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); - - // ::com::sun::star::awt::XLayoutContainer - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) - throw (css::uno::RuntimeException); - - void resizedCb(); - - static void ImplGetPropertyIds( std::list< sal_uInt16 > &/*aIds*/ ) - { - } - virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); } - - -public: - VCLXDialog(); - - // ::com::sun::star::awt::XDialog2 - void SAL_CALL endDialog( sal_Int32 nResult ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setHelpId( const rtl::OUString& id ) throw(::com::sun::star::uno::RuntimeException); - -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_AWT_VCLXDIALOG_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxfixedline.cxx b/toolkit/source/awt/vclxfixedline.cxx deleted file mode 100644 index 495ccb8c2f..0000000000 --- a/toolkit/source/awt/vclxfixedline.cxx +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "vclxfixedline.hxx" - -#include <com/sun/star/awt/PosSize.hpp> -#include <toolkit/helper/property.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <tools/debug.hxx> -#include <vcl/fixed.hxx> -#include <vcl/svapp.hxx> - -#include "forward.hxx" - -namespace layoutimpl -{ - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star; - -DBG_NAME( VCLXFixedLine ) - -VCLXFixedLine::VCLXFixedLine() - : VCLXWindow() -{ - DBG_CTOR( VCLXFixedLine, NULL ); -} - -VCLXFixedLine::~VCLXFixedLine() -{ - DBG_DTOR( VCLXFixedLine, NULL ); -} - -IMPLEMENT_FORWARD_XTYPEPROVIDER1( VCLXFixedLine, VCLXWindow ); - -void SAL_CALL VCLXFixedLine::dispose() throw(RuntimeException) -{ - { - SolarMutexGuard aGuard; - - EventObject aDisposeEvent; - aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this); - } - - VCLXWindow::dispose(); -} - -::com::sun::star::awt::Size SAL_CALL VCLXFixedLine::getMinimumSize() - throw(::com::sun::star::uno::RuntimeException) -{ - return awt::Size( 8, 8 ); -} - -void VCLXFixedLine::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) -{ - SolarMutexGuard aGuard; - - VCLXWindow::ProcessWindowEvent( _rVclWindowEvent ); -} - -void SAL_CALL VCLXFixedLine::setProperty( const ::rtl::OUString& PropertyName, const Any &Value ) throw(RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( GetWindow() ) - { -/* - sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); - switch ( nPropertyId ) - { - default: -*/ - VCLXWindow::setProperty( PropertyName, Value ); -// } - } -} - -Any SAL_CALL VCLXFixedLine::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) -{ - SolarMutexGuard aGuard; - - Any aReturn; - if ( GetWindow() ) - { -/* - sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); - switch ( nPropertyId ) - { - default: -*/ - aReturn = VCLXWindow::getProperty( PropertyName ); - // } - } - return aReturn; -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxfixedline.hxx b/toolkit/source/awt/vclxfixedline.hxx deleted file mode 100644 index 740390b062..0000000000 --- a/toolkit/source/awt/vclxfixedline.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_AWT_VCLXFIXEDLINE_HXX -#define LAYOUT_AWT_VCLXFIXEDLINE_HXX - -#include <comphelper/uno3.hxx> -#include <toolkit/awt/vclxwindow.hxx> - -/* We just provide our own FixedLine, because default has no width... */ - -class FixedLine; - -namespace layoutimpl -{ - -class VCLXFixedLine :public VCLXWindow -{ -public: - VCLXFixedLine(); - -protected: - ~VCLXFixedLine(); - - // XInterface - // DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XComponent - void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() - throw(::com::sun::star::uno::RuntimeException); - - // VclWindowPeer - virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); - - // VCLXWindow - void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); - -private: - VCLXFixedLine( const VCLXFixedLine& ); // never implemented - VCLXFixedLine& operator=( const VCLXFixedLine& ); // never implemented -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_AWT_VCLXFIXEDLINE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx deleted file mode 100644 index 93ae629444..0000000000 --- a/toolkit/source/awt/vclxfont.cxx +++ /dev/null @@ -1,255 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - - -#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; -} - -sal_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 ? sal_True : sal_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::awt::XFont2*, 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::XFont2>* ) 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 = sal::static_int_cast< sal_Int16 >( - pOutDev->GetTextWidth( String(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 ( sal_uInt16 n = 0; n < nCount; n++ ) - { - aSeq.getArray()[n] = sal::static_int_cast< sal_Int16 >( - pOutDev->GetTextWidth( - String(static_cast< sal_Unicode >(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 ); - - sal_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 ( sal_uLong n = 0; n < nPairs; n++ ) - { - pChars1[n] = pData[n].nChar1; - pChars2[n] = pData[n].nChar2; - pKerns[n] = sal::static_int_cast< sal_Int16 >(pData[n].nKern); - } - - - delete[] pData; - } - pOutDev->SetFont( aOldFont ); - } -} - -// ::com::sun::star::awt::XFont2 -sal_Bool VCLXFont::hasGlyphs( const ::rtl::OUString& aText ) - throw(::com::sun::star::uno::RuntimeException) -{ - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice ); - if ( pOutDev ) - { - String aStr( aText ); - if ( pOutDev->HasGlyphs( maFont, aStr, 0, aStr.Len() ) == STRING_LEN ) - { - return sal_True; - } - } - - return sal_False; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx deleted file mode 100644 index 38923f227d..0000000000 --- a/toolkit/source/awt/vclxgraphics.cxx +++ /dev/null @@ -1,488 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - -#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() -{ - mpOutputDevice = NULL; - mpClipRegion = NULL; -} - -VCLXGraphics::~VCLXGraphics() -{ - VCLXGraphicsList_impl* pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : NULL; - if ( pLst ) - { - for( VCLXGraphicsList_impl::iterator it = pLst->begin(); it < pLst->end(); ++it ) - { - if( *it == this ) { - pLst->erase( it ); - break; - } - } - } - - 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 - VCLXGraphicsList_impl* pLst = mpOutputDevice->GetUnoGraphicsList(); - if ( !pLst ) - pLst = mpOutputDevice->CreateUnoGraphicsList(); - pLst->push_back( this ); -} - -void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags ) -{ - if(mpOutputDevice) - { - SolarMutexGuard aVclGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::awt::SimpleFontMetric aM; - if( mpOutputDevice ) - { - mpOutputDevice->SetFont( maFont ); - aM = VCLUnoHelper::CreateFontMetric( mpOutputDevice->GetFontMetric() ); - } - return aM; -} - -void VCLXGraphics::setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - maFont = VCLUnoHelper::CreateFont( rxFont ); -} - -void VCLXGraphics::selectFont( const ::com::sun::star::awt::FontDescriptor& rDescription ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - maFont = VCLUnoHelper::CreateFont( rDescription, Font() ); -} - -void VCLXGraphics::setTextColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - maTextColor = Color( (sal_uInt32)nColor ); -} - -void VCLXGraphics::setTextFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - maTextFillColor = Color( (sal_uInt32)nColor ); -} - -void VCLXGraphics::setLineColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - maLineColor = Color( (sal_uInt32)nColor ); -} - -void VCLXGraphics::setFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - maFillColor = Color( (sal_uInt32)nColor ); -} - -void VCLXGraphics::setRasterOp( ::com::sun::star::awt::RasterOperation eROP ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - meRasterOp = (RasterOp)eROP; -} - -void VCLXGraphics::setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - - if( mpOutputDevice ) - mpOutputDevice->Push(); -} - -void VCLXGraphics::pop( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - if( mpOutputDevice ) - { - InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS ); - sal_uInt16 nPolys = (sal_uInt16) DataX.getLength(); - PolyPolygon aPolyPoly( nPolys ); - for ( sal_uInt16 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - if( mpOutputDevice ) - { - InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS|INITOUTDEV_FONT ); - mpOutputDevice->DrawTextArray( Point( x, y ), rText, rLongs.getConstArray() ); - } -} - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx deleted file mode 100644 index 6806278be1..0000000000 --- a/toolkit/source/awt/vclxmenu.cxx +++ /dev/null @@ -1,1117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - - -#include <toolkit/awt/vclxmenu.hxx> -#include <toolkit/helper/macros.hxx> -#include <toolkit/helper/servicenames.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <toolkit/helper/convert.hxx> -#include <cppuhelper/typeprovider.hxx> -#include <rtl/memory.h> -#include <rtl/uuid.h> -#include <osl/mutex.hxx> - -#include <vcl/menu.hxx> -#include <vcl/keycod.hxx> -#include <vcl/image.hxx> -#include <vcl/mnemonic.hxx> -#include <vcl/svapp.hxx> - -#include <com/sun/star/awt/KeyModifier.hpp> - - -#ifdef DBG_UTIL - #define THROW_MENUITEM_NOT_FOUND( Func, nItemId ) \ - if ( MENU_ITEM_NOTFOUND == mpMenu->GetItemPos( nItemId ) ) \ - throw ::com::sun::star::container::NoSuchElementException( \ - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( Func ) ) \ - += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": There is no menu item with " ) ) \ - += ::rtl::OUString::valueOf( sal_Int32( nItemId ) ) \ - += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " as identifier" ) ), \ - *this \ - ); - #define THROW_MENUPOS_NOT_FOUND( Func, nPos ) \ - if ( MENU_ITEM_NOTFOUND == sal_uInt16( nPos ) ) \ - throw ::com::sun::star::container::NoSuchElementException( \ - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( Func ) ) \ - += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": There is no menu item at position " ) ) \ - += ::rtl::OUString::valueOf( sal_Int32( nPos ) ), \ - *this \ - ); -#else - #define THROW_MENUITEM_NOT_FOUND( Func, nItemId ) \ - if ( MENU_ITEM_NOTFOUND == mpMenu->GetItemPos( nItemId ) ) \ - throw ::com::sun::star::container::NoSuchElementException(); - #define THROW_MENUPOS_NOT_FOUND( Func, nPos ) \ - if ( MENU_ITEM_NOTFOUND == sal_uInt16( nPos ) ) \ - throw ::com::sun::star::container::NoSuchElementException(); -#endif - - -// ---------------------------------------------------- -// class VCLXMenu -// ---------------------------------------------------- - -DBG_NAME(VCLXMenu) - -VCLXMenu::VCLXMenu() : maMenuListeners( *this ) -{ - DBG_CTOR( VCLXMenu, 0 ); - mpMenu = NULL; -} - -VCLXMenu::VCLXMenu( Menu* pMenu ) : maMenuListeners( *this ) -{ - DBG_CTOR( VCLXMenu, 0 ); - mpMenu = pMenu; -} - -VCLXMenu::~VCLXMenu() -{ - DBG_DTOR( VCLXMenu, 0 ); - for ( size_t n = maPopupMenueRefs.size(); n; ) { - delete maPopupMenueRefs[ --n ]; - } - if ( mpMenu ) - { - mpMenu->RemoveEventListener( LINK( this, VCLXMenu, MenuEventListener ) ); - delete mpMenu; - } -} - -sal_Bool VCLXMenu::IsPopupMenu() const -{ - return (mpMenu && ! mpMenu->IsMenuBar()); -} - -void VCLXMenu::ImplCreateMenu( sal_Bool bPopup ) -{ - DBG_ASSERT( !mpMenu, "CreateMenu: Menu exists!" ); - - if ( bPopup ) - mpMenu = new PopupMenu; - else - mpMenu = new MenuBar; - - mpMenu->AddEventListener( LINK( this, VCLXMenu, MenuEventListener ) ); -} - -IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) -{ - DBG_ASSERT( pEvent && pEvent->ISA( VclMenuEvent ), "Unknown Event!" ); - if ( pEvent && pEvent->ISA( VclMenuEvent ) ) - { - DBG_ASSERT( ((VclMenuEvent*)pEvent)->GetMenu() && mpMenu, "Menu???" ); - - VclMenuEvent* pMenuEvent = (VclMenuEvent*)pEvent; - if ( pMenuEvent->GetMenu() == mpMenu ) // Also called for the root menu - { - switch ( pMenuEvent->GetId() ) - { - case VCLEVENT_MENU_SELECT: - { - if ( maMenuListeners.getLength() ) - { - ::com::sun::star::awt::MenuEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.select( aEvent ); - } - } - break; - case VCLEVENT_OBJECT_DYING: - { - mpMenu = NULL; - } - break; - case VCLEVENT_MENU_HIGHLIGHT: - { - if ( maMenuListeners.getLength() ) - { - ::com::sun::star::awt::MenuEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.highlight( aEvent ); - } - } - break; - case VCLEVENT_MENU_ACTIVATE: - { - if ( maMenuListeners.getLength() ) - { - ::com::sun::star::awt::MenuEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.activate( aEvent ); - } - } - break; - case VCLEVENT_MENU_DEACTIVATE: - { - if ( maMenuListeners.getLength() ) - { - ::com::sun::star::awt::MenuEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.deactivate( aEvent ); - } - } - break; - - // ignore accessibility events - case VCLEVENT_MENU_ENABLE: - case VCLEVENT_MENU_INSERTITEM: - case VCLEVENT_MENU_REMOVEITEM: - case VCLEVENT_MENU_SUBMENUACTIVATE: - case VCLEVENT_MENU_SUBMENUDEACTIVATE: - case VCLEVENT_MENU_SUBMENUCHANGED: - case VCLEVENT_MENU_DEHIGHLIGHT: - case VCLEVENT_MENU_DISABLE: - case VCLEVENT_MENU_ITEMTEXTCHANGED: - case VCLEVENT_MENU_ITEMCHECKED: - case VCLEVENT_MENU_ITEMUNCHECKED: - case VCLEVENT_MENU_SHOW: - case VCLEVENT_MENU_HIDE: - break; - - default: OSL_FAIL( "MenuEventListener - Unknown event!" ); - } - } - } - return 0; -} - - -//============================================================================= -//============================================================================= -//============================================================================= - - -// ::com::sun::star::lang::XServiceInfo -::rtl::OUString SAL_CALL VCLXMenu::getImplementationName( ) -throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); - const sal_Bool bIsPopupMenu = IsPopupMenu(); - aGuard.clear(); - - ::rtl::OUString implName( RTL_CONSTASCII_USTRINGPARAM( "stardiv.Toolkit." ) ); - if ( bIsPopupMenu ) - implName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VCLXPopupMenu" ) ); - else - implName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VCLXMenuBar" ) ); - - return implName; -} - - -::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL VCLXMenu::getSupportedServiceNames( ) -throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); - const sal_Bool bIsPopupMenu = IsPopupMenu(); - aGuard.clear(); - - ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( 1 ); - if ( bIsPopupMenu ) - aNames[ 0 ] = ::rtl::OUString::createFromAscii( szServiceName2_PopupMenu ); - else - aNames[ 0 ] = ::rtl::OUString::createFromAscii( szServiceName2_MenuBar ); - - return aNames; -} - - -::sal_Bool SAL_CALL VCLXMenu::supportsService( const ::rtl::OUString& rServiceName ) -throw (::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); - - if ( aServiceNames[ 0 ] == rServiceName ) - return sal_True; - - return sal_False; -} - - -// ::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) -{ - ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); - const sal_Bool bIsPopupMenu = IsPopupMenu(); - aGuard.clear(); - - ::com::sun::star::uno::Any aRet; - - if ( bIsPopupMenu ) - 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::XPopupMenu*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XPopupMenuExtended*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended*, (::com::sun::star::awt::XPopupMenuExtended*) this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended2*, (::com::sun::star::awt::XPopupMenuExtended*) this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) ); - else - 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::XMenuBarExtended*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended*, (::com::sun::star::awt::XMenuBarExtended*) this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended2*, (::com::sun::star::awt::XMenuBarExtended*) this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, 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 -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > VCLXMenu::getTypes() -throw(::com::sun::star::uno::RuntimeException) -{ - ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); - const sal_Bool bIsPopupMenu = IsPopupMenu(); - aGuard.clear(); - - static ::cppu::OTypeCollection* pCollectionMenuBar = NULL; - static ::cppu::OTypeCollection* pCollectionPopupMenu = NULL; - - if ( bIsPopupMenu ) - { - if( !pCollectionPopupMenu ) - { - ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pCollectionPopupMenu ) - { - static ::cppu::OTypeCollection collectionPopupMenu( - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenuExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended2>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) ); - pCollectionPopupMenu = &collectionPopupMenu; - } - } - - return (*pCollectionPopupMenu).getTypes(); - } - else - { - if( !pCollectionMenuBar ) - { - ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pCollectionMenuBar ) - { - static ::cppu::OTypeCollection collectionMenuBar( - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), - 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::XMenuBarExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended2>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) ); - pCollectionMenuBar = &collectionMenuBar; - } - } - return (*pCollectionMenuBar).getTypes(); - } -} - - -::com::sun::star::uno::Sequence< sal_Int8 > VCLXMenu::getImplementationId() -throw(::com::sun::star::uno::RuntimeException) -{ - ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); - const sal_Bool bIsPopupMenu = IsPopupMenu(); - aGuard.clear(); - - static ::cppu::OImplementationId* pIdMenuBar = NULL; - static ::cppu::OImplementationId* pIdPopupMenu = NULL; - - if ( bIsPopupMenu ) - { - if( !pIdPopupMenu ) - { - ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pIdPopupMenu ) - { - static ::cppu::OImplementationId idPopupMenu( sal_False ); - pIdPopupMenu = &idPopupMenu; - } - } - - return (*pIdPopupMenu).getImplementationId(); - } - else - { - if( !pIdMenuBar ) - { - ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pIdMenuBar ) - { - static ::cppu::OImplementationId idMenuBar( sal_False ); - pIdMenuBar = &idMenuBar; - } - } - - return (*pIdMenuBar).getImplementationId(); - } -} - - -//============================================================================= -//============================================================================= -//============================================================================= - - -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) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - mpMenu->InsertItem( nItemId, aText, (MenuItemBits)nItemStyle, nPos ); -} - -void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - sal_Int32 nItemCount = (sal_Int32)mpMenu->GetItemCount(); - if ( mpMenu && ( nCount > 0 ) && ( nPos >= 0 ) && ( nPos < nItemCount ) && ( nItemCount > 0 )) - { - sal_Int16 nP = sal::static_int_cast< sal_Int16 >( - Min( (int)(nPos+nCount), (int)nItemCount )); - while( nP-nPos > 0 ) - mpMenu->RemoveItem( --nP ); - } -} - -sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - return mpMenu ? mpMenu->GetItemCount() : 0; -} - -sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - return mpMenu ? mpMenu->GetItemId( nPos ) : 0; -} - -sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - return mpMenu ? mpMenu->GetItemPos( nId ) : 0; -} - -void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - mpMenu->EnableItem( nItemId, bEnable ); -} - -sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - return mpMenu ? mpMenu->IsItemEnabled( nItemId ) : sal_False; -} - -void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - mpMenu->SetItemText( nItemId, aText ); -} - -::rtl::OUString VCLXMenu::getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::rtl::OUString aItemText; - if ( mpMenu ) - aItemText = mpMenu->GetItemText( nItemId ); - return aItemText; -} - -void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& rxPopupMenu ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - VCLXMenu* pVCLMenu = VCLXMenu::GetImplementation( rxPopupMenu ); - DBG_ASSERT( pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu(), "setPopupMenu: Invalid Menu!" ); - - if ( mpMenu && 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.push_back( pNewRef ); - - 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) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > aRef; - Menu* pMenu = mpMenu ? mpMenu->GetPopupMenu( nItemId ) : NULL; - if ( pMenu ) - { - for ( size_t n = maPopupMenueRefs.size(); n; ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenueRefs[ --n ]; - Menu* pM = ((VCLXMenu*)pRef->get())->GetMenu(); - if ( pM == pMenu ) - { - aRef = *pRef; - break; - } - } - // it seems the popup menu is not insert into maPopupMenueRefs - // if the popup men is not created by stardiv.Toolkit.VCLXPopupMenu - if( !aRef.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pNewRef = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > ; - *pNewRef = new VCLXPopupMenu( (PopupMenu*)pMenu ); - aRef = *pNewRef; - } - } - return aRef; -} - -// ::com::sun::star::awt::XPopupMenu -void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - mpMenu->InsertSeparator( nPos ); -} - -void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - mpMenu->SetDefaultItem( nItemId ); -} - -sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - return mpMenu ? mpMenu->GetDefaultItem() : 0; -} - -void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - mpMenu->CheckItem( nItemId, bCheck ); -} - -sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - return mpMenu ? mpMenu->IsItemChecked( nItemId ) : sal_False; -} - -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) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - sal_Int16 nRet = 0; - if ( mpMenu && IsPopupMenu() ) - nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle(rArea), nFlags | POPUPMENU_NOMOUSEUPCLOSE ); - return nRet; -} - - -void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - mpMenu->SetItemCommand( nItemId, aCommand ); -} - -::rtl::OUString SAL_CALL VCLXMenu::getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::rtl::OUString aItemCommand; - if ( mpMenu ) - aItemCommand = mpMenu->GetItemCommand( nItemId ); - return aItemCommand; -} - -void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - mpMenu->SetHelpCommand( nItemId, aHelp ); -} - -::rtl::OUString SAL_CALL VCLXMenu::getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::rtl::OUString aHelpCommand; - if ( mpMenu ) - aHelpCommand = mpMenu->GetHelpCommand( nItemId ); - return aHelpCommand; -} - - -// ============================================================================ -// ============================================================================ -// ============================================================================ - - -// BEGIN ANONYMOUS NAMESPACE -namespace -{ - namespace css = ::com::sun::star; - - Image lcl_XGraphic2VCLImage( - const css::uno::Reference< css::graphic::XGraphic >& xGraphic, - sal_Bool bResize ) - { - Image aImage; - if ( !xGraphic.is() ) - return aImage; - - aImage = Image( xGraphic ); - const ::Size aCurSize = aImage.GetSizePixel(); - const sal_Int32 nCurWidth = aCurSize.Width(); - const sal_Int32 nCurHeight = aCurSize.Height(); - const sal_Int32 nIdeal( 16 ); - - if ( nCurWidth > 0 && nCurHeight > 0 ) - { - if ( bResize && ( nCurWidth > nIdeal || nCurHeight > nIdeal ) ) - { - sal_Int32 nIdealWidth = nCurWidth > nIdeal ? nIdeal : nCurWidth; - sal_Int32 nIdealHeight = nCurHeight > nIdeal ? nIdeal : nCurHeight; - - ::Size aNewSize( nIdealWidth, nIdealHeight ); - - sal_Bool bModified( sal_False ); - BitmapEx aBitmapEx = aImage.GetBitmapEx(); - bModified = aBitmapEx.Scale( aNewSize, BMP_SCALE_INTERPOLATE ); - - if ( bModified ) - aImage = Image( aBitmapEx ); - } - } - return aImage; - } - - /** - As svtools builds after toolkit, we can not include/use - svtools/inc/acceleratorexecute.hxx - So I just copy here svt::AcceleratorExecute::st_AWTKey2VCLKey - and svt::AcceleratorExecute::st_VCLKey2AWTKey - */ - css::awt::KeyEvent lcl_VCLKey2AWTKey(const KeyCode& aVCLKey) - { - css::awt::KeyEvent aAWTKey; - aAWTKey.Modifiers = 0; - aAWTKey.KeyCode = (sal_Int16)aVCLKey.GetCode(); - - if (aVCLKey.IsShift()) - aAWTKey.Modifiers |= css::awt::KeyModifier::SHIFT; - if (aVCLKey.IsMod1()) - aAWTKey.Modifiers |= css::awt::KeyModifier::MOD1; - if (aVCLKey.IsMod2()) - aAWTKey.Modifiers |= css::awt::KeyModifier::MOD2; - if (aVCLKey.IsMod3()) - aAWTKey.Modifiers |= css::awt::KeyModifier::MOD3; - - return aAWTKey; - } - - KeyCode lcl_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey) - { - sal_Bool bShift = ((aAWTKey.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT ); - sal_Bool bMod1 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 ); - sal_Bool bMod2 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 ); - sal_Bool bMod3 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD3 ) == css::awt::KeyModifier::MOD3 ); - sal_uInt16 nKey = (sal_uInt16)aAWTKey.KeyCode; - - return KeyCode(nKey, bShift, bMod1, bMod2, bMod3); - } - -} // END ANONYMOUS NAMESPACE - - -// ============================================================================ -// ============================================================================ -// ============================================================================ - - -// XMenuExtended2 Methods - -::sal_Bool SAL_CALL VCLXMenu::isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - return IsPopupMenu(); -} - -void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu ) - mpMenu->Clear(); -} - - -::com::sun::star::awt::MenuItemType SAL_CALL VCLXMenu::getItemType( ::sal_Int16 nItemPos ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::com::sun::star::awt::MenuItemType aMenuItemType = - ::com::sun::star::awt::MenuItemType_DONTKNOW; - if ( mpMenu ) - { - THROW_MENUPOS_NOT_FOUND( "VCLXMenu::getItemType()", nItemPos ) - aMenuItemType = ( (::com::sun::star::awt::MenuItemType) mpMenu->GetItemType( nItemPos ) ); - } - - return aMenuItemType; -} - -void SAL_CALL VCLXMenu::hideDisabledEntries( ::sal_Bool bHide ) -throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu ) - { - if ( bHide ) - mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() | MENU_FLAG_HIDEDISABLEDENTRIES ); - else - mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() & ~MENU_FLAG_HIDEDISABLEDENTRIES ); - } -} - - -// ============================================================================ -// ============================================================================ -// ============================================================================ - - -// XPopupMenuExtended Methods - -::sal_Bool SAL_CALL VCLXMenu::isInExecute( ) -throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - return ( (PopupMenu*) mpMenu )->IsInExecute(); - else - return sal_False; -} - - -void SAL_CALL VCLXMenu::endExecute() -throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - ( (PopupMenu*) mpMenu )->EndExecute(); -} - - -void SAL_CALL VCLXMenu::setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo ) -throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - { - if ( aMenuLogo.Graphic.is() ) - { - Image aImage = lcl_XGraphic2VCLImage( aMenuLogo.Graphic, sal_False ); - MenuLogo aVCLMenuLogo; - - aVCLMenuLogo.aBitmap = aImage.GetBitmapEx(); - aVCLMenuLogo.aStartColor = Color( (sal_uInt32)(aMenuLogo.StartColor) ); - aVCLMenuLogo.aEndColor = Color( (sal_uInt32)(aMenuLogo.EndColor) ); - - mpMenu->SetLogo( aVCLMenuLogo ); - } - else - mpMenu->SetLogo(); - } -} - - -::com::sun::star::awt::MenuLogo SAL_CALL VCLXMenu::getLogo( ) -throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::com::sun::star::awt::MenuLogo aAWTMenuLogo; - if ( mpMenu ) - { - if ( mpMenu->HasLogo() ) - { - MenuLogo aVCLMenuLogo = mpMenu->GetLogo(); - aAWTMenuLogo.Graphic = Image(aVCLMenuLogo.aBitmap).GetXGraphic(); - aAWTMenuLogo.StartColor = aVCLMenuLogo.aStartColor.GetColor(); - aAWTMenuLogo.EndColor = aVCLMenuLogo.aEndColor.GetColor(); - } - } - return aAWTMenuLogo; -} - - -void SAL_CALL VCLXMenu::enableAutoMnemonics( ::sal_Bool bEnable ) -throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu ) - { - if ( !bEnable ) - mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() | MENU_FLAG_NOAUTOMNEMONICS ); - else - mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() & ~MENU_FLAG_NOAUTOMNEMONICS ); - } -} - - -void SAL_CALL VCLXMenu::setAcceleratorKeyEvent( ::sal_Int16 nItemId, - const ::com::sun::star::awt::KeyEvent& aKeyEvent ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setAcceleratorKeyEvent()", nItemId ) - KeyCode aVCLKeyCode = lcl_AWTKey2VCLKey( aKeyEvent ); - mpMenu->SetAccelKey( nItemId, aVCLKeyCode ); - } -} - - -::com::sun::star::awt::KeyEvent SAL_CALL VCLXMenu::getAcceleratorKeyEvent( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::com::sun::star::awt::KeyEvent aKeyEvent; - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getAcceleratorKeyEvent()", nItemId ) - KeyCode nKeyCode = mpMenu->GetAccelKey( nItemId ); - aKeyEvent = lcl_VCLKey2AWTKey( nKeyCode ); - } - - return aKeyEvent; -} - - -void SAL_CALL VCLXMenu::setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sHelpText ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setHelpText()", nItemId ) - mpMenu->SetHelpText( nItemId, sHelpText ); - } -} - - -::rtl::OUString SAL_CALL VCLXMenu::getHelpText( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - rtl::OUString sHelpText; - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getHelpText()", nItemId ) - sHelpText = mpMenu->GetHelpText( nItemId ); - } - - return sHelpText; -} - - -void SAL_CALL VCLXMenu::setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sTipHelpText ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setTipHelpText()", nItemId ) - mpMenu->SetTipHelpText( nItemId, sTipHelpText ); - } -} - - -::rtl::OUString SAL_CALL VCLXMenu::getTipHelpText( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - rtl::OUString sTipHelpText; - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getTipHelpText()", nItemId ) - sTipHelpText = mpMenu->GetTipHelpText( nItemId ); - } - return sTipHelpText; -} - - -void SAL_CALL VCLXMenu::setItemImage( - ::sal_Int16 nItemId, - const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImage()", nItemId ) - Image aImage = lcl_XGraphic2VCLImage( xGraphic, bScale ); - mpMenu->SetItemImage( nItemId, aImage ); - } -} - - -::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL VCLXMenu::getItemImage( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > rxGraphic; - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getItemImage()", nItemId ) - Image aImage = mpMenu->GetItemImage( nItemId ); - if ( !!aImage ) - rxGraphic = aImage.GetXGraphic(); - } - return rxGraphic; -} - - -void SAL_CALL VCLXMenu::setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAngle ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImageAngle()", nItemId ) - mpMenu->SetItemImageAngle( nItemId, nAngle ); - } -} - - -::sal_Int32 SAL_CALL VCLXMenu::getItemImageAngle( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::sal_Int32 nItemImageAngle( 0 ); - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getItemImageAngle()", nItemId ) - nItemImageAngle = mpMenu->GetItemImageAngle( nItemId ); - } - return nItemImageAngle; -} - - -void SAL_CALL VCLXMenu::setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool bMirror ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImageMirrorMode()", nItemId ) - mpMenu->SetItemImageMirrorMode( nItemId, bMirror ); - } -} - - -::sal_Bool SAL_CALL VCLXMenu::isItemImageInMirrorMode( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - sal_Bool bMirrorMode( sal_False ); - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::isItemImageInMirrorMode()", nItemId ) - bMirrorMode = mpMenu->GetItemImageMirrorMode( nItemId ); - } - return bMirrorMode; -} - - -// ---------------------------------------------------- -// class VCLXMenuBar -// ---------------------------------------------------- - -DBG_NAME(VCLXMenuBar); - -VCLXMenuBar::VCLXMenuBar() -{ - DBG_CTOR( VCLXMenuBar, 0 ); - ImplCreateMenu( sal_False ); -} - -VCLXMenuBar::VCLXMenuBar( MenuBar* pMenuBar ) : VCLXMenu( (Menu *)pMenuBar ) -{ - DBG_CTOR( VCLXMenuBar, 0 ); -} - -// ---------------------------------------------------- -// class VCLXPopupMenu -// ---------------------------------------------------- - -DBG_NAME(VCLXPopupMenu); - -VCLXPopupMenu::VCLXPopupMenu() -{ - DBG_CTOR( VCLXPopupMenu, 0 ); - ImplCreateMenu( sal_True ); -} - -VCLXPopupMenu::VCLXPopupMenu( PopupMenu* pPopMenu ) : VCLXMenu( (Menu *)pPopMenu ) -{ - DBG_CTOR( VCLXPopupMenu, 0 ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxplugin.cxx b/toolkit/source/awt/vclxplugin.cxx deleted file mode 100644 index 5910923c4f..0000000000 --- a/toolkit/source/awt/vclxplugin.cxx +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "vclxplugin.hxx" - -#include <com/sun/star/awt/PosSize.hpp> -#include <toolkit/helper/convert.hxx> -#include <toolkit/helper/property.hxx> -#include <vcl/ctrl.hxx> -#include <vcl/svapp.hxx> - -#include "forward.hxx" - -namespace layoutimpl -{ - -using namespace ::com::sun::star; - -VCLXPlugin::VCLXPlugin( Window *p, WinBits b ) - : VCLXWindow() - , mpWindow( p ) - , mpPlugin( 0 ) - , mStyle( b ) -{ -} - -VCLXPlugin::~VCLXPlugin() -{ -} - -void SAL_CALL VCLXPlugin::dispose() throw(uno::RuntimeException) -{ - { - SolarMutexGuard aGuard; - - lang::EventObject aDisposeEvent; - aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this); - } - - VCLXWindow::dispose(); -} - -void VCLXPlugin::SetPlugin( ::Control *p ) -{ - mpPlugin = p; -} - -awt::Size SAL_CALL VCLXPlugin::getMinimumSize() - throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - if ( mpPlugin ) - return AWTSize( mpPlugin->GetSizePixel() ); - return awt::Size(); -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxplugin.hxx b/toolkit/source/awt/vclxplugin.hxx deleted file mode 100644 index a9bc24d40f..0000000000 --- a/toolkit/source/awt/vclxplugin.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_AWT_VCLXPLUGIN_HXX -#define LAYOUT_AWT_VCLXPLUGIN_HXX - -#include <toolkit/awt/vclxwindow.hxx> -#include <tools/wintypes.hxx> - -class Control; -namespace layoutimpl -{ - -namespace css = ::com::sun::star; - -class VCLXPlugin : public VCLXWindow -{ -public: - Window *mpWindow; - ::Control *mpPlugin; - WinBits mStyle; - - VCLXPlugin( Window *p, WinBits b ); - - void SetPlugin( ::Control *p ); - -protected: - ~VCLXPlugin(); - - // XComponent - void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() - throw(::com::sun::star::uno::RuntimeException); - -private: - VCLXPlugin( VCLXPlugin const & ); - VCLXPlugin& operator=( VCLXPlugin const & ); -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_AWT_VCLXPLUGIN_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxpointer.cxx b/toolkit/source/awt/vclxpointer.cxx deleted file mode 100644 index 7ab0d6d25f..0000000000 --- a/toolkit/source/awt/vclxpointer.cxx +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - - -#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(); -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx deleted file mode 100644 index 64569f0e76..0000000000 --- a/toolkit/source/awt/vclxprinter.cxx +++ /dev/null @@ -1,465 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - - -#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 <vcl/svapp.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::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pProperties ) - { - static ::com::sun::star::beans::Property aPropTable[] = - { - ::com::sun::star::beans::Property( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")), PROPERTY_Orientation, ::getCppuType((const sal_Int16*)0), 0 ), - ::com::sun::star::beans::Property( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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 ) ) -{ - SolarMutexGuard aSolarGuard; - - mnOrientation = 0; - mbHorizontal = sal_False; -} - -VCLXPrinterPropertySet::~VCLXPrinterPropertySet() -{ - SolarMutexGuard aSolarGuard; - mpPrinter.reset(); -} - -::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::MutexGuard 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::MutexGuard 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: - { - OSL_FAIL( "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::MutexGuard aGuard( Mutex ); - - switch( nHandle ) - { - case PROPERTY_Orientation: - { - rValue >>= mnOrientation; - } - break; - case PROPERTY_Horizontal: - { - rValue >>= mbHorizontal; - } - break; - default: - { - OSL_FAIL( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" ); - } - } -} - -void VCLXPrinterPropertySet::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const -{ - ::osl::MutexGuard aGuard( ((VCLXPrinterPropertySet*)this)->Mutex ); - - switch( nHandle ) - { - case PROPERTY_Orientation: - rValue <<= mnOrientation; - break; - case PROPERTY_Horizontal: - rValue <<= mbHorizontal; - break; - default: - { - OSL_FAIL( "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::MutexGuard 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::MutexGuard 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::MutexGuard aGuard( Mutex ); - - sal_Int32 nIndex = 0; - sal_uInt16 nPaperBin = sal::static_int_cast< sal_uInt16 >( - rFormDescription.getToken( 3, ';', nIndex ).toInt32()); - GetPrinter()->SetPaperBin( nPaperBin ); -} - -::com::sun::star::uno::Sequence< sal_Int8 > VCLXPrinterPropertySet::getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard 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::MutexGuard 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 ) ); - - if ( !aRet.hasValue() ) - aRet = VCLXPrinterPropertySet::queryInterface( rType ); - - return (aRet.hasValue() ? aRet : OWeakObject::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::MutexGuard aGuard( Mutex ); - - sal_Bool bDone = sal_True; - if ( mpListener.get() ) - { - maInitJobSetup = mpPrinter->GetJobSetup(); - mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) ); - } - - return bDone; -} - -void VCLXPrinter::end( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( Mutex ); - - if ( mpListener.get() ) - { - Printer::PrintJob( mpListener, maInitJobSetup ); - mpListener.reset(); - } -} - -void VCLXPrinter::terminate( ) throw(::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( Mutex ); - - mpListener.reset(); -} - -::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( Mutex ); - - if ( mpListener.get() ) - { - mpListener->StartPage(); - } - return GetDevice(); -} - -void VCLXPrinter::endPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( Mutex ); - - if ( mpListener.get() ) - { - mpListener->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 ) ); - - if ( !aRet.hasValue() ) - aRet = VCLXPrinterPropertySet::queryInterface( rType ); - - return (aRet.hasValue() ? aRet : OWeakObject::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::MutexGuard 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) -{ - const std::vector<rtl::OUString>& rQueues = Printer::GetPrinterQueues(); - sal_uInt32 nPrinters = rQueues.size(); - - ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( nPrinters ); - for ( sal_uInt32 n = 0; n < nPrinters; n++ ) - aNames.getArray()[n] = rQueues[n]; - - 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; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxregion.cxx b/toolkit/source/awt/vclxregion.cxx deleted file mode 100644 index 27f2feab0e..0000000000 --- a/toolkit/source/awt/vclxregion.cxx +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - - -#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() ); - - sal_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; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxscroller.cxx b/toolkit/source/awt/vclxscroller.cxx deleted file mode 100644 index 91af5999d5..0000000000 --- a/toolkit/source/awt/vclxscroller.cxx +++ /dev/null @@ -1,204 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "vclxscroller.hxx" - -#include <assert.h> -#include <com/sun/star/awt/PosSize.hpp> -#include <com/sun/star/awt/ScrollBarOrientation.hpp> -#include <sal/macros.h> -#include <toolkit/helper/property.hxx> -#include <tools/debug.hxx> -#include <vcl/scrbar.hxx> -#include <vcl/svapp.hxx> - -#include "forward.hxx" - -namespace layoutimpl -{ - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star; - -DBG_NAME( VCLXScroller ) - -VCLXScroller::VCLXScroller() - : VCLXWindow() - , Bin() -{ - DBG_CTOR( VCLXScroller, NULL ); - mpHorScrollBar = mpVerScrollBar = 0; -} - -VCLXScroller::~VCLXScroller() -{ - DBG_DTOR( VCLXScroller, NULL ); -} - -IMPLEMENT_2_FORWARD_XINTERFACE1( VCLXScroller, VCLXWindow, Container ); - -IMPLEMENT_FORWARD_XTYPEPROVIDER1( VCLXScroller, VCLXWindow ); - -void SAL_CALL VCLXScroller::dispose() throw(RuntimeException) -{ - { - SolarMutexGuard aGuard; - - EventObject aDisposeEvent; - aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this); -// maTabListeners.disposeAndClear( aDisposeEvent ); - } - - VCLXWindow::dispose(); -} - -void VCLXScroller::ensureScrollBars() -{ - - if ( !mpVerScrollBar ) - { - mpVerScrollBar = new ScrollBar( GetWindow() , WB_VERT ); - mpVerScrollBar->SetLineSize( 4 ); - mpVerScrollBar->SetPageSize( 15 ); - mpVerScrollBar->Show(); - mpVerScrollBar->SetScrollHdl( LINK( this, VCLXScroller, ScrollHdl ) ); - } - if ( !mpHorScrollBar ) - { - mpHorScrollBar = new ScrollBar( GetWindow() , WB_HORZ ); - mpHorScrollBar->SetLineSize( 4 ); - mpHorScrollBar->SetPageSize( 15 ); - mpHorScrollBar->Show(); - mpHorScrollBar->SetScrollHdl( LINK( this, VCLXScroller, ScrollHdl ) ); - } // mpContent = new FixedImage( this, ImplGetWinBits( WindowAttributes, 0 ) ); - -} - -void SAL_CALL VCLXScroller::allocateArea( - const ::com::sun::star::awt::Rectangle &rArea ) - throw (::com::sun::star::uno::RuntimeException) -{ - ensureScrollBars(); // shouldn't be needed - - maAllocation = rArea; - setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height, PosSize::POSSIZE ); - - mpHorScrollBar->SetRangeMin( 0 ); - mpHorScrollBar->SetRangeMax( SAL_MAX( maChildRequisition.Width - rArea.Width, 0 ) ); - mpVerScrollBar->SetRangeMin( 0 ); - mpVerScrollBar->SetRangeMax( SAL_MAX( maChildRequisition.Height - rArea.Height, 0 ) ); - - int thumbX = mpHorScrollBar->GetThumbPos(); - int thumbY = mpVerScrollBar->GetThumbPos(); - int thumbWidth = mpVerScrollBar->GetSizePixel().getWidth(); - int thumbHeight = mpHorScrollBar->GetSizePixel().getHeight(); - - mpHorScrollBar->SetPosSizePixel( rArea.X, rArea.Y + rArea.Height - thumbHeight - 2, - rArea.Width - thumbWidth, thumbHeight ); - mpVerScrollBar->SetPosSizePixel( rArea.X + rArea.Width - thumbWidth - 2, rArea.Y-2, - thumbWidth, rArea.Height - thumbHeight ); - - awt::Rectangle childRect( rArea.X - thumbX, rArea.Y - thumbY, - SAL_MAX( maChildRequisition.Width, rArea.Width ) - thumbWidth - 4, - SAL_MAX( maChildRequisition.Height, rArea.Height ) - thumbHeight - 4 ); - if ( mxChild.is() ) - allocateChildAt( mxChild, childRect ); -} - -#define MAX_CHILD_REQ 40 -::com::sun::star::awt::Size SAL_CALL VCLXScroller::getMinimumSize() - throw(::com::sun::star::uno::RuntimeException) -{ - ensureScrollBars(); - assert( mpHorScrollBar && mpVerScrollBar ); - awt::Size childSize = Bin::getMinimumSize(); - int thumbWidth = mpVerScrollBar->GetSizePixel().getWidth(); - int thumbHeight = mpHorScrollBar->GetSizePixel().getHeight(); - maRequisition = awt::Size( - SAL_MIN( MAX_CHILD_REQ, childSize.Width ) + thumbWidth, - SAL_MIN( MAX_CHILD_REQ, childSize.Height ) + thumbHeight ); - return maRequisition; -} - -void VCLXScroller::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) -{ - VCLXWindow::ProcessWindowEvent( _rVclWindowEvent ); -} - -void SAL_CALL VCLXScroller::setProperty( const ::rtl::OUString& PropertyName, const Any &Value ) throw(RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( GetWindow() ) - { -/* - sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); - switch ( nPropertyId ) - { - default: -*/ - VCLXWindow::setProperty( PropertyName, Value ); -/* - } -*/ - } -} - -Any SAL_CALL VCLXScroller::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) -{ - SolarMutexGuard aGuard; - - Any aReturn; - if ( GetWindow() ) - { -/* - sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); - switch ( nPropertyId ) - { - default: -*/ - aReturn = VCLXWindow::getProperty( PropertyName ); - -// } - } - return aReturn; -} - -IMPL_LINK( VCLXScroller, ScrollHdl, ScrollBar *, pScrollBar ) -{ - (void) pScrollBar; - forceRecalc(); - return 0; -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxscroller.hxx b/toolkit/source/awt/vclxscroller.hxx deleted file mode 100644 index 763b52f5ab..0000000000 --- a/toolkit/source/awt/vclxscroller.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_AWT_VCLXSCROLLER_HXX -#define LAYOUT_AWT_VCLXSCROLLER_HXX - -#include <comphelper/uno3.hxx> -#include <layout/core/bin.hxx> -#include <toolkit/awt/vclxwindow.hxx> - -class ScrollBar; -class FixedImage; - -namespace layoutimpl -{ - -class VCLXScroller :public VCLXWindow - ,public Bin -{ -public: - VCLXScroller(); - -protected: - ~VCLXScroller(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XComponent - void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XLayoutContainer - virtual void SAL_CALL allocateArea( const ::com::sun::star::awt::Rectangle &rArea ) - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() - throw(::com::sun::star::uno::RuntimeException); - - // VclWindowPeer - virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); - - // VCLXWindow - void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); - -private: - VCLXScroller( const VCLXScroller& ); // never implemented - VCLXScroller& operator=( const VCLXScroller& ); // never implemented - - // because the underlying window is only setup-ed after construction, init - // scrollbars at play-time - void ensureScrollBars(); - - FixedImage *mpContent; // dummy - ScrollBar *mpHorScrollBar, *mpVerScrollBar; - DECL_LINK( ScrollHdl, ScrollBar* ); -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_AWT_VCLXSCROLLER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxspinbutton.cxx b/toolkit/source/awt/vclxspinbutton.cxx deleted file mode 100644 index 297845c06e..0000000000 --- a/toolkit/source/awt/vclxspinbutton.cxx +++ /dev/null @@ -1,358 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" -#include "toolkit/awt/vclxspinbutton.hxx" -#include "toolkit/helper/property.hxx" -#include <com/sun/star/awt/ScrollBarOrientation.hpp> - - -#include <tools/debug.hxx> -#include <vcl/spin.hxx> -#include <vcl/svapp.hxx> - -namespace toolkit -{ - void setButtonLikeFaceColor( Window* _pWindow, const ::com::sun::star::uno::Any& _rColorValue ); - ::com::sun::star::uno::Any getButtonLikeFaceColor( const Window* _pWindow ); -} - -//........................................................................ -namespace toolkit -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - - //-------------------------------------------------------------------- - namespace - { - void lcl_modifyStyle( Window* _pWindow, WinBits _nStyleBits, sal_Bool _bShouldBePresent ) - { - WinBits nStyle = _pWindow->GetStyle(); - if ( _bShouldBePresent ) - nStyle |= _nStyleBits; - else - nStyle &= ~_nStyleBits; - _pWindow->SetStyle( nStyle ); - } - } - - //==================================================================== - //= VCLXSpinButton - //==================================================================== - DBG_NAME( VCLXSpinButton ) - //-------------------------------------------------------------------- - VCLXSpinButton::VCLXSpinButton() - :maAdjustmentListeners( *this ) - { - DBG_CTOR( VCLXSpinButton, NULL ); - } - - //-------------------------------------------------------------------- - VCLXSpinButton::~VCLXSpinButton() - { - DBG_DTOR( VCLXSpinButton, NULL ); - } - - //-------------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2( VCLXSpinButton, VCLXWindow, VCLXSpinButton_Base ) - - //-------------------------------------------------------------------- - IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXSpinButton, VCLXWindow, VCLXSpinButton_Base ) - - //-------------------------------------------------------------------- - void SAL_CALL VCLXSpinButton::dispose( ) throw(RuntimeException) - { - { - SolarMutexGuard aGuard; - - EventObject aDisposeEvent; - aDisposeEvent.Source = *this; - maAdjustmentListeners.disposeAndClear( aDisposeEvent ); - } - - VCLXWindow::dispose(); - } - - //-------------------------------------------------------------------- - void SAL_CALL VCLXSpinButton::addAdjustmentListener( const Reference< XAdjustmentListener >& listener ) throw (RuntimeException) - { - if ( listener.is() ) - maAdjustmentListeners.addInterface( listener ); - } - - //-------------------------------------------------------------------- - void SAL_CALL VCLXSpinButton::removeAdjustmentListener( const Reference< XAdjustmentListener >& listener ) throw (RuntimeException) - { - if ( listener.is() ) - maAdjustmentListeners.removeInterface( listener ); - } - - namespace - { - typedef void (SpinButton::*SetSpinButtonValue) (long); - typedef long (SpinButton::*GetSpinButtonValue) (void) const; - - //................................................................ - void lcl_setSpinButtonValue(Window* _pWindow, SetSpinButtonValue _pSetter, sal_Int32 _nValue ) - { - SolarMutexGuard aGuard; - SpinButton* pSpinButton = static_cast< SpinButton* >( _pWindow ); - if ( pSpinButton ) - (pSpinButton->*_pSetter)( _nValue ); - } - - //................................................................ - sal_Int32 lcl_getSpinButtonValue(const Window* _pWindow, GetSpinButtonValue _pGetter ) - { - SolarMutexGuard aGuard; - - sal_Int32 nValue = 0; - - const SpinButton* pSpinButton = static_cast< const SpinButton* >( _pWindow ); - if ( pSpinButton ) - nValue = (pSpinButton->*_pGetter)( ); - return nValue; - } - } - - //-------------------------------------------------------------------- - void SAL_CALL VCLXSpinButton::setValue( sal_Int32 n ) throw (RuntimeException) - { - lcl_setSpinButtonValue( GetWindow(), &SpinButton::SetValue, n ); - } - - //-------------------------------------------------------------------- - void SAL_CALL VCLXSpinButton::setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) throw (RuntimeException) - { - SolarMutexGuard aGuard; - - setMinimum( minValue ); - setMaximum( maxValue ); - setValue( currentValue ); - } - - //-------------------------------------------------------------------- - sal_Int32 SAL_CALL VCLXSpinButton::getValue( ) throw (RuntimeException) - { - return lcl_getSpinButtonValue( GetWindow(), &SpinButton::GetValue ); - } - - //-------------------------------------------------------------------- - void SAL_CALL VCLXSpinButton::setMinimum( sal_Int32 minValue ) throw (RuntimeException) - { - lcl_setSpinButtonValue( GetWindow(), &SpinButton::SetRangeMin, minValue ); - } - - //-------------------------------------------------------------------- - void SAL_CALL VCLXSpinButton::setMaximum( sal_Int32 maxValue ) throw (RuntimeException) - { - lcl_setSpinButtonValue( GetWindow(), &SpinButton::SetRangeMax, maxValue ); - } - - //-------------------------------------------------------------------- - sal_Int32 SAL_CALL VCLXSpinButton::getMinimum( ) throw (RuntimeException) - { - return lcl_getSpinButtonValue( GetWindow(), &SpinButton::GetRangeMin ); - } - - //-------------------------------------------------------------------- - sal_Int32 SAL_CALL VCLXSpinButton::getMaximum( ) throw (RuntimeException) - { - return lcl_getSpinButtonValue( GetWindow(), &SpinButton::GetRangeMax ); - } - - //-------------------------------------------------------------------- - void SAL_CALL VCLXSpinButton::setSpinIncrement( sal_Int32 spinIncrement ) throw (RuntimeException) - { - lcl_setSpinButtonValue( GetWindow(), &SpinButton::SetValueStep, spinIncrement ); - } - - //-------------------------------------------------------------------- - sal_Int32 SAL_CALL VCLXSpinButton::getSpinIncrement( ) throw (RuntimeException) - { - return lcl_getSpinButtonValue( GetWindow(), &SpinButton::GetValueStep ); - } - - //-------------------------------------------------------------------- - void SAL_CALL VCLXSpinButton::setOrientation( sal_Int32 orientation ) throw (NoSupportException, RuntimeException) - { - SolarMutexGuard aGuard; - - lcl_modifyStyle( GetWindow(), WB_HSCROLL, orientation == ScrollBarOrientation::HORIZONTAL ); - } - - //-------------------------------------------------------------------- - sal_Int32 SAL_CALL VCLXSpinButton::getOrientation( ) throw (RuntimeException) - { - return ( 0 != ( GetWindow()->GetStyle() & WB_HSCROLL ) ) - ? ScrollBarOrientation::HORIZONTAL - : ScrollBarOrientation::VERTICAL; - } - - //-------------------------------------------------------------------- - void VCLXSpinButton::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) - { - SolarMutexClearableGuard aGuard; - Reference< XSpinValue > xKeepAlive( this ); - SpinButton* pSpinButton = static_cast< SpinButton* >( GetWindow() ); - if ( !pSpinButton ) - return; - - switch ( _rVclWindowEvent.GetId() ) - { - case VCLEVENT_SPINBUTTON_UP: - case VCLEVENT_SPINBUTTON_DOWN: - if ( maAdjustmentListeners.getLength() ) - { - AdjustmentEvent aEvent; - aEvent.Source = *this; - aEvent.Value = pSpinButton->GetValue(); - - aGuard.clear(); - maAdjustmentListeners.adjustmentValueChanged( aEvent ); - } - break; - - default: - xKeepAlive.clear(); - aGuard.clear(); - VCLXWindow::ProcessWindowEvent( _rVclWindowEvent ); - break; - } - } - - //-------------------------------------------------------------------- - void SAL_CALL VCLXSpinButton::setProperty( const ::rtl::OUString& PropertyName, const Any& Value ) throw(RuntimeException) - { - SolarMutexGuard aGuard; - - sal_Int32 nValue = 0; - sal_Bool bIsLongValue = ( Value >>= nValue ); - - if ( GetWindow() ) - { - sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); - switch ( nPropertyId ) - { - case BASEPROPERTY_BACKGROUNDCOLOR: - // the default implementation of the base class doesn't work here, since our - // interpretation for this property is slightly different - setButtonLikeFaceColor( GetWindow(), Value); - break; - - case BASEPROPERTY_SPINVALUE: - if ( bIsLongValue ) - setValue( nValue ); - break; - - case BASEPROPERTY_SPINVALUE_MIN: - if ( bIsLongValue ) - setMinimum( nValue ); - break; - - case BASEPROPERTY_SPINVALUE_MAX: - if ( bIsLongValue ) - setMaximum( nValue ); - break; - - case BASEPROPERTY_SPININCREMENT: - if ( bIsLongValue ) - setSpinIncrement( nValue ); - break; - - case BASEPROPERTY_ORIENTATION: - if ( bIsLongValue ) - lcl_modifyStyle( GetWindow(), WB_HSCROLL, nValue == ScrollBarOrientation::HORIZONTAL ); - break; - - default: - VCLXWindow::setProperty( PropertyName, Value ); - } - } - } - - //-------------------------------------------------------------------- - Any SAL_CALL VCLXSpinButton::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) - { - SolarMutexGuard aGuard; - - Any aReturn; - - if ( GetWindow() ) - { - sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); - switch ( nPropertyId ) - { - case BASEPROPERTY_BACKGROUNDCOLOR: - // the default implementation of the base class doesn't work here, since our - // interpretation for this property is slightly different - aReturn = getButtonLikeFaceColor( GetWindow() ); - break; - - case BASEPROPERTY_SPINVALUE: - aReturn <<= (sal_Int32)getValue( ); - break; - - case BASEPROPERTY_SPINVALUE_MIN: - aReturn <<= (sal_Int32)getMinimum( ); - break; - - case BASEPROPERTY_SPINVALUE_MAX: - aReturn <<= (sal_Int32)getMaximum( ); - break; - - case BASEPROPERTY_SPININCREMENT: - aReturn <<= (sal_Int32)getSpinIncrement( ); - break; - - case BASEPROPERTY_ORIENTATION: - aReturn <<= (sal_Int32) - ( ( 0 != ( GetWindow()->GetStyle() & WB_HSCROLL ) ) - ? ScrollBarOrientation::HORIZONTAL - : ScrollBarOrientation::VERTICAL - ); - break; - - default: - aReturn = VCLXWindow::getProperty( PropertyName ); - } - } - return aReturn; - } - -//........................................................................ -} // namespace toolkit -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxsplitter.cxx b/toolkit/source/awt/vclxsplitter.cxx deleted file mode 100644 index 787f1a1325..0000000000 --- a/toolkit/source/awt/vclxsplitter.cxx +++ /dev/null @@ -1,249 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "vclxsplitter.hxx" - -#include <assert.h> -#include <com/sun/star/awt/PosSize.hpp> -#include <sal/macros.h> -#include <toolkit/helper/property.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <vcl/split.hxx> -#include <vcl/svapp.hxx> - -#include "forward.hxx" - -namespace layoutimpl -{ - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star; - -VCLXSplitter::ChildProps::ChildProps( VCLXSplitter::ChildData *pData ) -{ - addProp( RTL_CONSTASCII_USTRINGPARAM( "Shrink" ), - ::getCppuType( static_cast< const rtl::OUString* >( NULL ) ), - &(pData->mbShrink) ); -} - -VCLXSplitter::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild ) - : Box_Base::ChildData( xChild ) - , mbShrink( false ) -{ -} - -VCLXSplitter::ChildData* -VCLXSplitter::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild ) -{ - return new ChildData( xChild ); -} - -VCLXSplitter::ChildProps* -VCLXSplitter::createChildProps( Box_Base::ChildData *pData ) -{ - return new ChildProps( static_cast<VCLXSplitter::ChildData*> ( pData ) ); -} - - -DBG_NAME( VCLXSplitter ); - -VCLXSplitter::VCLXSplitter( bool bHorizontal ) - : VCLXWindow() - , Box_Base() -{ - DBG_CTOR( VCLXSplitter, NULL ); - mnHandleRatio = 0.5; - mbHandlePressed = false; - mbHorizontal = bHorizontal; - mpSplitter = NULL; -} - -VCLXSplitter::~VCLXSplitter() -{ - DBG_DTOR( VCLXSplitter, NULL ); -} - -IMPLEMENT_2_FORWARD_XINTERFACE1( VCLXSplitter, VCLXWindow, Container ); - -IMPLEMENT_FORWARD_XTYPEPROVIDER1( VCLXSplitter, VCLXWindow ); - -VCLXSplitter::ChildData* -VCLXSplitter::getChild( int i ) -{ - if ( maChildren.size() && i == 0 ) - return static_cast<VCLXSplitter::ChildData*>( maChildren.front() ); - else if ( maChildren.size() > 1 && i == 1 ) - return static_cast<VCLXSplitter::ChildData*>( maChildren.back() ); - return 0; -} - -void SAL_CALL VCLXSplitter::dispose() throw(RuntimeException) -{ - { - SolarMutexGuard aGuard; - - EventObject aDisposeEvent; - aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this); -// maTabListeners.disposeAndClear( aDisposeEvent ); - } - - VCLXWindow::dispose(); -} - -void VCLXSplitter::ensureSplitter() -{ - if ( !mpSplitter ) - { - mpSplitter = new Splitter( GetWindow() , mbHorizontal ? WB_HORZ : WB_VERT ); - mpSplitter->Show(); - mpSplitter->SetEndSplitHdl( LINK( this, VCLXSplitter, HandleMovedHdl ) ); - } -} - -void SAL_CALL VCLXSplitter::addChild( - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > &xChild ) - throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException) -{ - if ( maChildren.size() == 2 ) - throw css::awt::MaxChildrenException(); - Box_Base::addChild( xChild ); -} - -void SAL_CALL VCLXSplitter::allocateArea( - const ::com::sun::star::awt::Rectangle &rArea ) - throw (::com::sun::star::uno::RuntimeException) -{ - ensureSplitter(); // shouldn't be needed... - getMinimumSize(); - int splitDiff; - if ( mbHorizontal ) - splitDiff = rArea.Width - maAllocation.Width; - else - splitDiff = rArea.Height - maAllocation.Height; - - assert( mpSplitter ); - if ( splitDiff ) - mpSplitter->SetSplitPosPixel( mpSplitter->GetSplitPosPixel() + splitDiff/2 ); - - maAllocation = rArea; - int width = mbHorizontal ? rArea.Width : rArea.Height; - int splitLen = 2; - int splitPos = mpSplitter->GetSplitPosPixel(); - setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height, PosSize::POSSIZE ); - if ( mbHorizontal ) - mpSplitter->SetPosSizePixel( splitPos, 0, splitLen, rArea.Height, PosSize::POSSIZE ); - else - mpSplitter->SetPosSizePixel( 0, splitPos, rArea.Width, splitLen, PosSize::POSSIZE ); - mpSplitter->SetDragRectPixel( ::Rectangle( 0, 0, rArea.Width, rArea.Height ) ); - int leftWidth = splitPos; - int rightWidth = width - splitPos; - - if ( getChild( 0 ) && getChild( 0 )->mxChild.is() ) - { - awt::Rectangle childRect( 0, 0, rArea.Width, rArea.Height ); - - if ( mbHorizontal ) - childRect.Width = leftWidth - 2; - else - childRect.Height = leftWidth - 2; - allocateChildAt( getChild( 0 )->mxChild, childRect ); - } - if ( getChild( 0 ) && getChild( 0 )->mxChild.is() ) - { - awt::Rectangle childRect( 0, 0, rArea.Width, rArea.Height ); - - if ( mbHorizontal ) - { - childRect.X += leftWidth + splitLen + 2; - childRect.Width = rightWidth; - } - else - { - childRect.Y += leftWidth + splitLen + 2; - childRect.Height = rightWidth; - } - allocateChildAt( getChild( 1 )->mxChild, childRect ); - } -} - -::com::sun::star::awt::Size SAL_CALL VCLXSplitter::getMinimumSize() - throw(::com::sun::star::uno::RuntimeException) -{ - ensureSplitter(); - - awt::Size size( mbHorizontal ? 2 : 0, mbHorizontal ? 0 : 2 ); - for ( unsigned int i = 0; i < 2; i++ ) - { - if ( getChild( i ) && getChild( i )->mxChild.is() ) - { - awt::Size childSize = getChild( i )->mxChild->getMinimumSize(); - if ( mbHorizontal ) - { - size.Width += childSize.Width; - size.Height = SAL_MAX( size.Height, childSize.Height ); - } - else - { - size.Width = SAL_MAX( size.Width, childSize.Width ); - size.Height += childSize.Height; - } - } - } - - maRequisition = size; - return size; -} - -void VCLXSplitter::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) -{ - VCLXWindow::ProcessWindowEvent( _rVclWindowEvent ); -} - -void SAL_CALL VCLXSplitter::setProperty( const ::rtl::OUString& PropertyName, const Any &Value ) throw(RuntimeException) -{ - VCLXWindow::setProperty( PropertyName, Value ); -} - -Any SAL_CALL VCLXSplitter::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) -{ - return VCLXWindow::getProperty( PropertyName ); -} - -IMPL_LINK( VCLXSplitter, HandleMovedHdl, Splitter *, pSplitter ) -{ - (void) pSplitter; - forceRecalc(); - return 0; -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxsplitter.hxx b/toolkit/source/awt/vclxsplitter.hxx deleted file mode 100644 index ca4cb094e2..0000000000 --- a/toolkit/source/awt/vclxsplitter.hxx +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_AWT_VCLXSPLITTER_HXX -#define LAYOUT_AWT_VCLXSPLITTER_HXX - -#include <com/sun/star/awt/MaxChildrenException.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <comphelper/uno3.hxx> -#include <layout/core/box-base.hxx> -#include <toolkit/awt/vclxwindow.hxx> - -class Splitter; - -namespace layoutimpl -{ - -class VCLXSplitter :public VCLXWindow - ,public Box_Base -{ -private: - VCLXSplitter( const VCLXSplitter& ); // never implemented - VCLXSplitter& operator=( const VCLXSplitter& ); // never implemented - -public: - VCLXSplitter( bool bHorizontal ); - -protected: - ~VCLXSplitter(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XComponent - void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XLayoutContainer - virtual void SAL_CALL addChild( - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >& Child ) - throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException); - - virtual void SAL_CALL allocateArea( const ::com::sun::star::awt::Rectangle &rArea ) - throw (::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() - throw(::com::sun::star::uno::RuntimeException); - - // unimplemented: - virtual sal_Bool SAL_CALL hasHeightForWidth() - throw(css::uno::RuntimeException) - { return false; } - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ ) - throw(css::uno::RuntimeException) - { return maRequisition.Height; } - - // VclWindowPeer - virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); - - // VCLXWindow - void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); - -public: - // Maps page ids to child references - struct ChildData : public Box_Base::ChildData - { - sal_Bool mbShrink; - ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); - }; - - struct ChildProps : public Box_Base::ChildProps - { - ChildProps( VCLXSplitter::ChildData *pData ); - }; - -protected: - - ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); - ChildProps *createChildProps( Box_Base::ChildData* pData ); - - ChildData* getChild( int i ); - - float mnHandleRatio; - bool mbHandlePressed; - - DECL_LINK( HandleMovedHdl, Splitter* ); - bool mbHorizontal; - Splitter *mpSplitter; - void ensureSplitter(); -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_AWT_VCLXSPLITTER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxsystemdependentwindow.cxx b/toolkit/source/awt/vclxsystemdependentwindow.cxx deleted file mode 100644 index 22da2a119a..0000000000 --- a/toolkit/source/awt/vclxsystemdependentwindow.cxx +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - - -#include <com/sun/star/lang/SystemDependent.hpp> - -#if defined UNX && ! defined QUARTZ && ! 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> - -#ifdef QUARTZ -#include "premac.h" -#include <Cocoa/Cocoa.h> -#include "postmac.h" -#endif - -#ifdef IOS -#include "premac.h" -#include <UIKit/UIKit.h> -#include "postmac.h" -#endif - -#include <vcl/svapp.hxx> -#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) -{ - SolarMutexGuard aGuard; - - // TODO, check the process id - ::com::sun::star::uno::Any aRet; - Window* pWindow = GetWindow(); - if ( pWindow ) - { - const SystemEnvData* pSysData = ((SystemChildWindow *)pWindow)->GetSystemData(); - if( pSysData ) - { -#if (defined WNT) - if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 ) - { - aRet <<= (sal_Int32)pSysData->hWnd; - } -#elif (defined QUARTZ) - if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC ) - { - aRet <<= (sal_IntPtr)pSysData->pView; - } -#elif (defined IOS) - if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_IOS ) - { - aRet <<= (sal_IntPtr)pSysData->pView; - } -#elif (defined UNX) - if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW ) - { - ::com::sun::star::awt::SystemDependentXWindow aSD; - aSD.DisplayPointer = sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(pSysData->pDisplay)); - aSD.WindowHandle = pSysData->aWindow; - aRet <<= aSD; - } -#endif - } - } - return aRet; -} - - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxtabcontrol.cxx b/toolkit/source/awt/vclxtabcontrol.cxx deleted file mode 100644 index 508054b914..0000000000 --- a/toolkit/source/awt/vclxtabcontrol.cxx +++ /dev/null @@ -1,518 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <vclxtabcontrol.hxx> - -#include <com/sun/star/awt/PosSize.hpp> -#include <sal/macros.h> -#include <toolkit/helper/property.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <vcl/tabctrl.hxx> -#include <vcl/tabpage.hxx> -#include <vcl/svapp.hxx> - -#include "forward.hxx" - -namespace layoutimpl -{ - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star; - -VCLXTabControl::ChildProps::ChildProps( VCLXTabControl::ChildData *pData ) -{ - addProp( RTL_CONSTASCII_USTRINGPARAM( "Title" ), - ::getCppuType( static_cast< const rtl::OUString* >( NULL ) ), - &(pData->maTitle) ); -} - -VCLXTabControl::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild ) - : Box_Base::ChildData( xChild ) - , maTitle() -{ -} - -VCLXTabControl::ChildData* -VCLXTabControl::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild ) -{ - return new ChildData( xChild ); -} - -VCLXTabControl::ChildProps* -VCLXTabControl::createChildProps( Box_Base::ChildData *pData ) -{ - return new ChildProps( static_cast<VCLXTabControl::ChildData*> ( pData ) ); -} - -DBG_NAME( VCLXTabControl ); - -#if !defined (__GNUC__) -#define __PRETTY_FUNCTION__ __FUNCTION__ -#endif /* !__GNUC__ */ - -VCLXTabControl::VCLXTabControl() - : VCLXWindow() - , VCLXTabControl_Base() - , Box_Base() - , mTabId (1) - , bRealized (false) -{ -#ifndef __SUNPRO_CC - OSL_TRACE ("\n********%s:%x", __PRETTY_FUNCTION__, this); -#endif - DBG_CTOR( VCLXTabControl, NULL ); -} - -VCLXTabControl::~VCLXTabControl() -{ - DBG_DTOR( VCLXTabControl, NULL ); -} - -IMPLEMENT_2_FORWARD_XINTERFACE2( VCLXTabControl, VCLXWindow, Container, VCLXTabControl_Base ); - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXTabControl, VCLXWindow, VCLXTabControl_Base ); - -void SAL_CALL VCLXTabControl::dispose( ) throw(uno::RuntimeException) -{ - { - SolarMutexGuard aGuard; - - EventObject aDisposeEvent; - aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this); -// maTabListeners.disposeAndClear( aDisposeEvent ); - } - - VCLXWindow::dispose(); -} - - -TabControl *VCLXTabControl::getTabControl() const throw (uno::RuntimeException) -{ - TabControl *pTabControl = static_cast< TabControl* >( GetWindow() ); - if ( pTabControl ) - return pTabControl; - throw uno::RuntimeException(); -} - -sal_Int32 SAL_CALL VCLXTabControl::insertTab() throw (uno::RuntimeException) -{ - TabControl *pTabControl = getTabControl(); - sal_uInt16 id = sal::static_int_cast< sal_uInt16 >( mTabId++ ); - rtl::OUString title (RTL_CONSTASCII_USTRINGPARAM( "" ) ); - pTabControl->InsertPage( id, title.getStr(), TAB_APPEND ); - pTabControl->SetTabPage( id, new TabPage( pTabControl ) ); - return id; -} - -void SAL_CALL VCLXTabControl::removeTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException) -{ - TabControl *pTabControl = getTabControl(); - if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL ) - throw IndexOutOfBoundsException(); - pTabControl->RemovePage( sal::static_int_cast< sal_uInt16 >( ID ) ); -} - -void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException) -{ - TabControl *pTabControl = getTabControl(); - if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL ) - throw IndexOutOfBoundsException(); - pTabControl->SelectTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ); -} - -sal_Int32 SAL_CALL VCLXTabControl::getActiveTabID() throw (uno::RuntimeException) -{ - return getTabControl()->GetCurPageId( ); -} - -void SAL_CALL VCLXTabControl::addTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException) -{ - for ( std::list< uno::Reference - < awt::XTabListener > >::const_iterator it - = mxTabListeners.begin(); it != mxTabListeners.end(); ++it ) - { - if ( *it == xListener ) - // already added - return; - } - mxTabListeners.push_back( xListener ); -} - -void SAL_CALL VCLXTabControl::removeTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException) -{ - for ( std::list< uno::Reference - < awt::XTabListener > >::iterator it - = mxTabListeners.begin(); it != mxTabListeners.end(); ++it ) - { - if ( *it == xListener ) - { - mxTabListeners.erase( it ); - break; - } - } -} - -void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const uno::Sequence< NamedValue >& Properties ) throw (uno::RuntimeException, IndexOutOfBoundsException) -{ - TabControl *pTabControl = getTabControl(); - if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL ) - throw IndexOutOfBoundsException(); - - for ( int i = 0; i < Properties.getLength(); i++ ) - { - const rtl::OUString &name = Properties[i].Name; - const uno::Any &value = Properties[i].Value; - - if ( name == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ) ) - { - rtl::OUString title = value.get<rtl::OUString>(); - pTabControl->SetPageText( sal::static_int_cast< sal_uInt16 >( ID ), title.getStr() ); - } - } -} - -uno::Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID ) - throw (IndexOutOfBoundsException, uno::RuntimeException) -{ - TabControl *pTabControl = getTabControl(); - if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL ) - throw IndexOutOfBoundsException(); - -#define ADD_PROP( seq, i, name, val ) { \ - NamedValue value; \ - value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \ - value.Value = uno::makeAny( val ); \ - seq[i] = value; \ - } - - uno::Sequence< NamedValue > props( 2 ); - ADD_PROP( props, 0, "Title", rtl::OUString( pTabControl->GetPageText( sal::static_int_cast< sal_uInt16 >( ID ) ) ) ); - ADD_PROP( props, 1, "Position", pTabControl->GetPagePos( sal::static_int_cast< sal_uInt16 >( ID ) ) ); -#undef ADD_PROP - return props; -} - -// TODO: draw tab border here -void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - TabControl *pTabControl = getTabControl(); - TabPage *pTabPage = pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( getActiveTabID() ) ); - if ( pTabPage ) - { - ::Point aPos( nX, nY ); - ::Size aSize = pTabPage->GetSizePixel(); - - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); - aPos = pDev->PixelToLogic( aPos ); - aSize = pDev->PixelToLogic( aSize ); - - pTabPage->Draw( pDev, aPos, aSize, 0 ); - } - - VCLXWindow::draw( nX, nY ); -} - -void VCLXTabControl::AddChild (uno::Reference< awt::XLayoutConstrains > const& xChild) - -{ -#ifndef __SUNPRO_CC - OSL_TRACE ("%s: children: %d", __PRETTY_FUNCTION__, maChildren.size ()); -#endif - mIdMap[ xChild ] = mTabId++; - Box_Base::AddChild( xChild ); -#ifndef __SUNPRO_CC - OSL_TRACE ("%s: children: %d", __PRETTY_FUNCTION__, maChildren.size ()); -#endif -} - -void SAL_CALL VCLXTabControl::addChild( - const uno::Reference< awt::XLayoutConstrains > &xChild ) - throw (uno::RuntimeException, awt::MaxChildrenException) -{ - mIdMap[ xChild ] = insertTab(); - Box_Base::addChild( xChild ); -} - -void SAL_CALL VCLXTabControl::removeChild( const uno::Reference< awt::XLayoutConstrains > &xChild ) - throw (uno::RuntimeException) -{ - removeTab( mIdMap[xChild] ); - mIdMap[ xChild ] = -1; - Box_Base::removeChild( xChild ); -} - -static void setChildrenVisible( uno::Reference < awt::XLayoutConstrains > xChild, bool visible ) -{ - uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY); - if ( xWin.is() ) - { - xWin->setVisible( visible ); - } - - uno::Reference < awt::XLayoutContainer > xCont( xChild, uno::UNO_QUERY ); - if ( xCont.is()) - { - uno::Sequence< uno::Reference < awt::XLayoutConstrains > > children = xCont->getChildren(); - for ( int i = 0; i < children.getLength(); i++ ) - { - setChildrenVisible( children[i], visible ); - } - } -} - -void SAL_CALL VCLXTabControl::allocateArea (awt::Rectangle const &area) - throw (uno::RuntimeException) -{ -#ifndef __SUNPRO_CC - OSL_TRACE ("\n%s", __PRETTY_FUNCTION__); -#endif - maAllocation = area; - - TabControl *pTabControl = getTabControl(); - -// FIXME: this is wrong. We just want to set tab controls pos/size for -// the tabs menu, otherwise, it gets events that should go to children -// (I guess we could solve this by making the tabcontrol as the actual -// XWindow parent of its children, when importing...) Not sure about -// TabPage drawing... That doesn't work on gtk+; just ignoring that. -// LATER: Nah, the proper fix is to get the XWindow hierarchy -// straight. - - awt::Size currentSize = getSize(); - awt::Size requestedSize (area.Width, area.Height); -// requestedSize.Height = getHeightForWidth( area.Width ); - - awt::Size minimumSize = getMinimumSize(); - if (requestedSize.Width < minimumSize.Width) - requestedSize.Width = minimumSize.Width; - if (requestedSize.Height < minimumSize.Height) - requestedSize.Height = minimumSize.Height; - - Size pageSize = static_cast<TabControl*> (GetWindow ())->GetTabPageSizePixel (); - awt::Size pageBasedSize (0, 0); - pageBasedSize.Width = pageSize.Width (); - pageBasedSize.Height = pageSize.Height (); - - const int wc = 0; - const int hc = 20; - static int pwc = 0; - static int phc = 40; - - if (requestedSize.Width < pageBasedSize.Width) - requestedSize.Width = pageBasedSize.Width + wc; - if (requestedSize.Height < pageBasedSize.Height) - requestedSize.Height = pageBasedSize.Height + hc; - - Window *parent = GetWindow()->GetParent(); - Size parentSize = parent->GetSizePixel(); - -#ifndef __SUNPRO_CC -#ifdef GCC_MAJOR - OSL_TRACE ("\n%s", __PRETTY_FUNCTION__); -#endif /* GCC_MAJOR */ - OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, currentSize.Width, currentSize.Height ); - OSL_TRACE ("%s: area: %d, %d", __FUNCTION__, area.Width, area.Height ); - OSL_TRACE ("%s: minimum: %d, %d", __FUNCTION__, minimumSize.Width, minimumSize.Height ); - OSL_TRACE ("%s: requestedSize: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height ); - OSL_TRACE ("%s: pageBasedSize: %d, %d", __FUNCTION__, pageBasedSize.Width, pageBasedSize.Height ); -#endif - - //bRealized = false; - if (!bRealized) - { - setPosSize( area.X, area.Y, requestedSize.Width, requestedSize.Height, awt::PosSize::POSSIZE ); - bRealized = true; - } - else - { - if ( requestedSize.Width > currentSize.Width + 10) - setPosSize( 0, 0, requestedSize.Width, 0, awt::PosSize::WIDTH ); - if ( requestedSize.Height > currentSize.Height + 10) - setPosSize( 0, 0, 0, requestedSize.Height, awt::PosSize::HEIGHT ); - } - - if (pageBasedSize.Width > parentSize.Width () - || pageBasedSize.Height > parentSize.Height ()) - //parent->SetSizePixel ( Size (pageBasedSize.Width, pageBasedSize.Height)); - //parent->SetSizePixel ( Size (pageBasedSize.Width + pwc, pageBasedSize.Height + phc)); - parent->SetSizePixel ( Size (requestedSize.Width + pwc, requestedSize.Height + phc)); - - // FIXME: we can save cycles by setting visibility more sensibly. Having - // it here does makes it easier when changing tabs (just needs a recalc()) - unsigned i = 0; - for ( std::list<Box_Base::ChildData *>::const_iterator it - = maChildren.begin(); it != maChildren.end(); ++it, ++i ) - { - ChildData *child = static_cast<VCLXTabControl::ChildData*> ( *it ); - uno::Reference - < awt::XLayoutConstrains > xChild( child->mxChild ); - if ( xChild.is() ) - { - uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY ); - bool active = (i+1 == (unsigned) getActiveTabID()); - - // HACK: since our layout:: container don't implement XWindow, we have no easy - // way to set them invisible; lets just set all their children as such :P - setChildrenVisible( xChild, active ); - - if ( active ) - { - ::Rectangle label_rect = pTabControl->GetTabBounds( sal::static_int_cast< sal_uInt16 >( i+1 ) ); - ::Rectangle page_rect = pTabControl->GetTabPageBounds( sal::static_int_cast< sal_uInt16 >( i+1 ) ); - - awt::Rectangle childRect; - childRect.X = page_rect.Left(); - childRect.Y = SAL_MAX( label_rect.Bottom(), page_rect.Top() ); - childRect.Width = page_rect.Right() - page_rect.Left(); - childRect.Height = page_rect.Bottom() - childRect.Y; - - allocateChildAt( xChild, childRect ); - } - } - } -} - -awt::Size SAL_CALL VCLXTabControl::getMinimumSize() - throw(uno::RuntimeException) -{ - awt::Size requestedSize = VCLXWindow::getMinimumSize(); - awt::Size childrenSize( 0, 0 ); - - TabControl* pTabControl = static_cast< TabControl* >( GetWindow() ); - if ( !pTabControl ) - return requestedSize; - - // calculate size to accomodate all children - unsigned i = 0; - for ( std::list<Box_Base::ChildData *>::const_iterator it - = maChildren.begin(); it != maChildren.end(); ++it, ++i ) - { - ChildData *child = static_cast<VCLXTabControl::ChildData*> ( *it ); - if ( child->mxChild.is() ) - { - // set the title prop here... - pTabControl->SetPageText( sal::static_int_cast< sal_uInt16 >( i+1 ), child->maTitle.getStr() ); - - awt::Size childSize( child->mxChild->getMinimumSize() ); - childrenSize.Width = SAL_MAX( childSize.Width, childrenSize.Width ); - childrenSize.Height = SAL_MAX( childSize.Height, childrenSize.Height ); - } - } - -#ifndef __SUNPRO_CC -#ifdef GCC_MAJOR - OSL_TRACE ("\n%s", __PRETTY_FUNCTION__); -#endif /* GCC_MAJOR */ - OSL_TRACE ("%s: children: %d", __FUNCTION__, i); - OSL_TRACE ("%s: childrenSize: %d, %d", __FUNCTION__, childrenSize.Width, childrenSize.Height ); -#endif - - requestedSize.Width += childrenSize.Width; - requestedSize.Height += childrenSize.Height + 20; - - maRequisition = requestedSize; - return requestedSize; -} - -void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) -{ - SolarMutexClearableGuard aGuard; - TabControl* pTabControl = static_cast< TabControl* >( GetWindow() ); - if ( !pTabControl ) - return; - - switch ( _rVclWindowEvent.GetId() ) - { - case VCLEVENT_TABPAGE_ACTIVATE: - forceRecalc(); - case VCLEVENT_TABPAGE_DEACTIVATE: - case VCLEVENT_TABPAGE_INSERTED: - case VCLEVENT_TABPAGE_REMOVED: - case VCLEVENT_TABPAGE_REMOVEDALL: - case VCLEVENT_TABPAGE_PAGETEXTCHANGED: - { - sal_uLong page = (sal_uLong) _rVclWindowEvent.GetData(); - for ( std::list< uno::Reference - < awt::XTabListener > >::iterator it - = mxTabListeners.begin(); it != mxTabListeners.end(); ++it ) - { - uno::Reference - < awt::XTabListener > listener = *it; - - switch ( _rVclWindowEvent.GetId() ) - { - - case VCLEVENT_TABPAGE_ACTIVATE: - listener->activated( page ); - break; - case VCLEVENT_TABPAGE_DEACTIVATE: - listener->deactivated( page ); - break; - case VCLEVENT_TABPAGE_INSERTED: - listener->inserted( page ); - break; - case VCLEVENT_TABPAGE_REMOVED: - listener->removed( page ); - break; - case VCLEVENT_TABPAGE_REMOVEDALL: - for ( int i = 1; i < mTabId; i++) - { - if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( i ) ) ) - listener->removed( i ); - } - break; - case VCLEVENT_TABPAGE_PAGETEXTCHANGED: - listener->changed( page, getTabProps( page ) ); - break; - } - } - break; - } - default: - aGuard.clear(); - VCLXWindow::ProcessWindowEvent( _rVclWindowEvent ); - break; - } -} - -void SAL_CALL VCLXTabControl::setProperty( const ::rtl::OUString& PropertyName, const uno::Any &Value ) throw(uno::RuntimeException) -{ - VCLXWindow::setProperty( PropertyName, Value ); -} - -uno::Any SAL_CALL VCLXTabControl::getProperty( const ::rtl::OUString& PropertyName ) throw(uno::RuntimeException) -{ - return VCLXWindow::getProperty( PropertyName ); -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxtabcontrol.hxx b/toolkit/source/awt/vclxtabcontrol.hxx deleted file mode 100644 index 84c785947b..0000000000 --- a/toolkit/source/awt/vclxtabcontrol.hxx +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_AWT_VCLXTABCONTROLLER_HXX -#define LAYOUT_AWT_VCLXTABCONTROLLER_HXX - -#include <com/sun/star/awt/XSimpleTabController.hpp> -#include <comphelper/uno3.hxx> -#include <layout/core/box-base.hxx> -#include <map> -#include <toolkit/awt/vclxwindow.hxx> - -class TabControl; - -namespace layoutimpl -{ - -typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSimpleTabController - > VCLXTabControl_Base; - -class VCLXTabControl :public VCLXWindow - ,public VCLXTabControl_Base - ,public Box_Base -{ - int mTabId; - bool bRealized; - -public: - VCLXTabControl(); - - void AddChild (css::uno::Reference <css::awt::XLayoutConstrains> const &); - -protected: - ~VCLXTabControl(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XComponent - void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw (::com::sun::star::uno::RuntimeException); - - // XSimpleTabController - virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getActiveTabID() throw (::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XLayoutContainer - virtual void SAL_CALL addChild( - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >& Child ) - throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException); - virtual void SAL_CALL removeChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >& Child ) - throw (::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL allocateArea( const ::com::sun::star::awt::Rectangle &rArea ) - throw (::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() - throw(::com::sun::star::uno::RuntimeException); - - // unimplemented: - virtual sal_Bool SAL_CALL hasHeightForWidth() - throw(css::uno::RuntimeException) - { return false; } - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ ) - throw(css::uno::RuntimeException) - { return maRequisition.Height; } - - // VclWindowPeer - virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); - - // VCLXWindow - void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); - -public: - // Maps page ids to child references - struct ChildData : public Box_Base::ChildData - { - rtl::OUString maTitle; - ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); - }; - - struct ChildProps : public Box_Base::ChildProps - { - ChildProps( VCLXTabControl::ChildData *pData ); - }; - - inline TabControl *getTabControl() const throw (::com::sun::star::uno::RuntimeException); - -protected: - ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); - ChildProps *createChildProps( Box_Base::ChildData* pData ); - - - std::map< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >, sal_Int32 > mIdMap; - // FIXME: we might want to use a Multiplexer - std::list< ::com::sun::star::uno::Reference - < ::com::sun::star::awt::XTabListener > > mxTabListeners; - - -private: - VCLXTabControl( const VCLXTabControl& ); // never implemented - VCLXTabControl& operator=( const VCLXTabControl& ); // never implemented -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_AWT_VCLXTABCONTROLLER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxtabpage.cxx b/toolkit/source/awt/vclxtabpage.cxx deleted file mode 100644 index c50e40ec33..0000000000 --- a/toolkit/source/awt/vclxtabpage.cxx +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <vclxtabpage.hxx> - -#include "forward.hxx" - -#include <com/sun/star/awt/PosSize.hpp> -#include <toolkit/helper/convert.hxx> -#include <vcl/tabpage.hxx> -#include <vcl/tabctrl.hxx> -#include <vcl/svapp.hxx> - -#if !defined (__GNUC__) -#define __PRETTY_FUNCTION__ __FUNCTION__ -#endif /* !__GNUC__ */ - -namespace layoutimpl -{ - -using namespace ::com::sun::star; - -// XInterface -IMPLEMENT_FORWARD_XINTERFACE2( VCLXTabPage, VCLXWindow, Bin ); - -// XTypeProvider -IMPLEMENT_FORWARD_XTYPEPROVIDER1( VCLXTabPage, VCLXWindow ); - -VCLXTabPage::VCLXTabPage( Window *p ) - : VCLXWindow() - , Bin() - , bRealized( false ) -{ - /* FIXME: before Window is set, setLabel, setProperty->setImage - * are silent no-ops. */ - p->SetComponentInterface( this ); -} - -VCLXTabPage::~VCLXTabPage() -{ -} - -void SAL_CALL VCLXTabPage::dispose() throw(uno::RuntimeException) -{ - { - SolarMutexGuard aGuard; - - lang::EventObject aDisposeEvent; - aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this); - } - - VCLXWindow::dispose(); -} - -void SAL_CALL VCLXTabPage::allocateArea( awt::Rectangle const& area ) - throw (uno::RuntimeException) -{ - awt::Size currentSize = getSize(); - awt::Size requestedSize = getMinimumSize(); - requestedSize.Height = getHeightForWidth( area.Width ); - - if ( currentSize.Width > 0 && currentSize.Height > 0 - && requestedSize.Width > currentSize.Width ) - requestedSize.Width = currentSize.Width; - if ( currentSize.Width > 0 && currentSize.Height > 0 - && requestedSize.Height > currentSize.Height ) - requestedSize.Height = currentSize.Height; - - // FIXME: missing destructor? - if ( !GetWindow() ) - return; - - Size windowSize = GetWindow()->GetSizePixel(); - Window *parent = GetWindow()->GetParent(); - Size parentSize = parent->GetSizePixel(); - - Point pos = GetWindow()->GetPosPixel(); -#ifndef __SUNPRO_CC - OSL_TRACE ("\n%s", __PRETTY_FUNCTION__); - OSL_TRACE ("%s: curpos: %d ,%d", __FUNCTION__, pos.X(), pos.Y() ); - - OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, currentSize.Width, currentSize.Height ); - OSL_TRACE ("%s: area: %d, %d", __FUNCTION__, area.Width, area.Height ); - OSL_TRACE ("%s: requestedSize: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height ); - OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parentSize.Width(), parentSize.Height() ); - OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, windowSize.Width(), windowSize.Height() ); -#endif - - if ( !bRealized ) - { - setPosSize( area.X, area.Y, requestedSize.Width, requestedSize.Height, awt::PosSize::SIZE ); - bRealized = true; - } - else - { - if ( requestedSize.Width > currentSize.Width + 10) - setPosSize( 0, 0, requestedSize.Width, 0, awt::PosSize::WIDTH ); - if ( requestedSize.Height > currentSize.Height + 10) - setPosSize( 0, 0, 0, requestedSize.Height, awt::PosSize::HEIGHT ); - } - - awt::Size newSize = getSize(); -#ifndef __SUNPRO_CC - OSL_TRACE ("%s: newSize: %d, %d", __FUNCTION__, newSize.Width, newSize.Height ); -#endif - maAllocation.Width = newSize.Width; - maAllocation.Height = newSize.Height; - - Bin::allocateArea( maAllocation ); -} - -awt::Size SAL_CALL VCLXTabPage::getMinimumSize() - throw(uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - return Bin::getMinimumSize(); -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxtabpage.hxx b/toolkit/source/awt/vclxtabpage.hxx deleted file mode 100644 index 955a5982fe..0000000000 --- a/toolkit/source/awt/vclxtabpage.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_AWT_VCLXTABPAGE_HXX -#define LAYOUT_AWT_VCLXTABPAGE_HXX - -#include <toolkit/awt/vclxwindow.hxx> -#include <layout/core/bin.hxx> -#include <comphelper/uno3.hxx> - -namespace layoutimpl -{ - -namespace css = ::com::sun::star; - -class VCLXTabPage : public VCLXWindow - , public Bin -{ - bool bRealized; - -public: - VCLXTabPage( Window *p ); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - -protected: - ~VCLXTabPage(); - - // XComponent - void SAL_CALL dispose() throw(css::uno::RuntimeException); - - // ::com::sun::star::awt::XLayoutContainer - virtual void SAL_CALL allocateArea( css::awt::Rectangle const& rArea ) - throw (css::uno::RuntimeException); - virtual css::awt::Size SAL_CALL getMinimumSize() - throw(css::uno::RuntimeException); - -private: - VCLXTabPage( VCLXTabPage const & ); - VCLXTabPage& operator=( VCLXTabPage const & ); -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_AWT_VCLXTABPAGE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx deleted file mode 100644 index 34f38c6e77..0000000000 --- a/toolkit/source/awt/vclxtabpagecontainer.cxx +++ /dev/null @@ -1,237 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_toolkit.hxx" - -#include <toolkit/awt/vclxtabpagecontainer.hxx> -#include <com/sun/star/awt/tab/XTabPageModel.hpp> -#include <com/sun/star/awt/XControl.hpp> -#include <vcl/tabpage.hxx> -#include <vcl/tabctrl.hxx> -#include <vcl/svapp.hxx> -#include <toolkit/helper/property.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <toolkit/helper/tkresmgr.hxx> -#include <cppuhelper/typeprovider.hxx> - -using ::rtl::OUString; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::view; -// ---------------------------------------------------- -// class VCLXTabPageContainer -// ---------------------------------------------------- -void VCLXTabPageContainer::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - VCLXWindow::ImplGetPropertyIds( rIds ); -} - -VCLXTabPageContainer::VCLXTabPageContainer() : - m_aTabPageListeners( *this ) -{ -} - -VCLXTabPageContainer::~VCLXTabPageContainer() -{ -#ifndef __SUNPRO_CC - OSL_TRACE ("%s", __FUNCTION__); -#endif -} - -void SAL_CALL VCLXTabPageContainer::draw( sal_Int32 nX, sal_Int32 nY ) throw(RuntimeException) -{ - SolarMutexGuard aGuard; - TabControl* pTabControl = (TabControl*)GetWindow(); - if ( pTabControl ) - { - TabPage *pTabPage = pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( pTabControl->GetCurPageId( ) ) ); - if ( pTabPage ) - { - ::Point aPos( nX, nY ); - ::Size aSize = pTabPage->GetSizePixel(); - - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); - aPos = pDev->PixelToLogic( aPos ); - aSize = pDev->PixelToLogic( aSize ); - - pTabPage->Draw( pDev, aPos, aSize, 0 ); - } - } - - VCLXWindow::draw( nX, nY ); -/* - if ( pWindow ) - { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); - if ( !pDev ) - pDev = pWindow->GetParent(); - - Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() ); - Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); - - pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS ); - } -*/ -} - -::com::sun::star::awt::DeviceInfo VCLXTabPageContainer::getInfo() throw(RuntimeException) -{ - ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo(); - return aInfo; -} - -void SAL_CALL VCLXTabPageContainer::setProperty(const ::rtl::OUString& PropertyName, const Any& Value ) throw(RuntimeException) -{ - SolarMutexGuard aGuard; - - TabControl* pTabPage = (TabControl*)GetWindow(); - if ( pTabPage ) - { - VCLXWindow::setProperty( PropertyName, Value ); - } -} -::sal_Int16 SAL_CALL VCLXTabPageContainer::getActiveTabPageID() throw (RuntimeException) -{ - TabControl* pTabCtrl = (TabControl*)GetWindow(); - return pTabCtrl != NULL ? pTabCtrl->GetCurPageId( ) : 0; -} -void SAL_CALL VCLXTabPageContainer::setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (RuntimeException) -{ - TabControl* pTabCtrl = (TabControl*)GetWindow(); - if ( pTabCtrl ) - pTabCtrl->SelectTabPage(_activetabpageid); -} -::sal_Int32 SAL_CALL VCLXTabPageContainer::getTabPageCount( ) throw (RuntimeException) -{ - TabControl* pTabCtrl = (TabControl*)GetWindow(); - return pTabCtrl != NULL ? pTabCtrl->GetPageCount() : 0; -} -::sal_Bool SAL_CALL VCLXTabPageContainer::isTabPageActive( ::sal_Int16 tabPageIndex ) throw (RuntimeException) -{ - return (getActiveTabPageID() == tabPageIndex); -} -Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPage( ::sal_Int16 tabPageIndex ) throw (RuntimeException) -{ - return (tabPageIndex >= 0 && tabPageIndex < static_cast<sal_Int16>(m_aTabPages.size())) ? m_aTabPages[tabPageIndex] : NULL; -} -Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPageByID( ::sal_Int16 tabPageID ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage; - ::std::vector< Reference< ::com::sun::star::awt::tab::XTabPage > >::iterator aIter = m_aTabPages.begin(); - ::std::vector< Reference< ::com::sun::star::awt::tab::XTabPage > >::iterator aEnd = m_aTabPages.end(); - for(;aIter != aEnd;++aIter) - { - Reference< awt::XControl > xControl(*aIter,UNO_QUERY ); - Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY ); - if ( tabPageID == xP->getTabPageID() ) - { - xTabPage = *aIter; - break; - } - } - return xTabPage; -} -void SAL_CALL VCLXTabPageContainer::addTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException) -{ - m_aTabPageListeners.addInterface( listener ); -} -void SAL_CALL VCLXTabPageContainer::removeTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException) -{ - m_aTabPageListeners.removeInterface( listener ); -} - -void VCLXTabPageContainer::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) -{ - SolarMutexClearableGuard aGuard; - TabControl* pTabControl = static_cast< TabControl* >( GetWindow() ); - if ( pTabControl ) - { - switch ( _rVclWindowEvent.GetId() ) - { - case VCLEVENT_TABPAGE_ACTIVATE: - { -// allocateArea( maAllocation ); - sal_uLong page = (sal_uLong)_rVclWindowEvent.GetData(); - awt::tab::TabPageActivatedEvent aEvent(NULL,page); - m_aTabPageListeners.tabPageActivated(aEvent); - break; - } - default: - aGuard.clear(); - VCLXWindow::ProcessWindowEvent( _rVclWindowEvent ); - break; - } - } -} -void SAL_CALL VCLXTabPageContainer::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException) -{ -} -void SAL_CALL VCLXTabPageContainer::elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - TabControl* pTabCtrl = (TabControl*)GetWindow(); - Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY); - if ( pTabCtrl && xTabPage.is() ) - { - Reference< awt::XControl > xControl(xTabPage,UNO_QUERY ); - Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY ); - sal_Int16 nPageID = xP->getTabPageID(); - - Window* pWindow = VCLUnoHelper::GetWindow(xControl->getPeer()); - TabPage* pPage = (TabPage*)pWindow; - pTabCtrl->InsertPage(nPageID,pPage->GetText()); - - pPage->Hide(); - pTabCtrl->SetTabPage(nPageID,pPage); - pTabCtrl->SetHelpText(nPageID,xP->getTooltip()); - pTabCtrl->SetPageImage(nPageID,TkResMgr::getImageFromURL(xP->getImageURL())); - pTabCtrl->SelectTabPage(nPageID); - m_aTabPages.push_back(xTabPage); - } -} -void SAL_CALL VCLXTabPageContainer::elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - TabControl* pTabCtrl = (TabControl*)GetWindow(); - Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY); - if ( pTabCtrl && xTabPage.is() ) - { - Reference< awt::XControl > xControl(xTabPage,UNO_QUERY ); - Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY ); - pTabCtrl->RemovePage(xP->getTabPageID()); - m_aTabPages.erase(::std::remove(m_aTabPages.begin(),m_aTabPages.end(),xTabPage)); - } -} -void SAL_CALL VCLXTabPageContainer::elementReplaced( const ::com::sun::star::container::ContainerEvent& /*Event*/ ) throw (::com::sun::star::uno::RuntimeException) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxtabpagemodel.cxx b/toolkit/source/awt/vclxtabpagemodel.cxx deleted file mode 100644 index 12e89b1085..0000000000 --- a/toolkit/source/awt/vclxtabpagemodel.cxx +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_toolkit.hxx" - -#include <toolkit/awt/vclxtabpagemodel.hxx> -#include <vcl/tabpage.hxx> -#include <vcl/tabctrl.hxx> -#include <toolkit/helper/property.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <toolkit/helper/unopropertyarrayhelper.hxx> -#include <cppuhelper/typeprovider.hxx> -// ---------------------------------------------------- -// class VCLXDialog -// ---------------------------------------------------- - -VCLXTabPageModel::VCLXTabPageModel() -{ -} - -VCLXTabPageModel::~VCLXTabPageModel() -{ -#ifndef __SUNPRO_CC - OSL_TRACE ("%s", __FUNCTION__); -#endif -} - -void SAL_CALL VCLXTabPageModel::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( GetMutex() ); - Window* pWindow = GetWindow(); - - if ( pWindow ) - { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); - if ( !pDev ) - pDev = pWindow->GetParent(); - - Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() ); - Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); - - pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS ); - } -} - -::com::sun::star::awt::DeviceInfo VCLXTabPageModel::getInfo() throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::awt::DeviceInfo aInfo;// = VCLXDevice::getInfo(); - return aInfo; -} - - -void SAL_CALL VCLXTabPageModel::setProperty( - const ::rtl::OUString& /*PropertyName*/, - const ::com::sun::star::uno::Any& /*Value*/ ) -throw(::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( GetMutex() ); - - /*TabPage* pTabPage = (TabPage*)GetWindow(); - if ( pTabPage ) - { - VCLXWindow::setProperty( PropertyName, Value ); - }*/ -} -//XTabPageModel -::sal_Int16 SAL_CALL VCLXTabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException) -{ - return 0; -} -::sal_Bool SAL_CALL VCLXTabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException) -{ - return false; -} -void SAL_CALL VCLXTabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException) -{ - //TabControl* pTabControl = (TabControl*)GetWindow(); - //if ( pTabControl ) - // pTabControl->EnablePage(0, true); -} -::rtl::OUString SAL_CALL VCLXTabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException) -{ - //TabControl* pTabControl = (TabControl*)GetWindow(); - //if ( pTabControl ) - // return pTabControl->GetPageText(0); - //else - return ::rtl::OUString(); -} -void SAL_CALL VCLXTabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException) -{ - //TabControl* pTabControl = (TabControl*)GetWindow(); - //if ( pTabControl ) - // pTabControl->SetPageText(0, _title); - -} -::rtl::OUString SAL_CALL VCLXTabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException) -{ - return ::rtl::OUString(); -} -void SAL_CALL VCLXTabPageModel::setImageURL( const ::rtl::OUString& /*_imageurl*/ ) throw (::com::sun::star::uno::RuntimeException) -{ - //m_sImageURL = _imageurl; -} -::rtl::OUString SAL_CALL VCLXTabPageModel::getTooltip() throw (::com::sun::star::uno::RuntimeException) -{ - //return m_sTooltip; - return ::rtl::OUString(); -} -void SAL_CALL VCLXTabPageModel::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException) -{ - (void)_tooltip; -} -::cppu::IPropertyArrayHelper& VCLXTabPageModel::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::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXTabPageModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) -{ - static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx deleted file mode 100644 index 1e8d9d5dd7..0000000000 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ /dev/null @@ -1,1761 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - -#include <boost/ptr_container/ptr_vector.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <stdio.h> -#ifdef WNT -#include <prewin.h> -#include <postwin.h> -#endif -#include <com/sun/star/awt/ImageScaleMode.hpp> -#include <com/sun/star/awt/WindowAttribute.hpp> -#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> -#include <com/sun/star/awt/WindowClass.hpp> -#include <com/sun/star/awt/MessageBoxButtons.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/SystemDependent.hpp> -#include <com/sun/star/awt/FocusEvent.hpp> -#include <com/sun/star/awt/KeyEvent.hpp> -#include <com/sun/star/awt/KeyModifier.hpp> -#include <com/sun/star/lang/EventObject.hpp> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/XInterface.hpp> -#include <com/sun/star/beans/NamedValue.hpp> -#include <cppuhelper/typeprovider.hxx> -#include <osl/conditn.hxx> -#include <rtl/memory.h> -#include <rtl/uuid.h> -#include <rtl/process.h> - -#ifdef QUARTZ -#include "premac.h" -#include <Cocoa/Cocoa.h> -#include "postmac.h" -#endif - -#ifdef IOS -#include "premac.h" -#include <UIKit/UIKit.h> -#include "postmac.h" -#endif - -#include <vcl/sysdata.hxx> - -#include <toolkit/awt/vclxwindows.hxx> -#include <toolkit/awt/vclxsystemdependentwindow.hxx> -#include <toolkit/awt/vclxregion.hxx> -#include <toolkit/awt/vclxtoolkit.hxx> -#include <toolkit/awt/vclxtabpagecontainer.hxx> -#include <toolkit/awt/vclxtabpagemodel.hxx> - -#include <toolkit/awt/xsimpleanimation.hxx> -#include <toolkit/awt/xthrobber.hxx> -#include <toolkit/awt/animatedimagespeer.hxx> -#include <toolkit/awt/vclxtopwindow.hxx> -#include <toolkit/awt/vclxwindow.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <toolkit/helper/unowrapper.hxx> -#include <toolkit/helper/servicenames.hxx> - -#include <toolkit/helper/macros.hxx> -#include <toolkit/helper/convert.hxx> -#include <vcl/unohelp.hxx> -#include <vcl/btndlg.hxx> -#include <vcl/button.hxx> -#include <vcl/combobox.hxx> -#include <vcl/ctrl.hxx> -#include <vcl/dialog.hxx> -#include <vcl/dockingarea.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 <vcl/throbber.hxx> -#include "toolkit/awt/vclxspinbutton.hxx" - -#include <tools/debug.hxx> -#include <comphelper/processfactory.hxx> -#include "awt/vclxtabcontrol.hxx" - -namespace css = ::com::sun::star; - -#define VCLWINDOW_FRAMEWINDOW 0x1000 -#define VCLWINDOW_SYSTEMCHILDWINDOW 0x1001 - -#if (defined WNT) -#define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 -#elif (defined QUARTZ) -#define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_MAC -#elif (defined UNX) -#define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW -#endif - -TOOLKIT_DLLPUBLIC WinBits ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt16 nCompType ) -{ - WinBits 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; - } - - bool bDecoratedWindow = false; - if ( bMessBox - || ( nCompType == WINDOW_DIALOG ) - || ( nCompType == WINDOW_MODELESSDIALOG ) - || ( nCompType == WINDOW_MODALDIALOG ) - || ( nCompType == WINDOW_SYSTEMDIALOG ) - || ( nCompType == WINDOW_PATHDIALOG ) - || ( nCompType == WINDOW_FILEDIALOG ) - || ( nCompType == WINDOW_PRINTERSETUPDIALOG ) - || ( nCompType == WINDOW_PRINTDIALOG ) - || ( nCompType == WINDOW_COLORDIALOG ) - || ( nCompType == WINDOW_FONTDIALOG ) - || ( nCompType == WINDOW_DOCKINGWINDOW ) - || ( nCompType == WINDOW_TABDIALOG ) - || ( nCompType == WINDOW_BUTTONDIALOG ) - || ( nCompType == WINDOW_SYSTEMCHILDWINDOW ) - ) - { - bDecoratedWindow = 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; - if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::NOLABEL ) //added for issue79712 - nWinBits |= WB_NOLABEL; - - // 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; - } - if ( nCompType == WINDOW_MULTILINEEDIT ) - { - if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL ) - nWinBits |= WB_AUTOHSCROLL; - if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::AUTOVSCROLL ) - nWinBits |= WB_AUTOVSCROLL; - } - - - if ( bDecoratedWindow ) - { - if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::NODECORATION ) - { - // No decoration removes several window attributes and must - // set WB_NOBORDER! - nWinBits &= ~WB_BORDER; - nWinBits &= ~WB_SIZEABLE; - nWinBits &= ~WB_MOVEABLE; - nWinBits &= ~WB_CLOSEABLE; - nWinBits |= WB_NOBORDER; - } - } - - return nWinBits; -} - -struct ComponentInfo -{ - const char* pName; - WindowType nWinType; -}; - -static ComponentInfo 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 }, - { "dockingarea", WINDOW_DOCKINGAREA }, - { "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 }, - { "frame", 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 }, - { "multilineedit", WINDOW_MULTILINEEDIT }, - { "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 }, - { "simpleanimation", WINDOW_CONTROL }, - { "animatedimages", WINDOW_CONTROL }, - { "spinbutton", WINDOW_SPINBUTTON }, - { "spinfield", WINDOW_SPINFIELD }, - { "throbber", WINDOW_CONTROL }, - { "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 }, - { "tabpagecontainer", WINDOW_CONTROL }, - { "tabpagemodel", WINDOW_TABPAGE } -}; - -extern "C" -{ -static int SAL_CALL 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 -// ---------------------------------------------------- - -static sal_Int32 nVCLToolkitInstanceCount = 0; -static sal_Bool bInitedByVCLToolkit = sal_False; -//static cppu::OInterfaceContainerHelper * pToolkits = 0; - -static osl::Mutex & getInitMutex() -{ - static osl::Mutex * pM; - if( !pM ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pM ) - { - static osl::Mutex aMutex; - pM = &aMutex; - } - } - return *pM; -} - -static osl::Condition & getInitCondition() -{ - static osl::Condition * pC = 0; - if( !pC ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pC ) - { - static osl::Condition aCondition; - pC = &aCondition; - } - } - return *pC; -} - -struct ToolkitThreadData -{ - VCLXToolkit * pTk; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; - - ToolkitThreadData( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, VCLXToolkit * pTk_ ) - : pTk( pTk_ ) - , xSMgr( rSMgr ) - { - } -}; - -extern "C" -{ -static void SAL_CALL ToolkitWorkerFunction( void* pArgs ) -{ - ToolkitThreadData * pTTD = (ToolkitThreadData *)pArgs; - bInitedByVCLToolkit = InitVCL( pTTD->xSMgr ); - if( bInitedByVCLToolkit ) - { - UnoWrapper* pUnoWrapper = new UnoWrapper( pTTD->pTk ); - Application::SetUnoWrapper( pUnoWrapper ); - } - getInitCondition().set(); - if( bInitedByVCLToolkit ) - { - { - SolarMutexGuard aGuard; - Application::Execute(); - } - try - { - pTTD->pTk->dispose(); - } - catch( com::sun::star::uno::Exception & ) - { - } - /* - if( pToolkits ) - { - cppu::OInterfaceIteratorHelper aIt( *pToolkits ); - ::com::sun::star::uno::XInterface * pI; - while( pI = aIt.next() ) - ((::com::sun::star::lang::XComponent *)pI)->dispose(); - - // delete toolkit container - osl::Guard< osl::Mutex > aGuard( getInitMutex() ); - delete pToolkits; - pToolkits = 0; - } - */ - DeInitVCL(); - } - else - { - JoinMainLoopThread(); - } - delete pTTD; -} -} - -// contructor, which might initialize VCL -VCLXToolkit::VCLXToolkit( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ): - cppu::WeakComponentImplHelper7< - ::com::sun::star::awt::XToolkit, - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::awt::XSystemChildFactory, - ::com::sun::star::awt::XMessageBoxFactory, - ::com::sun::star::awt::XDataTransferProviderAccess, - ::com::sun::star::awt::XExtendedToolkit, - ::com::sun::star::awt::XReschedule>( GetMutex() ), - m_aTopWindowListeners(rBHelper.rMutex), - m_aKeyHandlers(rBHelper.rMutex), - m_aFocusListeners(rBHelper.rMutex), - m_aEventListenerLink(LINK(this, VCLXToolkit, eventListenerHandler)), - m_aKeyListenerLink(LINK(this, VCLXToolkit, keyListenerHandler)), - m_bEventListener(false), - m_bKeyListener(false) -{ - hSvToolsLib = NULL; - fnSvtCreateWindow = NULL; - - osl::Guard< osl::Mutex > aGuard( getInitMutex() ); - nVCLToolkitInstanceCount++; - if( ( nVCLToolkitInstanceCount == 1 ) && ( !Application::IsInMain() ) ) - { - // setup execute thread - CreateMainLoopThread( ToolkitWorkerFunction, new ToolkitThreadData( rSMgr, this ) ); - getInitCondition().wait(); - /* - if( bInitedByVCLToolkit ) - { - // insert in disposing list - if( !pToolkits ) - pToolkits = new cppu::OInterfaceContainerHelper( getInitMutex() ); - pToolkits->addInterface( (::com::sun::star::lang::XComponent *)this ); - } - */ - } -} - -VCLXToolkit::~VCLXToolkit() -{ -} - - -void SAL_CALL VCLXToolkit::disposing() -{ - if ( hSvToolsLib ) - { - osl_unloadModule( hSvToolsLib ); - hSvToolsLib = NULL; - fnSvtCreateWindow = NULL; - } - - { - osl::Guard< osl::Mutex > aGuard( getInitMutex() ); - if( --nVCLToolkitInstanceCount == 0 ) - { - if( bInitedByVCLToolkit ) - { - Application::Quit(); - JoinMainLoopThread(); - bInitedByVCLToolkit = sal_False; - } - } - } - - if (m_bEventListener) - { - ::Application::RemoveEventListener(m_aEventListenerLink); - m_bEventListener = false; - } - if (m_bKeyListener) - { - ::Application::RemoveKeyListener(m_aKeyListenerLink); - m_bKeyListener = false; - } - ::css::lang::EventObject aEvent( - static_cast< ::cppu::OWeakObject * >(this)); - m_aTopWindowListeners.disposeAndClear(aEvent); - m_aKeyHandlers.disposeAndClear(aEvent); - m_aFocusListeners.disposeAndClear(aEvent); - -/* - osl::Guard< osl::Mutex > aGuard( getInitMutex() ); - // insert in disposing list - if( pToolkits ) - { - // remove from the disposing list - pToolkits->removeInterface( (::com::sun::star::lang::XComponent *)this ); - } -*/ -} - - -::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) -{ - return ImplCreateWindow( rDescriptor, WinBits(0) ); -} - -::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; - - SolarMutexGuard aSolarGuard; - - 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::ImplCreateWindow( VCLXWindow** ppNewComp, - const ::com::sun::star::awt::WindowDescriptor& rDescriptor, - Window* pParent, WinBits nWinBits ) -{ - String aServiceName( rDescriptor.WindowServiceName ); - aServiceName.ToLowerAscii(); - - Window* pNewWindow = NULL; - sal_uInt16 nType = ImplGetComponentType( aServiceName ); - bool bFrameControl = false; - if ( aServiceName == String( RTL_CONSTASCII_USTRINGPARAM("frame") ) ) - bFrameControl = true; - if ( aServiceName == String( RTL_CONSTASCII_USTRINGPARAM("tabcontrolnotabs") ) ) - { - nWinBits |= WB_NOBORDER; - nType = ImplGetComponentType( String( RTL_CONSTASCII_USTRINGPARAM("tabcontrol") ) ); - } - 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 ) - || ( nType == WINDOW_MESSBOX ) - || ( nType == WINDOW_INFOBOX ) - || ( nType == WINDOW_WARNINGBOX ) - || ( nType == WINDOW_ERRORBOX ) - || ( nType == WINDOW_QUERYBOX ) - ) - 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 ) - { - SolarMutexGuard aVclGuard; - 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|WB_AUTOHSCROLL ); - ((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( sal_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( sal_True ); - *ppNewComp = new VCLXDateField; - ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(DateField*)pNewWindow ); - break; - case WINDOW_DOCKINGAREA: - pNewWindow = new DockingAreaWindow( pParent ); - break; - case WINDOW_MULTILINEEDIT: - 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 ); - if ( bFrameControl ) - { - GroupBox* pGroupBox = static_cast< GroupBox* >( pNewWindow ); - *ppNewComp = new VCLXFrame; - // Frame control needs to recieve - // Mouse events - pGroupBox->SetMouseTransparent( sal_False ); - } - } - 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|WB_SIMPLEMODE|WB_AUTOHSCROLL ); - ((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 ); - *ppNewComp = new VCLXMetricField; - ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(MetricField*)pNewWindow ); - break; - case WINDOW_DIALOG: - case WINDOW_MODALDIALOG: - case WINDOW_MODELESSDIALOG: - { - // Modal/Modeless nur durch Show/Execute - if ( (pParent == NULL ) && ( rDescriptor.ParentIndex == -1 ) ) - pParent = DIALOG_NO_PARENT; - pNewWindow = new Dialog( pParent, nWinBits ); - // #i70217# Don't always create a new component object. It's possible that VCL has called - // GetComponentInterface( sal_True ) in the Dialog ctor itself (see Window::IsTopWindow() ) - // which creates a component object. - css::uno::Reference< css::awt::XWindowPeer > xWinPeer = pNewWindow->GetComponentInterface( sal_False ); - if ( xWinPeer.is() ) - *ppNewComp = dynamic_cast< VCLXDialog* >( xWinPeer.get() ); - else - *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( sal_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; - - // by default, disable RadioCheck - // Since the VCLXRadioButton really cares for it's RadioCheck settings, this is important: - // if we enable it, the VCLXRadioButton will use RadioButton::Check instead of RadioButton::SetState - // This leads to a strange behaviour if the control is newly created: when settings the initial - // state to "checked", the RadioButton::Check (called because RadioCheck=sal_True) will uncheck - // _all_other_ radio buttons in the same group. However, at this moment the grouping of the controls - // is not really valid: the controls are grouped after they have been created, but we're still in - // the creation process, so the RadioButton::Check relies on invalid grouping information. - // 07.08.2001 - #87254# - frank.schoenheit@sun.com - static_cast<RadioButton*>(pNewWindow)->EnableRadioCheck( sal_False ); - 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 ::toolkit::VCLXSpinButton; - 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 ); - *ppNewComp = new VCLXMultiPage; - break; - case WINDOW_TABDIALOG: - pNewWindow = new TabDialog( pParent, nWinBits ); - break; - case WINDOW_TABPAGE: - /* - if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCaseAsciiL( - RTL_CONSTASCII_STRINGPARAM("tabpagemodel") ) ) - { - pNewWindow = new TabControl( pParent, nWinBits ); - *ppNewComp = new VCLXTabPageContainer; - } - else - */ - { - pNewWindow = new TabPage( pParent, nWinBits ); - *ppNewComp = new VCLXTabPage; - } - break; - case WINDOW_TIMEBOX: - pNewWindow = new TimeBox( pParent, nWinBits ); - break; - case WINDOW_TIMEFIELD: - pNewWindow = new TimeField( pParent, nWinBits ); - static_cast<TimeField*>(pNewWindow)->EnableEmptyFieldValue( sal_True ); - *ppNewComp = new VCLXTimeField; - ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(TimeField*)pNewWindow ); - break; - case WINDOW_TOOLBOX: - pNewWindow = new ToolBox( pParent, nWinBits ); - *ppNewComp = new VCLXToolBox; - 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 - { - if ((pParent == NULL) && rDescriptor.Parent.is()) - { - // try to get a system dependent window handle - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer > xSystemDepParent(rDescriptor.Parent, ::com::sun::star::uno::UNO_QUERY); - - if (xSystemDepParent.is()) - { - sal_Int8 processID[16]; - - rtl_getGlobalProcessId( (sal_uInt8*)processID ); - - ::com::sun::star::uno::Sequence<sal_Int8> processIdSeq(processID, 16); - - ::com::sun::star::uno::Any anyHandle = xSystemDepParent->getWindowHandle(processIdSeq, SYSTEM_DEPENDENT_TYPE); - - // use sal_Int64 here to accomodate all int types - // uno::Any shift operator whill upcast if necessary - sal_Int64 nWindowHandle = 0; - sal_Bool bXEmbed = sal_False; - - bool bUseParentData = true; - if( ! (anyHandle >>= nWindowHandle) ) - { - css::uno::Sequence< css::beans::NamedValue > aProps; - if( anyHandle >>= aProps ) - { - const int nProps = aProps.getLength(); - const css::beans::NamedValue* pProps = aProps.getConstArray(); - for( int i = 0; i < nProps; i++ ) - { - if( pProps[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "WINDOW" ) ) ) - pProps[i].Value >>= nWindowHandle; - else if( pProps[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "XEMBED" ) ) ) - pProps[i].Value >>= bXEmbed; - } - } - else - bUseParentData = false; - } - - if( bUseParentData ) - { - SystemParentData aParentData; - aParentData.nSize = sizeof( aParentData ); - #if defined QUARTZ - aParentData.pView = reinterpret_cast<NSView*>(nWindowHandle); - #elif defined IOS - aParentData.pView = reinterpret_cast<UIView*>(nWindowHandle); - #elif defined UNX - aParentData.aWindow = nWindowHandle; - aParentData.bXEmbedSupport = bXEmbed; - #elif defined WNT - aParentData.hWnd = reinterpret_cast<HWND>(nWindowHandle); - #endif - pNewWindow = new WorkWindow( &aParentData ); - } - } - } - - if (!pNewWindow) - pNewWindow = new WorkWindow( pParent, nWinBits ); - } - - *ppNewComp = new VCLXTopWindow( pNewWindow->GetType() == WINDOW_WORKWINDOW ); - } - 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; - case WINDOW_CONTROL: - if ( aServiceName.EqualsAscii( "simpleanimation" ) ) - { - pNewWindow = new Throbber( pParent, nWinBits, Throbber::IMAGES_NONE ); - ((Throbber*)pNewWindow)->SetScaleMode( css::awt::ImageScaleMode::Anisotropic ); - // (compatibility) - *ppNewComp = new ::toolkit::XSimpleAnimation; - } - else if ( aServiceName.EqualsAscii( "throbber" ) ) - { - pNewWindow = new Throbber( pParent, nWinBits, Throbber::IMAGES_NONE ); - ((Throbber*)pNewWindow)->SetScaleMode( css::awt::ImageScaleMode::Anisotropic ); - // (compatibility) - *ppNewComp = new ::toolkit::XThrobber; - } - else if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCaseAsciiL( - RTL_CONSTASCII_STRINGPARAM("tabpagecontainer") ) ) - { - pNewWindow = new TabControl( pParent, nWinBits ); - *ppNewComp = new VCLXTabPageContainer; - } - else if ( aServiceName.EqualsAscii( "animatedimages" ) ) - { - pNewWindow = new Throbber( pParent, nWinBits ); - *ppNewComp = new ::toolkit::AnimatedImagesPeer; - } - break; - default: - OSL_ENSURE( false, "VCLXToolkit::ImplCreateWindow: unknown window type!" ); - break; - } - } - - return pNewWindow; -} - -extern "C" { static void SAL_CALL thisModule() {} } - -css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow( - const css::awt::WindowDescriptor& rDescriptor, - WinBits nForceWinBits ) -{ - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - SolarMutexGuard aSolarGuard; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xRef; - - Window* pParent = NULL; - if ( rDescriptor.Parent.is() ) - { - VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( rDescriptor.Parent ); - - // #103939# Don't throw assertion, may be it's a system dependend window, used in ImplCreateWindow. - // DBG_ASSERT( pParentComponent, "ParentComponent not valid" ); - - if ( pParentComponent ) - pParent = pParentComponent->GetWindow(); - } - - WinBits nWinBits = ImplGetWinBits( rDescriptor.WindowAttributes, - ImplGetComponentType( rDescriptor.WindowServiceName ) ); - nWinBits |= nForceWinBits; - - VCLXWindow* pNewComp = NULL; - - Window* pNewWindow = NULL; - // Try to create the window with SvTools - // (do this _before_ creating it on our own: The old mechanism (extended toolkit in SvTools) did it this way, - // and we need to stay compatible) - // try to load the lib - if ( !fnSvtCreateWindow && !hSvToolsLib ) - { - ::rtl::OUString aLibName = ::vcl::unohelper::CreateLibraryName( "svt", sal_True ); - hSvToolsLib = osl_loadModuleRelative( - &thisModule, aLibName.pData, SAL_LOADMODULE_DEFAULT ); - if ( hSvToolsLib ) - { - ::rtl::OUString aFunctionName( RTL_CONSTASCII_USTRINGPARAM( "CreateWindow" ) ); - fnSvtCreateWindow = (FN_SvtCreateWindow)osl_getFunctionSymbol( hSvToolsLib, aFunctionName.pData ); - } - } - // ask the SvTool creation function - if ( fnSvtCreateWindow ) - pNewWindow = fnSvtCreateWindow( &pNewComp, &rDescriptor, pParent, nWinBits ); - - // if SvTools could not provide a window, create it ourself - if ( !pNewWindow ) - pNewWindow = ImplCreateWindow( &pNewComp, rDescriptor, pParent, nWinBits ); - - DBG_ASSERT( pNewWindow, "createWindow: Unknown Component!" ); - DBG_ASSERTWARNING( pNewComp, "createWindow: No special Interface!" ); - - if ( pNewWindow ) - { - pNewWindow->SetCreatedWithToolkit( sal_True ); - //pNewWindow->SetPosPixel( Point() ); // do not force (0,0) position, keep default pos instead - - 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 ( !pNewComp ) - { - // Default-Interface - xRef = pNewWindow->GetComponentInterface( sal_True ); - } - else - { - pNewComp->SetCreatedWithToolkit( sal_True ); - xRef = pNewComp; - pNewWindow->SetComponentInterface( xRef ); - } - DBG_ASSERT( pNewWindow->GetComponentInterface( sal_False ) == xRef, - "VCLXToolkit::createWindow: did #133706# resurge?" ); - - if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::SHOW ) - pNewWindow->Show(); - } - - 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::awt::XSystemChildFactory -::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::createSystemChild( const ::com::sun::star::uno::Any& Parent, const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 nSystemType ) throw(::com::sun::star::uno::RuntimeException) -{ - Window* pChildWindow = NULL; - if ( nSystemType == SYSTEM_DEPENDENT_TYPE ) - { - // use sal_Int64 here to accomodate all int types - // uno::Any shift operator whill upcast if necessary - sal_Int64 nWindowHandle = 0; - sal_Bool bXEmbed = sal_False; - - bool bUseParentData = true; - if( ! (Parent >>= nWindowHandle) ) - { - css::uno::Sequence< css::beans::NamedValue > aProps; - if( Parent >>= aProps ) - { - const int nProps = aProps.getLength(); - const css::beans::NamedValue* pProps = aProps.getConstArray(); - for( int i = 0; i < nProps; i++ ) - { - if( pProps[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "WINDOW" ) ) ) - pProps[i].Value >>= nWindowHandle; - else if( pProps[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "XEMBED" ) ) ) - pProps[i].Value >>= bXEmbed; - } - } - else - bUseParentData = false; - } - - if( bUseParentData ) - { - SystemParentData aParentData; - aParentData.nSize = sizeof( aParentData ); - #if defined QUARTZ - aParentData.pView = reinterpret_cast<NSView*>(nWindowHandle); - #elif defined IOS - aParentData.pView = reinterpret_cast<UIView*>(nWindowHandle); - #elif defined UNX - aParentData.aWindow = nWindowHandle; - aParentData.bXEmbedSupport = bXEmbed; - #elif defined WNT - aParentData.hWnd = reinterpret_cast<HWND>(nWindowHandle); - #endif - SolarMutexGuard aGuard; - try - { - pChildWindow = new WorkWindow( &aParentData ); - } - catch ( ::com::sun::star::uno::RuntimeException & rEx ) - { - // system child window could not be created - OSL_TRACE( - "VCLXToolkit::createSystemChild: caught %s\n", - ::rtl::OUStringToOString( - rEx.Message, RTL_TEXTENCODING_UTF8).getStr()); - pChildWindow = NULL; - } - } - } - else if (nSystemType == com::sun::star::lang::SystemDependent::SYSTEM_JAVA) - { - SolarMutexGuard aGuard; - pChildWindow = new WorkWindow(0, Parent); - } - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer; - if ( pChildWindow ) - { - VCLXTopWindow* pPeer = new VCLXTopWindow(true); - SolarMutexGuard aGuard; - pPeer->SetWindow( pChildWindow ); - xPeer = pPeer; - } - - return xPeer; -} - -// ::com::sun::star::awt::XMessageBoxFactory -::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox > SAL_CALL VCLXToolkit::createMessageBox( - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& aParent, - const ::com::sun::star::awt::Rectangle& aPosSize, - const ::rtl::OUString& aType, - ::sal_Int32 aButtons, - const ::rtl::OUString& aTitle, - const ::rtl::OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::awt::WindowDescriptor aDescriptor; - - sal_Int32 nWindowAttributes = css::awt::WindowAttribute::BORDER|css::awt::WindowAttribute::MOVEABLE|css::awt::WindowAttribute::CLOSEABLE; - - // Map button definitions to window attributes - if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_OK ) - nWindowAttributes |= css::awt::VclWindowPeerAttribute::OK; - else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_OK_CANCEL ) - nWindowAttributes |= css::awt::VclWindowPeerAttribute::OK_CANCEL; - else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_YES_NO ) - nWindowAttributes |= css::awt::VclWindowPeerAttribute::YES_NO; - else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_YES_NO_CANCEL ) - nWindowAttributes |= css::awt::VclWindowPeerAttribute::YES_NO_CANCEL; - else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_RETRY_CANCEL ) - nWindowAttributes |= css::awt::VclWindowPeerAttribute::RETRY_CANCEL; - - // Map default button definitions to window attributes - if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_OK ) - nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_OK; - else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_CANCEL ) - nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_CANCEL; - else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_YES ) - nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_YES; - else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_NO ) - nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_NO; - else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_RETRY ) - nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_RETRY; - - // No more bits for VclWindowPeerAttribute possible. Mapping must be - // done explicitly using VCL methods - WinBits nAddWinBits( 0 ); - if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_ABORT_IGNORE_RETRY ) - nAddWinBits |= WB_ABORT_RETRY_IGNORE; - if ( sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_IGNORE ) - nAddWinBits |= WB_DEF_IGNORE; - - aDescriptor.Type = css::awt::WindowClass_MODALTOP; - aDescriptor.WindowServiceName = aType; - aDescriptor.ParentIndex = -1; - aDescriptor.Parent = aParent; - aDescriptor.Bounds = aPosSize; - aDescriptor.WindowAttributes = nWindowAttributes; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox > xMsgBox( - ImplCreateWindow( aDescriptor, nAddWinBits ), css::uno::UNO_QUERY ); - css::uno::Reference< css::awt::XWindow > xWindow( xMsgBox, css::uno::UNO_QUERY ); - if ( xMsgBox.is() && xWindow.is() ) - { - Window * pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - { - SolarMutexGuard aGuard; - xMsgBox->setCaptionText( aTitle ); - xMsgBox->setMessageText( aMessage ); - } - } - - return xMsgBox; -} - -::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > SAL_CALL VCLXToolkit::getDragGestureRecognizer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException) -{ - Window * pWindow = VCLUnoHelper::GetWindow( window ); - - if( pWindow ) - return pWindow->GetDragGestureRecognizer(); - - return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer >(); -} - -::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > SAL_CALL VCLXToolkit::getDragSource( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException) -{ - Window * pWindow = VCLUnoHelper::GetWindow( window ); - - if( pWindow ) - return pWindow->GetDragSource(); - - return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >(); -} - -::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > SAL_CALL VCLXToolkit::getDropTarget( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException) -{ - Window * pWindow = VCLUnoHelper::GetWindow( window ); - - if( pWindow ) - return pWindow->GetDropTarget(); - - return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >(); -} - -::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > SAL_CALL VCLXToolkit::getClipboard( const ::rtl::OUString& clipboardName ) throw(::com::sun::star::uno::RuntimeException) -{ - if( clipboardName.getLength() == 0 ) - { - if( !mxClipboard.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - { - // remember clipboard here - mxClipboard = ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > ( - xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")) ), ::com::sun::star::uno::UNO_QUERY ); - } - } - - return mxClipboard; - } - - else if( clipboardName.equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Selection")) ) ) - { - return mxSelection; - } - - return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >(); -} - -// XServiceInfo -::rtl::OUString VCLXToolkit::getImplementationName() throw(::com::sun::star::uno::RuntimeException) -{ - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("stardiv.Toolkit.VCLXToolkit")); -} - -sal_Bool VCLXToolkit::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( GetMutex() ); - - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames(); - const ::rtl::OUString* pArray = aSNL.getConstArray(); - const ::rtl::OUString* pArrayEnd = aSNL.getConstArray(); - for (; pArray != pArrayEnd; ++pArray ) - if( *pArray == rServiceName ) - break; - - return pArray != pArrayEnd; -} - -::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXToolkit::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) -{ - ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) ); - return ::com::sun::star::uno::Sequence< ::rtl::OUString >( &aServiceName, 1); -} - -// css::awt::XExtendedToolkit: - -// virtual -::sal_Int32 SAL_CALL VCLXToolkit::getTopWindowCount() - throw (::css::uno::RuntimeException) -{ - return static_cast< ::sal_Int32 >(::Application::GetTopWindowCount()); - // XXX numeric overflow -} - -// virtual -::css::uno::Reference< ::css::awt::XTopWindow > SAL_CALL -VCLXToolkit::getTopWindow(::sal_Int32 nIndex) - throw (::css::uno::RuntimeException) -{ - ::Window * p = ::Application::GetTopWindow(static_cast< long >(nIndex)); - // XXX numeric overflow - return ::css::uno::Reference< ::css::awt::XTopWindow >( - p == 0 ? 0 : static_cast< ::css::awt::XWindow * >(p->GetWindowPeer()), - ::css::uno::UNO_QUERY); -} - -// virtual -::css::uno::Reference< ::css::awt::XTopWindow > SAL_CALL -VCLXToolkit::getActiveTopWindow() throw (::css::uno::RuntimeException) -{ - ::Window * p = ::Application::GetActiveTopWindow(); - return ::css::uno::Reference< ::css::awt::XTopWindow >( - p == 0 ? 0 : static_cast< ::css::awt::XWindow * >(p->GetWindowPeer()), - ::css::uno::UNO_QUERY); -} - -// virtual -void SAL_CALL VCLXToolkit::addTopWindowListener( - ::css::uno::Reference< ::css::awt::XTopWindowListener > const & rListener) - throw (::css::uno::RuntimeException) -{ - OSL_ENSURE(rListener.is(), "Null rListener"); - ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex); - if (rBHelper.bDisposed || rBHelper.bInDispose) - { - aGuard.clear(); - rListener->disposing( - ::css::lang::EventObject( - static_cast< ::cppu::OWeakObject * >(this))); - } - else if (m_aTopWindowListeners.addInterface(rListener) == 1 - && !m_bEventListener) - { - m_bEventListener = true; - ::Application::AddEventListener(m_aEventListenerLink); - } -} - -// virtual -void SAL_CALL VCLXToolkit::removeTopWindowListener( - ::css::uno::Reference< ::css::awt::XTopWindowListener > const & rListener) - throw (::css::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(rBHelper.rMutex); - if (!(rBHelper.bDisposed || rBHelper.bInDispose) - && m_aTopWindowListeners.removeInterface(rListener) == 0 - && m_aFocusListeners.getLength() == 0 && m_bEventListener) - { - ::Application::RemoveEventListener(m_aEventListenerLink); - m_bEventListener = false; - } -} - -// virtual -void SAL_CALL VCLXToolkit::addKeyHandler( - ::css::uno::Reference< ::css::awt::XKeyHandler > const & rHandler) - throw (::css::uno::RuntimeException) -{ - OSL_ENSURE(rHandler.is(), "Null rHandler"); - ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex); - if (rBHelper.bDisposed || rBHelper.bInDispose) - { - aGuard.clear(); - rHandler->disposing( - ::css::lang::EventObject( - static_cast< ::cppu::OWeakObject * >(this))); - } - else if (m_aKeyHandlers.addInterface(rHandler) == 1 && !m_bKeyListener) - { - m_bKeyListener = true; - ::Application::AddKeyListener(m_aKeyListenerLink); - } -} - -// virtual -void SAL_CALL VCLXToolkit::removeKeyHandler( - ::css::uno::Reference< ::css::awt::XKeyHandler > const & rHandler) - throw (::css::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(rBHelper.rMutex); - if (!(rBHelper.bDisposed || rBHelper.bInDispose) - && m_aKeyHandlers.removeInterface(rHandler) == 0 && m_bKeyListener) - { - ::Application::RemoveKeyListener(m_aKeyListenerLink); - m_bKeyListener = false; - } -} - -// virtual -void SAL_CALL VCLXToolkit::addFocusListener( - ::css::uno::Reference< ::css::awt::XFocusListener > const & rListener) - throw (::css::uno::RuntimeException) -{ - OSL_ENSURE(rListener.is(), "Null rListener"); - ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex); - if (rBHelper.bDisposed || rBHelper.bInDispose) - { - aGuard.clear(); - rListener->disposing( - ::css::lang::EventObject( - static_cast< ::cppu::OWeakObject * >(this))); - } - else if (m_aFocusListeners.addInterface(rListener) == 1 - && !m_bEventListener) - { - m_bEventListener = true; - ::Application::AddEventListener(m_aEventListenerLink); - } -} - -// virtual -void SAL_CALL VCLXToolkit::removeFocusListener( - ::css::uno::Reference< ::css::awt::XFocusListener > const & rListener) - throw (::css::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(rBHelper.rMutex); - if (!(rBHelper.bDisposed || rBHelper.bInDispose) - && m_aFocusListeners.removeInterface(rListener) == 0 - && m_aTopWindowListeners.getLength() == 0 && m_bEventListener) - { - ::Application::RemoveEventListener(m_aEventListenerLink); - m_bEventListener = false; - } -} - -// virtual -void SAL_CALL VCLXToolkit::fireFocusGained( - ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface > const &) - throw (::com::sun::star::uno::RuntimeException) -{ -} - -// virtual -void SAL_CALL VCLXToolkit::fireFocusLost( - ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface > const &) - throw (::com::sun::star::uno::RuntimeException) -{ -} - - -IMPL_LINK(VCLXToolkit, eventListenerHandler, ::VclSimpleEvent const *, pEvent) -{ - switch (pEvent->GetId()) - { - case VCLEVENT_WINDOW_SHOW: - callTopWindowListeners( - pEvent, &::css::awt::XTopWindowListener::windowOpened); - break; - case VCLEVENT_WINDOW_HIDE: - callTopWindowListeners( - pEvent, &::css::awt::XTopWindowListener::windowClosed); - break; - case VCLEVENT_WINDOW_ACTIVATE: - callTopWindowListeners( - pEvent, &::css::awt::XTopWindowListener::windowActivated); - break; - case VCLEVENT_WINDOW_DEACTIVATE: - callTopWindowListeners( - pEvent, &::css::awt::XTopWindowListener::windowDeactivated); - break; - case VCLEVENT_WINDOW_CLOSE: - callTopWindowListeners( - pEvent, &::css::awt::XTopWindowListener::windowClosing); - break; - case VCLEVENT_WINDOW_GETFOCUS: - callFocusListeners(pEvent, true); - break; - case VCLEVENT_WINDOW_LOSEFOCUS: - callFocusListeners(pEvent, false); - break; - case VCLEVENT_WINDOW_MINIMIZE: - callTopWindowListeners( - pEvent, &::css::awt::XTopWindowListener::windowMinimized); - break; - case VCLEVENT_WINDOW_NORMALIZE: - callTopWindowListeners( - pEvent, &::css::awt::XTopWindowListener::windowNormalized); - break; - } - return 0; -} - -IMPL_LINK(VCLXToolkit, keyListenerHandler, ::VclSimpleEvent const *, pEvent) -{ - switch (pEvent->GetId()) - { - case VCLEVENT_WINDOW_KEYINPUT: - return callKeyHandlers(pEvent, true); - case VCLEVENT_WINDOW_KEYUP: - return callKeyHandlers(pEvent, false); - } - return 0; -} - -void VCLXToolkit::callTopWindowListeners( - ::VclSimpleEvent const * pEvent, - void (SAL_CALL ::css::awt::XTopWindowListener::* pFn)( - ::css::lang::EventObject const &)) -{ - ::Window * pWindow - = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); - if (pWindow->IsTopWindow()) - { - ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > - aListeners(m_aTopWindowListeners.getElements()); - if (aListeners.hasElements()) - { - ::css::lang::EventObject aAwtEvent( - static_cast< ::css::awt::XWindow * >(pWindow->GetWindowPeer())); - for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i) - { - ::css::uno::Reference< ::css::awt::XTopWindowListener > - xListener(aListeners[i], ::css::uno::UNO_QUERY); - try - { - (xListener.get()->*pFn)(aAwtEvent); - } - catch (::css::uno::RuntimeException & rEx) - { - OSL_TRACE( - "VCLXToolkit::callTopWindowListeners: caught %s\n", - ::rtl::OUStringToOString( - rEx.Message, RTL_TEXTENCODING_UTF8).getStr()); - } - } - } - } -} - -long VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent, - bool bPressed) -{ - ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > - aHandlers(m_aKeyHandlers.getElements()); - - if (aHandlers.hasElements()) - { - ::Window * pWindow = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); - - // See implementation in vclxwindow.cxx for mapping between VCL and UNO AWT event - ::KeyEvent * pKeyEvent = static_cast< ::KeyEvent * >( - static_cast< ::VclWindowEvent const * >(pEvent)->GetData()); - ::css::awt::KeyEvent aAwtEvent( - static_cast< ::css::awt::XWindow * >(pWindow->GetWindowPeer()), - (pKeyEvent->GetKeyCode().IsShift() - ? ::css::awt::KeyModifier::SHIFT : 0) - | (pKeyEvent->GetKeyCode().IsMod1() - ? ::css::awt::KeyModifier::MOD1 : 0) - | (pKeyEvent->GetKeyCode().IsMod2() - ? ::css::awt::KeyModifier::MOD2 : 0) - | (pKeyEvent->GetKeyCode().IsMod3() - ? ::css::awt::KeyModifier::MOD3 : 0), - pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(), - sal::static_int_cast< sal_Int16 >( - pKeyEvent->GetKeyCode().GetFunction())); - for (::sal_Int32 i = 0; i < aHandlers.getLength(); ++i) - { - ::css::uno::Reference< ::css::awt::XKeyHandler > xHandler( - aHandlers[i], ::css::uno::UNO_QUERY); - try - { - if ((bPressed ? xHandler->keyPressed(aAwtEvent) - : xHandler->keyReleased(aAwtEvent))) - return 1; - } - catch (::css::uno::RuntimeException & rEx) - { - OSL_TRACE( - "VCLXToolkit::callKeyHandlers: caught %s\n", - ::rtl::OUStringToOString( - rEx.Message, RTL_TEXTENCODING_UTF8).getStr()); - } - } - } - return 0; -} - -void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent, - bool bGained) -{ - ::Window * pWindow - = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); - if (pWindow->IsTopWindow()) - { - ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > - aListeners(m_aFocusListeners.getElements()); - if (aListeners.hasElements()) - { - // Ignore the interior of compound controls when determining the - // window that gets the focus next (see implementation in - // vclxwindow.cxx for mapping between VCL and UNO AWT event): - ::css::uno::Reference< css::uno::XInterface > xNext; - ::Window * pFocus = ::Application::GetFocusWindow(); - for (::Window * p = pFocus; p != 0; p = p->GetParent()) - if (!p->IsCompoundControl()) - { - pFocus = p; - break; - } - if (pFocus != 0) - xNext = pFocus->GetComponentInterface(true); - ::css::awt::FocusEvent aAwtEvent( - static_cast< ::css::awt::XWindow * >(pWindow->GetWindowPeer()), - pWindow->GetGetFocusFlags(), xNext, false); - for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i) - { - ::css::uno::Reference< ::css::awt::XFocusListener > xListener( - aListeners[i], ::css::uno::UNO_QUERY); - try - { - bGained ? xListener->focusGained(aAwtEvent) - : xListener->focusLost(aAwtEvent); - } - catch (::css::uno::RuntimeException & rEx) - { - OSL_TRACE( - "VCLXToolkit::callFocusListeners: caught %s\n", - ::rtl::OUStringToOString( - rEx.Message, RTL_TEXTENCODING_UTF8).getStr()); - } - } - } - } -} - -// css::awt::XReschedule: - -void SAL_CALL VCLXToolkit::reschedule() - throw (::com::sun::star::uno::RuntimeException) -{ - Application::Reschedule(true); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx deleted file mode 100644 index 04407bbc80..0000000000 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ /dev/null @@ -1,335 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" -#include <com/sun/star/lang/SystemDependent.hpp> -#include <com/sun/star/awt/SystemDependentXWindow.hpp> - -#if defined ( QUARTZ ) -#include "premac.h" -#include <Cocoa/Cocoa.h> -#include "postmac.h" -#endif - -#if defined ( IOS ) -#include "premac.h" -#include <UIKit/UIKit.h> -#include "postmac.h" -#endif - -#include <vcl/syschild.hxx> -#include <vcl/sysdata.hxx> -#include <cppuhelper/typeprovider.hxx> -#include <comphelper/sequence.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 <vcl/svapp.hxx> - -#include <tools/debug.hxx> - -using ::com::sun::star::uno::RuntimeException; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Type; -using ::com::sun::star::uno::Any; -using ::com::sun::star::lang::IndexOutOfBoundsException; - -VCLXTopWindow_Base::VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer ) - :m_bWHWND( _bSupportSystemWindowPeer ) -{ -} - -VCLXTopWindow_Base::~VCLXTopWindow_Base() -{ -} - -Any VCLXTopWindow_Base::queryInterface( const Type & rType ) throw(RuntimeException) -{ - ::com::sun::star::uno::Any aRet( VCLXTopWindow_XBase::queryInterface( rType ) ); - - // do not expose XSystemDependentWindowPeer if we do not have a system window handle - if ( !aRet.hasValue() && m_bWHWND ) - aRet = VCLXTopWindow_SBase::queryInterface( rType ); - - return aRet; -} - -Sequence< Type > VCLXTopWindow_Base::getTypes() throw(RuntimeException) -{ - Sequence< Type > aTypes( VCLXTopWindow_XBase::getTypes() ); - if ( m_bWHWND ) - aTypes = ::comphelper::concatSequences( aTypes, VCLXTopWindow_SBase::getTypes() ); - return aTypes; -} - -::com::sun::star::uno::Any VCLXTopWindow_Base::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - // TODO, check the process id - ::com::sun::star::uno::Any aRet; - Window* pWindow = GetWindowImpl(); - if ( pWindow ) - { - const SystemEnvData* pSysData = ((SystemWindow *)pWindow)->GetSystemData(); - if( pSysData ) - { -#if (defined WNT) - if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 ) - { - aRet <<= (sal_Int32)pSysData->hWnd; - } -#elif (defined QUARTZ) - if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC ) - { - aRet <<= (sal_IntPtr)pSysData->pView; - } -#elif (defined IOS) - if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_IOS ) - { - aRet <<= (sal_IntPtr)pSysData->pView; - } -#elif (defined UNX) - if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW ) - { - ::com::sun::star::awt::SystemDependentXWindow aSD; - aSD.DisplayPointer = sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(pSysData->pDisplay)); - aSD.WindowHandle = pSysData->aWindow; - aRet <<= aSD; - } -#endif - } - } - return aRet; -} - -void VCLXTopWindow_Base::addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - GetTopWindowListenersImpl().addInterface( rxListener ); -} - -void VCLXTopWindow_Base::removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - GetTopWindowListenersImpl().removeInterface( rxListener ); -} - -void VCLXTopWindow_Base::toFront( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindowImpl(); - if ( pWindow ) - ((WorkWindow*)pWindow)->ToTop( TOTOP_RESTOREWHENMIN ); -} - -void VCLXTopWindow_Base::toBack( ) throw(::com::sun::star::uno::RuntimeException) -{ -} - -void VCLXTopWindow_Base::setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& rxMenu ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - SystemWindow* pWindow = (SystemWindow*) GetWindowImpl(); - if ( pWindow ) - { - pWindow->SetMenuBar( NULL ); - if ( rxMenu.is() ) - { - VCLXMenu* pMenu = VCLXMenu::GetImplementation( rxMenu ); - if ( pMenu && !pMenu->IsPopupMenu() ) - pWindow->SetMenuBar( (MenuBar*) pMenu->GetMenu() ); - } - } - mxMenuBar = rxMenu; -} - -//-------------------------------------------------------------------- -::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMaximized() throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() ); - if ( !pWindow ) - return sal_False; - - return pWindow->IsMaximized(); -} - -//-------------------------------------------------------------------- -void SAL_CALL VCLXTopWindow_Base::setIsMaximized( ::sal_Bool _ismaximized ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() ); - if ( !pWindow ) - return; - - pWindow->Maximize( _ismaximized ); -} - -//-------------------------------------------------------------------- -::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMinimized() throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() ); - if ( !pWindow ) - return sal_False; - - return pWindow->IsMinimized(); -} - -//-------------------------------------------------------------------- -void SAL_CALL VCLXTopWindow_Base::setIsMinimized( ::sal_Bool _isMinimized ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() ); - if ( !pWindow ) - return; - - _isMinimized ? pWindow->Minimize() : pWindow->Restore(); -} - -//-------------------------------------------------------------------- -::sal_Int32 SAL_CALL VCLXTopWindow_Base::getDisplay() throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - const SystemWindow* pWindow = dynamic_cast< const SystemWindow* >( GetWindowImpl() ); - if ( !pWindow ) - return 0; - - return pWindow->GetScreenNumber(); -} - -//-------------------------------------------------------------------- -void SAL_CALL VCLXTopWindow_Base::setDisplay( ::sal_Int32 _display ) throw (RuntimeException, IndexOutOfBoundsException) -{ - SolarMutexGuard aGuard; - - if ( ( _display < 0 ) || ( _display >= (sal_Int32)Application::GetScreenCount() ) ) - throw IndexOutOfBoundsException(); - - SystemWindow* pWindow = dynamic_cast< SystemWindow* >( GetWindowImpl() ); - if ( !pWindow ) - return; - - pWindow->SetScreenNumber( _display ); -} - -// ---------------------------------------------------- -// class VCLXTopWindow -// ---------------------------------------------------- - -void VCLXTopWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - VCLXContainer::ImplGetPropertyIds( rIds ); -} - -VCLXTopWindow::VCLXTopWindow(bool bWHWND) - : VCLXTopWindow_Base( bWHWND ) -{ -} - -VCLXTopWindow::~VCLXTopWindow() -{ -} - -Window* VCLXTopWindow::GetWindowImpl() -{ - return VCLXContainer::GetWindow(); -} - -::cppu::OInterfaceContainerHelper& VCLXTopWindow::GetTopWindowListenersImpl() -{ - return GetTopWindowListeners(); -} - -// ::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( VCLXTopWindow_Base::queryInterface( rType ) ); - - if ( !aRet.hasValue() ) - aRet = VCLXContainer::queryInterface( rType ); - - return aRet; -} - -::com::sun::star::uno::Sequence< sal_Int8 > VCLXTopWindow::getImplementationId() throw(::com::sun::star::uno::RuntimeException) -{ - static ::cppu::OImplementationId* pId = NULL; - static ::cppu::OImplementationId* pIdWithHandle = NULL; - if ( isSystemDependentWindowPeer() ) - { - if( !pIdWithHandle ) - { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pIdWithHandle ) - { - static ::cppu::OImplementationId idWithHandle( sal_False ); - pIdWithHandle = &idWithHandle; - } - } - - return (*pIdWithHandle).getImplementationId(); - } - else - { - 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 > VCLXTopWindow::getTypes() throw(::com::sun::star::uno::RuntimeException) -{ - return ::comphelper::concatSequences( VCLXTopWindow_Base::getTypes(), VCLXContainer::getTypes() ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx deleted file mode 100644 index 10ecfcf678..0000000000 --- a/toolkit/source/awt/vclxwindow.cxx +++ /dev/null @@ -1,2628 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - -#include <com/sun/star/awt/WindowEvent.hpp> -#include <com/sun/star/awt/KeyEvent.hpp> -#include <com/sun/star/awt/KeyModifier.hpp> -#include <com/sun/star/awt/MouseEvent.hpp> -#include <com/sun/star/awt/MouseButton.hpp> -#include <com/sun/star/awt/MouseWheelBehavior.hpp> -#include <com/sun/star/awt/XTopWindow.hpp> -#include <com/sun/star/awt/Style.hpp> -#include <com/sun/star/accessibility/AccessibleRole.hpp> -#include <com/sun/star/awt/DockingEvent.hpp> -#include <com/sun/star/awt/EndDockingEvent.hpp> -#include <com/sun/star/awt/EndPopupModeEvent.hpp> -#include <com/sun/star/awt/XWindowListener2.hpp> -#include <com/sun/star/style/VerticalAlignment.hpp> -#include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/text/WritingMode2.hpp> -#include <toolkit/awt/vclxwindow.hxx> -#include <toolkit/awt/vclxpointer.hxx> -#include <toolkit/awt/vclxwindows.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 <toolkit/helper/accessibilityclient.hxx> -#include <cppuhelper/typeprovider.hxx> -#include <rtl/memory.h> -#include <rtl/uuid.h> -#include <rtl/ustrbuf.hxx> -#include <vcl/svapp.hxx> -#include <vcl/window.hxx> -#include <tools/color.hxx> -#include <vcl/dockwin.hxx> -#include <vcl/pdfextoutdevdata.hxx> -#include <vcl/tabpage.hxx> -#include <vcl/button.hxx> -#include <comphelper/asyncnotification.hxx> -#include <comphelper/flagguard.hxx> -#include "stylesettings.hxx" -#include <tools/urlobj.hxx> -#include <toolkit/helper/unopropertyarrayhelper.hxx> - -#include <boost/bind.hpp> - -using namespace ::com::sun::star; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::UNO_QUERY; -using ::com::sun::star::uno::RuntimeException; -using ::com::sun::star::lang::EventObject; -using ::com::sun::star::awt::XWindowListener2; -using ::com::sun::star::awt::XDockableWindowListener; -using ::com::sun::star::awt::XDevice; -using ::com::sun::star::awt::XStyleSettings; -using ::com::sun::star::lang::DisposedException; -using ::com::sun::star::style::VerticalAlignment; -using ::com::sun::star::style::VerticalAlignment_TOP; -using ::com::sun::star::style::VerticalAlignment_MIDDLE; -using ::com::sun::star::style::VerticalAlignment_BOTTOM; -using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE; - -namespace WritingMode2 = ::com::sun::star::text::WritingMode2; -namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior; - -//==================================================================== -//= VCLXWindowImpl -//==================================================================== -class SAL_DLLPRIVATE VCLXWindowImpl -{ -private: - typedef ::std::vector< VCLXWindow::Callback > CallbackArray; - -private: - VCLXWindow& mrAntiImpl; - ::toolkit::AccessibilityClient maAccFactory; - bool mbDisposed; - bool mbDrawingOntoParent; // no bit mask, is passed around by reference - sal_Bool mbEnableVisible; - sal_Bool mbDirectVisible; - - ::osl::Mutex maListenerContainerMutex; - ::cppu::OInterfaceContainerHelper maWindow2Listeners; - ::cppu::OInterfaceContainerHelper maDockableWindowListeners; - EventListenerMultiplexer maEventListeners; - FocusListenerMultiplexer maFocusListeners; - WindowListenerMultiplexer maWindowListeners; - KeyListenerMultiplexer maKeyListeners; - MouseListenerMultiplexer maMouseListeners; - MouseMotionListenerMultiplexer maMouseMotionListeners; - PaintListenerMultiplexer maPaintListeners; - VclContainerListenerMultiplexer maContainerListeners; - TopWindowListenerMultiplexer maTopWindowListeners; - - CallbackArray maCallbackEvents; - sal_uLong mnCallbackEventId; - -public: - bool mbDisposing : 1; - bool mbDesignMode : 1; - bool mbSynthesizingVCLEvent : 1; - bool mbWithDefaultProps : 1; - - sal_uLong mnListenerLockLevel; - sal_Int16 mnWritingMode; - sal_Int16 mnContextWritingMode; - - UnoPropertyArrayHelper* mpPropHelper; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer > - mxPointer; - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - mxAccessibleContext; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > - mxViewGraphics; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleSettings > - mxWindowStyleSettings; - -public: - bool& getDrawingOntoParent_ref() { return mbDrawingOntoParent; } - -public: - /** ctor - @param _pAntiImpl - the <type>VCLXWindow</type> instance which the object belongs to. Must - live longer then the object just being constructed. - */ - VCLXWindowImpl( VCLXWindow& _rAntiImpl, bool _bWithDefaultProps ); - - /** synchronously mbEnableVisible - */ - void setEnableVisible( sal_Bool bEnableVisible ) { mbEnableVisible = bEnableVisible; } - sal_Bool isEnableVisible() { return mbEnableVisible; } - /** synchronously mbDirectVisible; - */ - void setDirectVisible( sal_Bool bDirectVisible ) { mbDirectVisible = bDirectVisible; } - sal_Bool isDirectVisible() { return mbDirectVisible; } - - /** impl-version of VCLXWindow::ImplExecuteAsyncWithoutSolarLock - */ - void callBackAsync( const VCLXWindow::Callback& i_callback ); - - /** notifies the object that its VCLXWindow is being disposed - */ - void disposing(); - - inline ::toolkit::AccessibilityClient& getAccessibleFactory() - { - return maAccFactory; - } - - Reference< XStyleSettings > getStyleSettings(); - - /** returns the container of registered XWindowListener2 listeners - */ - inline ::cppu::OInterfaceContainerHelper& getWindow2Listeners() { return maWindow2Listeners; } - inline ::cppu::OInterfaceContainerHelper& getDockableWindowListeners(){ return maDockableWindowListeners; } - inline EventListenerMultiplexer& getEventListeners() { return maEventListeners; } - inline FocusListenerMultiplexer& getFocusListeners() { return maFocusListeners; } - inline WindowListenerMultiplexer& getWindowListeners() { return maWindowListeners; } - inline KeyListenerMultiplexer& getKeyListeners() { return maKeyListeners; } - inline MouseListenerMultiplexer& getMouseListeners() { return maMouseListeners; } - inline MouseMotionListenerMultiplexer& getMouseMotionListeners() { return maMouseMotionListeners; } - inline PaintListenerMultiplexer& getPaintListeners() { return maPaintListeners; } - inline VclContainerListenerMultiplexer& getContainerListeners() { return maContainerListeners; } - inline TopWindowListenerMultiplexer& getTopWindowListeners() { return maTopWindowListeners; } - - virtual ~VCLXWindowImpl(); - -protected: - virtual void SAL_CALL acquire(); - virtual void SAL_CALL release(); - -private: - DECL_LINK( OnProcessCallbacks, void* ); - -private: - VCLXWindowImpl(); // never implemented - VCLXWindowImpl( const VCLXWindowImpl& ); // never implemented - VCLXWindowImpl& operator=( const VCLXWindowImpl& ); // never implemented -}; - -//-------------------------------------------------------------------- -VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, bool _bWithDefaultProps ) - :mrAntiImpl( _rAntiImpl ) - ,mbDisposed( false ) - ,mbDrawingOntoParent( false ) - ,mbEnableVisible(sal_True) - ,mbDirectVisible(sal_True) - ,maListenerContainerMutex( ) - ,maWindow2Listeners( maListenerContainerMutex ) - ,maDockableWindowListeners( maListenerContainerMutex ) - ,maEventListeners( _rAntiImpl ) - ,maFocusListeners( _rAntiImpl ) - ,maWindowListeners( _rAntiImpl ) - ,maKeyListeners( _rAntiImpl ) - ,maMouseListeners( _rAntiImpl ) - ,maMouseMotionListeners( _rAntiImpl ) - ,maPaintListeners( _rAntiImpl ) - ,maContainerListeners( _rAntiImpl ) - ,maTopWindowListeners( _rAntiImpl ) - ,mnCallbackEventId( 0 ) - ,mbDisposing( false ) - ,mbDesignMode( false ) - ,mbSynthesizingVCLEvent( false ) - ,mbWithDefaultProps( _bWithDefaultProps ) - ,mnListenerLockLevel( 0 ) - ,mnWritingMode( WritingMode2::CONTEXT ) - ,mnContextWritingMode( WritingMode2::CONTEXT ) - ,mpPropHelper( NULL ) -{ -} - -VCLXWindowImpl::~VCLXWindowImpl() -{ - delete mpPropHelper; -} - -//-------------------------------------------------------------------- -void VCLXWindowImpl::disposing() -{ - SolarMutexGuard aGuard; - if ( mnCallbackEventId ) - Application::RemoveUserEvent( mnCallbackEventId ); - mnCallbackEventId = 0; - - mbDisposed= true; - - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = mrAntiImpl; - - maDockableWindowListeners.disposeAndClear( aEvent ); - maEventListeners.disposeAndClear( aEvent ); - maFocusListeners.disposeAndClear( aEvent ); - maWindowListeners.disposeAndClear( aEvent ); - maKeyListeners.disposeAndClear( aEvent ); - maMouseListeners.disposeAndClear( aEvent ); - maMouseMotionListeners.disposeAndClear( aEvent ); - maPaintListeners.disposeAndClear( aEvent ); - maContainerListeners.disposeAndClear( aEvent ); - maTopWindowListeners.disposeAndClear( aEvent ); - - ::toolkit::WindowStyleSettings* pStyleSettings = static_cast< ::toolkit::WindowStyleSettings* >( mxWindowStyleSettings.get() ); - if ( pStyleSettings != NULL ) - pStyleSettings->dispose(); - mxWindowStyleSettings.clear(); -} - -//-------------------------------------------------------------------- -void VCLXWindowImpl::callBackAsync( const VCLXWindow::Callback& i_callback ) -{ - DBG_TESTSOLARMUTEX(); - maCallbackEvents.push_back( i_callback ); - if ( !mnCallbackEventId ) - { - // ensure our VCLXWindow is not destroyed while the event is underway - mrAntiImpl.acquire(); - mnCallbackEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessCallbacks ) ); - } -} - -//---------------------------------------------------------------------------------------------------------------------- -IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG ) -{ - const Reference< uno::XInterface > xKeepAlive( mrAntiImpl ); - - // work on a copy of the callback array - CallbackArray aCallbacksCopy; - { - SolarMutexGuard aGuard; - aCallbacksCopy = maCallbackEvents; - maCallbackEvents.clear(); - - // we acquired our VCLXWindow once before posting the event, release this one ref now - mrAntiImpl.release(); - - if ( !mnCallbackEventId ) - // we were disposed while waiting for the mutex to lock - return 1L; - - mnCallbackEventId = 0; - } - - { - SolarMutexReleaser aReleaseSolar( SolarMutexReleaser::RescheduleDuringAcquire ); - for ( CallbackArray::const_iterator loop = aCallbacksCopy.begin(); - loop != aCallbacksCopy.end(); - ++loop - ) - { - (*loop)(); - } - } - - return 0L; -} - -//-------------------------------------------------------------------- -void SAL_CALL VCLXWindowImpl::acquire() -{ - mrAntiImpl.acquire(); -} - -//-------------------------------------------------------------------- -void SAL_CALL VCLXWindowImpl::release() -{ - mrAntiImpl.release(); -} - -//-------------------------------------------------------------------- -Reference< XStyleSettings > VCLXWindowImpl::getStyleSettings() -{ - SolarMutexGuard aGuard; - if ( mbDisposed ) - throw DisposedException( ::rtl::OUString(), mrAntiImpl ); - if ( !mxWindowStyleSettings.is() ) - mxWindowStyleSettings = new ::toolkit::WindowStyleSettings( maListenerContainerMutex, mrAntiImpl ); - return mxWindowStyleSettings; -} - -//==================================================================== -//==================================================================== - -// 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 ); -} - -// ---------------------------------------------------- -// class VCLXWindow -// ---------------------------------------------------- - -DBG_NAME(VCLXWindow); - -VCLXWindow::VCLXWindow( bool _bWithDefaultProps ) - :mpImpl( NULL ) -{ - DBG_CTOR( VCLXWindow, 0 ); - - mpImpl = new VCLXWindowImpl( *this, _bWithDefaultProps ); -} - -VCLXWindow::~VCLXWindow() -{ - DBG_DTOR( VCLXWindow, 0 ); - - delete mpImpl; - - if ( GetWindow() ) - { - GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) ); - GetWindow()->SetWindowPeer( NULL, NULL ); - GetWindow()->SetAccessible( NULL ); - } -} - -//---------------------------------------------------------------------------------------------------------------------- -void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback ) -{ - mpImpl->callBackAsync( i_callback ); -} - -//---------------------------------------------------------------------------------------------------------------------- -::toolkit::IAccessibleFactory& VCLXWindow::getAccessibleFactory() -{ - return mpImpl->getAccessibleFactory().getFactory(); -} - -void VCLXWindow::SetWindow( Window* pWindow ) -{ - if ( GetWindow() ) - { - GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) ); -// GetWindow()->DbgAssertNoEventListeners(); - } - - SetOutputDevice( pWindow ); - - if ( GetWindow() ) - { - GetWindow()->AddEventListener( LINK( this, VCLXWindow, WindowEventListener ) ); - sal_Bool bDirectVisible = pWindow ? pWindow->IsVisible() : false; - mpImpl->setDirectVisible( bDirectVisible ); - } -} - -void VCLXWindow::suspendVclEventListening( ) -{ - ++mpImpl->mnListenerLockLevel; -} - -void VCLXWindow::resumeVclEventListening( ) -{ - DBG_ASSERT( mpImpl->mnListenerLockLevel, "VCLXWindow::resumeVclEventListening: not suspended!" ); - --mpImpl->mnListenerLockLevel; -} - -void VCLXWindow::notifyWindowRemoved( Window& _rWindow ) -{ - if ( mpImpl->getContainerListeners().getLength() ) - { - awt::VclContainerEvent aEvent; - aEvent.Source = *this; - aEvent.Child = static_cast< XWindow* >( _rWindow.GetWindowPeer() ); - mpImpl->getContainerListeners().windowRemoved( aEvent ); - } -} - -IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent ) -{ - if ( mpImpl->mnListenerLockLevel ) - return 0L; - - DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" ); - if ( pEvent && pEvent->ISA( VclWindowEvent ) ) - { - DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow() && GetWindow(), "Window???" ); - ProcessWindowEvent( *(VclWindowEvent*)pEvent ); - } - return 0; -} - -namespace -{ - struct CallWindow2Listener - { - CallWindow2Listener( ::cppu::OInterfaceContainerHelper& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent ) - :m_rWindow2Listeners( i_rWindow2Listeners ) - ,m_bEnabled( i_bEnabled ) - ,m_aEvent( i_rEvent ) - { - } - - void operator()() - { - m_rWindow2Listeners.notifyEach( m_bEnabled ? &XWindowListener2::windowEnabled : &XWindowListener2::windowDisabled, m_aEvent ); - } - - ::cppu::OInterfaceContainerHelper& m_rWindow2Listeners; - const bool m_bEnabled; - const EventObject m_aEvent; - }; -} - -void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis( (::cppu::OWeakObject*)this ); - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_ENABLED: - case VCLEVENT_WINDOW_DISABLED: - { - Callback aCallback = CallWindow2Listener( - mpImpl->getWindow2Listeners(), - ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() ), - EventObject( *this ) - ); - ImplExecuteAsyncWithoutSolarLock( aCallback ); - } - break; - - case VCLEVENT_WINDOW_PAINT: - { - if ( mpImpl->getPaintListeners().getLength() ) - { - ::com::sun::star::awt::PaintEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.UpdateRect = AWTRectangle( *(Rectangle*)rVclWindowEvent.GetData() ); - aEvent.Count = 0; - mpImpl->getPaintListeners().windowPaint( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_MOVE: - { - if ( mpImpl->getWindowListeners().getLength() ) - { - ::com::sun::star::awt::WindowEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - mpImpl->getWindowListeners().windowMoved( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_RESIZE: - { - if ( mpImpl->getWindowListeners().getLength() ) - { - ::com::sun::star::awt::WindowEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - mpImpl->getWindowListeners().windowResized( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_SHOW: - { - if ( mpImpl->getWindowListeners().getLength() ) - { - ::com::sun::star::awt::WindowEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - mpImpl->getWindowListeners().windowShown( aEvent ); - } - - // For TopWindows this means opened... - if ( mpImpl->getTopWindowListeners().getLength() ) - { - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - mpImpl->getTopWindowListeners().windowOpened( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_HIDE: - { - if ( mpImpl->getWindowListeners().getLength() ) - { - ::com::sun::star::awt::WindowEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - mpImpl->getWindowListeners().windowHidden( aEvent ); - } - - // For TopWindows this means closed... - if ( mpImpl->getTopWindowListeners().getLength() ) - { - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - mpImpl->getTopWindowListeners().windowClosed( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_ACTIVATE: - { - if ( mpImpl->getTopWindowListeners().getLength() ) - { - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - mpImpl->getTopWindowListeners().windowActivated( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_DEACTIVATE: - { - if ( mpImpl->getTopWindowListeners().getLength() ) - { - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - mpImpl->getTopWindowListeners().windowDeactivated( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_CLOSE: - { - if ( mpImpl->getDockableWindowListeners().getLength() ) - { - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::closed, aEvent ); - } - if ( mpImpl->getTopWindowListeners().getLength() ) - { - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - mpImpl->getTopWindowListeners().windowClosing( aEvent ); - } - } - break; - case VCLEVENT_CONTROL_GETFOCUS: - case VCLEVENT_WINDOW_GETFOCUS: - { - if ( ( rVclWindowEvent.GetWindow()->IsCompoundControl() - && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_GETFOCUS - ) - || ( !rVclWindowEvent.GetWindow()->IsCompoundControl() - && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS - ) - ) - { - if ( mpImpl->getFocusListeners().getLength() ) - { - ::com::sun::star::awt::FocusEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags(); - aEvent.Temporary = sal_False; - mpImpl->getFocusListeners().focusGained( aEvent ); - } - } - } - break; - case VCLEVENT_CONTROL_LOSEFOCUS: - case VCLEVENT_WINDOW_LOSEFOCUS: - { - if ( ( rVclWindowEvent.GetWindow()->IsCompoundControl() - && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_LOSEFOCUS - ) - || ( !rVclWindowEvent.GetWindow()->IsCompoundControl() - && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_LOSEFOCUS - ) - ) - { - if ( mpImpl->getFocusListeners().getLength() ) - { - ::com::sun::star::awt::FocusEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.FocusFlags = rVclWindowEvent.GetWindow()->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(); - } - mpImpl->getFocusListeners().focusLost( aEvent ); - } - } - } - break; - case VCLEVENT_WINDOW_MINIMIZE: - { - if ( mpImpl->getTopWindowListeners().getLength() ) - { - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - mpImpl->getTopWindowListeners().windowMinimized( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_NORMALIZE: - { - if ( mpImpl->getTopWindowListeners().getLength() ) - { - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - mpImpl->getTopWindowListeners().windowNormalized( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_KEYINPUT: - { - if ( mpImpl->getKeyListeners().getLength() ) - { - ::com::sun::star::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent( - *(KeyEvent*)rVclWindowEvent.GetData(), *this - ) ); - mpImpl->getKeyListeners().keyPressed( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_KEYUP: - { - if ( mpImpl->getKeyListeners().getLength() ) - { - ::com::sun::star::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent( - *(KeyEvent*)rVclWindowEvent.GetData(), *this - ) ); - mpImpl->getKeyListeners().keyReleased( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_COMMAND: - { - CommandEvent* pCmdEvt = (CommandEvent*)rVclWindowEvent.GetData(); - if ( mpImpl->getMouseListeners().getLength() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) ) - { - // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden... - Point aWhere = static_cast< CommandEvent* >( rVclWindowEvent.GetData() )->GetMousePosPixel(); - if ( !pCmdEvt->IsMouseEvent() ) - { // for keyboard events, we set the coordinates to -1,-1. This is a slight HACK, but the current API - // handles a context menu command as special case of a mouse event, which is simply wrong. - // Without extending the API, we would not have another chance to notify listeners of a - // keyboard-triggered context menu request - aWhere = Point( -1, -1 ); - } - - MouseEvent aMEvt( aWhere, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 ); - awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( aMEvt, *this ) ); - aEvent.PopupTrigger = sal_True; - - Callback aCallback = ::boost::bind( - &MouseListenerMultiplexer::mousePressed, - &mpImpl->getMouseListeners(), - aEvent - ); - ImplExecuteAsyncWithoutSolarLock( aCallback ); - } - } - break; - case VCLEVENT_WINDOW_MOUSEMOVE: - { - MouseEvent* pMouseEvt = (MouseEvent*)rVclWindowEvent.GetData(); - if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) ) - { - awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) ); - - Callback aCallback = ::boost::bind( - pMouseEvt->IsEnterWindow() ? &MouseListenerMultiplexer::mouseEntered : &MouseListenerMultiplexer::mouseExited, - &mpImpl->getMouseListeners(), - aEvent - ); - ImplExecuteAsyncWithoutSolarLock( aCallback ); - } - - if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() ) - { - awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) ); - aEvent.ClickCount = 0; // #92138# - if ( pMouseEvt->GetMode() & MOUSE_SIMPLEMOVE ) - mpImpl->getMouseMotionListeners().mouseMoved( aEvent ); - else - mpImpl->getMouseMotionListeners().mouseDragged( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_MOUSEBUTTONDOWN: - { - if ( mpImpl->getMouseListeners().getLength() ) - { - awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) ); - Callback aCallback = ::boost::bind( - &MouseListenerMultiplexer::mousePressed, - &mpImpl->getMouseListeners(), - aEvent - ); - ImplExecuteAsyncWithoutSolarLock( aCallback ); - } - } - break; - case VCLEVENT_WINDOW_MOUSEBUTTONUP: - { - if ( mpImpl->getMouseListeners().getLength() ) - { - awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) ); - Callback aCallback = ::boost::bind( - &MouseListenerMultiplexer::mouseReleased, - &mpImpl->getMouseListeners(), - aEvent - ); - ImplExecuteAsyncWithoutSolarLock( aCallback ); - } - } - break; - case VCLEVENT_WINDOW_STARTDOCKING: - { - if ( mpImpl->getDockableWindowListeners().getLength() ) - { - DockingData *pData = (DockingData*)rVclWindowEvent.GetData(); - - if( pData ) - { - ::com::sun::star::awt::DockingEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect ); - aEvent.MousePos.X = pData->maMousePos.X(); - aEvent.MousePos.Y = pData->maMousePos.Y(); - aEvent.bLiveMode = pData->mbLivemode; - aEvent.bInteractive = pData->mbInteractive; - - mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::startDocking, aEvent ); - } - } - } - break; - case VCLEVENT_WINDOW_DOCKING: - { - if ( mpImpl->getDockableWindowListeners().getLength() ) - { - DockingData *pData = (DockingData*)rVclWindowEvent.GetData(); - - if( pData ) - { - ::com::sun::star::awt::DockingEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect ); - aEvent.MousePos.X = pData->maMousePos.X(); - aEvent.MousePos.Y = pData->maMousePos.Y(); - aEvent.bLiveMode = pData->mbLivemode; - aEvent.bInteractive = pData->mbInteractive; - - Reference< XDockableWindowListener > xFirstListener; - ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() ); - while ( aIter.hasMoreElements() && !xFirstListener.is() ) - { - xFirstListener.set( aIter.next(), UNO_QUERY ); - } - - ::com::sun::star::awt::DockingData aDockingData = - xFirstListener->docking( aEvent ); - pData->maTrackRect = VCLRectangle( aDockingData.TrackingRectangle ); - pData->mbFloating = aDockingData.bFloating; - } - } - } - break; - case VCLEVENT_WINDOW_ENDDOCKING: - { - if ( mpImpl->getDockableWindowListeners().getLength() ) - { - EndDockingData *pData = (EndDockingData*)rVclWindowEvent.GetData(); - - if( pData ) - { - ::com::sun::star::awt::EndDockingEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.WindowRectangle = AWTRectangle( pData->maWindowRect ); - aEvent.bFloating = pData->mbFloating; - aEvent.bCancelled = pData->mbCancelled; - mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking, aEvent ); - } - } - } - break; - case VCLEVENT_WINDOW_PREPARETOGGLEFLOATING: - { - if ( mpImpl->getDockableWindowListeners().getLength() ) - { - sal_Bool *p_bFloating = (sal_Bool*)rVclWindowEvent.GetData(); - - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - - Reference< XDockableWindowListener > xFirstListener; - ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() ); - while ( aIter.hasMoreElements() && !xFirstListener.is() ) - { - xFirstListener.set( aIter.next(), UNO_QUERY ); - } - - *p_bFloating = xFirstListener->prepareToggleFloatingMode( aEvent ); - } - } - break; - case VCLEVENT_WINDOW_TOGGLEFLOATING: - { - if ( mpImpl->getDockableWindowListeners().getLength() ) - { - ::com::sun::star::lang::EventObject aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::toggleFloatingMode, aEvent ); - } - } - break; - case VCLEVENT_WINDOW_ENDPOPUPMODE: - { - if ( mpImpl->getDockableWindowListeners().getLength() ) - { - EndPopupModeData *pData = (EndPopupModeData*)rVclWindowEvent.GetData(); - - if( pData ) - { - ::com::sun::star::awt::EndPopupModeEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.FloatingPosition.X = pData->maFloatingPos.X(); - aEvent.FloatingPosition.Y = pData->maFloatingPos.Y(); - aEvent.bTearoff = pData->mbTearoff; - mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endPopupMode, aEvent ); - } - } - } - break; - - } -} - -uno::Reference< accessibility::XAccessibleContext > VCLXWindow::CreateAccessibleContext() -{ - SolarMutexGuard aGuard; - return getAccessibleFactory().createAccessibleContext( this ); -} - -void VCLXWindow::SetSynthesizingVCLEvent( sal_Bool _b ) -{ - mpImpl->mbSynthesizingVCLEvent = _b; -} - -sal_Bool VCLXWindow::IsSynthesizingVCLEvent() const -{ - return mpImpl->mbSynthesizingVCLEvent; -} - -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::lang::XUnoTunnel -IMPL_XUNOTUNNEL2( VCLXWindow, VCLXDevice ) - -// ::com::sun::star::lang::Component -void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - mpImpl->mxViewGraphics = NULL; - - if ( !mpImpl->mbDisposing ) - { - mpImpl->mbDisposing = true; - - mpImpl->disposing(); - - if ( GetWindow() ) - { - OutputDevice* pOutDev = GetOutputDevice(); - SetWindow( NULL ); // Damit ggf. Handler abgemeldet werden (virtuell). - SetOutputDevice( pOutDev ); - DestroyOutputDevice(); - } - - // #i14103# dispose the accessible context after the window has been destroyed, - // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent() - // for VCLEVENT_WINDOW_CHILDDESTROYED contains a reference to an already disposed accessible object - try - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComponent( mpImpl->mxAccessibleContext, ::com::sun::star::uno::UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - catch ( const ::com::sun::star::uno::Exception& ) - { - OSL_FAIL( "VCLXWindow::dispose: could not dispose the accessible context!" ); - } - mpImpl->mxAccessibleContext.clear(); - - mpImpl->mbDisposing = false; - } -} - -void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - mpImpl->getEventListeners().addInterface( rxListener ); -} - -void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - mpImpl->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) -{ - SolarMutexGuard aGuard; - - if ( GetWindow() ) - { - if( Window::GetDockingManager()->IsDockable( GetWindow() ) ) - Window::GetDockingManager()->SetPosSizePixel( GetWindow() , X, Y, Width, Height, Flags ); - else - GetWindow()->SetPosSizePixel( X, Y, Width, Height, Flags ); - } -} - -::com::sun::star::awt::Rectangle VCLXWindow::getPosSize( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::awt::Rectangle aBounds; - if ( GetWindow() ) - { - if( Window::GetDockingManager()->IsDockable( GetWindow() ) ) - aBounds = AWTRectangle( Window::GetDockingManager()->GetPosSizePixel( GetWindow() ) ); - else - aBounds = AWTRectangle( Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) ); - } - - return aBounds; -} - -void VCLXWindow::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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 ) ); - } - } -*/ - mpImpl->setDirectVisible( bVisible ); - pWindow->Show( bVisible && mpImpl->isEnableVisible() ); - } -} - -void VCLXWindow::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - { - pWindow->Enable( bEnable, sal_False ); // #95824# without children! - pWindow->EnableInput( bEnable ); - } -} - -void VCLXWindow::setFocus( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - mpImpl->getWindowListeners().addInterface( rxListener ); - - Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY ); - if ( xListener2.is() ) - mpImpl->getWindow2Listeners().addInterface( xListener2 ); - - // #100119# Get all resize events, even if height or width 0, or invisible - if ( GetWindow() ) - GetWindow()->EnableAllResize( sal_True ); -} - -void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY ); - if ( xListener2.is() ) - mpImpl->getWindow2Listeners().removeInterface( xListener2 ); - - mpImpl->getWindowListeners().removeInterface( rxListener ); -} - -void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - mpImpl->getFocusListeners().addInterface( rxListener ); -} - -void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - mpImpl->getFocusListeners().removeInterface( rxListener ); -} - -void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - mpImpl->getKeyListeners().addInterface( rxListener ); -} - -void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - mpImpl->getKeyListeners().removeInterface( rxListener ); -} - -void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - mpImpl->getMouseListeners().addInterface( rxListener ); -} - -void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - mpImpl->getMouseListeners().removeInterface( rxListener ); -} - -void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - mpImpl->getMouseMotionListeners().addInterface( rxListener ); -} - -void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - mpImpl->getMouseMotionListeners().removeInterface( rxListener ); -} - -void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - mpImpl->getPaintListeners().addInterface( rxListener ); -} - -void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - mpImpl->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) -{ - // no guard. nothing to guard here. - // 82463 - 12/21/00 - fs - return Application::GetVCLToolkit(); -} - -void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& rxPointer ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - VCLXPointer* pPointer = VCLXPointer::GetImplementation( rxPointer ); - if ( pPointer ) - { - mpImpl->mxPointer = rxPointer; - if ( GetWindow() ) - GetWindow()->SetPointer( pPointer->GetPointer() ); - } -} - -void VCLXWindow::setBackground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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 nInvalidateFlags ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( GetWindow() ) - GetWindow()->Invalidate( (sal_uInt16) nInvalidateFlags ); -} - -void VCLXWindow::invalidateRect( const ::com::sun::star::awt::Rectangle& rRect, sal_Int16 nInvalidateFlags ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( GetWindow() ) - GetWindow()->Invalidate( VCLRectangle(rRect), (sal_uInt16) nInvalidateFlags ); -} - - -// ::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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - mpImpl->mbDesignMode = bOn; -} - -sal_Bool VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - return mpImpl->mbDesignMode; -} - -void VCLXWindow::enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( GetWindow() ) - GetWindow()->EnableClipSiblings( bClip ); -} - -void VCLXWindow::setForeground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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: OSL_FAIL( "VCLWindow::getStyles() - unknown Type" ); - } - - } -} - -namespace toolkit -{ - static void setColorSettings( Window* _pWindow, const ::com::sun::star::uno::Any& _rValue, - void (StyleSettings::*pSetter)( const Color& ), const Color& (StyleSettings::*pGetter)( ) const ) - { - sal_Int32 nColor = 0; - if ( !( _rValue >>= nColor ) ) - nColor = (Application::GetSettings().GetStyleSettings().*pGetter)().GetColor(); - - AllSettings aSettings = _pWindow->GetSettings(); - StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - - (aStyleSettings.*pSetter)( Color( nColor ) ); - - aSettings.SetStyleSettings( aStyleSettings ); - _pWindow->SetSettings( aSettings, sal_True ); - } -} - -// Terminated by BASEPROPERTY_NOTFOUND (or 0) -void VCLXWindow::PushPropertyIds( std::list< sal_uInt16 > &rIds, - int nFirstId, ...) -{ - va_list pVarArgs; - va_start( pVarArgs, nFirstId ); - - for ( int nId = nFirstId; nId != BASEPROPERTY_NOTFOUND; - nId = va_arg( pVarArgs, int ) ) - rIds.push_back( (sal_uInt16) nId ); - - va_end( pVarArgs ); -} - -void VCLXWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds, bool bWithDefaults ) -{ - // These are common across ~all VCLXWindow derived classes - if( bWithDefaults ) - PushPropertyIds( rIds, - BASEPROPERTY_ALIGN, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_TEXT, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_ENABLEVISIBLE, // for visibility - BASEPROPERTY_TABSTOP, - 0); - - // lovely hack from: - // void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId ) - std::list< sal_uInt16 >::const_iterator iter; - for( iter = rIds.begin(); iter != rIds.end(); ++iter) { - if( *iter == BASEPROPERTY_FONTDESCRIPTOR ) - { - // some properties are not included in the FontDescriptor, but everytime - // when we have a FontDescriptor we want to have these properties too. - // => Easier to register the here, istead everywhere where I register the FontDescriptor... - - rIds.push_back( BASEPROPERTY_TEXTCOLOR ); - rIds.push_back( BASEPROPERTY_TEXTLINECOLOR ); - rIds.push_back( BASEPROPERTY_FONTRELIEF ); - rIds.push_back( BASEPROPERTY_FONTEMPHASISMARK ); - break; - } - } -} - -void VCLXWindow::GetPropertyIds( std::list< sal_uInt16 >& _out_rIds ) -{ - return ImplGetPropertyIds( _out_rIds, mpImpl->mbWithDefaultProps ); -} - -::cppu::OInterfaceContainerHelper& VCLXWindow::GetContainerListeners() -{ - return mpImpl->getContainerListeners(); -} - -::cppu::OInterfaceContainerHelper& VCLXWindow::GetTopWindowListeners() -{ - return mpImpl->getTopWindowListeners(); -} - -namespace -{ - void lcl_updateWritingMode( Window& _rWindow, const sal_Int16 _nWritingMode, const sal_Int16 _nContextWritingMode ) - { - sal_Bool bEnableRTL = sal_False; - switch ( _nWritingMode ) - { - case WritingMode2::LR_TB: bEnableRTL = sal_False; break; - case WritingMode2::RL_TB: bEnableRTL = sal_True; break; - case WritingMode2::CONTEXT: - { - // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use - // it. If it doesn't (but is CONTEXT itself), then just ask the parent window of our - // own window for its RTL mode - switch ( _nContextWritingMode ) - { - case WritingMode2::LR_TB: bEnableRTL = sal_False; break; - case WritingMode2::RL_TB: bEnableRTL = sal_True; break; - case WritingMode2::CONTEXT: - { - const Window* pParent = _rWindow.GetParent(); - OSL_ENSURE( pParent, "lcl_updateWritingMode: cannot determine context's writing mode!" ); - if ( pParent ) - bEnableRTL = pParent->IsRTLEnabled(); - } - break; - } - } - break; - default: - OSL_FAIL( "lcl_updateWritingMode: unsupported WritingMode!" ); - } // switch ( nWritingMode ) - - _rWindow.EnableRTL( bEnableRTL ); - } -} - -void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( !pWindow ) - return; - - 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_REFERENCE_DEVICE: - { - Control* pControl = dynamic_cast< Control* >( pWindow ); - OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" ); - if ( !pControl ) - break; - Reference< XDevice > xDevice( Value, UNO_QUERY ); - OutputDevice* pDevice = VCLUnoHelper::GetOutputDevice( xDevice ); - pControl->SetReferenceDevice( pDevice ); - } - break; - - case BASEPROPERTY_CONTEXT_WRITING_MODE: - { - OSL_VERIFY( Value >>= mpImpl->mnContextWritingMode ); - if ( mpImpl->mnWritingMode == WritingMode2::CONTEXT ) - lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode ); - } - break; - - case BASEPROPERTY_WRITING_MODE: - { - sal_Bool bProperType = ( Value >>= mpImpl->mnWritingMode ); - OSL_ENSURE( bProperType, "VCLXWindow::setProperty( 'WritingMode' ): illegal value type!" ); - if ( bProperType ) - lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode ); - } - break; - - case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR: - { - sal_uInt16 nWheelBehavior( MouseWheelBehavior::SCROLL_FOCUS_ONLY ); - OSL_VERIFY( Value >>= nWheelBehavior ); - - AllSettings aSettings = pWindow->GetSettings(); - MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - - sal_uInt16 nVclBehavior( MOUSE_WHEEL_FOCUS_ONLY ); - switch ( nWheelBehavior ) - { - case MouseWheelBehavior::SCROLL_DISABLED: nVclBehavior = MOUSE_WHEEL_DISABLE; break; - case MouseWheelBehavior::SCROLL_FOCUS_ONLY: nVclBehavior = MOUSE_WHEEL_FOCUS_ONLY; break; - case MouseWheelBehavior::SCROLL_ALWAYS: nVclBehavior = MOUSE_WHEEL_ALWAYS; break; - default: - OSL_FAIL( "VCLXWindow::setProperty( 'MouseWheelBehavior' ): illegal property value!" ); - } - - aMouseSettings.SetWheelBehavior( nVclBehavior ); - aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings, sal_True ); - } - break; - - case BASEPROPERTY_NATIVE_WIDGET_LOOK: - { - sal_Bool bEnable( sal_True ); - OSL_VERIFY( Value >>= bEnable ); - pWindow->EnableNativeWidget( bEnable ); - } - break; - - case BASEPROPERTY_PLUGINPARENT: - { - // set parent handle - SetSystemParent_Impl( Value ); - } - break; - - case BASEPROPERTY_ENABLED: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - setEnable( b ); - } - break; - case BASEPROPERTY_ENABLEVISIBLE: - { - sal_Bool b = sal_False; - if ( Value >>= b ) - { - if( b != mpImpl->isEnableVisible() ) - { - mpImpl->setEnableVisible( b ); - pWindow->Show( b && mpImpl->isDirectVisible() ); - } - } - } - break; - case BASEPROPERTY_TEXT: - case BASEPROPERTY_LABEL: - case BASEPROPERTY_TITLE: - { - ::rtl::OUString aText; - if ( Value >>= aText ) - { - switch (eWinType) - { - case WINDOW_OKBUTTON: - case WINDOW_CANCELBUTTON: - case WINDOW_HELPBUTTON: - // Standard Button: overwrite only if not empty. - if (aText.getLength()) - pWindow->SetText( aText ); - break; - - default: - pWindow->SetText( aText ); - break; - } - } - } - break; - case BASEPROPERTY_ACCESSIBLENAME: - { - ::rtl::OUString aText; - if ( Value >>= aText ) - pWindow->SetAccessibleName( aText ); - } - break; - case BASEPROPERTY_HELPURL: - { - ::rtl::OUString aURL; - if ( Value >>= aURL ) - { - INetURLObject aHelpURL( aURL ); - if ( aHelpURL.GetProtocol() == INET_PROT_HID ) - pWindow->SetHelpId( rtl::OUStringToOString( aHelpURL.GetURLPath(), RTL_TEXTENCODING_UTF8 ) ); - else - pWindow->SetHelpId( rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ) ); - } - } - break; - case BASEPROPERTY_HELPTEXT: - { - ::rtl::OUString aHelpText; - if ( Value >>= aHelpText ) - { - pWindow->SetQuickHelpText( aHelpText ); - } - } - 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_FONTRELIEF: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - { - Font aFont = pWindow->GetControlFont(); - aFont.SetRelief( (FontRelief)n ); - pWindow->SetControlFont( aFont ); - } - } - break; - case BASEPROPERTY_FONTEMPHASISMARK: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - { - Font aFont = pWindow->GetControlFont(); - aFont.SetEmphasisMark( n ); - pWindow->SetControlFont( aFont ); - } - } - break; - case BASEPROPERTY_BACKGROUNDCOLOR: - if ( bVoid ) - { - switch ( eWinType ) - { - // set dialog color for default - case WINDOW_DIALOG: - case WINDOW_MESSBOX: - case WINDOW_INFOBOX: - case WINDOW_WARNINGBOX: - case WINDOW_ERRORBOX: - case WINDOW_QUERYBOX: - case WINDOW_TABPAGE: - { - Color aColor = pWindow->GetSettings().GetStyleSettings().GetDialogColor(); - pWindow->SetBackground( aColor ); - pWindow->SetControlBackground( aColor ); - break; - } - - case WINDOW_FIXEDTEXT: - case WINDOW_CHECKBOX: - case WINDOW_RADIOBUTTON: - case WINDOW_GROUPBOX: - case WINDOW_FIXEDLINE: - { - // support transparency only for special controls - pWindow->SetBackground(); - pWindow->SetControlBackground(); - pWindow->SetPaintTransparent( sal_True ); - break; - } - - default: - { - // default code which enables transparency for - // compound controls. It's not real transparency - // as most of these controls repaint their client - // area completely new. - if ( pWindow->IsCompoundControl() ) - pWindow->SetBackground(); - pWindow->SetControlBackground(); - break; - } - } - } - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) - { - Color aColor( nColor ); - pWindow->SetControlBackground( aColor ); - pWindow->SetBackground( aColor ); - switch ( eWinType ) - { - // reset paint transparent mode - case WINDOW_FIXEDTEXT: - case WINDOW_CHECKBOX: - case WINDOW_RADIOBUTTON: - case WINDOW_GROUPBOX: - case WINDOW_FIXEDLINE: - pWindow->SetPaintTransparent( sal_False ); - default: ; - } - pWindow->Invalidate(); // Falls das Control nicht drauf reagiert - } - } - break; - case BASEPROPERTY_TEXTCOLOR: - if ( bVoid ) - { - pWindow->SetControlForeground(); - } - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) - { - Color aColor( nColor ); - pWindow->SetTextColor( aColor ); - pWindow->SetControlForeground( aColor ); - } - } - break; - case BASEPROPERTY_TEXTLINECOLOR: - if ( bVoid ) - { - pWindow->SetTextLineColor(); - } - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) - { - Color aColor( nColor ); - pWindow->SetTextLineColor( aColor ); - } - } - break; - case BASEPROPERTY_FILLCOLOR: - if ( bVoid ) - pWindow->SetFillColor(); - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) - { - Color aColor( nColor ); - pWindow->SetFillColor( aColor ); - } - } - break; - case BASEPROPERTY_LINECOLOR: - if ( bVoid ) - pWindow->SetLineColor(); - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) - { - Color aColor( nColor ); - pWindow->SetLineColor( aColor ); - } - } - break; - case BASEPROPERTY_BORDER: - { - WinBits nStyle = pWindow->GetStyle(); - sal_uInt16 nBorder = 0; - 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 = false; - Value >>= bTab; - if ( bTab ) - nStyle |= WB_TABSTOP; - else - nStyle |= WB_NOTABSTOP; - } - pWindow->SetStyle( nStyle ); - } - break; - case BASEPROPERTY_VERTICALALIGN: - { - VerticalAlignment eAlign = VerticalAlignment_MAKE_FIXED_SIZE; - WinBits nStyle = pWindow->GetStyle(); - nStyle &= ~(WB_TOP|WB_VCENTER|WB_BOTTOM); - if ( !bVoid ) - Value >>= eAlign; - switch ( eAlign ) - { - case VerticalAlignment_TOP: - nStyle |= WB_TOP; - break; - case VerticalAlignment_MIDDLE: - nStyle |= WB_VCENTER; - break; - case VerticalAlignment_BOTTOM: - nStyle |= WB_BOTTOM; - break; - default: ; // for warning free code, MAKE_FIXED_SIZE - } - pWindow->SetStyle( nStyle ); - } - break; - case BASEPROPERTY_ALIGN: - { - sal_Int16 nAlign = PROPERTY_ALIGN_LEFT; - switch ( eWinType ) - { - case WINDOW_COMBOBOX: - case WINDOW_BUTTON: - case WINDOW_PUSHBUTTON: - case WINDOW_OKBUTTON: - case WINDOW_CANCELBUTTON: - case WINDOW_HELPBUTTON: - nAlign = PROPERTY_ALIGN_CENTER; - // no break here! - case WINDOW_FIXEDTEXT: - case WINDOW_EDIT: - case WINDOW_MULTILINEEDIT: - case WINDOW_CHECKBOX: - case WINDOW_RADIOBUTTON: - case WINDOW_LISTBOX: - { - WinBits nStyle = pWindow->GetStyle(); - nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT); - 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 ) - || ( eWinType == WINDOW_CHECKBOX ) - || ( eWinType == WINDOW_RADIOBUTTON ) - || ( eWinType == WINDOW_BUTTON ) - || ( eWinType == WINDOW_PUSHBUTTON ) - || ( eWinType == WINDOW_OKBUTTON ) - || ( eWinType == WINDOW_CANCELBUTTON ) - || ( eWinType == WINDOW_HELPBUTTON ) - ) - { - WinBits nStyle = pWindow->GetStyle(); - sal_Bool bMulti = false; - Value >>= bMulti; - if ( bMulti ) - nStyle |= WB_WORDBREAK; - else - nStyle &= ~WB_WORDBREAK; - pWindow->SetStyle( nStyle ); - } - } - break; - case BASEPROPERTY_ORIENTATION: - { - switch ( eWinType ) - { - case WINDOW_FIXEDLINE: - { - sal_Int32 nOrientation = 0; - if ( Value >>= nOrientation ) - { - WinBits nStyle = pWindow->GetStyle(); - nStyle &= ~(WB_HORZ|WB_VERT); - if ( nOrientation == 0 ) - nStyle |= WB_HORZ; - else - nStyle |= WB_VERT; - - pWindow->SetStyle( nStyle ); - } - } - break; - } - } - break; - case BASEPROPERTY_AUTOMNEMONICS: - { - sal_Bool bAutoMnemonics = false; - Value >>= bAutoMnemonics; - AllSettings aSettings = pWindow->GetSettings(); - StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - if ( aStyleSettings.GetAutoMnemonic() != bAutoMnemonics ) - { - aStyleSettings.SetAutoMnemonic( bAutoMnemonics ); - aSettings.SetStyleSettings( aStyleSettings ); - pWindow->SetSettings( aSettings ); - } - } - break; - case BASEPROPERTY_MOUSETRANSPARENT: - { - sal_Bool bMouseTransparent = false; - Value >>= bMouseTransparent; - pWindow->SetMouseTransparent( bMouseTransparent ); - } - break; - case BASEPROPERTY_PAINTTRANSPARENT: - { - sal_Bool bPaintTransparent = false; - Value >>= bPaintTransparent; - pWindow->SetPaintTransparent( bPaintTransparent ); -// pWindow->SetBackground(); - } - break; - - case BASEPROPERTY_REPEAT: - { - sal_Bool bRepeat( sal_False ); - Value >>= bRepeat; - - WinBits nStyle = pWindow->GetStyle(); - if ( bRepeat ) - nStyle |= WB_REPEAT; - else - nStyle &= ~WB_REPEAT; - pWindow->SetStyle( nStyle ); - } - break; - - case BASEPROPERTY_REPEAT_DELAY: - { - sal_Int32 nRepeatDelay = 0; - if ( Value >>= nRepeatDelay ) - { - AllSettings aSettings = pWindow->GetSettings(); - MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - - aMouseSettings.SetButtonRepeat( nRepeatDelay ); - aSettings.SetMouseSettings( aMouseSettings ); - - pWindow->SetSettings( aSettings, sal_True ); - } - } - break; - - case BASEPROPERTY_SYMBOL_COLOR: - ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetButtonTextColor, &StyleSettings::GetButtonTextColor ); - break; - - case BASEPROPERTY_BORDERCOLOR: - ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetMonoColor, &StyleSettings::GetMonoColor); - break; - case BASEPROPERTY_DEFAULTCONTROL: - { - rtl::OUString aName; - Value >>= aName; - break; - } - } -} - -::com::sun::star::uno::Any VCLXWindow::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - if ( GetWindow() ) - { - WindowType eWinType = GetWindow()->GetType(); - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_REFERENCE_DEVICE: - { - Control* pControl = dynamic_cast< Control* >( GetWindow() ); - OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" ); - if ( !pControl ) - break; - - VCLXDevice* pDevice = new VCLXDevice; - pDevice->SetOutputDevice( pControl->GetReferenceDevice() ); - aProp <<= Reference< XDevice >( pDevice ); - } - break; - - case BASEPROPERTY_CONTEXT_WRITING_MODE: - aProp <<= mpImpl->mnContextWritingMode; - break; - - case BASEPROPERTY_WRITING_MODE: - aProp <<= mpImpl->mnWritingMode; - break; - - case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR: - { - sal_uInt16 nVclBehavior = GetWindow()->GetSettings().GetMouseSettings().GetWheelBehavior(); - sal_Int16 nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY; - switch ( nVclBehavior ) - { - case MOUSE_WHEEL_DISABLE: nBehavior = MouseWheelBehavior::SCROLL_DISABLED; break; - case MOUSE_WHEEL_FOCUS_ONLY: nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY; break; - case MOUSE_WHEEL_ALWAYS: nBehavior = MouseWheelBehavior::SCROLL_ALWAYS; break; - default: - OSL_FAIL( "VCLXWindow::getProperty( 'MouseWheelBehavior' ): illegal VCL value!" ); - } - aProp <<= nBehavior; - } - break; - - case BASEPROPERTY_NATIVE_WIDGET_LOOK: - aProp <<= (sal_Bool) GetWindow()->IsNativeWidgetEnabled(); - break; - - case BASEPROPERTY_ENABLED: - aProp <<= (sal_Bool) GetWindow()->IsEnabled(); - break; - - case BASEPROPERTY_ENABLEVISIBLE: - aProp <<= (sal_Bool) mpImpl->isEnableVisible(); - break; - - case BASEPROPERTY_HIGHCONTRASTMODE: - aProp <<= (sal_Bool) GetWindow()->GetSettings().GetStyleSettings().GetHighContrastMode(); - break; - - case BASEPROPERTY_TEXT: - case BASEPROPERTY_LABEL: - case BASEPROPERTY_TITLE: - { - ::rtl::OUString aText = GetWindow()->GetText(); - aProp <<= aText; - } - break; - case BASEPROPERTY_ACCESSIBLENAME: - { - ::rtl::OUString aText = GetWindow()->GetAccessibleName(); - aProp <<= aText; - } - break; - case BASEPROPERTY_HELPTEXT: - { - ::rtl::OUString aText = GetWindow()->GetQuickHelpText(); - aProp <<= aText; - } - break; - case BASEPROPERTY_HELPURL: - { - rtl::OUString aHelpId( rtl::OStringToOUString( GetWindow()->GetHelpId(), RTL_TEXTENCODING_UTF8 ) ); - aProp <<= ::rtl::OUString( aHelpId ); - } - 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_DISPLAYBACKGROUNDCOLOR: - aProp <<= (sal_Int32) GetWindow()->GetDisplayBackground().GetColor().GetColor(); - break; - case BASEPROPERTY_FONTRELIEF: - aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetRelief(); - break; - case BASEPROPERTY_FONTEMPHASISMARK: - aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetEmphasisMark(); - break; - case BASEPROPERTY_TEXTCOLOR: - aProp <<= (sal_Int32) GetWindow()->GetControlForeground().GetColor(); - break; - case BASEPROPERTY_TEXTLINECOLOR: - aProp <<= (sal_Int32) GetWindow()->GetTextLineColor().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_Int16 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_VERTICALALIGN: - { - WinBits nStyle = GetWindow()->GetStyle(); - if ( nStyle & WB_TOP ) - aProp <<= VerticalAlignment_TOP; - else if ( nStyle & WB_VCENTER ) - aProp <<= VerticalAlignment_MIDDLE; - else if ( nStyle & WB_BOTTOM ) - aProp <<= VerticalAlignment_BOTTOM; - } - break; - case BASEPROPERTY_ALIGN: - { - switch ( eWinType ) - { - case WINDOW_FIXEDTEXT: - case WINDOW_EDIT: - case WINDOW_MULTILINEEDIT: - case WINDOW_CHECKBOX: - case WINDOW_RADIOBUTTON: - case WINDOW_LISTBOX: - case WINDOW_COMBOBOX: - case WINDOW_BUTTON: - case WINDOW_PUSHBUTTON: - case WINDOW_OKBUTTON: - case WINDOW_CANCELBUTTON: - case WINDOW_HELPBUTTON: - { - 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 ) - || ( eWinType == WINDOW_CHECKBOX ) - || ( eWinType == WINDOW_RADIOBUTTON ) - || ( eWinType == WINDOW_BUTTON ) - || ( eWinType == WINDOW_PUSHBUTTON ) - || ( eWinType == WINDOW_OKBUTTON ) - || ( eWinType == WINDOW_CANCELBUTTON ) - || ( eWinType == WINDOW_HELPBUTTON ) - ) - aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_WORDBREAK ) ? sal_True : sal_False; - } - break; - case BASEPROPERTY_AUTOMNEMONICS: - { - sal_Bool bAutoMnemonics = GetWindow()->GetSettings().GetStyleSettings().GetAutoMnemonic(); - aProp <<= bAutoMnemonics; - } - break; - case BASEPROPERTY_MOUSETRANSPARENT: - { - sal_Bool bMouseTransparent = GetWindow()->IsMouseTransparent(); - aProp <<= bMouseTransparent; - } - break; - case BASEPROPERTY_PAINTTRANSPARENT: - { - sal_Bool bPaintTransparent = GetWindow()->IsPaintTransparent(); - aProp <<= bPaintTransparent; - } - break; - - case BASEPROPERTY_REPEAT: - aProp <<= (sal_Bool)( 0 != ( GetWindow()->GetStyle() & WB_REPEAT ) ); - break; - - case BASEPROPERTY_REPEAT_DELAY: - { - sal_Int32 nButtonRepeat = GetWindow()->GetSettings().GetMouseSettings().GetButtonRepeat(); - aProp <<= (sal_Int32)nButtonRepeat; - } - break; - - case BASEPROPERTY_SYMBOL_COLOR: - aProp <<= (sal_Int32)GetWindow()->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor(); - break; - - case BASEPROPERTY_BORDERCOLOR: - aProp <<= (sal_Int32)GetWindow()->GetSettings().GetStyleSettings().GetMonoColor().GetColor(); - break; - } - } - return aProp; -} - - -// ::com::sun::star::awt::XLayoutConstrains -::com::sun::star::awt::Size VCLXWindow::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - // 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(); - switch ( nWinType ) - { - 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: - return VCLXScrollBar::implGetMinimumSize( GetWindow() ); - default: - aSz = GetWindow()->GetOptimalSize( WINDOWSIZE_MINIMUM ); - } - } - - 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) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - if ( VCLUnoHelper::GetOutputDevice( rxDevice ) ) - mpImpl->mxViewGraphics = rxDevice; - else - mpImpl->mxViewGraphics = NULL; - - return mpImpl->mxViewGraphics.is(); -} - -::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXWindow::getGraphics( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - return mpImpl->mxViewGraphics; -} - -::com::sun::star::awt::Size VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( !pWindow ) - return; - - if ( isDesignMode() || mpImpl->isEnableVisible() ) - { - TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow ); - if ( pTabPage ) - { - Point aPos( nX, nY ); - Size aSize = pWindow->GetSizePixel(); - - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics ); - aPos = pDev->PixelToLogic( aPos ); - aSize = pDev->PixelToLogic( aSize ); - - pTabPage->Draw( pDev, aPos, aSize, 0 ); - return; - } - - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics ); - Point aPos( nX, nY ); - - if ( !pDev ) - pDev = pWindow->GetParent(); - - if ( pWindow->GetParent() && !pWindow->IsSystemWindow() && ( pWindow->GetParent() == pDev ) ) - { - // #i40647# don't draw here if this is a recursive call - // sometimes this is called recursively, because the Update call on the parent - // (strangely) triggers another paint. Prevent a stack overflow here - // Yes, this is only fixing symptoms for the moment .... - // #i40647# / 2005-01-18 / frank.schoenheit@sun.com - if ( !mpImpl->getDrawingOntoParent_ref() ) - { - ::comphelper::FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() ); - - sal_Bool bWasVisible = pWindow->IsVisible(); - Point aOldPos( pWindow->GetPosPixel() ); - - if ( bWasVisible && aOldPos == aPos ) - { - pWindow->Update(); - return; - } - - pWindow->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( pWindow->GetParent() ) - pWindow->GetParent()->Update(); - - pWindow->Show(); - pWindow->Update(); - pWindow->SetParentUpdateMode( sal_False ); - pWindow->Hide(); - pWindow->SetParentUpdateMode( sal_True ); - - pWindow->SetPosPixel( aOldPos ); - if ( bWasVisible ) - pWindow->Show( sal_True ); - } - } - else if ( pDev ) - { - Size aSz = pWindow->GetSizePixel(); - aSz = pDev->PixelToLogic( aSz ); - Point aP = pDev->PixelToLogic( aPos ); - - vcl::PDFExtOutDevData* pPDFExport = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()); - bool bDrawSimple = ( pDev->GetOutDevType() == OUTDEV_PRINTER ) - || ( pDev->GetOutDevViewType() == OUTDEV_VIEWTYPE_PRINTPREVIEW ) - || ( pPDFExport != NULL ); - if ( bDrawSimple ) - { - pWindow->Draw( pDev, aP, aSz, WINDOW_DRAW_NOCONTROLS ); - } - else - { - sal_Bool bOldNW =pWindow->IsNativeWidgetEnabled(); - if( bOldNW ) - pWindow->EnableNativeWidget(sal_False); - pWindow->PaintToDevice( pDev, aP, aSz ); - if( bOldNW ) - pWindow->EnableNativeWidget(sal_True); - } - } - } -} - -void VCLXWindow::setZoom( float fZoomX, float /*fZoomY*/ ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( GetWindow() ) - { - // Fraction::Fraction takes a double, but we have a float only. - // The implicit conversion from float to double can result in a precision loss, i.e. 1.2 is converted to - // 1.200000000047something. To prevent this, we convert explicitly to double, and round it. - double nZoom( fZoomX ); - nZoom = ::rtl::math::round( nZoom, 4 ); - GetWindow()->SetZoom( Fraction( nZoom ) ); - } -} - -// ::com::sun::star::lang::XEventListener -void SAL_CALL VCLXWindow::disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - // check if it comes from our AccessibleContext - uno::Reference< uno::XInterface > aAC( mpImpl->mxAccessibleContext, uno::UNO_QUERY ); - uno::Reference< uno::XInterface > xSource( _rSource.Source, uno::UNO_QUERY ); - - if ( aAC.get() == xSource.get() ) - { // yep, it does - mpImpl->mxAccessibleContext = uno::Reference< accessibility::XAccessibleContext >(); - } -} - -// ::com::sun::star::accessibility::XAccessible -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXWindow::getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException) -{ - using namespace ::com::sun::star; - - SolarMutexGuard aGuard; - - // already disposed - if( ! mpImpl ) - return uno::Reference< accessibility::XAccessibleContext >(); - - if ( !mpImpl->mxAccessibleContext.is() && GetWindow() ) - { - mpImpl->mxAccessibleContext = CreateAccessibleContext(); - - // add as event listener to this component - // in case somebody disposes it, we do not want to have a (though weak) reference to a dead - // object - uno::Reference< lang::XComponent > xComp( mpImpl->mxAccessibleContext, uno::UNO_QUERY ); - if ( xComp.is() ) - xComp->addEventListener( this ); - } - - return mpImpl->mxAccessibleContext; -} - -// ::com::sun::star::awt::XDockable -void SAL_CALL VCLXWindow::addDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( xListener.is() ) - mpImpl->getDockableWindowListeners().addInterface( xListener ); - -} - -void SAL_CALL VCLXWindow::removeDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - mpImpl->getDockableWindowListeners().removeInterface( xListener ); -} - -void SAL_CALL VCLXWindow::enableDocking( sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - pWindow->EnableDocking( bEnable ); -} - -sal_Bool SAL_CALL VCLXWindow::isFloating( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if( pWindow ) - return Window::GetDockingManager()->IsFloating( pWindow ); - else - return sal_False; -} - -void SAL_CALL VCLXWindow::setFloatingMode( sal_Bool bFloating ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if( pWindow ) - Window::GetDockingManager()->SetFloatingMode( pWindow, bFloating ); -} - -sal_Bool SAL_CALL VCLXWindow::isLocked( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if( pWindow ) - return Window::GetDockingManager()->IsLocked( pWindow ); - else - return sal_False; -} - -void SAL_CALL VCLXWindow::lock( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if( pWindow && !Window::GetDockingManager()->IsFloating( pWindow ) ) - Window::GetDockingManager()->Lock( pWindow ); -} - -void SAL_CALL VCLXWindow::unlock( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if( pWindow && !Window::GetDockingManager()->IsFloating( pWindow ) ) - Window::GetDockingManager()->Unlock( pWindow ); -} -void SAL_CALL VCLXWindow::startPopupMode( const ::com::sun::star::awt::Rectangle& ) throw (::com::sun::star::uno::RuntimeException) -{ - // TODO: remove interface in the next incompatible build - SolarMutexGuard aGuard; - -} - -sal_Bool SAL_CALL VCLXWindow::isInPopupMode( ) throw (::com::sun::star::uno::RuntimeException) -{ - // TODO: remove interface in the next incompatible build - SolarMutexGuard aGuard; - return sal_False; -} - - -// ::com::sun::star::awt::XWindow2 - -void SAL_CALL VCLXWindow::setOutputSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - Window *pWindow; - if( (pWindow = GetWindow()) != NULL ) - { - DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow); - if( pDockingWindow ) - pDockingWindow->SetOutputSizePixel( VCLSize( aSize ) ); - else - pWindow->SetOutputSizePixel( VCLSize( aSize ) ); - } -} - -::com::sun::star::awt::Size SAL_CALL VCLXWindow::getOutputSize( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - Window *pWindow; - if( (pWindow = GetWindow()) != NULL ) - { - DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow); - if( pDockingWindow ) - return AWTSize( pDockingWindow->GetOutputSizePixel() ); - else - return AWTSize( pWindow->GetOutputSizePixel() ); - } - else - return ::com::sun::star::awt::Size(); -} - -sal_Bool SAL_CALL VCLXWindow::isVisible( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - if( GetWindow() ) - return GetWindow()->IsVisible(); - else - return sal_False; -} - -sal_Bool SAL_CALL VCLXWindow::isActive( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - if( GetWindow() ) - return GetWindow()->IsActive(); - else - return sal_False; - -} - -sal_Bool SAL_CALL VCLXWindow::isEnabled( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - if( GetWindow() ) - return GetWindow()->IsEnabled(); - else - return sal_False; -} - -sal_Bool SAL_CALL VCLXWindow::hasFocus( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - if( GetWindow() ) - return GetWindow()->HasFocus(); - else - return sal_False; -} - -// ::com::sun::star::beans::XPropertySetInfo - -UnoPropertyArrayHelper * -VCLXWindow::GetPropHelper() -{ - SolarMutexGuard aGuard; - if ( mpImpl->mpPropHelper == NULL ) - { - std::list< sal_uInt16 > aIDs; - GetPropertyIds( aIDs ); - mpImpl->mpPropHelper = new UnoPropertyArrayHelper( aIDs ); - } - return mpImpl->mpPropHelper; -} - -::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL -VCLXWindow::getProperties() throw (::com::sun::star::uno::RuntimeException) -{ - return GetPropHelper()->getProperties(); -} -::com::sun::star::beans::Property SAL_CALL -VCLXWindow::getPropertyByName( const ::rtl::OUString& rName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException) -{ - return GetPropHelper()->getPropertyByName( rName ); -} - -::sal_Bool SAL_CALL -VCLXWindow::hasPropertyByName( const ::rtl::OUString& rName ) throw (::com::sun::star::uno::RuntimeException) -{ - return GetPropHelper()->hasPropertyByName( rName ); -} - -Reference< XStyleSettings > SAL_CALL VCLXWindow::getStyleSettings() throw (RuntimeException) -{ - return mpImpl->getStyleSettings(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxwindow1.cxx b/toolkit/source/awt/vclxwindow1.cxx deleted file mode 100644 index a8056bb3df..0000000000 --- a/toolkit/source/awt/vclxwindow1.cxx +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" - -#include <toolkit/awt/vclxwindow.hxx> -#include <com/sun/star/beans/NamedValue.hpp> -#ifndef _SV_WORKWIN -#include <vcl/wrkwin.hxx> -#endif -#include <vcl/window.hxx> - -#ifdef WNT -#include <prewin.h> -#include <postwin.h> -#elif defined ( QUARTZ ) -#include "premac.h" -#include <Cocoa/Cocoa.h> -#include "postmac.h" -#elif defined ( IOS ) -#include "premac.h" -#include <UIKit/UIKit.h> -#include "postmac.h" -#endif -#include <vcl/sysdata.hxx> - -/// helper method to set a window handle into a SystemParentData struct -void VCLXWindow::SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle ) -{ - // does only work for WorkWindows - Window *pWindow = GetWindow(); - if ( pWindow->GetType() != WINDOW_WORKWINDOW ) - { - ::com::sun::star::uno::Exception *pException = - new ::com::sun::star::uno::RuntimeException; - pException->Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("not a work window")); - throw pException; - } - - // use sal_Int64 here to accomodate all int types - // uno::Any shift operator whill upcast if necessary - sal_Int64 nHandle = 0; - sal_Bool bXEmbed = sal_False; - bool bThrow = false; - if( ! (rHandle >>= nHandle) ) - { - com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > aProps; - if( rHandle >>= aProps ) - { - const int nProps = aProps.getLength(); - const com::sun::star::beans::NamedValue* pProps = aProps.getConstArray(); - for( int i = 0; i < nProps; i++ ) - { - if( pProps[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "WINDOW" ) ) ) - pProps[i].Value >>= nHandle; - else if( pProps[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "XEMBED" ) ) ) - pProps[i].Value >>= bXEmbed; - } - } - else - bThrow = true; - } - if( bThrow ) - { - ::com::sun::star::uno::Exception *pException = - new ::com::sun::star::uno::RuntimeException; - pException->Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("incorrect window handle type")); - throw pException; - } - // create system parent data - SystemParentData aSysParentData; - aSysParentData.nSize = sizeof ( SystemParentData ); -#if defined( WNT ) - aSysParentData.hWnd = (HWND) nHandle; -#elif defined( QUARTZ ) - aSysParentData.pView = reinterpret_cast<NSView*>(nHandle); -#elif defined( IOS ) - aSysParentData.pView = reinterpret_cast<UIView*>(nHandle); -#elif defined( UNX ) - aSysParentData.aWindow = (long)nHandle; - aSysParentData.bXEmbedSupport = bXEmbed; -#endif - - // set system parent - ((WorkWindow*)pWindow)->SetPluginParent( &aSysParentData ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx deleted file mode 100644 index 60679acd77..0000000000 --- a/toolkit/source/awt/vclxwindows.cxx +++ /dev/null @@ -1,6684 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" -#include <toolkit/awt/vclxwindows.hxx> -#include <com/sun/star/awt/ScrollBarOrientation.hpp> -#include <com/sun/star/graphic/XGraphicProvider.hpp> -#include <toolkit/helper/vclunohelper.hxx> -#include <toolkit/helper/macros.hxx> -#include <toolkit/helper/property.hxx> -#include <toolkit/helper/convert.hxx> -#include <toolkit/helper/imagealign.hxx> -#include <toolkit/helper/accessibilityclient.hxx> -#include <toolkit/helper/fixedhyperbase.hxx> -#include <toolkit/helper/tkresmgr.hxx> -#include <cppuhelper/typeprovider.hxx> -#include <com/sun/star/awt/VisualEffect.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/system/XSystemShellExecute.hpp> -#include <com/sun/star/system/SystemShellExecuteFlags.hpp> -#include <com/sun/star/resource/XStringResourceResolver.hpp> -#include <com/sun/star/awt/ImageScaleMode.hpp> -#include <com/sun/star/awt/XItemList.hpp> -#include <comphelper/componentcontext.hxx> -#include <comphelper/namedvaluecollection.hxx> -#include <comphelper/processfactory.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> -#include <vcl/svapp.hxx> -#include <vcl/tabpage.hxx> -#include <vcl/tabctrl.hxx> -#include <tools/diagnose_ex.h> - -#include <boost/bind.hpp> -#include <boost/function.hpp> - -using ::com::sun::star::uno::Any; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::makeAny; -using ::com::sun::star::uno::RuntimeException; -using ::com::sun::star::lang::EventObject; -using ::com::sun::star::awt::ItemListEvent; -using ::com::sun::star::awt::XItemList; -using ::com::sun::star::graphic::XGraphic; -using ::com::sun::star::graphic::XGraphicProvider; - -using namespace ::com::sun::star; -using namespace ::com::sun::star::awt::VisualEffect; -namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode; - -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; -} - -namespace toolkit -{ - /** sets the "face color" for button like controls (scroll bar, spin button) - */ - void setButtonLikeFaceColor( Window* _pWindow, const ::com::sun::star::uno::Any& _rColorValue ) - { - AllSettings aSettings = _pWindow->GetSettings(); - StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - - if ( !_rColorValue.hasValue() ) - { - const StyleSettings& aAppStyle = Application::GetSettings().GetStyleSettings(); - aStyleSettings.SetFaceColor( aAppStyle.GetFaceColor( ) ); - aStyleSettings.SetCheckedColor( aAppStyle.GetCheckedColor( ) ); - aStyleSettings.SetLightBorderColor( aAppStyle.GetLightBorderColor() ); - aStyleSettings.SetLightColor( aAppStyle.GetLightColor() ); - aStyleSettings.SetShadowColor( aAppStyle.GetShadowColor() ); - aStyleSettings.SetDarkShadowColor( aAppStyle.GetDarkShadowColor() ); - } - else - { - sal_Int32 nBackgroundColor = 0; - _rColorValue >>= nBackgroundColor; - aStyleSettings.SetFaceColor( nBackgroundColor ); - - // for the real background (everything except the buttons and the thumb), - // use an average between the desired color and "white" - Color aWhite( COL_WHITE ); - Color aBackground( nBackgroundColor ); - aBackground.SetRed( ( aBackground.GetRed() + aWhite.GetRed() ) / 2 ); - aBackground.SetGreen( ( aBackground.GetGreen() + aWhite.GetGreen() ) / 2 ); - aBackground.SetBlue( ( aBackground.GetBlue() + aWhite.GetBlue() ) / 2 ); - aStyleSettings.SetCheckedColor( aBackground ); - - sal_Int32 nBackgroundLuminance = Color( nBackgroundColor ).GetLuminance(); - sal_Int32 nWhiteLuminance = Color( COL_WHITE ).GetLuminance(); - - Color aLightShadow( nBackgroundColor ); - aLightShadow.IncreaseLuminance( (sal_uInt8)( ( nWhiteLuminance - nBackgroundLuminance ) * 2 / 3 ) ); - aStyleSettings.SetLightBorderColor( aLightShadow ); - - Color aLight( nBackgroundColor ); - aLight.IncreaseLuminance( (sal_uInt8)( ( nWhiteLuminance - nBackgroundLuminance ) * 1 / 3 ) ); - aStyleSettings.SetLightColor( aLight ); - - Color aShadow( nBackgroundColor ); - aShadow.DecreaseLuminance( (sal_uInt8)( nBackgroundLuminance * 1 / 3 ) ); - aStyleSettings.SetShadowColor( aShadow ); - - Color aDarkShadow( nBackgroundColor ); - aDarkShadow.DecreaseLuminance( (sal_uInt8)( nBackgroundLuminance * 2 / 3 ) ); - aStyleSettings.SetDarkShadowColor( aDarkShadow ); - } - - aSettings.SetStyleSettings( aStyleSettings ); - _pWindow->SetSettings( aSettings, sal_True ); - } - - Any getButtonLikeFaceColor( const Window* _pWindow ) - { - sal_Int32 nBackgroundColor = _pWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor(); - return makeAny( nBackgroundColor ); - } - - static void adjustBooleanWindowStyle( const Any& _rValue, Window* _pWindow, WinBits _nBits, sal_Bool _bInverseSemantics ) - { - WinBits nStyle = _pWindow->GetStyle(); - sal_Bool bValue( sal_False ); - OSL_VERIFY( _rValue >>= bValue ); - if ( bValue != _bInverseSemantics ) - nStyle |= _nBits; - else - nStyle &= ~_nBits; - _pWindow->SetStyle( nStyle ); - } - - static void setVisualEffect( const Any& _rValue, Window* _pWindow ) - { - AllSettings aSettings = _pWindow->GetSettings(); - StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - - sal_Int16 nStyle = LOOK3D; - OSL_VERIFY( _rValue >>= nStyle ); - switch ( nStyle ) - { - case FLAT: - aStyleSettings.SetOptions( aStyleSettings.GetOptions() & ~STYLE_OPTION_MONO ); - break; - case LOOK3D: - default: - aStyleSettings.SetOptions( aStyleSettings.GetOptions() | STYLE_OPTION_MONO ); - } - aSettings.SetStyleSettings( aStyleSettings ); - _pWindow->SetSettings( aSettings ); - } - - static Any getVisualEffect( Window* _pWindow ) - { - Any aEffect; - - StyleSettings aStyleSettings = _pWindow->GetSettings().GetStyleSettings(); - if ( (aStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) - aEffect <<= (sal_Int16)FLAT; - else - aEffect <<= (sal_Int16)LOOK3D; - return aEffect; - } -} - -// ---------------------------------------------------- -// class VCLXGraphicControl -// ---------------------------------------------------- - -void VCLXGraphicControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - VCLXWindow::ImplGetPropertyIds( rIds ); -} - -void VCLXGraphicControl::ImplSetNewImage() -{ - OSL_PRECOND( GetWindow(), "VCLXGraphicControl::ImplSetNewImage: window is required to be not-NULL!" ); - Button* pButton = static_cast< Button* >( GetWindow() ); - pButton->SetModeImage( GetImage() ); -} - -void VCLXGraphicControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, short Flags ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( GetWindow() ) - { - Size aOldSize = GetWindow()->GetSizePixel(); - VCLXWindow::setPosSize( X, Y, Width, Height, Flags ); - if ( ( aOldSize.Width() != Width ) || ( aOldSize.Height() != Height ) ) - ImplSetNewImage(); - } -} - -void VCLXGraphicControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Button* pButton = static_cast< Button* >( GetWindow() ); - if ( !pButton ) - return; - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_GRAPHIC: - { - Reference< XGraphic > xGraphic; - OSL_VERIFY( Value >>= xGraphic ); - maImage = Image( xGraphic ); - ImplSetNewImage(); - } - break; - - case BASEPROPERTY_IMAGEALIGN: - { - WindowType eType = GetWindow()->GetType(); - if ( ( eType == WINDOW_PUSHBUTTON ) - || ( eType == WINDOW_RADIOBUTTON ) - || ( eType == WINDOW_CHECKBOX ) - ) - { - sal_Int16 nAlignment = sal_Int16(); - if ( Value >>= nAlignment ) - pButton->SetImageAlign( static_cast< ImageAlign >( nAlignment ) ); - } - } - break; - case BASEPROPERTY_IMAGEPOSITION: - { - WindowType eType = GetWindow()->GetType(); - if ( ( eType == WINDOW_PUSHBUTTON ) - || ( eType == WINDOW_RADIOBUTTON ) - || ( eType == WINDOW_CHECKBOX ) - ) - { - sal_Int16 nImagePosition = 2; - OSL_VERIFY( Value >>= nImagePosition ); - pButton->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition ) ); - } - } - break; - default: - VCLXWindow::setProperty( PropertyName, Value ); - break; - } -} - -::com::sun::star::uno::Any VCLXGraphicControl::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - if ( !GetWindow() ) - return aProp; - - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_GRAPHIC: - aProp <<= maImage.GetXGraphic(); - break; - case BASEPROPERTY_IMAGEALIGN: - { - WindowType eType = GetWindow()->GetType(); - if ( ( eType == WINDOW_PUSHBUTTON ) - || ( eType == WINDOW_RADIOBUTTON ) - || ( eType == WINDOW_CHECKBOX ) - ) - { - aProp <<= ::toolkit::getCompatibleImageAlign( static_cast< Button* >( GetWindow() )->GetImageAlign() ); - } - } - break; - case BASEPROPERTY_IMAGEPOSITION: - { - WindowType eType = GetWindow()->GetType(); - if ( ( eType == WINDOW_PUSHBUTTON ) - || ( eType == WINDOW_RADIOBUTTON ) - || ( eType == WINDOW_CHECKBOX ) - ) - { - aProp <<= ::toolkit::translateImagePosition( static_cast< Button* >( GetWindow() )->GetImageAlign() ); - } - } - break; - default: - { - aProp <<= VCLXWindow::getProperty( PropertyName ); - } - break; - } - return aProp; -} - -//-------------------------------------------------------------------- -// class VCLXButton -// ---------------------------------------------------- - -void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_DEFAULTBUTTON, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_GRAPHIC, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_IMAGEALIGN, - BASEPROPERTY_IMAGEPOSITION, - BASEPROPERTY_IMAGEURL, - BASEPROPERTY_LABEL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_PUSHBUTTONTYPE, - BASEPROPERTY_REPEAT, - BASEPROPERTY_REPEAT_DELAY, - BASEPROPERTY_STATE, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_TOGGLE, - BASEPROPERTY_FOCUSONCLICK, - BASEPROPERTY_MULTILINE, - BASEPROPERTY_ALIGN, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_REFERENCE_DEVICE, - 0); - VCLXGraphicControl::ImplGetPropertyIds( rIds ); -} - -VCLXButton::VCLXButton() - :maActionListeners( *this ) - ,maItemListeners( *this ) -{ -} - -VCLXButton::~VCLXButton() -{ -} - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext() -{ - return getAccessibleFactory().createAccessibleContext( this ); -} - -void VCLXButton::dispose() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::lang::EventObject aObj; - aObj.Source = (::cppu::OWeakObject*)this; - maActionListeners.disposeAndClear( aObj ); - maItemListeners.disposeAndClear( aObj ); - VCLXGraphicControl::dispose(); -} - -void VCLXButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.addInterface( l ); -} - -void VCLXButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.removeInterface( l ); -} - -void VCLXButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l )throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maItemListeners.addInterface( l ); -} - -void VCLXButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maItemListeners.removeInterface( l ); -} - -void VCLXButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - pWindow->SetText( rLabel ); -} - -void VCLXButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - maActionCommand = rCommand; -} - -::com::sun::star::awt::Size VCLXButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - Button* pButton = (Button*)GetWindow(); - if ( pButton ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_FOCUSONCLICK: - ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_NOPOINTERFOCUS, sal_True ); - break; - - case BASEPROPERTY_TOGGLE: - ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_TOGGLE, sal_False ); - break; - - case BASEPROPERTY_DEFAULTBUTTON: - { - WinBits nStyle = pButton->GetStyle() | WB_DEFBUTTON; - sal_Bool b = sal_Bool(); - if ( ( Value >>= b ) && !b ) - nStyle &= ~WB_DEFBUTTON; - pButton->SetStyle( nStyle ); - } - break; - case BASEPROPERTY_STATE: - { - if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON ) - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - ((PushButton*)pButton)->SetState( (TriState)n ); - } - } - break; - default: - { - VCLXGraphicControl::setProperty( PropertyName, Value ); - } - } - } -} - -::com::sun::star::uno::Any VCLXButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - Button* pButton = (Button*)GetWindow(); - if ( pButton ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_FOCUSONCLICK: - aProp <<= (sal_Bool)( ( pButton->GetStyle() & WB_NOPOINTERFOCUS ) == 0 ); - break; - - case BASEPROPERTY_TOGGLE: - aProp <<= (sal_Bool)( ( pButton->GetStyle() & WB_TOGGLE ) != 0 ); - break; - - case BASEPROPERTY_DEFAULTBUTTON: - { - aProp <<= (sal_Bool) ( ( pButton->GetStyle() & WB_DEFBUTTON ) ? sal_True : sal_False ); - } - break; - case BASEPROPERTY_STATE: - { - if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON ) - { - aProp <<= (sal_Int16)((PushButton*)pButton)->GetState(); - } - } - break; - default: - { - aProp <<= VCLXGraphicControl::getProperty( PropertyName ); - } - } - } - return aProp; -} - -void VCLXButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_BUTTON_CLICK: - { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - // since we call listeners below, there is a potential that we will be destroyed - // during the listener call. To prevent the resulting crashs, we keep us - // alive as long as we're here - - if ( maActionListeners.getLength() ) - { - ::com::sun::star::awt::ActionEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.ActionCommand = maActionCommand; - - Callback aCallback = ::boost::bind( - &ActionListenerMultiplexer::actionPerformed, - &maActionListeners, - aEvent - ); - ImplExecuteAsyncWithoutSolarLock( aCallback ); - } - } - break; - - case VCLEVENT_PUSHBUTTON_TOGGLE: - { - PushButton& rButton = dynamic_cast< PushButton& >( *rVclWindowEvent.GetWindow() ); - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - if ( maItemListeners.getLength() ) - { - ::com::sun::star::awt::ItemEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.Selected = ( rButton.GetState() == STATE_CHECK ) ? 1 : 0; - maItemListeners.itemStateChanged( aEvent ); - } - } - break; - - default: - VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent ); - break; - } -} - -// ---------------------------------------------------- -// class VCLXImageControl -// ---------------------------------------------------- - -void VCLXImageControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_GRAPHIC, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_IMAGEURL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_SCALEIMAGE, - BASEPROPERTY_IMAGE_SCALE_MODE, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - 0); - VCLXGraphicControl::ImplGetPropertyIds( rIds ); -} - -VCLXImageControl::VCLXImageControl() -{ -} - -VCLXImageControl::~VCLXImageControl() -{ -} - -void VCLXImageControl::ImplSetNewImage() -{ - OSL_PRECOND( GetWindow(), "VCLXImageControl::ImplSetNewImage: window is required to be not-NULL!" ); - ImageControl* pControl = static_cast< ImageControl* >( GetWindow() ); - pControl->SetImage( GetImage() ); -} - -::com::sun::star::awt::Size VCLXImageControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Size aSz = GetImage().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) -{ - SolarMutexGuard aGuard; - - ::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; -} - -void VCLXImageControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ImageControl* pImageControl = (ImageControl*)GetWindow(); - - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_IMAGE_SCALE_MODE: - { - sal_Int16 nScaleMode( ImageScaleMode::Anisotropic ); - if ( pImageControl && ( Value >>= nScaleMode ) ) - { - pImageControl->SetScaleMode( nScaleMode ); - } - } - break; - - case BASEPROPERTY_SCALEIMAGE: - { - // this is for compatibility only, nowadays, the ImageScaleMode property should be used - sal_Bool bScaleImage = sal_False; - if ( pImageControl && ( Value >>= bScaleImage ) ) - { - pImageControl->SetScaleMode( bScaleImage ? ImageScaleMode::Anisotropic : ImageScaleMode::None ); - } - } - break; - - default: - VCLXGraphicControl::setProperty( PropertyName, Value ); - break; - } -} - -::com::sun::star::uno::Any VCLXImageControl::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - ImageControl* pImageControl = (ImageControl*)GetWindow(); - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - - switch ( nPropType ) - { - case BASEPROPERTY_IMAGE_SCALE_MODE: - aProp <<= ( pImageControl ? pImageControl->GetScaleMode() : ImageScaleMode::Anisotropic ); - break; - - case BASEPROPERTY_SCALEIMAGE: - aProp <<= ( pImageControl && pImageControl->GetScaleMode() != ImageScaleMode::None ) ? sal_True : sal_False; - break; - - default: - aProp = VCLXGraphicControl::getProperty( PropertyName ); - break; - } - return aProp; -} - -// ---------------------------------------------------- -// class VCLXCheckBox -// ---------------------------------------------------- - - -void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_GRAPHIC, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_IMAGEPOSITION, - BASEPROPERTY_IMAGEURL, - BASEPROPERTY_LABEL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_STATE, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_TRISTATE, - BASEPROPERTY_VISUALEFFECT, - BASEPROPERTY_MULTILINE, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_ALIGN, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_REFERENCE_DEVICE, - 0); - VCLXGraphicControl::ImplGetPropertyIds( rIds ); -} - -VCLXCheckBox::VCLXCheckBox() : maActionListeners( *this ), maItemListeners( *this ) -{ -} - -// ::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::XButton*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XCheckBox*, this ) ); - return (aRet.hasValue() ? aRet : VCLXGraphicControl::queryInterface( rType )); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXCheckBox ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox>* ) NULL ), - VCLXGraphicControl::getTypes() -IMPL_XTYPEPROVIDER_END - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXCheckBox::CreateAccessibleContext() -{ - return getAccessibleFactory().createAccessibleContext( this ); -} - -void VCLXCheckBox::dispose() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::lang::EventObject aObj; - aObj.Source = (::cppu::OWeakObject*)this; - maItemListeners.disposeAndClear( aObj ); - VCLXGraphicControl::dispose(); -} - -void VCLXCheckBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maItemListeners.addInterface( l ); -} - -void VCLXCheckBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maItemListeners.removeInterface( l ); -} - -void VCLXCheckBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.addInterface( l ); -} - -void VCLXCheckBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.removeInterface( l ); -} - -void VCLXCheckBox::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionCommand = rCommand; -} - -void VCLXCheckBox::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - pWindow->SetText( rLabel ); -} - -void VCLXCheckBox::setState( short n ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - CheckBox* pCheckBox = (CheckBox*)GetWindow(); - if ( pCheckBox) - { - TriState eState; - switch ( n ) - { - case 0: eState = STATE_NOCHECK; break; - case 1: eState = STATE_CHECK; break; - case 2: eState = STATE_DONTKNOW; break; - default: eState = STATE_NOCHECK; - } - pCheckBox->SetState( eState ); - - // #105198# call C++ click listeners (needed for accessibility) - // pCheckBox->GetClickHdl().Call( pCheckBox ); - - // #107218# Call same virtual methods and listeners like VCL would do after user interaction - SetSynthesizingVCLEvent( sal_True ); - pCheckBox->Toggle(); - pCheckBox->Click(); - SetSynthesizingVCLEvent( sal_False ); - } -} - -short VCLXCheckBox::getState() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - short nState = -1; - CheckBox* pCheckBox = (CheckBox*)GetWindow(); - if ( pCheckBox ) - { - switch ( pCheckBox->GetState() ) - { - case STATE_NOCHECK: nState = 0; break; - case STATE_CHECK: nState = 1; break; - case STATE_DONTKNOW: nState = 2; break; - default: OSL_FAIL( "VCLXCheckBox::getState(): unknown TriState!" ); - } - } - - return nState; -} - -void VCLXCheckBox::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - CheckBox* pCheckBox = (CheckBox*)GetWindow(); - if ( pCheckBox) - pCheckBox->EnableTriState( b ); -} - -::com::sun::star::awt::Size VCLXCheckBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - CheckBox* pCheckBox = (CheckBox*)GetWindow(); - if ( pCheckBox ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_VISUALEFFECT: - ::toolkit::setVisualEffect( Value, pCheckBox ); - break; - - case BASEPROPERTY_TRISTATE: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - pCheckBox->EnableTriState( b ); - } - break; - case BASEPROPERTY_STATE: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - setState( n ); - } - break; - default: - { - VCLXGraphicControl::setProperty( PropertyName, Value ); - } - } - } -} - -::com::sun::star::uno::Any VCLXCheckBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - CheckBox* pCheckBox = (CheckBox*)GetWindow(); - if ( pCheckBox ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_VISUALEFFECT: - aProp = ::toolkit::getVisualEffect( pCheckBox ); - break; - case BASEPROPERTY_TRISTATE: - aProp <<= (sal_Bool)pCheckBox->IsTriStateEnabled(); - break; - case BASEPROPERTY_STATE: - aProp <<= (sal_Int16)pCheckBox->GetState(); - break; - default: - { - aProp <<= VCLXGraphicControl::getProperty( PropertyName ); - } - } - } - return aProp; -} - -void VCLXCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_CHECKBOX_TOGGLE: - { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - // since we call listeners below, there is a potential that we will be destroyed - // in during the listener call. To prevent the resulting crashs, we keep us - // alive as long as we're here - - CheckBox* pCheckBox = (CheckBox*)GetWindow(); - if ( pCheckBox ) - { - if ( maItemListeners.getLength() ) - { - ::com::sun::star::awt::ItemEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.Highlighted = sal_False; - aEvent.Selected = pCheckBox->GetState(); - maItemListeners.itemStateChanged( aEvent ); - } - if ( !IsSynthesizingVCLEvent() && maActionListeners.getLength() ) - { - ::com::sun::star::awt::ActionEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.ActionCommand = maActionCommand; - maActionListeners.actionPerformed( aEvent ); - } - } - } - break; - - default: - VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent ); - break; - } -} - -// ---------------------------------------------------- -// class VCLXRadioButton -// ---------------------------------------------------- -void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_GRAPHIC, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_IMAGEPOSITION, - BASEPROPERTY_IMAGEURL, - BASEPROPERTY_LABEL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_STATE, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_VISUALEFFECT, - BASEPROPERTY_MULTILINE, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_ALIGN, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_REFERENCE_DEVICE, - BASEPROPERTY_GROUPNAME, - 0); - VCLXGraphicControl::ImplGetPropertyIds( rIds ); -} - - -VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ), maActionListeners( *this ) -{ -} - -// ::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 ), - SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ) ); - return (aRet.hasValue() ? aRet : VCLXGraphicControl::queryInterface( rType )); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXRadioButton ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ), - VCLXGraphicControl::getTypes() -IMPL_XTYPEPROVIDER_END - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXRadioButton::CreateAccessibleContext() -{ - return getAccessibleFactory().createAccessibleContext( this ); -} - -void VCLXRadioButton::dispose() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::lang::EventObject aObj; - aObj.Source = (::cppu::OWeakObject*)this; - maItemListeners.disposeAndClear( aObj ); - VCLXGraphicControl::dispose(); -} - -void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - RadioButton* pButton = (RadioButton*)GetWindow(); - if ( pButton ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_VISUALEFFECT: - ::toolkit::setVisualEffect( Value, pButton ); - break; - - case BASEPROPERTY_STATE: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - { - sal_Bool b = n ? sal_True : sal_False; - if ( pButton->IsRadioCheckEnabled() ) - pButton->Check( b ); - else - pButton->SetState( b ); - } - } - break; - case BASEPROPERTY_AUTOTOGGLE: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - pButton->EnableRadioCheck( b ); - } - break; - default: - { - VCLXGraphicControl::setProperty( PropertyName, Value ); - } - } - } -} - -::com::sun::star::uno::Any VCLXRadioButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - RadioButton* pButton = (RadioButton*)GetWindow(); - if ( pButton ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_VISUALEFFECT: - aProp = ::toolkit::getVisualEffect( pButton ); - break; - case BASEPROPERTY_STATE: - aProp <<= (sal_Int16) ( pButton->IsChecked() ? 1 : 0 ); - break; - case BASEPROPERTY_AUTOTOGGLE: - aProp <<= (sal_Bool) pButton->IsRadioCheckEnabled(); - break; - default: - { - aProp <<= VCLXGraphicControl::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) -{ - SolarMutexGuard aGuard; - maItemListeners.addInterface( l ); -} - -void VCLXRadioButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maItemListeners.removeInterface( l ); -} - -void VCLXRadioButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.addInterface( l ); -} - -void VCLXRadioButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.removeInterface( l ); -} - -void VCLXRadioButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - pWindow->SetText( rLabel ); -} - -void VCLXRadioButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionCommand = rCommand; -} - -void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - RadioButton* pRadioButton = (RadioButton*)GetWindow(); - if ( pRadioButton) - { - pRadioButton->Check( b ); - // #102717# item listeners are called, but not C++ click listeners in StarOffice code => call click hdl - // But this is needed in old code because Accessibility API uses it. - // pRadioButton->GetClickHdl().Call( pRadioButton ); - - // #107218# Call same virtual methods and listeners like VCL would do after user interaction - SetSynthesizingVCLEvent( sal_True ); - pRadioButton->Click(); - SetSynthesizingVCLEvent( sal_False ); - } -} - -sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - RadioButton* pRadioButton = (RadioButton*)GetWindow(); - return pRadioButton ? pRadioButton->IsChecked() : sal_False; -} - -::com::sun::star::awt::Size VCLXRadioButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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); -} - -void VCLXRadioButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - // since we call listeners below, there is a potential that we will be destroyed - // in during the listener call. To prevent the resulting crashs, we keep us - // alive as long as we're here - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_BUTTON_CLICK: - if ( !IsSynthesizingVCLEvent() && maActionListeners.getLength() ) - { - ::com::sun::star::awt::ActionEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.ActionCommand = maActionCommand; - maActionListeners.actionPerformed( aEvent ); - } - ImplClickedOrToggled( sal_False ); - break; - - case VCLEVENT_RADIOBUTTON_TOGGLE: - ImplClickedOrToggled( sal_True ); - break; - - default: - VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent ); - break; - } -} - -void VCLXRadioButton::ImplClickedOrToggled( sal_Bool bToggled ) -{ - // In the formulars, RadioChecked is not enabled, call itemStateChanged only for click - // In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled - RadioButton* pRadioButton = (RadioButton*)GetWindow(); - if ( pRadioButton && ( pRadioButton->IsRadioCheckEnabled() == bToggled ) && ( bToggled || 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 ); - } -} - -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > VCLXRadioButton::getFirstActionListener () -{ - if (!maItemListeners.getLength ()) - return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > (); - return maActionListeners.getElements()[0]; -} - -// ---------------------------------------------------- -// class VCLXSpinField -// ---------------------------------------------------- -void VCLXSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, - 0 ); - VCLXEdit::ImplGetPropertyIds( rIds ); -} - -VCLXSpinField::VCLXSpinField() : maSpinListeners( *this ) -{ -} - -// ::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) -{ - SolarMutexGuard aGuard; - maSpinListeners.addInterface( l ); -} - -void VCLXSpinField::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maSpinListeners.removeInterface( l ); -} - -void VCLXSpinField::up() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - SpinField* pSpinField = (SpinField*) GetWindow(); - if ( pSpinField ) - pSpinField->Up(); -} - -void VCLXSpinField::down() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - SpinField* pSpinField = (SpinField*) GetWindow(); - if ( pSpinField ) - pSpinField->Down(); -} - -void VCLXSpinField::first() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - SpinField* pSpinField = (SpinField*) GetWindow(); - if ( pSpinField ) - pSpinField->First(); -} - -void VCLXSpinField::last() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - SpinField* pSpinField = (SpinField*) GetWindow(); - if ( pSpinField ) - pSpinField->Last(); -} - -void VCLXSpinField::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - { - WinBits nStyle = pWindow->GetStyle(); - if ( bRepeat ) - nStyle |= WB_REPEAT; - else - nStyle &= ~WB_REPEAT; - pWindow->SetStyle( nStyle ); - } -} - -void VCLXSpinField::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_SPINFIELD_UP: - case VCLEVENT_SPINFIELD_DOWN: - case VCLEVENT_SPINFIELD_FIRST: - case VCLEVENT_SPINFIELD_LAST: - { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - // since we call listeners below, there is a potential that we will be destroyed - // in during the listener call. To prevent the resulting crashs, we keep us - // alive as long as we're here - - if ( maSpinListeners.getLength() ) - { - ::com::sun::star::awt::SpinEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_SPINFIELD_UP: maSpinListeners.up( aEvent ); - break; - case VCLEVENT_SPINFIELD_DOWN: maSpinListeners.down( aEvent ); - break; - case VCLEVENT_SPINFIELD_FIRST: maSpinListeners.first( aEvent ); - break; - case VCLEVENT_SPINFIELD_LAST: maSpinListeners.last( aEvent ); - break; - } - - } - } - break; - - default: - VCLXEdit::ProcessWindowEvent( rVclWindowEvent ); - break; - } -} - - -// ---------------------------------------------------- -// class VCLXListBox -// ---------------------------------------------------- -void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_DROPDOWN, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_LINECOUNT, - BASEPROPERTY_MULTISELECTION, - BASEPROPERTY_MULTISELECTION_SIMPLEMODE, - BASEPROPERTY_ITEM_SEPARATOR_POS, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_SELECTEDITEMS, - BASEPROPERTY_STRINGITEMLIST, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_READONLY, - BASEPROPERTY_ALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_REFERENCE_DEVICE, - BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, - 0); - VCLXWindow::ImplGetPropertyIds( rIds ); -} - - -VCLXListBox::VCLXListBox() - : maActionListeners( *this ), - maItemListeners( *this ) -{ -} - -void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - maItemListeners.addInterface( l ); -} - -void VCLXListBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maItemListeners.removeInterface( l ); -} - -void VCLXListBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.addInterface( l ); -} - -void VCLXListBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.removeInterface( l ); -} - -void VCLXListBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - ListBox* pBox = (ListBox*) GetWindow(); - if ( pBox ) - { - sal_uInt16 nP = nPos; - const ::rtl::OUString* pItems = aItems.getConstArray(); - const ::rtl::OUString* pItemsEnd = aItems.getConstArray() + aItems.getLength(); - while ( pItems != pItemsEnd ) - { - if ( (sal_uInt16)nP == 0xFFFF ) - { - OSL_FAIL( "VCLXListBox::addItems: too many entries!" ); - // skip remaining entries, list cannot hold them, anyway - break; - } - - pBox->InsertEntry( *pItems++, nP++ ); - } - } -} - -void VCLXListBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - ListBox* pBox = (ListBox*) GetWindow(); - return pBox ? pBox->GetEntryCount() : 0; -} - -::rtl::OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - ListBox* pBox = (ListBox*) GetWindow(); - return pBox ? pBox->GetSelectEntryPos() : 0; -} - -::com::sun::star::uno::Sequence<sal_Int16> VCLXListBox::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - ListBox* pBox = (ListBox*) GetWindow(); - if ( pBox && ( pBox->IsEntryPosSelected( nPos ) != bSelect ) ) - { - pBox->SelectEntryPos( nPos, bSelect ); - - // VCL doesn't call select handler after API call. - // ImplCallItemListeners(); - - // #107218# Call same listeners like VCL would do after user interaction - SetSynthesizingVCLEvent( sal_True ); - pBox->Select(); - SetSynthesizingVCLEvent( sal_False ); - } -} - -void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ListBox* pBox = (ListBox*) GetWindow(); - if ( pBox ) - { - sal_Bool bChanged = sal_False; - for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; ) - { - sal_uInt16 nPos = (sal_uInt16) aPositions.getConstArray()[--n]; - if ( pBox->IsEntryPosSelected( nPos ) != bSelect ) - { - pBox->SelectEntryPos( nPos, bSelect ); - bChanged = sal_True; - } - } - - if ( bChanged ) - { - // VCL doesn't call select handler after API call. - // ImplCallItemListeners(); - - // #107218# Call same listeners like VCL would do after user interaction - SetSynthesizingVCLEvent( sal_True ); - pBox->Select(); - SetSynthesizingVCLEvent( sal_False ); - } - } -} - -void VCLXListBox::selectItem( const ::rtl::OUString& rItemText, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ListBox* pBox = (ListBox*) GetWindow(); - if ( pBox ) - { - String aItemText( rItemText ); - selectItemPos( pBox->GetEntryPos( aItemText ), bSelect ); - } -} - - -void VCLXListBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ListBox* pBox = (ListBox*) GetWindow(); - if ( pBox ) - pBox->SetDropDownLineCount( nLines ); -} - -sal_Int16 VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - ListBox* pBox = (ListBox*) GetWindow(); - if ( pBox ) - pBox->EnableMultiSelection( bMulti ); -} - -void VCLXListBox::makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ListBox* pBox = (ListBox*) GetWindow(); - if ( pBox ) - pBox->SetTopEntry( nEntry ); -} - -void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - // since we call listeners below, there is a potential that we will be destroyed - // in during the listener call. To prevent the resulting crashs, we keep us - // alive as long as we're here - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_LISTBOX_SELECT: - { - ListBox* pListBox = (ListBox*)GetWindow(); - - if( pListBox ) - { - sal_Bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) ? sal_True : sal_False; - if ( bDropDown && !IsSynthesizingVCLEvent() && maActionListeners.getLength() ) - { - // Bei DropDown den ActionListener rufen... - ::com::sun::star::awt::ActionEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.ActionCommand = pListBox->GetSelectEntry(); - maActionListeners.actionPerformed( aEvent ); - } - - if ( maItemListeners.getLength() ) - { - ImplCallItemListeners(); - } - } - } - break; - - case VCLEVENT_LISTBOX_DOUBLECLICK: - if ( GetWindow() && maActionListeners.getLength() ) - { - ::com::sun::star::awt::ActionEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.ActionCommand = ((ListBox*)GetWindow())->GetSelectEntry(); - maActionListeners.actionPerformed( aEvent ); - } - break; - - default: - VCLXWindow::ProcessWindowEvent( rVclWindowEvent ); - break; - } -} - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXListBox::CreateAccessibleContext() -{ - SolarMutexGuard aGuard; - - return getAccessibleFactory().createAccessibleContext( this ); -} - -void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ListBox* pListBox = (ListBox*)GetWindow(); - if ( pListBox ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_ITEM_SEPARATOR_POS: - { - sal_Int16 nSeparatorPos(0); - if ( Value >>= nSeparatorPos ) - pListBox->SetSeparatorPos( nSeparatorPos ); - } - break; - case BASEPROPERTY_READONLY: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - pListBox->SetReadOnly( b); - } - break; - case BASEPROPERTY_MULTISELECTION: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - pListBox->EnableMultiSelection( b ); - } - break; - case BASEPROPERTY_MULTISELECTION_SIMPLEMODE: - ::toolkit::adjustBooleanWindowStyle( Value, pListBox, WB_SIMPLEMODE, sal_False ); - break; - case BASEPROPERTY_LINECOUNT: - { - sal_Int16 n = sal_Int16(); - 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 ); - - if ( aItems.getLength() ) - selectItemsPos( aItems, sal_True ); - else - pListBox->SetNoSelection(); - - 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) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - ListBox* pListBox = (ListBox*)GetWindow(); - if ( pListBox ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_ITEM_SEPARATOR_POS: - aProp <<= sal_Int16( pListBox->GetSeparatorPos() ); - break; - case BASEPROPERTY_READONLY: - { - aProp <<= (sal_Bool) pListBox->IsReadOnly(); - } - break; - case BASEPROPERTY_MULTISELECTION: - { - aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled(); - } - break; - case BASEPROPERTY_MULTISELECTION_SIMPLEMODE: - { - aProp <<= (sal_Bool)( ( pListBox->GetStyle() & WB_SIMPLEMODE ) == 0 ); - } - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - nCols = nLines = 0; - ListBox* pListBox = (ListBox*) GetWindow(); - if ( pListBox ) - { - sal_uInt16 nC, nL; - pListBox->GetMaxVisColumnsAndLines( nC, nL ); - nCols = nC; - nLines = nL; - } -} - -void VCLXListBox::ImplCallItemListeners() -{ - ListBox* pListBox = (ListBox*) GetWindow(); - if ( pListBox && 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 ); - } -} -namespace -{ - Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL ) - { - if ( !i_rImageURL.getLength() ) - return Image(); - - try - { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XGraphicProvider > xProvider; - if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) ) - { - ::comphelper::NamedValueCollection aMediaProperties; - aMediaProperties.put( "URL", i_rImageURL ); - Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() ); - return Image( xGraphic ); - } - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return Image(); - } -} -void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() ); - - ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemInserted: no ListBox?!" ); - ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pListBox->GetEntryCount() ) ), - "VCLXListBox::listItemInserted: illegal (inconsistent) item position!" ); - pListBox->InsertEntry( - i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(), - i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(), - i_rEvent.ItemPosition ); -} - -void SAL_CALL VCLXListBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() ); - - ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemRemoved: no ListBox?!" ); - ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ), - "VCLXListBox::listItemRemoved: illegal (inconsistent) item position!" ); - - pListBox->RemoveEntry( i_rEvent.ItemPosition ); -} - -void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() ); - - ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" ); - ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ), - "VCLXListBox::listItemModified: illegal (inconsistent) item position!" ); - - // VCL's ListBox does not support changing an entry's text or image, so remove and re-insert - - const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pListBox->GetEntry( i_rEvent.ItemPosition ) ); - const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) ); - - pListBox->RemoveEntry( i_rEvent.ItemPosition ); - pListBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition ); -} - -void SAL_CALL VCLXListBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() ); - ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" ); - - pListBox->Clear(); - - (void)i_rEvent; -} - -void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() ); - ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" ); - - pListBox->Clear(); - - uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW ); - uno::Reference< resource::XStringResourceResolver > xStringResourceResolver; - if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) ) - { - xStringResourceResolver.set( - xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ), - uno::UNO_QUERY - ); - } - - - Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW ); - uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems(); - for ( sal_Int32 i=0; i<aItems.getLength(); ++i ) - { - ::rtl::OUString aLocalizationKey( aItems[i].First ); - if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' ) - { - aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 )); - } - pListBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) ); - } -} - -void SAL_CALL VCLXListBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException) -{ - // just disambiguate - VCLXWindow::disposing( i_rEvent ); -} - -// ---------------------------------------------------- -// class VCLXMessageBox -// ---------------------------------------------------- - -void VCLXMessageBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - VCLXTopWindow::ImplGetPropertyIds( rIds ); -} - -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 : VCLXTopWindow::queryInterface( rType )); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXMessageBox ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox>* ) NULL ), - VCLXTopWindow::getTypes() -IMPL_XTYPEPROVIDER_END - -void VCLXMessageBox::setCaptionText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - pWindow->SetText( rText ); -} - -::rtl::OUString VCLXMessageBox::getCaptionText() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - MessBox* pBox = (MessBox*)GetWindow(); - if ( pBox ) - pBox->SetMessText( rText ); -} - -::rtl::OUString VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::rtl::OUString aText; - MessBox* pBox = (MessBox*)GetWindow(); - if ( pBox ) - aText = pBox->GetMessText(); - return aText; -} - -sal_Int16 VCLXMessageBox::execute() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - MessBox* pBox = (MessBox*)GetWindow(); - return pBox ? pBox->Execute() : 0; -} - -::com::sun::star::awt::Size SAL_CALL VCLXMessageBox::getMinimumSize() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - return ::com::sun::star::awt::Size( 250, 100 ); -} - -// ---------------------------------------------------- -// class VCLXDialog -// ---------------------------------------------------- -void VCLXDialog::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - VCLXTopWindow::ImplGetPropertyIds( rIds ); -} - -VCLXDialog::VCLXDialog() -{ - OSL_TRACE("XDialog created"); -} - -VCLXDialog::~VCLXDialog() -{ -#ifndef __SUNPRO_CC - OSL_TRACE ("%s", __FUNCTION__); -#endif -} - -// ::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::document::XVbaMethodParameter*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XDialog2*, this ), - 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::document::XVbaMethodParameter>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ), - VCLXTopWindow::getTypes() -IMPL_XTYPEPROVIDER_END - -void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - Dialog* pDialog = dynamic_cast< Dialog* >( GetWindow() ); - if ( pDialog ) - pDialog->EndDialog( i_result ); -} - -void SAL_CALL VCLXDialog::setHelpId( const ::rtl::OUString& rId ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - pWindow->SetHelpId( rtl::OUStringToOString( rId, RTL_TEXTENCODING_UTF8 ) ); -} - -void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - pWindow->SetText( Title ); -} - -::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::rtl::OUString aTitle; - Window* pWindow = GetWindow(); - if ( pWindow ) - aTitle = pWindow->GetText(); - return aTitle; -} - -sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - sal_Int16 nRet = 0; - if ( GetWindow() ) - { - Dialog* pDlg = (Dialog*) GetWindow(); - Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP ); - Window* pOldParent = NULL; - Window* pSetParent = NULL; - if ( pParent && !pParent->IsReallyVisible() ) - { - pOldParent = pDlg->GetParent(); - Window* pFrame = pDlg->GetWindow( WINDOW_FRAME ); - if( pFrame != pDlg ) - { - pDlg->SetParent( pFrame ); - pSetParent = pFrame; - } - } - - nRet = pDlg->Execute(); - - // set the parent back only in case no new parent was set from outside - // in other words, revert only own changes - if ( pOldParent && pDlg->GetParent() == pSetParent ) - pDlg->SetParent( pOldParent ); - } - return nRet; -} - -void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException) -{ - endDialog(0); -} - -void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - Window* pWindow = GetWindow(); - - if ( pWindow ) - { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); - if ( !pDev ) - pDev = pWindow->GetParent(); - - Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() ); - Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); - - pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS ); - } -} - -::com::sun::star::awt::DeviceInfo VCLXDialog::getInfo() throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo(); - - SolarMutexGuard aGuard; - Dialog* pDlg = (Dialog*) GetWindow(); - if ( pDlg ) - pDlg->GetDrawWindowBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset ); - - return aInfo; -} - -// ::com::sun::star::document::XVbaMethodParameter -void SAL_CALL VCLXDialog::setVbaMethodParameter( - const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Any& Value ) -throw(::com::sun::star::uno::RuntimeException) -{ - if (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cancel")) == PropertyName) - { - SolarMutexGuard aGuard; - if ( GetWindow() ) - { - sal_Int8 nCancel = 0; - Value >>= nCancel; - - Dialog* pDlg = (Dialog*) GetWindow(); - pDlg->SetCloseFlag(nCancel); - } - } -} - -::com::sun::star::uno::Any SAL_CALL VCLXDialog::getVbaMethodParameter( - const ::rtl::OUString& /*PropertyName*/ ) -throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aRet; - return aRet; -} - -void SAL_CALL VCLXDialog::setProperty( - const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Any& Value ) -throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Dialog* pDialog = (Dialog*)GetWindow(); - if ( pDialog ) - { - sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; - - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_GRAPHIC: - { - Reference< XGraphic > xGraphic; - if (( Value >>= xGraphic ) && xGraphic.is() ) - { - Image aImage( xGraphic ); - - Wallpaper aWallpaper( aImage.GetBitmapEx()); - aWallpaper.SetStyle( WALLPAPER_SCALE ); - pDialog->SetBackground( aWallpaper ); - } - else if ( bVoid || !xGraphic.is() ) - { - Color aColor = pDialog->GetControlBackground().GetColor(); - if ( aColor == COL_AUTO ) - aColor = pDialog->GetSettings().GetStyleSettings().GetDialogColor(); - - Wallpaper aWallpaper( aColor ); - pDialog->SetBackground( aWallpaper ); - } - } - break; - - default: - { - VCLXWindow::setProperty( PropertyName, Value ); - } - } - } -} - - -// ---------------------------------------------------- -// class VCLXTabPage -// ---------------------------------------------------- -VCLXMultiPage::VCLXMultiPage() : maTabListeners( *this ), mTabId( 1 ) -{ - OSL_TRACE("VCLXMultiPage::VCLXMultiPage()" ); -} - -void VCLXMultiPage::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_MULTIPAGEVALUE, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_GRAPHIC, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_IMAGEALIGN, - BASEPROPERTY_IMAGEPOSITION, - BASEPROPERTY_IMAGEURL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_FOCUSONCLICK, - 0); - VCLXContainer::ImplGetPropertyIds( rIds ); -} - -VCLXMultiPage::~VCLXMultiPage() -{ -} -void SAL_CALL VCLXMultiPage::dispose() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::lang::EventObject aObj; - aObj.Source = (::cppu::OWeakObject*)this; - maTabListeners.disposeAndClear( aObj ); - VCLXContainer::dispose(); -} -::com::sun::star::uno::Any SAL_CALL VCLXMultiPage::queryInterface(const ::com::sun::star::uno::Type & rType ) -throw(::com::sun::star::uno::RuntimeException) -{ - uno::Any aRet = ::cppu::queryInterface( rType, static_cast< awt::XSimpleTabController*>( this ) ); - - return ( aRet.hasValue() ? aRet : VCLXContainer::queryInterface( rType ) ); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXMultiPage ) - VCLXContainer::getTypes() -IMPL_XTYPEPROVIDER_END - -// ::com::sun::star::awt::XView -void SAL_CALL VCLXMultiPage::draw( sal_Int32 nX, sal_Int32 nY ) -throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - Window* pWindow = GetWindow(); - - if ( pWindow ) - { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); - if ( !pDev ) - pDev = pWindow->GetParent(); - - Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() ); - Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); - - pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS ); - } -} - -// ::com::sun::star::awt::XDevice, -::com::sun::star::awt::DeviceInfo SAL_CALL VCLXMultiPage::getInfo() -throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo(); - return aInfo; -} - -uno::Any SAL_CALL VCLXMultiPage::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - OSL_TRACE(" **** VCLXMultiPage::getProperty( %s )", - rtl::OUStringToOString( PropertyName, - RTL_TEXTENCODING_UTF8 ).getStr() ); - ::com::sun::star::uno::Any aProp; - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - - case BASEPROPERTY_MULTIPAGEVALUE: - { - aProp <<= getActiveTabID(); - } - break; - default: - aProp <<= VCLXContainer::getProperty( PropertyName ); - } - return aProp; -} - -void SAL_CALL VCLXMultiPage::setProperty( - const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Any& Value ) -throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - OSL_TRACE(" **** VCLXMultiPage::setProperty( %s )", rtl::OUStringToOString( PropertyName, RTL_TEXTENCODING_UTF8 ).getStr() ); - - TabControl* pTabControl = (TabControl*)GetWindow(); - if ( pTabControl ) - { - sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; - - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_MULTIPAGEVALUE: - { - OSL_TRACE("***MULTIPAGE VALUE"); - sal_Int32 nId(0); - Value >>= nId; - // when the multipage is created we attempt to set the activepage - // but no pages created - if ( nId && nId <= getWindows().getLength() ) - activateTab( nId ); - } - case BASEPROPERTY_GRAPHIC: - { - Reference< XGraphic > xGraphic; - if (( Value >>= xGraphic ) && xGraphic.is() ) - { - Image aImage( xGraphic ); - - Wallpaper aWallpaper( aImage.GetBitmapEx()); - aWallpaper.SetStyle( WALLPAPER_SCALE ); - pTabControl->SetBackground( aWallpaper ); - } - else if ( bVoid || !xGraphic.is() ) - { - Color aColor = pTabControl->GetControlBackground().GetColor(); - if ( aColor == COL_AUTO ) - aColor = pTabControl->GetSettings().GetStyleSettings().GetDialogColor(); - - Wallpaper aWallpaper( aColor ); - pTabControl->SetBackground( aWallpaper ); - } - } - break; - - default: - { - VCLXContainer::setProperty( PropertyName, Value ); - } - } - } -} - -TabControl *VCLXMultiPage::getTabControl() const throw (uno::RuntimeException) -{ - TabControl *pTabControl = dynamic_cast< TabControl* >( GetWindow() ); - if ( pTabControl ) - return pTabControl; - throw uno::RuntimeException(); -} -sal_Int32 SAL_CALL VCLXMultiPage::insertTab() throw (uno::RuntimeException) -{ - TabControl *pTabControl = getTabControl(); - TabPage* pTab = new TabPage( pTabControl ); - rtl::OUString title (RTL_CONSTASCII_USTRINGPARAM( "" ) ); - return static_cast< sal_Int32 >( insertTab( pTab, title ) ); -} - -sal_uInt16 VCLXMultiPage::insertTab( TabPage* pPage, rtl::OUString& sTitle ) -{ - TabControl *pTabControl = getTabControl(); - sal_uInt16 id = sal::static_int_cast< sal_uInt16 >( mTabId++ ); - pTabControl->InsertPage( id, sTitle.getStr(), TAB_APPEND ); - pTabControl->SetTabPage( id, pPage ); - return id; -} - -void SAL_CALL VCLXMultiPage::removeTab( sal_Int32 ID ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException) -{ - TabControl *pTabControl = getTabControl(); - if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL ) - throw lang::IndexOutOfBoundsException(); - pTabControl->RemovePage( sal::static_int_cast< sal_uInt16 >( ID ) ); -} - -void SAL_CALL VCLXMultiPage::activateTab( sal_Int32 ID ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException) -{ - TabControl *pTabControl = getTabControl(); - OSL_TRACE("Attempting to activate tab %d, active tab is %d, numtabs is %d", ID, getActiveTabID(), getWindows().getLength() ); - if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL ) - throw lang::IndexOutOfBoundsException(); - pTabControl->SelectTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ); -} - -sal_Int32 SAL_CALL VCLXMultiPage::getActiveTabID() throw (uno::RuntimeException) -{ - return getTabControl()->GetCurPageId( ); -} - -void SAL_CALL VCLXMultiPage::addTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maTabListeners.addInterface( xListener ); -} - -void SAL_CALL VCLXMultiPage::removeTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maTabListeners.addInterface( xListener ); -} - -void SAL_CALL VCLXMultiPage::setTabProps( sal_Int32 ID, const uno::Sequence< beans::NamedValue >& Properties ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException) -{ - SolarMutexGuard aGuard; - TabControl *pTabControl = getTabControl(); - if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL ) - throw lang::IndexOutOfBoundsException(); - - for ( int i = 0; i < Properties.getLength(); i++ ) - { - const rtl::OUString &name = Properties[i].Name; - const uno::Any &value = Properties[i].Value; - - if ( name == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ) ) - { - rtl::OUString title = value.get<rtl::OUString>(); - pTabControl->SetPageText( sal::static_int_cast< sal_uInt16 >( ID ), title.getStr() ); - } - } -} - -uno::Sequence< beans::NamedValue > SAL_CALL VCLXMultiPage::getTabProps( sal_Int32 ID ) - throw (lang::IndexOutOfBoundsException, uno::RuntimeException) -{ - SolarMutexGuard aGuard; - TabControl *pTabControl = getTabControl(); - if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL ) - throw lang::IndexOutOfBoundsException(); - -#define ADD_PROP( seq, i, name, val ) { \ - beans::NamedValue value; \ - value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \ - value.Value = uno::makeAny( val ); \ - seq[i] = value; \ - } - - uno::Sequence< beans::NamedValue > props( 2 ); - ADD_PROP( props, 0, "Title", rtl::OUString( pTabControl->GetPageText( sal::static_int_cast< sal_uInt16 >( ID ) ) ) ); - ADD_PROP( props, 1, "Position", pTabControl->GetPagePos( sal::static_int_cast< sal_uInt16 >( ID ) ) ); -#undef ADD_PROP - return props; -} -void VCLXMultiPage::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_TABPAGE_DEACTIVATE: - { - sal_uLong nPageID = (sal_uLong)( rVclWindowEvent.GetData() ); - maTabListeners.deactivated( nPageID ); - break; - - } - case VCLEVENT_TABPAGE_ACTIVATE: - { - sal_uLong nPageID = (sal_uLong)( rVclWindowEvent.GetData() ); - maTabListeners.activated( nPageID ); - break; - } - default: - VCLXContainer::ProcessWindowEvent( rVclWindowEvent ); - break; - }; -} - -// ---------------------------------------------------- -// class VCLXTabPage -// ---------------------------------------------------- -VCLXTabPage::VCLXTabPage() -{ -} - -void VCLXTabPage::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_GRAPHIC, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_IMAGEALIGN, - BASEPROPERTY_IMAGEPOSITION, - BASEPROPERTY_IMAGEURL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_FOCUSONCLICK, - 0); - VCLXContainer::ImplGetPropertyIds( rIds ); -} - -VCLXTabPage::~VCLXTabPage() -{ -} - -::com::sun::star::uno::Any SAL_CALL VCLXTabPage::queryInterface(const ::com::sun::star::uno::Type & rType ) -throw(::com::sun::star::uno::RuntimeException) -{ - return VCLXContainer::queryInterface( rType ); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXTabPage ) - VCLXContainer::getTypes() -IMPL_XTYPEPROVIDER_END - -// ::com::sun::star::awt::XView -void SAL_CALL VCLXTabPage::draw( sal_Int32 nX, sal_Int32 nY ) -throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - Window* pWindow = GetWindow(); - - if ( pWindow ) - { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); - if ( !pDev ) - pDev = pWindow->GetParent(); - - Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() ); - Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); - - pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS ); - } -} - -// ::com::sun::star::awt::XDevice, -::com::sun::star::awt::DeviceInfo SAL_CALL VCLXTabPage::getInfo() -throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo(); - return aInfo; -} - -void SAL_CALL VCLXTabPage::setProperty( - const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Any& Value ) -throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - TabPage* pTabPage = (TabPage*)GetWindow(); - if ( pTabPage ) - { - sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; - - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_GRAPHIC: - { - Reference< XGraphic > xGraphic; - if (( Value >>= xGraphic ) && xGraphic.is() ) - { - Image aImage( xGraphic ); - - Wallpaper aWallpaper( aImage.GetBitmapEx()); - aWallpaper.SetStyle( WALLPAPER_SCALE ); - pTabPage->SetBackground( aWallpaper ); - } - else if ( bVoid || !xGraphic.is() ) - { - Color aColor = pTabPage->GetControlBackground().GetColor(); - if ( aColor == COL_AUTO ) - aColor = pTabPage->GetSettings().GetStyleSettings().GetDialogColor(); - - Wallpaper aWallpaper( aColor ); - pTabPage->SetBackground( aWallpaper ); - } - } - break; - case BASEPROPERTY_TITLE: - { - ::rtl::OUString sTitle; - if ( Value >>= sTitle ) - { - pTabPage->SetText(sTitle); - } - } - break; - - default: - { - VCLXContainer::setProperty( PropertyName, Value ); - } - } - } -} - -TabPage *VCLXTabPage::getTabPage() const throw (uno::RuntimeException) -{ - TabPage *pTabPage = dynamic_cast< TabPage* >( GetWindow() ); - if ( pTabPage ) - return pTabPage; - throw uno::RuntimeException(); -} - -// ---------------------------------------------------- -// class VCLXFixedHyperlink -// ---------------------------------------------------- - -VCLXFixedHyperlink::VCLXFixedHyperlink() : - - maActionListeners( *this ) - -{ -} - -VCLXFixedHyperlink::~VCLXFixedHyperlink() -{ -} - -// ::com::sun::star::uno::XInterface -::com::sun::star::uno::Any VCLXFixedHyperlink::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::XFixedHyperlink*, this ) ); - return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); -} - -void VCLXFixedHyperlink::dispose() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::lang::EventObject aObj; - aObj.Source = (::cppu::OWeakObject*)this; - maActionListeners.disposeAndClear( aObj ); - VCLXWindow::dispose(); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXFixedHyperlink ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedHyperlink>* ) NULL ), - VCLXWindow::getTypes() -IMPL_XTYPEPROVIDER_END - -void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_BUTTON_CLICK: - { - if ( maActionListeners.getLength() ) - { - ::com::sun::star::awt::ActionEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - maActionListeners.actionPerformed( aEvent ); - } - else - { - // open the URL - ::rtl::OUString sURL; - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); - if ( pBase ) - sURL = pBase->GetURL(); - Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))), uno::UNO_QUERY ); - if ( sURL.getLength() > 0 && xSystemShellExecute.is() ) - { - try - { - // start browser - xSystemShellExecute->execute( - sURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); - } - catch( uno::Exception& ) - { - } - } - } - } - - default: - VCLXWindow::ProcessWindowEvent( rVclWindowEvent ); - break; - } -} - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXFixedHyperlink::CreateAccessibleContext() -{ - return getAccessibleFactory().createAccessibleContext( this ); -} - -void VCLXFixedHyperlink::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); - if ( pBase ) - pBase->SetDescription( Text ); -} - -::rtl::OUString VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::rtl::OUString aText; - Window* pWindow = GetWindow(); - if ( pWindow ) - aText = pWindow->GetText(); - return aText; -} - -void VCLXFixedHyperlink::setURL( const ::rtl::OUString& URL ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); - if ( pBase ) - pBase->SetURL( URL ); -} - -::rtl::OUString VCLXFixedHyperlink::getURL( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::rtl::OUString aText; - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); - if ( pBase ) - aText = pBase->GetURL(); - return aText; -} - -void VCLXFixedHyperlink::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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 VCLXFixedHyperlink::getAlignment() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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; -} - -void VCLXFixedHyperlink::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.addInterface( l ); -} - -void VCLXFixedHyperlink::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.removeInterface( l ); -} - -::com::sun::star::awt::Size VCLXFixedHyperlink::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Size aSz; - FixedText* pFixedText = (FixedText*)GetWindow(); - if ( pFixedText ) - aSz = pFixedText->CalcMinimumSize(); - return AWTSize(aSz); -} - -::com::sun::star::awt::Size VCLXFixedHyperlink::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException) -{ - return getMinimumSize(); -} - -::com::sun::star::awt::Size VCLXFixedHyperlink::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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; -} - -void VCLXFixedHyperlink::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); - if ( pBase ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_LABEL: - { - ::rtl::OUString sNewLabel; - if ( Value >>= sNewLabel ) - pBase->SetDescription( sNewLabel ); - break; - } - - case BASEPROPERTY_URL: - { - ::rtl::OUString sNewURL; - if ( Value >>= sNewURL ) - pBase->SetURL( sNewURL ); - break; - } - - default: - { - VCLXWindow::setProperty( PropertyName, Value ); - } - } - } -} - -::com::sun::star::uno::Any VCLXFixedHyperlink::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); - if ( pBase ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_URL: - { - aProp = makeAny( ::rtl::OUString( pBase->GetURL() ) ); - break; - } - - default: - { - aProp <<= VCLXWindow::getProperty( PropertyName ); - } - } - } - return aProp; -} - -void VCLXFixedHyperlink::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_ALIGN, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_LABEL, - BASEPROPERTY_MULTILINE, - BASEPROPERTY_NOLABEL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_URL, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - 0); - VCLXWindow::ImplGetPropertyIds( rIds ); -} - -// ---------------------------------------------------- -// class VCLXFixedText -// ---------------------------------------------------- -void VCLXFixedText::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_ALIGN, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_LABEL, - BASEPROPERTY_MULTILINE, - BASEPROPERTY_NOLABEL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_REFERENCE_DEVICE, - 0); - VCLXWindow::ImplGetPropertyIds( rIds ); -} - -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 - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXFixedText::CreateAccessibleContext() -{ - return getAccessibleFactory().createAccessibleContext( this ); -} - -void VCLXFixedText::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Window* pWindow = GetWindow(); - if ( pWindow ) - pWindow->SetText( Text ); -} - -::rtl::OUString VCLXFixedText::getText() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::rtl::OUString aText; - Window* pWindow = GetWindow(); - if ( pWindow ) - aText = pWindow->GetText(); - return aText; -} - -void VCLXFixedText::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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& rMaxSize ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Size aAdjustedSize( VCLUnoHelper::ConvertToVCLSize( rMaxSize ) ); - FixedText* pFixedText = (FixedText*)GetWindow(); - if ( pFixedText ) - aAdjustedSize = pFixedText->CalcMinimumSize( rMaxSize.Width ); - return VCLUnoHelper::ConvertToAWTSize( aAdjustedSize ); -} - -// ---------------------------------------------------- -// class VCLXScrollBar -// ---------------------------------------------------- -void VCLXScrollBar::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BLOCKINCREMENT, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_LINEINCREMENT, - BASEPROPERTY_LIVE_SCROLL, - BASEPROPERTY_ORIENTATION, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_REPEAT_DELAY, - BASEPROPERTY_SCROLLVALUE, - BASEPROPERTY_SCROLLVALUE_MAX, - BASEPROPERTY_SCROLLVALUE_MIN, - BASEPROPERTY_SYMBOL_COLOR, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_VISIBLESIZE, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - 0); - VCLXWindow::ImplGetPropertyIds( rIds ); -} - -VCLXScrollBar::VCLXScrollBar() : maAdjustmentListeners( *this ) -{ -} - -// ::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 - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXScrollBar::CreateAccessibleContext() -{ - return getAccessibleFactory().createAccessibleContext( this ); -} - -// ::com::sun::star::lang::XComponent -void VCLXScrollBar::dispose() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::lang::EventObject aObj; - aObj.Source = (::cppu::OWeakObject*)this; - maAdjustmentListeners.disposeAndClear( aObj ); - VCLXWindow::dispose(); -} - -// ::com::sun::star::awt::XScrollbar -void VCLXScrollBar::addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maAdjustmentListeners.addInterface( l ); -} - -void VCLXScrollBar::removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maAdjustmentListeners.removeInterface( l ); -} - -void VCLXScrollBar::setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - if ( pScrollBar ) - pScrollBar->DoScroll( n ); -} - -void VCLXScrollBar::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - if ( pScrollBar ) - { - pScrollBar->SetVisibleSize( nVisible ); - pScrollBar->SetRangeMax( nMax ); - pScrollBar->DoScroll( nValue ); - } -} - -sal_Int32 VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - return pScrollBar ? pScrollBar->GetThumbPos() : 0; -} - -void VCLXScrollBar::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - if ( pScrollBar ) - pScrollBar->SetRangeMax( n ); -} - -sal_Int32 VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - return pScrollBar ? pScrollBar->GetRangeMax() : 0; -} - -void VCLXScrollBar::setMinimum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() ); - if ( pScrollBar ) - pScrollBar->SetRangeMin( n ); -} - -sal_Int32 VCLXScrollBar::getMinimum() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() ); - return pScrollBar ? pScrollBar->GetRangeMin() : 0; -} - -void VCLXScrollBar::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - if ( pScrollBar ) - pScrollBar->SetLineSize( n ); -} - -sal_Int32 VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - return pScrollBar ? pScrollBar->GetLineSize() : 0; -} - -void VCLXScrollBar::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - if ( pScrollBar ) - pScrollBar->SetPageSize( n ); -} - -sal_Int32 VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - return pScrollBar ? pScrollBar->GetPageSize() : 0; -} - -void VCLXScrollBar::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - if ( pScrollBar ) - pScrollBar->SetVisibleSize( n ); -} - -sal_Int32 VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*) GetWindow(); - return pScrollBar ? pScrollBar->GetVisibleSize() : 0; -} - -void VCLXScrollBar::setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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; - - pWindow->SetStyle( nStyle ); - pWindow->Resize(); - } -} - -sal_Int32 VCLXScrollBar::getOrientation() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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; - -} - -// ::com::sun::star::awt::VclWindowPeer -void VCLXScrollBar::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ScrollBar* pScrollBar = (ScrollBar*)GetWindow(); - if ( pScrollBar ) - { - sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; - - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_LIVE_SCROLL: - { - sal_Bool bDo = sal_False; - if ( !bVoid ) - { - OSL_VERIFY( Value >>= bDo ); - } - AllSettings aSettings( pScrollBar->GetSettings() ); - StyleSettings aStyle( aSettings.GetStyleSettings() ); - sal_uLong nDragOptions = aStyle.GetDragFullOptions(); - if ( bDo ) - nDragOptions |= DRAGFULL_OPTION_SCROLL; - else - nDragOptions &= ~DRAGFULL_OPTION_SCROLL; - aStyle.SetDragFullOptions( nDragOptions ); - aSettings.SetStyleSettings( aStyle ); - pScrollBar->SetSettings( aSettings ); - } - break; - - case BASEPROPERTY_SCROLLVALUE: - { - if ( !bVoid ) - { - sal_Int32 n = 0; - if ( Value >>= n ) - setValue( n ); - } - } - break; - case BASEPROPERTY_SCROLLVALUE_MAX: - case BASEPROPERTY_SCROLLVALUE_MIN: - { - if ( !bVoid ) - { - sal_Int32 n = 0; - if ( Value >>= n ) - { - if ( nPropType == BASEPROPERTY_SCROLLVALUE_MAX ) - setMaximum( n ); - else - setMinimum( n ); - } - } - } - break; - case BASEPROPERTY_LINEINCREMENT: - { - if ( !bVoid ) - { - sal_Int32 n = 0; - if ( Value >>= n ) - setLineIncrement( n ); - } - } - break; - case BASEPROPERTY_BLOCKINCREMENT: - { - if ( !bVoid ) - { - sal_Int32 n = 0; - if ( Value >>= n ) - setBlockIncrement( n ); - } - } - break; - case BASEPROPERTY_VISIBLESIZE: - { - if ( !bVoid ) - { - sal_Int32 n = 0; - if ( Value >>= n ) - setVisibleSize( n ); - } - } - break; - case BASEPROPERTY_ORIENTATION: - { - if ( !bVoid ) - { - sal_Int32 n = 0; - if ( Value >>= n ) - setOrientation( n ); - } - } - break; - - case BASEPROPERTY_BACKGROUNDCOLOR: - { - // the default implementation of the base class doesn't work here, since our - // interpretation for this property is slightly different - ::toolkit::setButtonLikeFaceColor( pScrollBar, Value); - } - break; - - default: - { - VCLXWindow::setProperty( PropertyName, Value ); - } - } - } -} - -::com::sun::star::uno::Any VCLXScrollBar::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - ScrollBar* pScrollBar = (ScrollBar*)GetWindow(); - if ( pScrollBar ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - - switch ( nPropType ) - { - case BASEPROPERTY_LIVE_SCROLL: - { - aProp <<= (sal_Bool)( 0 != ( pScrollBar->GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SCROLL ) ); - } - break; - case BASEPROPERTY_SCROLLVALUE: - { - aProp <<= (sal_Int32) getValue(); - } - break; - case BASEPROPERTY_SCROLLVALUE_MAX: - { - aProp <<= (sal_Int32) getMaximum(); - } - break; - case BASEPROPERTY_SCROLLVALUE_MIN: - { - aProp <<= (sal_Int32) getMinimum(); - } - break; - case BASEPROPERTY_LINEINCREMENT: - { - aProp <<= (sal_Int32) getLineIncrement(); - } - break; - case BASEPROPERTY_BLOCKINCREMENT: - { - aProp <<= (sal_Int32) getBlockIncrement(); - } - break; - case BASEPROPERTY_VISIBLESIZE: - { - aProp <<= (sal_Int32) getVisibleSize(); - } - break; - case BASEPROPERTY_ORIENTATION: - { - aProp <<= (sal_Int32) getOrientation(); - } - break; - case BASEPROPERTY_BACKGROUNDCOLOR: - { - // the default implementation of the base class doesn't work here, since our - // interpretation for this property is slightly different - aProp = ::toolkit::getButtonLikeFaceColor( pScrollBar ); - } - break; - - default: - { - aProp <<= VCLXWindow::getProperty( PropertyName ); - } - } - } - return aProp; -} - -void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_SCROLLBAR_SCROLL: - { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - // since we call listeners below, there is a potential that we will be destroyed - // in during the listener call. To prevent the resulting crashs, we keep us - // alive as long as we're here - - if ( maAdjustmentListeners.getLength() ) - { - ScrollBar* pScrollBar = (ScrollBar*)GetWindow(); - - if( pScrollBar ) - { - ::com::sun::star::awt::AdjustmentEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.Value = pScrollBar->GetThumbPos(); - - // set adjustment type - ScrollType aType = pScrollBar->GetType(); - if ( aType == SCROLL_LINEUP || aType == SCROLL_LINEDOWN ) - { - aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_LINE; - } - else if ( aType == SCROLL_PAGEUP || aType == SCROLL_PAGEDOWN ) - { - aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_PAGE; - } - else if ( aType == SCROLL_DRAG ) - { - aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_ABS; - } - - maAdjustmentListeners.adjustmentValueChanged( aEvent ); - } - } - } - break; - - default: - VCLXWindow::ProcessWindowEvent( rVclWindowEvent ); - break; - } -} - -::com::sun::star::awt::Size SAL_CALL VCLXScrollBar::implGetMinimumSize( Window* p ) throw(::com::sun::star::uno::RuntimeException) -{ - long n = p->GetSettings().GetStyleSettings().GetScrollBarSize(); - return ::com::sun::star::awt::Size( n, n ); -} - -::com::sun::star::awt::Size SAL_CALL VCLXScrollBar::getMinimumSize() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - return implGetMinimumSize( GetWindow() ); -} - - -// ---------------------------------------------------- -// class VCLXEdit -// ---------------------------------------------------- - -void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_ALIGN, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ECHOCHAR, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HARDLINEBREAKS, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_HSCROLL, - BASEPROPERTY_LINE_END_FORMAT, - BASEPROPERTY_MAXTEXTLEN, - BASEPROPERTY_MULTILINE, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_READONLY, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_TEXT, - BASEPROPERTY_VSCROLL, - BASEPROPERTY_HIDEINACTIVESELECTION, - BASEPROPERTY_PAINTTRANSPARENT, - BASEPROPERTY_AUTOHSCROLL, - BASEPROPERTY_AUTOVSCROLL, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - 0); - VCLXWindow::ImplGetPropertyIds( rIds ); -} - -VCLXEdit::VCLXEdit() : maTextListeners( *this ) -{ -} - -// ::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 - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXEdit::CreateAccessibleContext() -{ - return getAccessibleFactory().createAccessibleContext( this ); -} - -void VCLXEdit::dispose() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - GetTextListeners().addInterface( l ); -} - -void VCLXEdit::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - GetTextListeners().removeInterface( l ); -} - -void VCLXEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Edit* pEdit = (Edit*)GetWindow(); - if ( pEdit ) - { - pEdit->SetText( aText ); - - // #107218# Call same listeners like VCL would do after user interaction - SetSynthesizingVCLEvent( sal_True ); - pEdit->SetModifyFlag(); - pEdit->Modify(); - SetSynthesizingVCLEvent( sal_False ); - } -} - -void VCLXEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Edit* pEdit = (Edit*)GetWindow(); - if ( pEdit ) - { - pEdit->SetSelection( Selection( rSel.Min, rSel.Max ) ); - pEdit->ReplaceSelected( aText ); - - // #107218# Call same listeners like VCL would do after user interaction - SetSynthesizingVCLEvent( sal_True ); - pEdit->SetModifyFlag(); - pEdit->Modify(); - SetSynthesizingVCLEvent( sal_False ); - } -} - -::rtl::OUString VCLXEdit::getText() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::rtl::OUString aText; - Window* pWindow = GetWindow(); - if ( pWindow ) - aText = pWindow->GetText(); - return aText; -} - -::rtl::OUString VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - Edit* pEdit = (Edit*) GetWindow(); - if ( pEdit ) - pEdit->SetReadOnly( !bEditable ); -} - - -void VCLXEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Edit* pEdit = (Edit*) GetWindow(); - if ( pEdit ) - pEdit->SetMaxTextLen( nLen ); -} - -sal_Int16 VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - Edit* pEdit = (Edit*) GetWindow(); - return pEdit ? pEdit->GetMaxTextLen() : 0; -} - -void VCLXEdit::setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - Edit* pEdit = (Edit*)GetWindow(); - if ( pEdit ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_HIDEINACTIVESELECTION: - ::toolkit::adjustBooleanWindowStyle( Value, pEdit, WB_NOHIDESELECTION, sal_True ); - if ( pEdit->GetSubEdit() ) - ::toolkit::adjustBooleanWindowStyle( Value, pEdit->GetSubEdit(), WB_NOHIDESELECTION, sal_True ); - break; - - case BASEPROPERTY_READONLY: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - pEdit->SetReadOnly( b ); - } - break; - case BASEPROPERTY_ECHOCHAR: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - pEdit->SetEchoChar( n ); - } - break; - case BASEPROPERTY_MAXTEXTLEN: - { - sal_Int16 n = sal_Int16(); - 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) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - Edit* pEdit = (Edit*)GetWindow(); - if ( pEdit ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_HIDEINACTIVESELECTION: - aProp <<= (sal_Bool)( ( pEdit->GetStyle() & WB_NOHIDESELECTION ) == 0 ); - break; - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - ::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 ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - nLines = 1; - nCols = 0; - Edit* pEdit = (Edit*) GetWindow(); - if ( pEdit ) - nCols = pEdit->GetMaxVisChars(); -} - -void VCLXEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_EDIT_MODIFY: - { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - // since we call listeners below, there is a potential that we will be destroyed - // during the listener call. To prevent the resulting crashs, we keep us - // alive as long as we're here - - if ( GetTextListeners().getLength() ) - { - ::com::sun::star::awt::TextEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; - GetTextListeners().textChanged( aEvent ); - } - } - break; - - default: - VCLXWindow::ProcessWindowEvent( rVclWindowEvent ); - break; - } -} - -// ---------------------------------------------------- -// class VCLXComboBox -// ---------------------------------------------------- - -void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_AUTOCOMPLETE, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_DROPDOWN, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_LINECOUNT, - BASEPROPERTY_MAXTEXTLEN, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_READONLY, - BASEPROPERTY_STRINGITEMLIST, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_TEXT, - BASEPROPERTY_HIDEINACTIVESELECTION, - BASEPROPERTY_ALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_REFERENCE_DEVICE, - BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, - 0); - // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box - // #i92690# / 2008-08-12 / frank.schoenheit@sun.com - // VCLXEdit::ImplGetPropertyIds( rIds ); - VCLXWindow::ImplGetPropertyIds( rIds ); -} - -VCLXComboBox::VCLXComboBox() - : maActionListeners( *this ), maItemListeners( *this ) -{ -} - -VCLXComboBox::~VCLXComboBox() -{ -#ifndef __SUNPRO_CC - OSL_TRACE ("%s", __FUNCTION__); -#endif -} - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXComboBox::CreateAccessibleContext() -{ - SolarMutexGuard aGuard; - - return getAccessibleFactory().createAccessibleContext( this ); -} - -void VCLXComboBox::dispose() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - maItemListeners.addInterface( l ); -} - -void VCLXComboBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maItemListeners.removeInterface( l ); -} - -void VCLXComboBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.addInterface( l ); -} - -void VCLXComboBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - maActionListeners.removeInterface( l ); -} - -void VCLXComboBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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 ( nP == 0xFFFF ) - { - OSL_FAIL( "VCLXComboBox::addItems: too many entries!" ); - // skip remaining entries, list cannot hold them, anyway - break; - } - } - } -} - -void VCLXComboBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - ComboBox* pBox = (ComboBox*) GetWindow(); - return pBox ? pBox->GetEntryCount() : 0; -} - -::rtl::OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - ComboBox* pBox = (ComboBox*) GetWindow(); - if ( pBox ) - pBox->SetDropDownLineCount( nLines ); -} - -sal_Int16 VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - ComboBox* pComboBox = (ComboBox*)GetWindow(); - if ( pComboBox ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_LINECOUNT: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - pComboBox->SetDropDownLineCount( n ); - } - break; - case BASEPROPERTY_AUTOCOMPLETE: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - pComboBox->EnableAutocomplete( n != 0 ); - } - break; - case BASEPROPERTY_STRINGITEMLIST: - { - ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems; - if ( Value >>= aItems ) - { - pComboBox->Clear(); - addItems( aItems, 0 ); - } - } - break; - default: - { - VCLXEdit::setProperty( PropertyName, Value ); - - // #109385# SetBorderStyle is not virtual - if ( nPropType == BASEPROPERTY_BORDER ) - { - sal_uInt16 nBorder = sal_uInt16(); - if ( (Value >>= nBorder) && nBorder != 0 ) - pComboBox->SetBorderStyle( nBorder ); - } - } - } - } -} - -::com::sun::star::uno::Any VCLXComboBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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; -} - -void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - // since we call listeners below, there is a potential that we will be destroyed - // during the listener call. To prevent the resulting crashs, we keep us - // alive as long as we're here - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_COMBOBOX_SELECT: - if ( maItemListeners.getLength() ) - { - ComboBox* pComboBox = (ComboBox*)GetWindow(); - if( pComboBox ) - { - if ( !pComboBox->IsTravelSelect() ) - { - ::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 ); - } - } - } - break; - - case VCLEVENT_COMBOBOX_DOUBLECLICK: - if ( maActionListeners.getLength() ) - { - ::com::sun::star::awt::ActionEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)this; -// aEvent.ActionCommand = ...; - maActionListeners.actionPerformed( aEvent ); - } - break; - - default: - VCLXEdit::ProcessWindowEvent( rVclWindowEvent ); - break; - } -} - -::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - nCols = nLines = 0; - ComboBox* pComboBox = (ComboBox*) GetWindow(); - if ( pComboBox ) - { - sal_uInt16 nC, nL; - pComboBox->GetMaxVisColumnsAndLines( nC, nL ); - nCols = nC; - nLines = nL; - } -} -void SAL_CALL VCLXComboBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); - - ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemInserted: no ComboBox?!" ); - ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pComboBox->GetEntryCount() ) ), - "VCLXComboBox::listItemInserted: illegal (inconsistent) item position!" ); - pComboBox->InsertEntry( - i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(), - i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(), - i_rEvent.ItemPosition ); -} - -void SAL_CALL VCLXComboBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); - - ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemRemoved: no ComboBox?!" ); - ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ), - "VCLXComboBox::listItemRemoved: illegal (inconsistent) item position!" ); - - pComboBox->RemoveEntry( i_rEvent.ItemPosition ); -} - -void SAL_CALL VCLXComboBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); - - ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" ); - ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ), - "VCLXComboBox::listItemModified: illegal (inconsistent) item position!" ); - - // VCL's ComboBox does not support changing an entry's text or image, so remove and re-insert - - const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pComboBox->GetEntry( i_rEvent.ItemPosition ) ); - const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pComboBox->GetEntryImage( i_rEvent.ItemPosition ) ); - - pComboBox->RemoveEntry( i_rEvent.ItemPosition ); - pComboBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition ); -} - -void SAL_CALL VCLXComboBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); - ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" ); - - pComboBox->Clear(); - - (void)i_rEvent; -} - -void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException) -{ - SolarMutexGuard aGuard; - - ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); - ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" ); - - pComboBox->Clear(); - - uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW ); - // bool localize = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ); - uno::Reference< resource::XStringResourceResolver > xStringResourceResolver; - if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) ) - { - xStringResourceResolver.set( - xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ), - uno::UNO_QUERY - ); - } - - - Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW ); - uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems(); - for ( sal_Int32 i=0; i<aItems.getLength(); ++i ) - { - ::rtl::OUString aLocalizationKey( aItems[i].First ); - if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' ) - { - aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 )); - } - pComboBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) ); - } -} -void SAL_CALL VCLXComboBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException) -{ - // just disambiguate - VCLXEdit::disposing( i_rEvent ); -} - -// ---------------------------------------------------- -// class VCLXFormattedSpinField -// ---------------------------------------------------- -void VCLXFormattedSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - // Interestingly in the UnoControl API this is - // - not derived from XEdit ultimately, (correct ?) - so cut this here ... -// VCLXSpinField::ImplGetPropertyIds( rIds ); - VCLXWindow::ImplGetPropertyIds( rIds ); -} - -VCLXFormattedSpinField::VCLXFormattedSpinField() -{ -} - -VCLXFormattedSpinField::~VCLXFormattedSpinField() -{ -} - -void VCLXFormattedSpinField::setStrictFormat( sal_Bool bStrict ) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - FormatterBase* pFormatter = GetFormatter(); - if ( pFormatter ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_SPIN: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - { - WinBits nStyle = GetWindow()->GetStyle() | WB_SPIN; - if ( !b ) - nStyle &= ~WB_SPIN; - GetWindow()->SetStyle( nStyle ); - } - } - break; - case BASEPROPERTY_STRICTFORMAT: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - { - pFormatter->SetStrictFormat( b ); - } - } - break; - default: - { - VCLXSpinField::setProperty( PropertyName, Value ); - } - } - } -} - -::com::sun::star::uno::Any VCLXFormattedSpinField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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; - default: - { - aProp <<= VCLXSpinField::getProperty( PropertyName ); - } - } - } - return aProp; -} - - -// ---------------------------------------------------- -// class VCLXDateField -// ---------------------------------------------------- - -void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_ALIGN, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DATE, - BASEPROPERTY_DATEMAX, - BASEPROPERTY_DATEMIN, - BASEPROPERTY_DATESHOWCENTURY, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_DROPDOWN, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_EXTDATEFORMAT, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_READONLY, - BASEPROPERTY_REPEAT, - BASEPROPERTY_REPEAT_DELAY, - BASEPROPERTY_SPIN, - BASEPROPERTY_STRICTFORMAT, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_ENFORCE_FORMAT, - BASEPROPERTY_TEXT, - BASEPROPERTY_HIDEINACTIVESELECTION, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, - 0); - VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); -} - -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) -{ - SolarMutexGuard aGuard; - - 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 = 0; - if ( Value >>= n ) - setDate( n ); - } - } - break; - case BASEPROPERTY_DATEMIN: - { - sal_Int32 n = 0; - if ( Value >>= n ) - setMin( n ); - } - break; - case BASEPROPERTY_DATEMAX: - { - sal_Int32 n = 0; - if ( Value >>= n ) - setMax( n ); - } - break; - case BASEPROPERTY_EXTDATEFORMAT: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - ((DateField*)GetWindow())->SetExtDateFormat( (ExtDateFieldFormat) n ); - } - break; - case BASEPROPERTY_DATESHOWCENTURY: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - ((DateField*)GetWindow())->SetShowDateCentury( b ); - } - break; - case BASEPROPERTY_ENFORCE_FORMAT: - { - sal_Bool bEnforce( sal_True ); - OSL_VERIFY( Value >>= bEnforce ); - static_cast< DateField* >( GetWindow() )->EnforceValidValue( bEnforce ); - } - break; - default: - { - VCLXFormattedSpinField::setProperty( PropertyName, Value ); - } - } - } -} - -::com::sun::star::uno::Any VCLXDateField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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; - case BASEPROPERTY_DATESHOWCENTURY: - { - aProp <<= ((DateField*)GetWindow())->IsShowDateCentury(); - } - break; - case BASEPROPERTY_ENFORCE_FORMAT: - { - aProp <<= (sal_Bool)static_cast< DateField* >( GetWindow() )->IsEnforceValidValue( ); - } - break; - default: - { - aProp <<= VCLXFormattedSpinField::getProperty( PropertyName ); - } - } - } - return aProp; -} - - -void VCLXDateField::setDate( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - DateField* pDateField = (DateField*) GetWindow(); - if ( pDateField ) - { - pDateField->SetDate( nDate ); - - // #107218# Call same listeners like VCL would do after user interaction - SetSynthesizingVCLEvent( sal_True ); - pDateField->SetModifyFlag(); - pDateField->Modify(); - SetSynthesizingVCLEvent( sal_False ); - } -} - -sal_Int32 VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - DateField* pDateField = (DateField*) GetWindow(); - if ( pDateField ) - pDateField->SetMin( nDate ); -} - -sal_Int32 VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - DateField* pDateField = (DateField*) GetWindow(); - if ( pDateField ) - pDateField->SetMax( nDate ); -} - -sal_Int32 VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - DateField* pDateField = (DateField*) GetWindow(); - if ( pDateField ) - pDateField->SetFirst( nDate ); -} - -sal_Int32 VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - DateField* pDateField = (DateField*) GetWindow(); - if ( pDateField ) - pDateField->SetLast( nDate ); -} - -sal_Int32 VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - DateField* pDateField = (DateField*) GetWindow(); - if ( pDateField ) - pDateField->SetLongFormat( bLong ); -} - -sal_Bool VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - DateField* pDateField = (DateField*) GetWindow(); - return pDateField ? pDateField->IsLongFormat() : sal_False; -} - -void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - DateField* pDateField = (DateField*) GetWindow(); - if ( pDateField ) - { - pDateField->SetEmptyDate(); - - // #107218# Call same listeners like VCL would do after user interaction - SetSynthesizingVCLEvent( sal_True ); - pDateField->SetModifyFlag(); - pDateField->Modify(); - SetSynthesizingVCLEvent( sal_False ); - } -} - -sal_Bool VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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 -// ---------------------------------------------------- - -void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_ALIGN, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_EXTTIMEFORMAT, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_READONLY, - BASEPROPERTY_REPEAT, - BASEPROPERTY_REPEAT_DELAY, - BASEPROPERTY_SPIN, - BASEPROPERTY_STRICTFORMAT, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_TIME, - BASEPROPERTY_TIMEMAX, - BASEPROPERTY_TIMEMIN, - BASEPROPERTY_ENFORCE_FORMAT, - BASEPROPERTY_TEXT, - BASEPROPERTY_HIDEINACTIVESELECTION, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, - 0); - VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); -} - -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) -{ - SolarMutexGuard aGuard; - - TimeField* pTimeField = (TimeField*) GetWindow(); - if ( pTimeField ) - { - pTimeField->SetTime( nTime ); - - // #107218# Call same listeners like VCL would do after user interaction - SetSynthesizingVCLEvent( sal_True ); - pTimeField->SetModifyFlag(); - pTimeField->Modify(); - SetSynthesizingVCLEvent( sal_False ); - } -} - -sal_Int32 VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - TimeField* pTimeField = (TimeField*) GetWindow(); - if ( pTimeField ) - pTimeField->SetMin( nTime ); -} - -sal_Int32 VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - TimeField* pTimeField = (TimeField*) GetWindow(); - if ( pTimeField ) - pTimeField->SetMax( nTime ); -} - -sal_Int32 VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - TimeField* pTimeField = (TimeField*) GetWindow(); - if ( pTimeField ) - pTimeField->SetFirst( nTime ); -} - -sal_Int32 VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - TimeField* pTimeField = (TimeField*) GetWindow(); - if ( pTimeField ) - pTimeField->SetLast( nTime ); -} - -sal_Int32 VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - TimeField* pTimeField = (TimeField*) GetWindow(); - if ( pTimeField ) - pTimeField->SetEmptyTime(); -} - -sal_Bool VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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 = 0; - if ( Value >>= n ) - setTime( n ); - } - } - break; - case BASEPROPERTY_TIMEMIN: - { - sal_Int32 n = 0; - if ( Value >>= n ) - setMin( n ); - } - break; - case BASEPROPERTY_TIMEMAX: - { - sal_Int32 n = 0; - if ( Value >>= n ) - setMax( n ); - } - break; - case BASEPROPERTY_EXTTIMEFORMAT: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - ((TimeField*)GetWindow())->SetExtFormat( (ExtTimeFieldFormat) n ); - } - break; - case BASEPROPERTY_ENFORCE_FORMAT: - { - sal_Bool bEnforce( sal_True ); - OSL_VERIFY( Value >>= bEnforce ); - static_cast< TimeField* >( GetWindow() )->EnforceValidValue( bEnforce ); - } - break; - default: - { - VCLXFormattedSpinField::setProperty( PropertyName, Value ); - } - } - } -} - -::com::sun::star::uno::Any VCLXTimeField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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; - case BASEPROPERTY_ENFORCE_FORMAT: - { - aProp <<= (sal_Bool)static_cast< TimeField* >( GetWindow() )->IsEnforceValidValue( ); - } - break; - default: - { - aProp <<= VCLXFormattedSpinField::getProperty( PropertyName ); - } - } - } - return aProp; -} - -// ---------------------------------------------------- -// class VCLXNumericField -// ---------------------------------------------------- - -void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_ALIGN, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DECIMALACCURACY, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_NUMSHOWTHOUSANDSEP, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_READONLY, - BASEPROPERTY_REPEAT, - BASEPROPERTY_REPEAT_DELAY, - BASEPROPERTY_SPIN, - BASEPROPERTY_STRICTFORMAT, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_VALUEMAX_DOUBLE, - BASEPROPERTY_VALUEMIN_DOUBLE, - BASEPROPERTY_VALUESTEP_DOUBLE, - BASEPROPERTY_VALUE_DOUBLE, - BASEPROPERTY_ENFORCE_FORMAT, - BASEPROPERTY_HIDEINACTIVESELECTION, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, - 0); - VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); -} - -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) -{ - SolarMutexGuard aGuard; - - NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); - if ( pNumericFormatter ) - { - // z.B. 105, 2 Digits => 1,05 - // ein float 1,05 muss also eine 105 einstellen... - pNumericFormatter->SetValue( - (long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) ); - - // #107218# Call same listeners like VCL would do after user interaction - Edit* pEdit = (Edit*)GetWindow(); - if ( pEdit ) - { - SetSynthesizingVCLEvent( sal_True ); - pEdit->SetModifyFlag(); - pEdit->Modify(); - SetSynthesizingVCLEvent( sal_False ); - } - } -} - -double VCLXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); - return pNumericFormatter - ? ImplCalcDoubleValue( (double)pNumericFormatter->GetValue(), pNumericFormatter->GetDecimalDigits() ) - : 0; -} - -void VCLXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); - if ( pNumericFormatter ) - pNumericFormatter->SetMin( - (long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) ); -} - -double VCLXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); - return pNumericFormatter - ? ImplCalcDoubleValue( (double)pNumericFormatter->GetMin(), pNumericFormatter->GetDecimalDigits() ) - : 0; -} - -void VCLXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); - if ( pNumericFormatter ) - pNumericFormatter->SetMax( - (long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) ); -} - -double VCLXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); - return pNumericFormatter - ? ImplCalcDoubleValue( (double)pNumericFormatter->GetMax(), pNumericFormatter->GetDecimalDigits() ) - : 0; -} - -void VCLXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - NumericField* pNumericField = (NumericField*) GetWindow(); - if ( pNumericField ) - pNumericField->SetFirst( - (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) ); -} - -double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - NumericField* pNumericField = (NumericField*) GetWindow(); - return pNumericField - ? ImplCalcDoubleValue( (double)pNumericField->GetFirst(), pNumericField->GetDecimalDigits() ) - : 0; -} - -void VCLXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - NumericField* pNumericField = (NumericField*) GetWindow(); - if ( pNumericField ) - pNumericField->SetLast( - (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) ); -} - -double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - NumericField* pNumericField = (NumericField*) GetWindow(); - if ( pNumericField ) - pNumericField->SetSpinSize( - (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) ); -} - -double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); - if ( pNumericFormatter ) - { - double n = getValue(); - pNumericFormatter->SetDecimalDigits( Value ); - setValue( n ); - } -} - -sal_Int16 VCLXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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 = 0; - if ( Value >>= d ) - setValue( d ); - } - } - break; - case BASEPROPERTY_VALUEMIN_DOUBLE: - { - double d = 0; - if ( Value >>= d ) - setMin( d ); - } - break; - case BASEPROPERTY_VALUEMAX_DOUBLE: - { - double d = 0; - if ( Value >>= d ) - setMax( d ); - } - break; - case BASEPROPERTY_VALUESTEP_DOUBLE: - { - double d = 0; - if ( Value >>= d ) - setSpinSize( d ); - } - break; - case BASEPROPERTY_DECIMALACCURACY: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - setDecimalDigits( n ); - } - break; - case BASEPROPERTY_NUMSHOWTHOUSANDSEP: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - ((NumericField*)GetWindow())->SetUseThousandSep( b ); - } - break; - default: - { - VCLXFormattedSpinField::setProperty( PropertyName, Value ); - } - } - } -} - -::com::sun::star::uno::Any VCLXNumericField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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; - case BASEPROPERTY_NUMSHOWTHOUSANDSEP: - { - aProp <<= (sal_Bool) ((NumericField*)GetWindow())->IsUseThousandSep(); - } - break; - default: - { - aProp <<= VCLXFormattedSpinField::getProperty( PropertyName ); - } - } - } - return aProp; -} - - -// ---------------------------------------------------- -// class VCLXMetricField -// ---------------------------------------------------- - -void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_ALIGN, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DECIMALACCURACY, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_NUMSHOWTHOUSANDSEP, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_READONLY, - BASEPROPERTY_REPEAT, - BASEPROPERTY_REPEAT_DELAY, - BASEPROPERTY_SPIN, - BASEPROPERTY_STRICTFORMAT, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_ENFORCE_FORMAT, - BASEPROPERTY_HIDEINACTIVESELECTION, - BASEPROPERTY_UNIT, - BASEPROPERTY_CUSTOMUNITTEXT, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, - 0); - VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); -} - -VCLXMetricField::VCLXMetricField() -{ -} - -VCLXMetricField::~VCLXMetricField() -{ -} - -MetricFormatter *VCLXMetricField::GetMetricFormatter() throw(::com::sun::star::uno::RuntimeException) -{ - MetricFormatter *pFormatter = (MetricFormatter *) GetFormatter(); - if (!pFormatter) - throw ::com::sun::star::uno::RuntimeException(); - return pFormatter; -} - -MetricField *VCLXMetricField::GetMetricField() throw(::com::sun::star::uno::RuntimeException) -{ - MetricField *pField = (MetricField *) GetWindow(); - if (!pField) - throw ::com::sun::star::uno::RuntimeException(); - return pField; -} - -// ::com::sun::star::uno::XInterface -::com::sun::star::uno::Any VCLXMetricField::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::XMetricField*, this ) ); - return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType )); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXMetricField ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMetricField>* ) NULL ), - VCLXFormattedSpinField::getTypes() -IMPL_XTYPEPROVIDER_END - -// FIXME: later ... -#define MetricUnitUnoToVcl(a) ((FieldUnit)(a)) - -#define METRIC_MAP_PAIR(method,parent) \ - sal_Int64 VCLXMetricField::get##method( sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \ - { \ - SolarMutexGuard aGuard; \ - return GetMetric##parent()->Get##method( MetricUnitUnoToVcl( nUnit ) ); \ - } \ - void VCLXMetricField::set##method( sal_Int64 nValue, sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \ - { \ - SolarMutexGuard aGuard; \ - GetMetric##parent()->Set##method( nValue, MetricUnitUnoToVcl( nUnit ) ); \ - } - -METRIC_MAP_PAIR(Min, Formatter) -METRIC_MAP_PAIR(Max, Formatter) -METRIC_MAP_PAIR(First, Field) -METRIC_MAP_PAIR(Last, Field) - -#undef METRIC_MAP_PAIR - -::sal_Int64 VCLXMetricField::getValue( ::sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - return GetMetricFormatter()->GetValue( MetricUnitUnoToVcl( nUnit ) ); -} - -::sal_Int64 VCLXMetricField::getCorrectedValue( ::sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - return GetMetricFormatter()->GetCorrectedValue( MetricUnitUnoToVcl( nUnit ) ); -} - -// FIXME: acute cut/paste evilness - move this to the parent Edit class ? -void VCLXMetricField::CallListeners() -{ - // #107218# Call same listeners like VCL would do after user interaction - Edit* pEdit = (Edit*)GetWindow(); - if ( pEdit ) - { - SetSynthesizingVCLEvent( sal_True ); - pEdit->SetModifyFlag(); - pEdit->Modify(); - SetSynthesizingVCLEvent( sal_False ); - } -} - -void VCLXMetricField::setValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - GetMetricFormatter()->SetValue( Value, MetricUnitUnoToVcl( Unit ) ); - CallListeners(); -} - -void VCLXMetricField::setUserValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - GetMetricFormatter()->SetUserValue( Value, MetricUnitUnoToVcl( Unit ) ); - CallListeners(); -} - -void VCLXMetricField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) -{ - VCLXFormattedSpinField::setStrictFormat( bStrict ); -} - -sal_Bool VCLXMetricField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) -{ - return VCLXFormattedSpinField::isStrictFormat(); -} - -void VCLXMetricField::setSpinSize( sal_Int64 Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - GetMetricField()->SetSpinSize( Value ); -} - -sal_Int64 VCLXMetricField::getSpinSize() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - return GetMetricField()->GetSpinSize(); -} - -void VCLXMetricField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - GetMetricFormatter()->SetDecimalDigits( Value ); -} - -sal_Int16 VCLXMetricField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter(); - return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0; -} - -void VCLXMetricField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( GetWindow() ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_DECIMALACCURACY: - { - sal_Int16 n = 0; - if ( Value >>= n ) - setDecimalDigits( n ); - break; - } - case BASEPROPERTY_NUMSHOWTHOUSANDSEP: - { - sal_Bool b = sal_False; - if ( Value >>= b ) - ((NumericField*)GetWindow())->SetUseThousandSep( b ); - } - break; - case BASEPROPERTY_UNIT: - { - sal_uInt16 nVal = 0; - if ( Value >>= nVal ) - ((MetricField*)GetWindow())->SetUnit( (FieldUnit) nVal ); - break; - } - case BASEPROPERTY_CUSTOMUNITTEXT: - { - rtl::OUString aStr; - if ( Value >>= aStr ) - ((MetricField*)GetWindow())->SetCustomUnitText( aStr ); - break; - } - default: - { - VCLXFormattedSpinField::setProperty( PropertyName, Value ); - break; - } - } - } -} - -::com::sun::star::uno::Any VCLXMetricField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::com::sun::star::uno::Any aProp; - FormatterBase* pFormatter = GetFormatter(); - if ( pFormatter ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_NUMSHOWTHOUSANDSEP: - aProp <<= (sal_Bool) ((NumericField*)GetWindow())->IsUseThousandSep(); - break; - case BASEPROPERTY_UNIT: - aProp <<= (sal_uInt16) ((MetricField*)GetWindow())->GetUnit(); - break; - case BASEPROPERTY_CUSTOMUNITTEXT: - aProp <<= rtl::OUString (((MetricField*)GetWindow())->GetCustomUnitText()); - break; - default: - { - aProp <<= VCLXFormattedSpinField::getProperty( PropertyName ); - break; - } - } - } - return aProp; -} - - -// ---------------------------------------------------- -// class VCLXCurrencyField -// ---------------------------------------------------- - -void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_ALIGN, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_CURRENCYSYMBOL, - BASEPROPERTY_CURSYM_POSITION, - BASEPROPERTY_DECIMALACCURACY, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_NUMSHOWTHOUSANDSEP, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_READONLY, - BASEPROPERTY_REPEAT, - BASEPROPERTY_REPEAT_DELAY, - BASEPROPERTY_SPIN, - BASEPROPERTY_STRICTFORMAT, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_VALUEMAX_DOUBLE, - BASEPROPERTY_VALUEMIN_DOUBLE, - BASEPROPERTY_VALUESTEP_DOUBLE, - BASEPROPERTY_VALUE_DOUBLE, - BASEPROPERTY_ENFORCE_FORMAT, - BASEPROPERTY_HIDEINACTIVESELECTION, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, - 0); - VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); -} - -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) -{ - SolarMutexGuard aGuard; - - 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() ) ); - - // #107218# Call same listeners like VCL would do after user interaction - Edit* pEdit = (Edit*)GetWindow(); - if ( pEdit ) - { - SetSynthesizingVCLEvent( sal_True ); - pEdit->SetModifyFlag(); - pEdit->Modify(); - SetSynthesizingVCLEvent( sal_False ); - } - } -} - -double VCLXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); - return pCurrencyFormatter - ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetValue(), pCurrencyFormatter->GetDecimalDigits() ) - : 0; -} - -void VCLXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); - if ( pCurrencyFormatter ) - pCurrencyFormatter->SetMin( - ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) ); -} - -double VCLXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); - return pCurrencyFormatter - ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMin(), pCurrencyFormatter->GetDecimalDigits() ) - : 0; -} - -void VCLXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); - if ( pCurrencyFormatter ) - pCurrencyFormatter->SetMax( - ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) ); -} - -double VCLXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); - return pCurrencyFormatter - ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMax(), pCurrencyFormatter->GetDecimalDigits() ) - : 0; -} - -void VCLXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); - if ( pCurrencyField ) - pCurrencyField->SetFirst( - ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) ); -} - -double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); - return pCurrencyField - ? ImplCalcDoubleValue( (double)pCurrencyField->GetFirst(), pCurrencyField->GetDecimalDigits() ) - : 0; -} - -void VCLXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); - if ( pCurrencyField ) - pCurrencyField->SetLast( - ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) ); -} - -double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); - return pCurrencyField - ? ImplCalcDoubleValue( (double)pCurrencyField->GetLast(), pCurrencyField->GetDecimalDigits() ) - : 0; -} - -void VCLXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow(); - if ( pCurrencyField ) - pCurrencyField->SetSpinSize( - ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) ); -} - -double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter(); - if ( pCurrencyFormatter ) - { - double n = getValue(); - pCurrencyFormatter->SetDecimalDigits( Value ); - setValue( n ); - } -} - -sal_Int16 VCLXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - 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 = 0; - if ( Value >>= d ) - setValue( d ); - } - } - break; - case BASEPROPERTY_VALUEMIN_DOUBLE: - { - double d = 0; - if ( Value >>= d ) - setMin( d ); - } - break; - case BASEPROPERTY_VALUEMAX_DOUBLE: - { - double d = 0; - if ( Value >>= d ) - setMax( d ); - } - break; - case BASEPROPERTY_VALUESTEP_DOUBLE: - { - double d = 0; - if ( Value >>= d ) - setSpinSize( d ); - } - break; - case BASEPROPERTY_DECIMALACCURACY: - { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - setDecimalDigits( n ); - } - break; - case BASEPROPERTY_CURRENCYSYMBOL: - { - ::rtl::OUString aString; - if ( Value >>= aString ) - ((LongCurrencyField*)GetWindow())->SetCurrencySymbol( aString ); - } - break; - case BASEPROPERTY_NUMSHOWTHOUSANDSEP: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - ((LongCurrencyField*)GetWindow())->SetUseThousandSep( b ); - } - break; - default: - { - VCLXFormattedSpinField::setProperty( PropertyName, Value ); - } - } - } -} - -::com::sun::star::uno::Any VCLXCurrencyField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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; - case BASEPROPERTY_CURRENCYSYMBOL: - { - aProp <<= ::rtl::OUString( ((LongCurrencyField*)GetWindow())->GetCurrencySymbol() ); - } - break; - case BASEPROPERTY_NUMSHOWTHOUSANDSEP: - { - aProp <<= (sal_Bool) ((LongCurrencyField*)GetWindow())->IsUseThousandSep(); - } - break; - default: - { - aProp <<= VCLXFormattedSpinField::getProperty( PropertyName ); - } - } - } - return aProp; -} - -// ---------------------------------------------------- -// class VCLXPatternField -// ---------------------------------------------------- - -void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_ALIGN, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_BORDER, - BASEPROPERTY_BORDERCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_EDITMASK, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_LITERALMASK, - BASEPROPERTY_MAXTEXTLEN, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_READONLY, - BASEPROPERTY_STRICTFORMAT, - BASEPROPERTY_TABSTOP, - BASEPROPERTY_TEXT, - BASEPROPERTY_HIDEINACTIVESELECTION, - BASEPROPERTY_VERTICALALIGN, - BASEPROPERTY_WRITING_MODE, - BASEPROPERTY_CONTEXT_WRITING_MODE, - BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, - 0); - VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); -} - -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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - PatternField* pPatternField = (PatternField*) GetWindow(); - if ( pPatternField ) - { - EditMask = rtl::OStringToOUString(pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US); - LiteralMask = pPatternField->GetLiteralMask(); - } -} - -void VCLXPatternField::setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - PatternField* pPatternField = (PatternField*) GetWindow(); - if ( pPatternField ) - { - pPatternField->SetString( Str ); - } -} - -::rtl::OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - ::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) -{ - SolarMutexGuard aGuard; - - 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) -{ - SolarMutexGuard aGuard; - - ::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; -} - -// ---------------------------------------------------- -// class VCLXToolBox -// ---------------------------------------------------- -VCLXToolBox::VCLXToolBox() -{ -} - -VCLXToolBox::~VCLXToolBox() -{ -} - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXToolBox::CreateAccessibleContext() -{ - return getAccessibleFactory().createAccessibleContext( this ); -} - -// ---------------------------------------------------- -// class VCLXFrame -// ---------------------------------------------------- -VCLXFrame::VCLXFrame() -{ -} - -void VCLXFrame::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_BACKGROUNDCOLOR, - BASEPROPERTY_DEFAULTCONTROL, - BASEPROPERTY_ENABLED, - BASEPROPERTY_ENABLEVISIBLE, - BASEPROPERTY_FONTDESCRIPTOR, - BASEPROPERTY_GRAPHIC, - BASEPROPERTY_HELPTEXT, - BASEPROPERTY_HELPURL, - BASEPROPERTY_PRINTABLE, - BASEPROPERTY_LABEL, - 0); - VCLXContainer::ImplGetPropertyIds( rIds ); -} - -VCLXFrame::~VCLXFrame() -{ -} - -::com::sun::star::uno::Any SAL_CALL VCLXFrame::queryInterface(const ::com::sun::star::uno::Type & rType ) -throw(::com::sun::star::uno::RuntimeException) -{ - return VCLXContainer::queryInterface( rType ); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXFrame ) - VCLXContainer::getTypes() -IMPL_XTYPEPROVIDER_END - -// ::com::sun::star::awt::XView -void SAL_CALL VCLXFrame::draw( sal_Int32 nX, sal_Int32 nY ) -throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - Window* pWindow = GetWindow(); - - if ( pWindow ) - { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); - if ( !pDev ) - pDev = pWindow->GetParent(); - - Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() ); - Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); - - pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS ); - } -} - -// ::com::sun::star::awt::XDevice, -::com::sun::star::awt::DeviceInfo SAL_CALL VCLXFrame::getInfo() -throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo(); - return aInfo; -} - -void SAL_CALL VCLXFrame::setProperty( - const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Any& Value ) -throw(::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aGuard; - -#if OSL_DEBUG_LEVEL > 0 - sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; - (void)bVoid; -#endif - - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - default: - { - VCLXContainer::setProperty( PropertyName, Value ); - } - } -} - -void VCLXFrame::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); - VCLXContainer::ProcessWindowEvent( rVclWindowEvent ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/xsimpleanimation.cxx b/toolkit/source/awt/xsimpleanimation.cxx deleted file mode 100644 index 65254d16dc..0000000000 --- a/toolkit/source/awt/xsimpleanimation.cxx +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" -#include "toolkit/awt/xsimpleanimation.hxx" -#include "toolkit/helper/property.hxx" -#include <tools/debug.hxx> -#include <vcl/throbber.hxx> -#include <vcl/svapp.hxx> - -//........................................................................ -namespace toolkit -{ -//........................................................................ - - using namespace ::com::sun::star; - - //==================================================================== - //= XSimpleAnimation - //==================================================================== - DBG_NAME( XSimpleAnimation ) - - //-------------------------------------------------------------------- - XSimpleAnimation::XSimpleAnimation() - { - DBG_CTOR( XSimpleAnimation, NULL ); - } - - //-------------------------------------------------------------------- - XSimpleAnimation::~XSimpleAnimation() - { - DBG_DTOR( XSimpleAnimation, NULL ); - } - - //-------------------------------------------------------------------- - void SAL_CALL XSimpleAnimation::start() throw ( uno::RuntimeException ) - { - SolarMutexGuard aGuard; - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber != NULL) - pThrobber->start(); - } - - //-------------------------------------------------------------------- - void SAL_CALL XSimpleAnimation::stop() throw ( uno::RuntimeException ) - { - SolarMutexGuard aGuard; - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber != NULL) - pThrobber->stop(); - } - - //-------------------------------------------------------------------- - void SAL_CALL XSimpleAnimation::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& rImageList ) - throw ( uno::RuntimeException ) - { - SolarMutexGuard aGuard; - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber != NULL) - pThrobber->setImageList( rImageList ); - } - - //-------------------------------------------------------------------- - void SAL_CALL XSimpleAnimation::setProperty( const ::rtl::OUString& PropertyName, const uno::Any& Value ) - throw( uno::RuntimeException ) - { - SolarMutexGuard aGuard; - - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber == NULL ) - { - VCLXWindow::setProperty( PropertyName, Value ); - return; - } - - sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); - switch ( nPropertyId ) - { - case BASEPROPERTY_STEP_TIME: { - sal_Int32 nStepTime( 0 ); - if ( Value >>= nStepTime ) - pThrobber->setStepTime( nStepTime ); - - break; - } - case BASEPROPERTY_REPEAT: { - sal_Bool bRepeat( sal_True ); - if ( Value >>= bRepeat ) - pThrobber->setRepeat( bRepeat ); - break; - } - default: - VCLXWindow::setProperty( PropertyName, Value ); - } - } - - //-------------------------------------------------------------------- - uno::Any SAL_CALL XSimpleAnimation::getProperty( const ::rtl::OUString& PropertyName ) - throw( uno::RuntimeException ) - { - SolarMutexGuard aGuard; - - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber == NULL ) - return VCLXWindow::getProperty( PropertyName ); - - uno::Any aReturn; - sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); - switch ( nPropertyId ) - { - case BASEPROPERTY_STEP_TIME: - aReturn <<= pThrobber->getStepTime(); - break; - case BASEPROPERTY_REPEAT: - aReturn <<= pThrobber->getRepeat(); - break; - default: - aReturn = VCLXWindow::getProperty( PropertyName ); - } - return aReturn; - } - -//........................................................................ -} // namespace toolkit -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/xthrobber.cxx b/toolkit/source/awt/xthrobber.cxx deleted file mode 100644 index 04cd37d19b..0000000000 --- a/toolkit/source/awt/xthrobber.cxx +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" -#include "toolkit/awt/xthrobber.hxx" -#include "toolkit/helper/property.hxx" -#include <toolkit/helper/tkresmgr.hxx> - -#include "xthrobber.hrc" -#include <tools/debug.hxx> -#include <vcl/fixed.hxx> -#include <vcl/timer.hxx> -#include <vcl/svapp.hxx> -#include <vcl/throbber.hxx> - -//........................................................................ -namespace toolkit -{ -//........................................................................ - - using namespace ::com::sun::star; - - //==================================================================== - //= XThrobber - //==================================================================== - DBG_NAME( XThrobber ) - - //-------------------------------------------------------------------- - XThrobber::XThrobber() - { - DBG_CTOR( XThrobber, NULL ); - } - - //-------------------------------------------------------------------- - XThrobber::~XThrobber() - { - DBG_DTOR( XThrobber, NULL ); - } - - //-------------------------------------------------------------------- - void SAL_CALL XThrobber::start() throw ( uno::RuntimeException ) - { - SolarMutexGuard aGuard; - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber != NULL) - pThrobber->start(); - } - - //-------------------------------------------------------------------- - void SAL_CALL XThrobber::stop() throw ( uno::RuntimeException ) - { - SolarMutexGuard aGuard; - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber != NULL) - pThrobber->stop(); - } - - //-------------------------------------------------------------------- - void XThrobber::SetWindow( Window* pWindow ) - { - XThrobber_Base::SetWindow( pWindow ); - InitImageList(); - } - - //-------------------------------------------------------------------- - void SAL_CALL XThrobber::InitImageList() - throw( uno::RuntimeException ) - { - SolarMutexGuard aGuard; - - Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) ); - if ( pThrobber == NULL) - return; - - uno::Sequence< uno::Reference< graphic::XGraphic > > aImageList(12); - sal_uInt16 nIconIdStart = RID_TK_ICON_THROBBER_START; - - for ( sal_uInt16 i=0; i<12; i++ ) - { - Image aImage = TK_RES_IMAGE( nIconIdStart + i ); - aImageList[i] = aImage.GetXGraphic(); - } - - pThrobber->setImageList( aImageList ); - } - -//........................................................................ -} // namespace toolkit -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/xthrobber.hrc b/toolkit/source/awt/xthrobber.hrc deleted file mode 100644 index d483c878d8..0000000000 --- a/toolkit/source/awt/xthrobber.hrc +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _TOOLKIT_AWT_XTHROBBER_HRC_ -#define _TOOLKIT_AWT_XTHROBBER_HRC_ - -#define RID_TK_ICON_THROBBER_START 1000 - -#endif // _TOOLKIT_AWT_XTHROBBER_HRC_ diff --git a/toolkit/source/awt/xthrobber.src b/toolkit/source/awt/xthrobber.src deleted file mode 100644 index e23318c089..0000000000 --- a/toolkit/source/awt/xthrobber.src +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _TOOLKIT_AWT_XTHROBBER_HRC_ -#include <xthrobber.hrc> -#endif - -#define STD_MASK_COLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }; - -Image RID_TK_ICON_THROBBER_START -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_01.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 1 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_02.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 2 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_03.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 3 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_04.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 4 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_05.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 5 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_06.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 6 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_07.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 7 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_08.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 8 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_09.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 9 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_10.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 10 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_11.png"; }; - STD_MASK_COLOR -}; - -Image RID_TK_ICON_THROBBER_START + 11 -{ - ImageBitmap = Bitmap{ file = "spinner03-grey_12.png"; }; - STD_MASK_COLOR -}; |