summaryrefslogtreecommitdiff
path: root/toolkit/source
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/source')
-rw-r--r--toolkit/source/awt/animatedimagespeer.cxx542
-rw-r--r--toolkit/source/awt/asynccallback.cxx198
-rw-r--r--toolkit/source/awt/forward.hxx76
-rw-r--r--toolkit/source/awt/non-interactable-containers.xml15
-rw-r--r--toolkit/source/awt/stylesettings.cxx987
-rw-r--r--toolkit/source/awt/stylesettings.hxx187
-rw-r--r--toolkit/source/awt/vclxaccessiblecomponent.cxx926
-rw-r--r--toolkit/source/awt/vclxbitmap.cxx95
-rw-r--r--toolkit/source/awt/vclxbutton.cxx129
-rw-r--r--toolkit/source/awt/vclxbutton.hxx117
-rw-r--r--toolkit/source/awt/vclxcontainer.cxx238
-rw-r--r--toolkit/source/awt/vclxdevice.cxx363
-rw-r--r--toolkit/source/awt/vclxdialog.cxx274
-rw-r--r--toolkit/source/awt/vclxdialog.hxx109
-rw-r--r--toolkit/source/awt/vclxfixedline.cxx127
-rw-r--r--toolkit/source/awt/vclxfixedline.hxx78
-rw-r--r--toolkit/source/awt/vclxfont.cxx255
-rw-r--r--toolkit/source/awt/vclxgraphics.cxx488
-rw-r--r--toolkit/source/awt/vclxmenu.cxx1117
-rw-r--r--toolkit/source/awt/vclxplugin.cxx84
-rw-r--r--toolkit/source/awt/vclxplugin.hxx70
-rw-r--r--toolkit/source/awt/vclxpointer.cxx82
-rw-r--r--toolkit/source/awt/vclxprinter.cxx465
-rw-r--r--toolkit/source/awt/vclxregion.cxx173
-rw-r--r--toolkit/source/awt/vclxscroller.cxx204
-rw-r--r--toolkit/source/awt/vclxscroller.hxx90
-rw-r--r--toolkit/source/awt/vclxspinbutton.cxx358
-rw-r--r--toolkit/source/awt/vclxsplitter.cxx249
-rw-r--r--toolkit/source/awt/vclxsplitter.hxx124
-rw-r--r--toolkit/source/awt/vclxsystemdependentwindow.cxx129
-rw-r--r--toolkit/source/awt/vclxtabcontrol.cxx518
-rw-r--r--toolkit/source/awt/vclxtabcontrol.hxx148
-rw-r--r--toolkit/source/awt/vclxtabpage.cxx147
-rw-r--r--toolkit/source/awt/vclxtabpage.hxx76
-rw-r--r--toolkit/source/awt/vclxtabpagecontainer.cxx237
-rw-r--r--toolkit/source/awt/vclxtabpagemodel.cxx153
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx1761
-rw-r--r--toolkit/source/awt/vclxtopwindow.cxx335
-rw-r--r--toolkit/source/awt/vclxwindow.cxx2628
-rw-r--r--toolkit/source/awt/vclxwindow1.cxx114
-rw-r--r--toolkit/source/awt/vclxwindows.cxx6684
-rw-r--r--toolkit/source/awt/xsimpleanimation.cxx153
-rw-r--r--toolkit/source/awt/xthrobber.cxx117
-rw-r--r--toolkit/source/awt/xthrobber.hrc33
-rw-r--r--toolkit/source/awt/xthrobber.src104
-rw-r--r--toolkit/source/controls/accessiblecontrolcontext.cxx382
-rw-r--r--toolkit/source/controls/animatedimages.cxx496
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx1969
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx1142
-rw-r--r--toolkit/source/controls/eventcontainer.cxx214
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx473
-rw-r--r--toolkit/source/controls/geometrycontrolmodel.cxx650
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx394
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.hxx100
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx442
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.hxx121
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx331
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx138
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx456
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx135
-rw-r--r--toolkit/source/controls/grid/grideventforwarder.cxx152
-rw-r--r--toolkit/source/controls/grid/grideventforwarder.hxx88
-rw-r--r--toolkit/source/controls/grid/initguard.hxx67
-rw-r--r--toolkit/source/controls/grid/sortablegriddatamodel.cxx880
-rw-r--r--toolkit/source/controls/grid/sortablegriddatamodel.hxx201
-rw-r--r--toolkit/source/controls/roadmapcontrol.cxx503
-rw-r--r--toolkit/source/controls/roadmapentry.cxx126
-rw-r--r--toolkit/source/controls/spinningprogress.cxx143
-rw-r--r--toolkit/source/controls/stdtabcontroller.cxx437
-rw-r--r--toolkit/source/controls/stdtabcontrollermodel.cxx434
-rw-r--r--toolkit/source/controls/tabpagecontainer.cxx296
-rw-r--r--toolkit/source/controls/tabpagemodel.cxx396
-rw-r--r--toolkit/source/controls/tkscrollbar.cxx298
-rw-r--r--toolkit/source/controls/tksimpleanimation.cxx193
-rw-r--r--toolkit/source/controls/tkspinbutton.cxx354
-rw-r--r--toolkit/source/controls/tkthrobber.cxx203
-rw-r--r--toolkit/source/controls/tree/treecontrol.cxx514
-rw-r--r--toolkit/source/controls/tree/treecontrol.hxx141
-rw-r--r--toolkit/source/controls/tree/treedatamodel.cxx676
-rw-r--r--toolkit/source/controls/unocontrol.cxx1610
-rw-r--r--toolkit/source/controls/unocontrolbase.cxx274
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx836
-rw-r--r--toolkit/source/controls/unocontrolcontainermodel.cxx92
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx1485
-rw-r--r--toolkit/source/controls/unocontrols.cxx4397
-rw-r--r--toolkit/source/helper/accessibilityclient.cxx280
-rw-r--r--toolkit/source/helper/externallock.cxx48
-rw-r--r--toolkit/source/helper/fixedhyperbase.cxx74
-rw-r--r--toolkit/source/helper/formpdfexport.cxx628
-rw-r--r--toolkit/source/helper/imagealign.cxx138
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx235
-rw-r--r--toolkit/source/helper/property.cxx415
-rw-r--r--toolkit/source/helper/registerservices.cxx342
-rw-r--r--toolkit/source/helper/servicenames.cxx123
-rw-r--r--toolkit/source/helper/tkresmgr.cxx131
-rw-r--r--toolkit/source/helper/unomemorystream.cxx110
-rw-r--r--toolkit/source/helper/unopropertyarrayhelper.cxx162
-rw-r--r--toolkit/source/helper/unowrapper.cxx346
-rw-r--r--toolkit/source/helper/vclunohelper.cxx804
-rw-r--r--toolkit/source/layout/core/bin.cxx201
-rw-r--r--toolkit/source/layout/core/bin.hxx116
-rw-r--r--toolkit/source/layout/core/box-base.cxx176
-rw-r--r--toolkit/source/layout/core/box-base.hxx90
-rw-r--r--toolkit/source/layout/core/box.cxx284
-rw-r--r--toolkit/source/layout/core/box.hxx105
-rw-r--r--toolkit/source/layout/core/byteseq.cxx79
-rw-r--r--toolkit/source/layout/core/container.cxx131
-rw-r--r--toolkit/source/layout/core/container.hxx139
-rw-r--r--toolkit/source/layout/core/dialogbuttonhbox.cxx283
-rw-r--r--toolkit/source/layout/core/dialogbuttonhbox.hxx76
-rw-r--r--toolkit/source/layout/core/factory.cxx126
-rw-r--r--toolkit/source/layout/core/factory.hxx77
-rw-r--r--toolkit/source/layout/core/flow.cxx213
-rw-r--r--toolkit/source/layout/core/flow.hxx98
-rw-r--r--toolkit/source/layout/core/helper.cxx597
-rw-r--r--toolkit/source/layout/core/helper.hxx152
-rw-r--r--toolkit/source/layout/core/import.cxx328
-rw-r--r--toolkit/source/layout/core/import.hxx214
-rw-r--r--toolkit/source/layout/core/localized-string.cxx83
-rw-r--r--toolkit/source/layout/core/localized-string.hxx79
-rw-r--r--toolkit/source/layout/core/precompiled_xmlscript.hxx38
-rw-r--r--toolkit/source/layout/core/proplist.cxx422
-rw-r--r--toolkit/source/layout/core/proplist.hxx94
-rw-r--r--toolkit/source/layout/core/root.cxx393
-rw-r--r--toolkit/source/layout/core/root.hxx159
-rw-r--r--toolkit/source/layout/core/table.cxx314
-rw-r--r--toolkit/source/layout/core/table.hxx105
-rw-r--r--toolkit/source/layout/core/timer.cxx151
-rw-r--r--toolkit/source/layout/core/timer.hxx52
-rw-r--r--toolkit/source/layout/core/translate.cxx133
-rw-r--r--toolkit/source/layout/core/translate.hxx43
-rw-r--r--toolkit/source/layout/core/vcl.cxx69
-rw-r--r--toolkit/source/layout/core/vcl.hxx51
-rw-r--r--toolkit/source/layout/vcl/wbutton.cxx680
-rw-r--r--toolkit/source/layout/vcl/wcontainer.cxx269
-rw-r--r--toolkit/source/layout/vcl/wfield.cxx795
-rw-r--r--toolkit/source/layout/vcl/wrapper.cxx1363
-rw-r--r--toolkit/source/layout/vcl/wrapper.hxx152
138 files changed, 0 insertions, 56562 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
-};
diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx
deleted file mode 100644
index e006ce9a6c..0000000000
--- a/toolkit/source/controls/accessiblecontrolcontext.cxx
+++ /dev/null
@@ -1,382 +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/controls/accessiblecontrolcontext.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
-#include <com/sun/star/awt/XControl.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <vcl/svapp.hxx>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <vcl/window.hxx>
-
-//........................................................................
-namespace toolkit
-{
-//........................................................................
-
- using ::comphelper::OContextEntryGuard;
- 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::accessibility;
-
- //====================================================================
- //= OAccessibleControlContext
- //====================================================================
- //--------------------------------------------------------------------
- OAccessibleControlContext::OAccessibleControlContext()
- :OAccessibleControlContext_Base( )
- {
- // nothing to do here, we have a late ctor
- }
-
- //--------------------------------------------------------------------
- OAccessibleControlContext::~OAccessibleControlContext()
- {
- ensureDisposed();
- }
-
- //--------------------------------------------------------------------
- IMPLEMENT_FORWARD_XINTERFACE3( OAccessibleControlContext, OAccessibleControlContext_Base, OAccessibleImplementationAccess, OAccessibleControlContext_IBase )
- IMPLEMENT_FORWARD_XTYPEPROVIDER3( OAccessibleControlContext, OAccessibleControlContext_Base, OAccessibleImplementationAccess, OAccessibleControlContext_IBase )
- // (order matters: the first is the class name, the second is the class doing the ref counting)
-
- //--------------------------------------------------------------------
- void OAccessibleControlContext::Init( const Reference< XAccessible >& _rxCreator ) SAL_THROW( ( Exception ) )
- {
- OContextEntryGuard aGuard( this );
-
- // retrieve the model of the control
- OSL_ENSURE( !m_xControlModel.is(), "OAccessibleControlContext::Init: already know a control model....!???" );
-
- Reference< awt::XControl > xControl( _rxCreator, UNO_QUERY );
- if ( xControl.is() )
- m_xControlModel = m_xControlModel.query( xControl->getModel() );
- OSL_ENSURE( m_xControlModel.is(), "OAccessibleControlContext::Init: invalid creator (no control, or control without model!" );
- if ( !m_xControlModel.is() )
- throw DisposedException(); // caught by the caller (the create method)
-
- // start listening at the model
- startModelListening();
-
- // announce the XAccessible to our base class
- OAccessibleControlContext_Base::lateInit( _rxCreator );
- }
-
- //--------------------------------------------------------------------
- OAccessibleControlContext* OAccessibleControlContext::create( const Reference< XAccessible >& _rxCreator ) SAL_THROW( ( ) )
- {
- OAccessibleControlContext* pNew = NULL;
- try
- {
- pNew = new OAccessibleControlContext;
- pNew->Init( _rxCreator );
- }
- catch( const Exception& )
- {
- OSL_FAIL( "OAccessibleControlContext::create: caught an exception from the late ctor!" );
- }
- return pNew;
- }
-
- //--------------------------------------------------------------------
- void OAccessibleControlContext::startModelListening( ) SAL_THROW( ( Exception ) )
- {
- Reference< XComponent > xModelComp( m_xControlModel, UNO_QUERY );
- OSL_ENSURE( xModelComp.is(), "OAccessibleControlContext::startModelListening: invalid model!" );
- if ( xModelComp.is() )
- xModelComp->addEventListener( this );
- }
-
- //--------------------------------------------------------------------
- void OAccessibleControlContext::stopModelListening( ) SAL_THROW( ( Exception ) )
- {
- Reference< XComponent > xModelComp( m_xControlModel, UNO_QUERY );
- OSL_ENSURE( xModelComp.is(), "OAccessibleControlContext::stopModelListening: invalid model!" );
- if ( xModelComp.is() )
- xModelComp->removeEventListener( this );
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL OAccessibleControlContext::getAccessibleChildCount( ) throw (RuntimeException)
- {
- // we do not have children
- return 0;
- }
-
- //--------------------------------------------------------------------
- Reference< XAccessible > SAL_CALL OAccessibleControlContext::getAccessibleChild( sal_Int32 ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- // we do not have children
- throw IndexOutOfBoundsException();
- }
-
- //--------------------------------------------------------------------
- Reference< XAccessible > SAL_CALL OAccessibleControlContext::getAccessibleParent( ) throw (RuntimeException)
- {
- OContextEntryGuard aGuard( this );
- OSL_ENSURE( implGetForeignControlledParent().is(), "OAccessibleControlContext::getAccessibleParent: somebody forgot to set a parent!" );
- // this parent of us is foreign controlled - somebody has to set it using the OAccessibleImplementationAccess
- // class, before integrating our instance into an AccessibleDocumentModel
- return implGetForeignControlledParent();
- }
-
- //--------------------------------------------------------------------
- sal_Int16 SAL_CALL OAccessibleControlContext::getAccessibleRole( ) throw (RuntimeException)
- {
- return AccessibleRole::SHAPE;
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString SAL_CALL OAccessibleControlContext::getAccessibleDescription( ) throw (RuntimeException)
- {
- OContextEntryGuard aGuard( this );
- return getModelStringProperty( "HelpText" );
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString SAL_CALL OAccessibleControlContext::getAccessibleName( ) throw (RuntimeException)
- {
- OContextEntryGuard aGuard( this );
- return getModelStringProperty( "Name" );
- }
-
- //--------------------------------------------------------------------
- Reference< XAccessibleRelationSet > SAL_CALL OAccessibleControlContext::getAccessibleRelationSet( ) throw (RuntimeException)
- {
- return NULL;
- }
-
- //--------------------------------------------------------------------
- Reference< XAccessibleStateSet > SAL_CALL OAccessibleControlContext::getAccessibleStateSet( ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- // no OContextEntryGuard here, as we do not want to throw an exception in case we're not alive anymore
-
- ::utl::AccessibleStateSetHelper* pStateSet = NULL;
- if ( isAlive() )
- {
- // no own states, only the ones which are foreign controlled
- pStateSet = new ::utl::AccessibleStateSetHelper( implGetForeignControlledStates() );
- }
- else
- { // only the DEFUNC state if we're already disposed
- pStateSet = new ::utl::AccessibleStateSetHelper;
- pStateSet->AddState( AccessibleStateType::DEFUNC );
- }
- return pStateSet;
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OAccessibleControlContext::disposing( const EventObject&
- #if OSL_DEBUG_LEVEL > 0
- _rSource
- #endif
- ) throw ( RuntimeException )
- {
- OSL_ENSURE( Reference< XPropertySet >( _rSource.Source, UNO_QUERY ).get() == m_xControlModel.get(),
- "OAccessibleControlContext::disposing: where did this come from?" );
-
- stopModelListening( );
- m_xControlModel.clear();
- m_xModelPropsInfo.clear();
-
- OAccessibleControlContext_Base::disposing();
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString OAccessibleControlContext::getModelStringProperty( const sal_Char* _pPropertyName )
- {
- ::rtl::OUString sReturn;
- try
- {
- if ( !m_xModelPropsInfo.is() && m_xControlModel.is() )
- m_xModelPropsInfo = m_xControlModel->getPropertySetInfo();
-
- ::rtl::OUString sPropertyName( ::rtl::OUString::createFromAscii( _pPropertyName ) );
- if ( m_xModelPropsInfo.is() && m_xModelPropsInfo->hasPropertyByName( sPropertyName ) )
- m_xControlModel->getPropertyValue( sPropertyName ) >>= sReturn;
- }
- catch( const Exception& )
- {
- OSL_FAIL( "OAccessibleControlContext::getModelStringProperty: caught an exception!" );
- }
- return sReturn;
- }
-
- //--------------------------------------------------------------------
- Window* OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const
- {
- Reference< awt::XControl > xControl( getAccessibleCreator(), UNO_QUERY );
- Reference< awt::XWindow > xWindow;
- if ( xControl.is() )
- xWindow = xWindow.query( xControl->getPeer() );
-
- Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : NULL;
-
- if ( _pxUNOWindow )
- *_pxUNOWindow = xWindow;
- return pWindow;
- }
-
- //--------------------------------------------------------------------
- awt::Rectangle SAL_CALL OAccessibleControlContext::implGetBounds( ) throw (RuntimeException)
- {
- SolarMutexGuard aSolarGuard;
- // want to do some VCL stuff here ...
- OContextEntryGuard aGuard( this );
-
- OSL_FAIL( "OAccessibleControlContext::implGetBounds: performance issue: forced to calc the size myself!" );
- // In design mode (and this is what this class is for), the surrounding shape (if any) should handle this call
- // The problem is that in design mode, our size may not be correct (in the drawing layer, controls are
- // positioned/sized for painting only), and that calculation of our position is expensive
-
- // what we know (or can obtain from somewhere):
- // * the PosSize of our peer, relative to it's parent window
- // * the parent window which the PosSize is relative to
- // * our foreign controlled accessible parent
- // from this info, we can determine the the position of our peer relative to the foreign parent
-
- // our control
- Reference< awt::XWindow > xWindow;
- Window* pVCLWindow = implGetWindow( &xWindow );
-
- awt::Rectangle aBounds( 0, 0, 0, 0 );
- if ( xWindow.is() )
- {
- // ugly, but .... though the XWindow has a getPosSize, it is impossible to determine the
- // parent which this position/size is relative to. This means we must tunnel UNO and ask the
- // implementation
- Window* pVCLParent = pVCLWindow ? pVCLWindow->GetParent() : NULL;
-
- // the relative location of the window
- ::Point aWindowRelativePos( 0, 0);
- if ( pVCLWindow )
- aWindowRelativePos = pVCLWindow->GetPosPixel();
-
- // the screnn position of the "window parent" of the control
- ::Point aVCLParentScreenPos( 0, 0 );
- if ( pVCLParent )
- aVCLParentScreenPos = pVCLParent->GetPosPixel();
-
- // the screen position of the "accessible parent" of the control
- Reference< XAccessible > xParentAcc( implGetForeignControlledParent() );
- Reference< XAccessibleComponent > xParentAccComponent;
- if ( xParentAcc.is() )
- xParentAccComponent = xParentAccComponent.query( xParentAcc->getAccessibleContext() );
- awt::Point aAccParentScreenPos( 0, 0 );
- if ( xParentAccComponent.is() )
- aAccParentScreenPos = xParentAccComponent->getLocationOnScreen();
-
- // now the size of the control
- aBounds = xWindow->getPosSize();
-
- // correct the pos
- aBounds.X = aWindowRelativePos.X() + aVCLParentScreenPos.X() - aAccParentScreenPos.X;
- aBounds.Y = aWindowRelativePos.Y() + aVCLParentScreenPos.Y() - aAccParentScreenPos.Y;
- }
-
- return aBounds;
- }
-
- //--------------------------------------------------------------------
- Reference< XAccessible > SAL_CALL OAccessibleControlContext::getAccessibleAtPoint( const awt::Point& /* _rPoint */ ) throw (RuntimeException)
- {
- // no children at all
- return NULL;
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OAccessibleControlContext::grabFocus( ) throw (RuntimeException)
- {
- OSL_FAIL( "OAccessibleControlContext::grabFocus: !isFocusTraversable, but grabFocus!" );
- }
-
- //--------------------------------------------------------------------
- Any SAL_CALL OAccessibleControlContext::getAccessibleKeyBinding( ) throw (RuntimeException)
- {
- // we do not have any key bindings to activate a UNO control in design mode
- return Any();
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL OAccessibleControlContext::getForeground( ) throw (::com::sun::star::uno::RuntimeException)
- {
- SolarMutexGuard aSolarGuard;
- // want to do some VCL stuff here ...
- OContextEntryGuard aGuard( this );
-
- Window* pWindow = implGetWindow( );
- sal_Int32 nColor = 0;
- 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 OAccessibleControlContext::getBackground( ) throw (::com::sun::star::uno::RuntimeException)
- {
- SolarMutexGuard aSolarGuard;
- // want to do some VCL stuff here ...
- OContextEntryGuard aGuard( this );
-
- Window* pWindow = implGetWindow( );
- sal_Int32 nColor = 0;
- if ( pWindow )
- {
- if ( pWindow->IsControlBackground() )
- nColor = pWindow->GetControlBackground().GetColor();
- else
- nColor = pWindow->GetBackground().GetColor().GetColor();
- }
-
- return nColor;
- }
-
-//........................................................................
-} //namespace toolkit
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/animatedimages.cxx b/toolkit/source/controls/animatedimages.cxx
deleted file mode 100644
index 99369dafae..0000000000
--- a/toolkit/source/controls/animatedimages.cxx
+++ /dev/null
@@ -1,496 +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/controls/animatedimages.hxx"
-#include "toolkit/helper/servicenames.hxx"
-#include "toolkit/helper/property.hxx"
-#include "toolkit/helper/unopropertyarrayhelper.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/awt/VisualEffect.hpp>
-#include <com/sun/star/awt/ImageScaleMode.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
-/** === end UNO includes === **/
-
-//......................................................................................................................
-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::container::ContainerEvent;
- using ::com::sun::star::container::XContainerListener;
- using ::com::sun::star::beans::XPropertySetInfo;
- using ::com::sun::star::lang::DisposedException;
- using ::com::sun::star::lang::IndexOutOfBoundsException;
- using ::com::sun::star::lang::EventObject;
- using ::com::sun::star::awt::XControlModel;
- using ::com::sun::star::awt::XAnimatedImages;
- using ::com::sun::star::lang::IllegalArgumentException;
- using ::com::sun::star::awt::XWindowPeer;
- using ::com::sun::star::util::XModifyListener;
- using ::com::sun::star::awt::XToolkit;
- using ::com::sun::star::lang::XMultiServiceFactory;
- /** === end UNO using === **/
- namespace VisualEffect = ::com::sun::star::awt::VisualEffect;
- namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
-
- //==================================================================================================================
- //= AnimatedImagesControl
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- AnimatedImagesControl::AnimatedImagesControl( Reference< XMultiServiceFactory > const & i_factory )
- :AnimatedImagesControl_Base( i_factory )
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString AnimatedImagesControl::GetComponentServiceName()
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AnimatedImages" ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControl::startAnimation( ) throw (RuntimeException)
- {
- Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
- if ( xAnimation.is() )
- xAnimation->startAnimation();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControl::stopAnimation( ) throw (RuntimeException)
- {
- Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
- if ( xAnimation.is() )
- xAnimation->stopAnimation();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Bool SAL_CALL AnimatedImagesControl::isAnimationRunning( ) throw (RuntimeException)
- {
- Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
- if ( xAnimation.is() )
- return xAnimation->isAnimationRunning();
- return sal_False;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL AnimatedImagesControl::getImplementationName( ) throw(RuntimeException)
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.AnimatedImagesControl" ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL AnimatedImagesControl::getSupportedServiceNames() throw(RuntimeException)
- {
- Sequence< ::rtl::OUString > aServices( AnimatedImagesControl_Base::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControl );
- return aServices;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- namespace
- {
- void lcl_updatePeer( Reference< XWindowPeer > const& i_peer, Reference< XControlModel > const& i_model )
- {
- const Reference< XModifyListener > xPeerModify( i_peer, UNO_QUERY );
- if ( xPeerModify.is() )
- {
- EventObject aEvent;
- aEvent.Source = i_model;
- xPeerModify->modified( aEvent );
- }
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- sal_Bool SAL_CALL AnimatedImagesControl::setModel( const Reference< XControlModel >& i_rModel ) throw ( RuntimeException )
- {
- const Reference< XAnimatedImages > xOldContainer( getModel(), UNO_QUERY );
- const Reference< XAnimatedImages > xNewContainer( i_rModel, UNO_QUERY );
-
- if ( !AnimatedImagesControl_Base::setModel( i_rModel ) )
- return sal_False;
-
- if ( xOldContainer.is() )
- xOldContainer->removeContainerListener( this );
-
- if ( xNewContainer.is() )
- xNewContainer->addContainerListener( this );
-
- lcl_updatePeer( getPeer(), getModel() );
-
- return sal_True;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControl::createPeer( const Reference< XToolkit >& i_toolkit, const Reference< XWindowPeer >& i_parentPeer ) throw(RuntimeException)
- {
- AnimatedImagesControl_Base::createPeer( i_toolkit, i_parentPeer );
-
- lcl_updatePeer( getPeer(), getModel() );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControl::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
- {
- const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
- if ( xPeerListener.is() )
- xPeerListener->elementInserted( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControl::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
- {
- const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
- if ( xPeerListener.is() )
- xPeerListener->elementRemoved( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControl::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
- {
- const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
- if ( xPeerListener.is() )
- xPeerListener->elementReplaced( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControl::disposing( const EventObject& i_event ) throw (RuntimeException)
- {
- UnoControlBase::disposing( i_event );
- }
-
- //==================================================================================================================
- //= AnimatedImagesControlModel_Data
- //==================================================================================================================
- struct AnimatedImagesControlModel_Data
- {
- ::std::vector< Sequence< ::rtl::OUString > > aImageSets;
- };
-
- namespace
- {
- void lcl_checkIndex( const AnimatedImagesControlModel_Data& i_data, const sal_Int32 i_index, const Reference< XInterface >& i_context,
- const bool i_forInsert = false )
- {
- if ( ( i_index < 0 ) || ( size_t( i_index ) > i_data.aImageSets.size() + ( i_forInsert ? 1 : 0 ) ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), i_context );
- }
-
- void lcl_notify( ::osl::ClearableMutexGuard& i_guard, ::cppu::OBroadcastHelper& i_broadcaseHelper,
- void ( SAL_CALL XContainerListener::*i_notificationMethod )( const ContainerEvent& ),
- const sal_Int32 i_accessor, const Sequence< ::rtl::OUString >& i_imageURLs, const Reference< XInterface >& i_context )
- {
- ::cppu::OInterfaceContainerHelper* pContainerListeners = i_broadcaseHelper.getContainer( XContainerListener::static_type() );
- if ( pContainerListeners == NULL )
- return;
-
- ContainerEvent aEvent;
- aEvent.Source = i_context;
- aEvent.Accessor <<= i_accessor;
- aEvent.Element <<= i_imageURLs;
-
- i_guard.clear();
- pContainerListeners->notifyEach( i_notificationMethod, aEvent );
- }
- }
-
- //==================================================================================================================
- //= AnimatedImagesControlModel
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- AnimatedImagesControlModel::AnimatedImagesControlModel( Reference< XMultiServiceFactory > const & i_factory )
- :AnimatedImagesControlModel_Base( i_factory )
- ,m_pData( new AnimatedImagesControlModel_Data )
- {
- ImplRegisterProperty( BASEPROPERTY_AUTO_REPEAT );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_IMAGE_SCALE_MODE );
- ImplRegisterProperty( BASEPROPERTY_STEP_TIME );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- AnimatedImagesControlModel::AnimatedImagesControlModel( const AnimatedImagesControlModel& i_copySource )
- :AnimatedImagesControlModel_Base( i_copySource )
- ,m_pData( new AnimatedImagesControlModel_Data( *i_copySource.m_pData ) )
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- AnimatedImagesControlModel::~AnimatedImagesControlModel()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- UnoControlModel* AnimatedImagesControlModel::Clone() const
- {
- return new AnimatedImagesControlModel( *this );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XPropertySetInfo > SAL_CALL AnimatedImagesControlModel::getPropertySetInfo( ) throw(RuntimeException)
- {
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL AnimatedImagesControlModel::getServiceName() throw(RuntimeException)
- {
- return ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL AnimatedImagesControlModel::getImplementationName( ) throw(RuntimeException)
- {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.toolkit.AnimatedImagesControlModel"));
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL AnimatedImagesControlModel::getSupportedServiceNames() throw(RuntimeException)
- {
- Sequence< ::rtl::OUString > aServiceNames(2);
- aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
- aServiceNames[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlModel"));
- return aServiceNames;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 i_handle, const Any& i_value ) throw (Exception)
- {
- switch ( i_handle )
- {
- case BASEPROPERTY_IMAGE_SCALE_MODE:
- {
- sal_Int16 nImageScaleMode( ImageScaleMode::Anisotropic );
- OSL_VERIFY( i_value >>= nImageScaleMode ); // convertFastPropertyValue ensures that this has the proper type
- if ( ( nImageScaleMode != ImageScaleMode::None )
- && ( nImageScaleMode != ImageScaleMode::Isotropic )
- && ( nImageScaleMode != ImageScaleMode::Anisotropic )
- )
- throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
- }
- break;
- }
-
- AnimatedImagesControlModel_Base::setFastPropertyValue_NoBroadcast( i_handle, i_value );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Any AnimatedImagesControlModel::ImplGetDefaultValue( sal_uInt16 i_propertyId ) const
- {
- switch ( i_propertyId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- return makeAny( ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControl ) );
-
- case BASEPROPERTY_BORDER:
- return makeAny( VisualEffect::NONE );
-
- case BASEPROPERTY_STEP_TIME:
- return makeAny( (sal_Int32) 100 );
-
- case BASEPROPERTY_AUTO_REPEAT:
- return makeAny( (sal_Bool)sal_True );
-
- case BASEPROPERTY_IMAGE_SCALE_MODE:
- return makeAny( ImageScaleMode::None );
-
- default:
- return UnoControlModel::ImplGetDefaultValue( i_propertyId );
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper& SAL_CALL AnimatedImagesControlModel::getInfoHelper()
- {
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL AnimatedImagesControlModel::getStepTime() throw (RuntimeException)
- {
- sal_Int32 nStepTime( 100 );
- OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_STEP_TIME ) ) >>= nStepTime );
- return nStepTime;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControlModel::setStepTime( ::sal_Int32 i_stepTime ) throw (RuntimeException)
- {
- setPropertyValue( GetPropertyName( BASEPROPERTY_STEP_TIME ), makeAny( i_stepTime ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Bool SAL_CALL AnimatedImagesControlModel::getAutoRepeat() throw (RuntimeException)
- {
- sal_Bool bAutoRepeat( sal_True );
- OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_AUTO_REPEAT ) ) >>= bAutoRepeat );
- return bAutoRepeat;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControlModel::setAutoRepeat( ::sal_Bool i_autoRepeat ) throw (RuntimeException)
- {
- setPropertyValue( GetPropertyName( BASEPROPERTY_AUTO_REPEAT ), makeAny( i_autoRepeat ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int16 SAL_CALL AnimatedImagesControlModel::getScaleMode() throw (RuntimeException)
- {
- sal_Int16 nImageScaleMode( ImageScaleMode::Anisotropic );
- OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ) ) >>= nImageScaleMode );
- return nImageScaleMode;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControlModel::setScaleMode( ::sal_Int16 i_scaleMode ) throw (IllegalArgumentException, RuntimeException)
- {
- setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ), makeAny( i_scaleMode ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL AnimatedImagesControlModel::getImageSetCount( ) throw (RuntimeException)
- {
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
- throw DisposedException();
-
- return m_pData->aImageSets.size();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL AnimatedImagesControlModel::getImageSet( ::sal_Int32 i_index ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
- throw DisposedException();
-
- lcl_checkIndex( *m_pData, i_index, *this );
-
- return m_pData->aImageSets[ i_index ];
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControlModel::insertImageSet( ::sal_Int32 i_index, const Sequence< ::rtl::OUString >& i_imageURLs ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // sanity checks
- if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
- throw DisposedException();
-
- lcl_checkIndex( *m_pData, i_index, *this, true );
-
- // actaul insertion
- m_pData->aImageSets.insert( m_pData->aImageSets.begin() + i_index, i_imageURLs );
-
- // listener notification
- lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementInserted, i_index, i_imageURLs, *this );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControlModel::replaceImageSet( ::sal_Int32 i_index, const Sequence< ::rtl::OUString >& i_imageURLs ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // sanity checks
- if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
- throw DisposedException();
-
- lcl_checkIndex( *m_pData, i_index, *this );
-
- // actaul insertion
- m_pData->aImageSets[ i_index ] = i_imageURLs;
-
- // listener notification
- lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementReplaced, i_index, i_imageURLs, *this );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControlModel::removeImageSet( ::sal_Int32 i_index ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // sanity checks
- if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
- throw DisposedException();
-
- lcl_checkIndex( *m_pData, i_index, *this );
-
- // actual removal
- ::std::vector< Sequence< ::rtl::OUString > >::iterator removalPos = m_pData->aImageSets.begin() + i_index;
- Sequence< ::rtl::OUString > aRemovedElement( *removalPos );
- m_pData->aImageSets.erase( removalPos );
-
- // listener notification
- lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementRemoved, i_index, aRemovedElement, *this );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControlModel::addContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
- {
- BrdcstHelper.addListener( XContainerListener::static_type(), i_listener );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL AnimatedImagesControlModel::removeContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
- {
- BrdcstHelper.removeListener( XContainerListener::static_type(), i_listener );
- }
-
-//......................................................................................................................
-} // namespace toolkit
-//......................................................................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
deleted file mode 100644
index dca31ab619..0000000000
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ /dev/null
@@ -1,1969 +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/controls/controlmodelcontainerbase.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/window.hxx>
-#include <vcl/wall.hxx>
-#include <osl/mutex.hxx>
-#include <toolkit/helper/property.hxx>
-#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/controls/geometrycontrolmodel.hxx>
-#include <toolkit/controls/unocontrols.hxx>
-#include "toolkit/controls/formattedcontrol.hxx"
-#include "toolkit/controls/roadmapcontrol.hxx"
-#ifndef TOOLKIT_INC_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX
-#include "toolkit/controls/tkscrollbar.hxx"
-#endif
-#include <toolkit/controls/stdtabcontroller.hxx>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <com/sun/star/awt/WindowAttribute.hpp>
-#include <com/sun/star/resource/XStringResourceResolver.hpp>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <comphelper/processfactory.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/outdev.hxx>
-#include <comphelper/types.hxx>
-
-#include <comphelper/componentcontext.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <toolkit/helper/tkresmgr.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/image.hxx>
-
-#include "tree/treecontrol.hxx"
-#include "grid/gridcontrol.hxx"
-#include <toolkit/controls/tabpagecontainer.hxx>
-
-#include <boost/bind.hpp>
-
-#include <map>
-#include <algorithm>
-#include <functional>
-#include "tools/urlobj.hxx"
-#include "osl/file.hxx"
-#include "toolkit/controls/dialogcontrol.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::util;
-using namespace toolkit;
-
-#define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
-
-//HELPER
-::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
-
-struct LanguageDependentProp
-{
- const char* pPropName;
- sal_Int32 nPropNameLength;
-};
-
-// ----------------------------------------------------------------------------
-namespace
-{
- static const Sequence< ::rtl::OUString >& lcl_getLanguageDependentProperties()
- {
- static Sequence< ::rtl::OUString > s_aLanguageDependentProperties;
- if ( s_aLanguageDependentProperties.getLength() == 0 )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( s_aLanguageDependentProperties.getLength() == 0 )
- {
- s_aLanguageDependentProperties.realloc( 2 );
- s_aLanguageDependentProperties[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) );
- s_aLanguageDependentProperties[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
- // note: properties must be sorted
- }
- }
- return s_aLanguageDependentProperties;
- }
-}
-
-// ----------------------------------------------------------------------------
-// functor for disposing a control model
-struct DisposeControlModel : public ::std::unary_function< Reference< XControlModel >, void >
-{
- void operator()( Reference< XControlModel >& _rxModel )
- {
- try
- {
- ::comphelper::disposeComponent( _rxModel );
- }
- catch (const Exception&)
- {
- OSL_TRACE( "DisposeControlModel::(): caught an exception while disposing a component!" );
- }
- }
-};
-
-// ----------------------------------------------------------------------------
-// functor for searching control model by name
-struct FindControlModel : public ::std::unary_function< ControlModelContainerBase::UnoControlModelHolder, bool >
-{
-private:
- const ::rtl::OUString& m_rName;
-
-public:
- FindControlModel( const ::rtl::OUString& _rName ) : m_rName( _rName ) { }
-
- bool operator()( const ControlModelContainerBase::UnoControlModelHolder& _rCompare )
- {
- return ( _rCompare.second == m_rName ) ? true : false;
- }
-};
-
-// ----------------------------------------------------------------------------
-// functor for cloning a control model, and insertion into a target list
-struct CloneControlModel : public ::std::unary_function< ControlModelContainerBase::UnoControlModelHolder, void >
-{
-private:
- ControlModelContainerBase::UnoControlModelHolderList& m_rTargetList;
-
-public:
- CloneControlModel( ControlModelContainerBase::UnoControlModelHolderList& _rTargetList )
- :m_rTargetList( _rTargetList )
- {
- }
-
- void operator()( const ControlModelContainerBase::UnoControlModelHolder& _rSource )
- {
- // clone the source object
- Reference< XCloneable > xCloneSource( _rSource.first, UNO_QUERY );
- Reference< XControlModel > xClone( xCloneSource->createClone(), UNO_QUERY );
- // add to target list
- m_rTargetList.push_back( ControlModelContainerBase::UnoControlModelHolder( xClone, _rSource.second ) );
- }
-};
-
-// ----------------------------------------------------------------------------
-// functor for comparing a XControlModel with a given reference
-struct CompareControlModel : public ::std::unary_function< ControlModelContainerBase::UnoControlModelHolder, bool >
-{
-private:
- Reference< XControlModel > m_xReference;
-public:
- CompareControlModel( const Reference< XControlModel >& _rxReference ) : m_xReference( _rxReference ) { }
-
- bool operator()( const ControlModelContainerBase::UnoControlModelHolder& _rCompare )
- {
- return ( _rCompare.first.get() == m_xReference.get() ) ? true : false;
- }
-};
-
-// ----------------------------------------------------------------------------
-static void lcl_throwIllegalArgumentException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw IllegalArgumentException();
-}
-
-// ----------------------------------------------------------------------------
-static void lcl_throwNoSuchElementException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw NoSuchElementException();
-}
-
-// ----------------------------------------------------------------------------
-static void lcl_throwElementExistException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw ElementExistException();
-}
-
-// ----------------------------------------------------------------------------
-static const ::rtl::OUString& getTabIndexPropertyName( )
-{
- static const ::rtl::OUString s_sTabIndexProperty( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) );
- return s_sTabIndexProperty;
-}
-
-// ----------------------------------------------------------------------------
-static const ::rtl::OUString& getStepPropertyName( )
-{
- static const ::rtl::OUString s_sStepProperty( RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
- return s_sStepProperty;
-}
-
-// ----------------------------------------------------
-// class ControlModelContainerBase
-// ----------------------------------------------------
-ControlModelContainerBase::ControlModelContainerBase( const Reference< XMultiServiceFactory >& i_factory )
- :ControlModelContainer_IBase( i_factory )
- ,maContainerListeners( *this )
- ,maChangeListeners ( GetMutex() )
- ,mbGroupsUpToDate( sal_False )
-{
-}
-
-ControlModelContainerBase::ControlModelContainerBase( const ControlModelContainerBase& rModel )
- : ControlModelContainer_IBase( rModel )
- , maContainerListeners( *this )
- , maChangeListeners ( GetMutex() )
- , mbGroupsUpToDate( sal_False )
-{
-}
-
-ControlModelContainerBase::~ControlModelContainerBase()
-{
- maModels.clear();
- mbGroupsUpToDate = sal_False;
-}
-
-Any ControlModelContainerBase::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- Any aAny;
-
- switch ( nPropId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialog );
- break;
- default:
- aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
- }
-
- return aAny;
-}
-
-::cppu::IPropertyArrayHelper& ControlModelContainerBase::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-void SAL_CALL ControlModelContainerBase::dispose( ) throw(RuntimeException)
-{
- // ====================================================================
- // tell our listeners
- {
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- EventObject aDisposeEvent;
- aDisposeEvent.Source = static_cast< XAggregation* >( static_cast< ::cppu::OWeakAggObject* >( this ) );
-
- maContainerListeners.disposeAndClear( aDisposeEvent );
- maChangeListeners.disposeAndClear( aDisposeEvent );
- }
-
- // ====================================================================
- // call the base class
- UnoControlModel::dispose();
-
- // ====================================================================
- // dispose our child models
- // for this, collect the models (we collect them from maModels, and this is modified when disposing children)
- ::std::vector< Reference< XControlModel > > aChildModels( maModels.size() );
-
- ::std::transform(
- maModels.begin(), maModels.end(), // source range
- aChildModels.begin(), // target location
- ::boost::bind( &UnoControlModelHolder::first, _1 ) // operation to apply -> select the XControlModel part
- );
-
- // now dispose
- ::std::for_each( aChildModels.begin(), aChildModels.end(), DisposeControlModel() );
- aChildModels.clear();
-
- mbGroupsUpToDate = sal_False;
-}
-
-// XMultiPropertySet
-Reference< XPropertySetInfo > ControlModelContainerBase::getPropertySetInfo( ) throw(RuntimeException)
-{
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-void ControlModelContainerBase::Clone_Impl(ControlModelContainerBase& _rClone) const
-{
- // clone all children
- ::std::for_each(
- maModels.begin(), maModels.end(),
- CloneControlModel( _rClone.maModels )
- );
-}
-UnoControlModel* ControlModelContainerBase::Clone() const
-{
- // clone the container itself
- ControlModelContainerBase* pClone = new ControlModelContainerBase( *this );
- Clone_Impl(*pClone);
-
- return pClone;
-}
-
-ControlModelContainerBase::UnoControlModelHolderList::iterator ControlModelContainerBase::ImplFindElement( const ::rtl::OUString& rName )
-{
- return ::std::find_if( maModels.begin(), maModels.end(), FindControlModel( rName ) );
-}
-
-// ::XMultiServiceFactory
-Reference< XInterface > ControlModelContainerBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(Exception, RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- OGeometryControlModel_Base* pNewModel = NULL;
-
- const Reference< XMultiServiceFactory > xFactory( maContext.getLegacyServiceFactory() );
- if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlEditModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFileControlModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlButtonModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlImageControlModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedHyperlinkModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedHyperlinkModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedTextModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlListBoxModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRoadmapModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoTreeModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoGridModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlTabPageContainerModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlTabPageContainerModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoMultiPageModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoMultiPageModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoPageModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoPageModel >( xFactory );
- else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoFrameModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoFrameModel >( xFactory );
-
- if ( !pNewModel )
- {
- if ( xFactory.is() )
- {
- Reference< XInterface > xObject = xFactory->createInstance( aServiceSpecifier );
- Reference< XServiceInfo > xSI( xObject, UNO_QUERY );
- Reference< XCloneable > xCloneAccess( xSI, UNO_QUERY );
- Reference< XAggregation > xAgg( xCloneAccess, UNO_QUERY );
- if ( xAgg.is() )
- {
- if ( xSI->supportsService(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlModel"))) )
- {
- // release 3 of the 4 references we have to the object
- xAgg.clear();
- xSI.clear();
- xObject.clear();
-
- pNewModel = new OCommonGeometryControlModel( xCloneAccess, aServiceSpecifier );
- }
- }
- }
- }
-
- Reference< XInterface > xNewModel = (::cppu::OWeakObject*)pNewModel;
- return xNewModel;
-}
-
-Reference< XInterface > ControlModelContainerBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /* Arguments */ ) throw(Exception, RuntimeException)
-{
- return createInstance( ServiceSpecifier );
-}
-
-Sequence< ::rtl::OUString > ControlModelContainerBase::getAvailableServiceNames() throw(RuntimeException)
-{
- static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
- if ( !pNamesSeq )
- {
- pNamesSeq = new Sequence< ::rtl::OUString >( 26 );
- ::rtl::OUString* pNames = pNamesSeq->getArray();
- pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
- pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
- pNames[2] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel );
- pNames[3] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel );
- pNames[4] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel );
- pNames[5] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel );
- pNames[6] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel );
- pNames[7] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel );
- pNames[8] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel );
- pNames[9] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel );
- pNames[10] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel );
- pNames[11] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel );
- pNames[12] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel );
- pNames[13] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel );
- pNames[14] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel );
- pNames[15] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel );
- pNames[16] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlProgressBarModel );
- pNames[17] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlScrollBarModel );
- pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel );
- pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel );
- pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel );
- pNames[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
- pNames[22] = ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainerModel );
- pNames[23] = ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageModel );
- pNames[23] = ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
- pNames[24] = ::rtl::OUString::createFromAscii( szServiceName_UnoFrameModel );
- }
- return *pNamesSeq;
-}
-
-// XContainer
-void ControlModelContainerBase::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
-{
- maContainerListeners.addInterface( l );
-}
-
-void ControlModelContainerBase::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
-{
- maContainerListeners.removeInterface( l );
-}
-
-// XElementAcces
-Type ControlModelContainerBase::getElementType() throw(RuntimeException)
-{
- Type aType = getCppuType( ( Reference< XControlModel>* ) NULL );
- return aType;
-}
-
-sal_Bool ControlModelContainerBase::hasElements() throw(RuntimeException)
-{
- return !maModels.empty();
-}
-
-// XNameContainer, XNameReplace, XNameAccess
-void ControlModelContainerBase::replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- Reference< XControlModel > xNewModel;
- aElement >>= xNewModel;
- if ( !xNewModel.is() )
- lcl_throwIllegalArgumentException();
-
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
- // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
- // With container controls you could have constructed an existing hierachy and are now
- // add this to an existing container, in this case a name nested in the containment
- // hierachy of the added control could contain a name clash, if we have access to the
- // list of global names then recursively check for previously existing names ( we need
- // to do this obviously before the 'this' objects container is updated
- Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
- if ( xAllChildren.is() )
- {
- // remove old control ( and children ) from global list of containees
- updateUserFormChildren( xAllChildren, aName, Remove, uno::Reference< XControlModel >() );
- // Add new control ( and containees if they exist )
- updateUserFormChildren( xAllChildren, aName, Insert, xNewModel );
- }
- // stop listening at the old model
- stopControlListening( aElementPos->first );
- Reference< XControlModel > xReplaced( aElementPos->first );
- // remember the new model, and start listening
- aElementPos->first = xNewModel;
- startControlListening( xNewModel );
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element = aElement;
- aEvent.ReplacedElement <<= xReplaced;
- aEvent.Accessor <<= aName;
-
- // notify the container listener
- maContainerListeners.elementReplaced( aEvent );
-
- // our "tab controller model" has potentially changed -> notify this
- implNotifyTabModelChange( aName );
-}
-
-Any ControlModelContainerBase::getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
-
- return makeAny( aElementPos->first );
-}
-
-Sequence< ::rtl::OUString > ControlModelContainerBase::getElementNames() throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aNames( maModels.size() );
-
- ::std::transform(
- maModels.begin(), maModels.end(), // source range
- aNames.getArray(), // target range
- ::boost::bind( &UnoControlModelHolder::second, _1 ) // operator to apply: select the second element (the name)
- );
-
- return aNames;
-}
-
-sal_Bool ControlModelContainerBase::hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
-{
- return maModels.end() != ImplFindElement( aName );
-}
-
-void ControlModelContainerBase::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- Reference< XControlModel > xM;
- aElement >>= xM;
-
- if ( xM.is() )
- {
- Reference< beans::XPropertySet > xProps( xM, UNO_QUERY );
- if ( xProps.is() )
- {
-
- Reference< beans::XPropertySetInfo > xPropInfo = xProps.get()->getPropertySetInfo();
-
- ::rtl::OUString sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
- if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ) && ImplHasProperty(BASEPROPERTY_DIALOGSOURCEURL) )
- {
- Any aUrl = xProps.get()->getPropertyValue( sImageSourceProperty );
-
- ::rtl::OUString absoluteUrl =
- getPhysicalLocation( getPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ), aUrl );
-
- aUrl <<= absoluteUrl;
-
- xProps.get()->setPropertyValue( sImageSourceProperty , aUrl );
- }
- }
- }
-
-
-
- if ( !aName.getLength() || !xM.is() )
- lcl_throwIllegalArgumentException();
-
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() != aElementPos )
- lcl_throwElementExistException();
-
- // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
- // With container controls you could have constructed an existing hierachy and are now
- // add this to an existing container, in this case a name nested in the containment
- // hierachy of the added control could contain a name clash, if we have access to the
- // list of global names then we need to recursively check for previously existing
- // names ( we need to do this obviously before the 'this' objects container is updated
- // remove old control ( and children ) from global list of containees
- Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
-
- if ( xAllChildren.is() )
- updateUserFormChildren( xAllChildren, aName, Insert, xM );
- maModels.push_back( UnoControlModelHolder( xM, aName ) );
- mbGroupsUpToDate = sal_False;
- startControlListening( xM );
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElement;
- aEvent.Accessor <<= aName;
- maContainerListeners.elementInserted( aEvent );
-
- // our "tab controller model" has potentially changed -> notify this
- implNotifyTabModelChange( aName );
-}
-
-void ControlModelContainerBase::removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
-
- // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
- // With container controls you could have constructed an existing hierachy and are now
- // removing this control from an existing container, in this case all nested names in
- // the containment hierachy of the control to be removed need to be removed from the global
- // names cache ( we need to do this obviously before the 'this' objects container is updated )
- Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
- if ( xAllChildren.is() )
- updateUserFormChildren( xAllChildren, aName, Remove, uno::Reference< XControlModel >() );
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElementPos->first;
- aEvent.Accessor <<= aName;
- maContainerListeners.elementRemoved( aEvent );
-
- stopControlListening( aElementPos->first );
- Reference< XPropertySet > xPS( aElementPos->first, UNO_QUERY );
- maModels.erase( aElementPos );
- mbGroupsUpToDate = sal_False;
-
- if ( xPS.is() )
- {
- try
- {
- xPS->setPropertyValue( PROPERTY_RESOURCERESOLVER, makeAny( Reference< resource::XStringResourceResolver >() ) );
- }
- catch (const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- // our "tab controller model" has potentially changed -> notify this
- implNotifyTabModelChange( aName );
-}
-
-// ----------------------------------------------------------------------------
-sal_Bool SAL_CALL ControlModelContainerBase::getGroupControl( ) throw (RuntimeException)
-{
- return sal_True;
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL ControlModelContainerBase::setGroupControl( sal_Bool ) throw (RuntimeException)
-{
- OSL_TRACE( "UnoControlDialogModel::setGroupControl: explicit grouping not supported" );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL ControlModelContainerBase::setControlModels( const Sequence< Reference< XControlModel > >& _rControls ) throw (RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- // set the tab indexes according to the order of models in the sequence
- const Reference< XControlModel >* pControls = _rControls.getConstArray( );
- const Reference< XControlModel >* pControlsEnd = _rControls.getConstArray( ) + _rControls.getLength();
-
- sal_Int16 nTabIndex = 1;
-
- for ( ; pControls != pControlsEnd; ++pControls )
- {
- // look up the control in our own structure. This is to prevent invalid arguments
- UnoControlModelHolderList::const_iterator aPos =
- ::std::find_if(
- maModels.begin(), maModels.end(),
- CompareControlModel( *pControls )
- );
- if ( maModels.end() != aPos )
- {
- // okay, this is an existent model
- // now set the TabIndex property (if applicable)
- Reference< XPropertySet > xProps( aPos->first, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xProps.is() )
- xPSI = xProps->getPropertySetInfo();
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- xProps->setPropertyValue( getTabIndexPropertyName(), makeAny( nTabIndex++ ) );
- }
- mbGroupsUpToDate = sal_False;
- }
-}
-
-
-typedef ::std::multimap< sal_Int32, Reference< XControlModel >, ::std::less< sal_Int32 > > MapIndexToModel;
-
-// ----------------------------------------------------------------------------
-Sequence< Reference< XControlModel > > SAL_CALL ControlModelContainerBase::getControlModels( ) throw (RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- MapIndexToModel aSortedModels;
- // will be the sorted container of all models which have a tab index property
- ::std::vector< Reference< XControlModel > > aUnindexedModels;
- // will be the container of all models which do not have a tab index property
-
- UnoControlModelHolderList::const_iterator aLoop = maModels.begin();
- for ( ; aLoop != maModels.end(); ++aLoop )
- {
- Reference< XControlModel > xModel( aLoop->first );
-
- // see if the model has a TabIndex property
- Reference< XPropertySet > xControlProps( xModel, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xControlProps.is() )
- xPSI = xControlProps->getPropertySetInfo( );
- DBG_ASSERT( xPSI.is(), "UnoControlDialogModel::getControlModels: invalid child model!" );
-
- // has it?
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- { // yes
- sal_Int32 nTabIndex = -1;
- xControlProps->getPropertyValue( getTabIndexPropertyName() ) >>= nTabIndex;
-
- aSortedModels.insert( MapIndexToModel::value_type( nTabIndex, xModel ) );
- }
- else if ( xModel.is() )
- // no, it hasn't, but we have to include it, anyway
- aUnindexedModels.push_back( xModel );
- }
-
- // okay, here we have a container of all our models, sorted by tab index,
- // plus a container of "unindexed" models
- // -> merge them
- Sequence< Reference< XControlModel > > aReturn( aUnindexedModels.size() + aSortedModels.size() );
- ::std::transform(
- aSortedModels.begin(), aSortedModels.end(),
- ::std::copy( aUnindexedModels.begin(), aUnindexedModels.end(), aReturn.getArray() ),
- ::boost::bind( &MapIndexToModel::value_type::second, _1 )
- );
-
- return aReturn;
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL ControlModelContainerBase::setGroup( const Sequence< Reference< XControlModel > >&, const ::rtl::OUString& ) throw (RuntimeException)
-{
- // not supported. We have only implicit grouping:
- // We only have a sequence of control models, and we _know_ (yes, that's a HACK relying on
- // implementation details) that VCL does grouping according to the order of controls automatically
- // At least VCL does this for all we're interested in: Radio buttons.
- OSL_TRACE( "UnoControlDialogModel::setGroup: grouping not supported" );
-}
-
-////----- XInitialization -------------------------------------------------------------------
-void SAL_CALL ControlModelContainerBase::initialize (const Sequence<Any>& rArguments) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
-{
- sal_Int16 nPageId = -1;
- if ( rArguments.getLength() == 1 )
- {
- if ( !( rArguments[ 0 ] >>= nPageId ))
- throw lang::IllegalArgumentException();
- m_nTabPageId = nPageId;
- }
- else
- m_nTabPageId = -1;
-}
-::sal_Int16 SAL_CALL ControlModelContainerBase::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
-{
- return m_nTabPageId;
-}
-::sal_Bool SAL_CALL ControlModelContainerBase::getEnabled() throw (::com::sun::star::uno::RuntimeException)
-{
- return m_bEnabled;
-}
-void SAL_CALL ControlModelContainerBase::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
-{
- m_bEnabled = _enabled;
-}
-::rtl::OUString SAL_CALL ControlModelContainerBase::getTitle() throw (::com::sun::star::uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- Reference<XPropertySet> xThis(*this,UNO_QUERY);
- ::rtl::OUString sTitle;
- xThis->getPropertyValue(GetPropertyName(BASEPROPERTY_TITLE)) >>= sTitle;
- return sTitle;
- //return m_sTitle;
-}
-void SAL_CALL ControlModelContainerBase::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- Reference<XPropertySet> xThis(*this,UNO_QUERY);
- xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_TITLE),makeAny(_title));
-}
-::rtl::OUString SAL_CALL ControlModelContainerBase::getImageURL() throw (::com::sun::star::uno::RuntimeException)
-{
- return m_sImageURL;
-}
-void SAL_CALL ControlModelContainerBase::setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException)
-{
- m_sImageURL = _imageurl;
-}
-::rtl::OUString SAL_CALL ControlModelContainerBase::getTooltip() throw (::com::sun::star::uno::RuntimeException)
-{
- return m_sTooltip;
-}
-void SAL_CALL ControlModelContainerBase::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
-{
- m_sTooltip = _tooltip;
-}
-
-// ----------------------------------------------------------------------------
-namespace
-{
- enum GroupingMachineState
- {
- eLookingForGroup,
- eExpandingGroup
- };
-
- // ........................................................................
- static sal_Int32 lcl_getDialogStep( const Reference< XControlModel >& _rxModel )
- {
- sal_Int32 nStep = 0;
- try
- {
- Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY );
- xModelProps->getPropertyValue( getStepPropertyName() ) >>= nStep;
- }
- catch (const Exception&)
- {
- OSL_TRACE( "lcl_getDialogStep: caught an exception while determining the dialog page!" );
- }
- return nStep;
- }
-}
-
-// ----------------------------------------------------------------------------
-sal_Int32 SAL_CALL ControlModelContainerBase::getGroupCount( ) throw (RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- implUpdateGroupStructure();
-
- return maGroups.size();
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL ControlModelContainerBase::getGroup( sal_Int32 _nGroup, Sequence< Reference< XControlModel > >& _rGroup, ::rtl::OUString& _rName ) throw (RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- implUpdateGroupStructure();
-
- if ( ( _nGroup < 0 ) || ( _nGroup >= (sal_Int32)maGroups.size() ) )
- {
- OSL_TRACE( "UnoControlDialogModel::getGroup: invalid argument and I am not allowed to throw an exception!" );
- _rGroup.realloc( 0 );
- _rName = ::rtl::OUString();
- }
- else
- {
- AllGroups::const_iterator aGroupPos = maGroups.begin() + _nGroup;
- _rGroup.realloc( aGroupPos->size() );
- // copy the models
- ::std::copy( aGroupPos->begin(), aGroupPos->end(), _rGroup.getArray() );
- // give the group a name
- _rName = ::rtl::OUString::valueOf( _nGroup );
- }
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL ControlModelContainerBase::getGroupByName( const ::rtl::OUString& _rName, Sequence< Reference< XControlModel > >& _rGroup ) throw (RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- ::rtl::OUString sDummyName;
- getGroup( _rName.toInt32( ), _rGroup, sDummyName );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL ControlModelContainerBase::addChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
-{
- maChangeListeners.addInterface( _rxListener );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL ControlModelContainerBase::removeChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
-{
- maChangeListeners.removeInterface( _rxListener );
-}
-
-// ----------------------------------------------------------------------------
-void ControlModelContainerBase::implNotifyTabModelChange( const ::rtl::OUString& _rAccessor )
-{
- // multiplex to our change listeners:
- // the changes event
- ChangesEvent aEvent;
- aEvent.Source = *this;
- aEvent.Base <<= aEvent.Source; // the "base of the changes root" is also ourself
- aEvent.Changes.realloc( 1 ); // exactly one change
- aEvent.Changes[ 0 ].Accessor <<= _rAccessor;
-
-
- Sequence< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() );
- const Reference< XInterface >* pListener = aChangeListeners.getConstArray();
- const Reference< XInterface >* pListenerEnd = aChangeListeners.getConstArray() + aChangeListeners.getLength();
- for ( ; pListener != pListenerEnd; ++pListener )
- {
- if ( pListener->is() )
- static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent );
- }
-}
-
-
-// ----------------------------------------------------------------------------
-void ControlModelContainerBase::implUpdateGroupStructure()
-{
- if ( mbGroupsUpToDate )
- // nothing to do
- return;
-
- // conditions for a group:
- // * all elements of the group are radio buttons
- // * all elements of the group are on the same dialog page
- // * in the overall control order (determined by the tab index), all elements are subsequent
-
- maGroups.clear();
-
- Sequence< Reference< XControlModel > > aControlModels = getControlModels();
- const Reference< XControlModel >* pControlModels = aControlModels.getConstArray();
- const Reference< XControlModel >* pControlModelsEnd = pControlModels + aControlModels.getLength();
-
- // in extreme we have as much groups as controls
- maGroups.reserve( aControlModels.getLength() );
-
- GroupingMachineState eState = eLookingForGroup; // the current state of our machine
- Reference< XServiceInfo > xModelSI; // for checking for a radion button
- AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building
- sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to
- sal_Bool bIsRadioButton; // is it a radio button?
-
-#if OSL_DEBUG_LEVEL > 1
- ::std::vector< ::rtl::OUString > aCurrentGroupLabels;
-#endif
-
- for ( ; pControlModels != pControlModelsEnd; ++pControlModels )
- {
- // we'll need this in every state
- xModelSI = xModelSI.query( *pControlModels );
- bIsRadioButton = xModelSI.is() && xModelSI->supportsService( ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) );
-
- switch ( eState )
- {
- case eLookingForGroup:
- {
- if ( !bIsRadioButton )
- // this is no radio button -> still looking for the beginning of a group
- continue;
- // the current model is a radio button
- // -> we found the beginning of a new group
- // create the place for this group
- size_t nGroups = maGroups.size();
- maGroups.resize( nGroups + 1 );
- aCurrentGroup = maGroups.begin() + nGroups;
- // and add the (only, til now) member
- aCurrentGroup->push_back( *pControlModels );
-
- // get the step which all controls of this group now have to belong to
- nCurrentGroupStep = lcl_getDialogStep( *pControlModels );
- // new state: looking for further members
- eState = eExpandingGroup;
-
-#if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) )
- xModelProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) >>= sLabel;
- aCurrentGroupLabels.push_back( sLabel );
-#endif
- }
- break;
-
- case eExpandingGroup:
- {
- if ( !bIsRadioButton )
- { // no radio button -> the group is done
- aCurrentGroup = maGroups.end();
- eState = eLookingForGroup;
-#if OSL_DEBUG_LEVEL > 1
- aCurrentGroupLabels.clear();
-#endif
- continue;
- }
-
- // it is a radio button - is it on the proper page?
- const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels );
- if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page
- || ( 0 == nThisModelStep ) // the current button appears on all pages
- )
- {
- // -> it belongs to the same group
- aCurrentGroup->push_back( *pControlModels );
- // state still is eExpandingGroup - we're looking for further elements
- eState = eExpandingGroup;
-
-#if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) )
- xModelProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) >>= sLabel;
- aCurrentGroupLabels.push_back( sLabel );
-#endif
- continue;
- }
-
- // it's a radio button, but on a different page
- // -> we open a new group for it
-
- // close the old group
- aCurrentGroup = maGroups.end();
-#if OSL_DEBUG_LEVEL > 1
- aCurrentGroupLabels.clear();
-#endif
-
- // open a new group
- size_t nGroups = maGroups.size();
- maGroups.resize( nGroups + 1 );
- aCurrentGroup = maGroups.begin() + nGroups;
- // and add the (only, til now) member
- aCurrentGroup->push_back( *pControlModels );
-
- nCurrentGroupStep = nThisModelStep;
-
- // state is the same: we still are looking for further elements of the current group
- eState = eExpandingGroup;
-#if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) )
- xModelProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) >>= sLabel;
- aCurrentGroupLabels.push_back( sLabel );
-#endif
- }
- break;
- }
- }
-
- mbGroupsUpToDate = sal_True;
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL ControlModelContainerBase::propertyChange( const PropertyChangeEvent& _rEvent ) throw (RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- DBG_ASSERT( 0 == _rEvent.PropertyName.compareToAscii( "TabIndex" ),
- "UnoControlDialogModel::propertyChange: not listening for this property!" );
-
- // the accessor for the changed element
- ::rtl::OUString sAccessor;
- UnoControlModelHolderList::const_iterator aPos =
- ::std::find_if(
- maModels.begin(), maModels.end(),
- CompareControlModel( Reference< XControlModel >( _rEvent.Source, UNO_QUERY ) )
- );
- OSL_ENSURE( maModels.end() != aPos, "UnoControlDialogModel::propertyChange: don't know this model!" );
- if ( maModels.end() != aPos )
- sAccessor = aPos->second;
-
- // our groups are not up-to-date
- mbGroupsUpToDate = sal_False;
-
- // notify
- implNotifyTabModelChange( sAccessor );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL ControlModelContainerBase::disposing( const EventObject& /*rEvent*/ ) throw (RuntimeException)
-{
-}
-
-// ----------------------------------------------------------------------------
-void ControlModelContainerBase::startControlListening( const Reference< XControlModel >& _rxChildModel )
-{
- SolarMutexGuard aGuard;
-
- Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xModelProps.is() )
- xPSI = xModelProps->getPropertySetInfo();
-
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- xModelProps->addPropertyChangeListener( getTabIndexPropertyName(), this );
-}
-
-// ----------------------------------------------------------------------------
-void ControlModelContainerBase::stopControlListening( const Reference< XControlModel >& _rxChildModel )
-{
- SolarMutexGuard aGuard;
-
- Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xModelProps.is() )
- xPSI = xModelProps->getPropertySetInfo();
-
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- xModelProps->removePropertyChangeListener( getTabIndexPropertyName(), this );
-}
-
-// ============================================================================
-// = class ResourceListener
-// ============================================================================
-
-ResourceListener::ResourceListener(
- const Reference< util::XModifyListener >& rListener ) :
- OWeakObject(),
- m_xListener( rListener ),
- m_bListening( false )
-{
-}
-
-ResourceListener::~ResourceListener()
-{
-}
-
-// XInterface
-Any SAL_CALL ResourceListener::queryInterface( const Type& rType )
-throw ( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- static_cast< XModifyListener* >( this ),
- static_cast< XEventListener* >( this ));
-
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
-}
-
-void SAL_CALL ResourceListener::acquire() throw ()
-{
- OWeakObject::acquire();
-}
-
-void SAL_CALL ResourceListener::release() throw ()
-{
- OWeakObject::release();
-}
-
-void ResourceListener::startListening(
- const Reference< resource::XStringResourceResolver >& rResource )
-{
- Reference< util::XModifyBroadcaster > xModifyBroadcaster( rResource, UNO_QUERY );
-
- {
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- bool bListening( m_bListening );
- bool bResourceSet( m_xResource.is() );
- aGuard.clear();
- // --- SAFE ---
-
- if ( bListening && bResourceSet )
- stopListening();
-
- // --- SAFE ---
- aGuard.reset();
- m_xResource = rResource;
- aGuard.clear();
- // --- SAFE ---
- }
-
- Reference< util::XModifyListener > xThis( static_cast<OWeakObject*>( this ), UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- {
- try
- {
- xModifyBroadcaster->addModifyListener( xThis );
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- m_bListening = true;
- // --- SAFE ---
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
- }
-}
-
-void ResourceListener::stopListening()
-{
- Reference< util::XModifyBroadcaster > xModifyBroadcaster;
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- if ( m_bListening && m_xResource.is() )
- xModifyBroadcaster = Reference< util::XModifyBroadcaster >( m_xResource, UNO_QUERY );
- aGuard.clear();
- // --- SAFE ---
-
- Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- {
- try
- {
- // --- SAFE ---
- aGuard.reset();
- m_bListening = false;
- m_xResource.clear();
- aGuard.clear();
- // --- SAFE ---
-
- xModifyBroadcaster->removeModifyListener( xThis );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
- }
-}
-
-// XModifyListener
-void SAL_CALL ResourceListener::modified(
- const lang::EventObject& aEvent )
-throw ( RuntimeException )
-{
- Reference< util::XModifyListener > xListener;
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- xListener = m_xListener;
- aGuard.clear();
- // --- SAFE ---
-
- if ( xListener.is() )
- {
- try
- {
- xListener->modified( aEvent );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
- }
-}
-
-// XEventListener
-void SAL_CALL ResourceListener::disposing(
- const EventObject& Source )
-throw ( RuntimeException )
-{
- Reference< lang::XEventListener > xListener;
- Reference< resource::XStringResourceResolver > xResource;
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- Reference< XInterface > xIfacRes( m_xResource, UNO_QUERY );
- Reference< XInterface > xIfacList( m_xListener, UNO_QUERY );
- aGuard.clear();
- // --- SAFE ---
-
- if ( Source.Source == xIfacRes )
- {
- // --- SAFE ---
- aGuard.reset();
- m_bListening = false;
- xResource = m_xResource;
- xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
- m_xResource.clear();
- aGuard.clear();
- // --- SAFE ---
-
- if ( xListener.is() )
- {
- try
- {
- xListener->disposing( Source );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
- }
- }
- else if ( Source.Source == xIfacList )
- {
- // --- SAFE ---
- aGuard.reset();
- m_bListening = false;
- xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
- xResource = m_xResource;
- m_xResource.clear();
- m_xListener.clear();
- aGuard.clear();
- // --- SAFE ---
-
- // Remove ourself as listener from resource resolver
- Reference< util::XModifyBroadcaster > xModifyBroadcaster( xResource, UNO_QUERY );
- Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- {
- try
- {
- xModifyBroadcaster->removeModifyListener( xThis );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
- }
- }
-}
-
-//===============================================================
-// ----------------------------------------------------
-// class DialogContainerControl
-// ----------------------------------------------------
-ControlContainerBase::ControlContainerBase( const Reference< XMultiServiceFactory >& i_factory )
- :ContainerControl_IBase( i_factory )
- ,mbSizeModified(false)
- ,mbPosModified(false)
-{
- maComponentInfos.nWidth = 280;
- maComponentInfos.nHeight = 400;
- mxListener = new ResourceListener( Reference< util::XModifyListener >(
- static_cast< OWeakObject* >( this ), UNO_QUERY ));
-}
-
-ControlContainerBase::~ControlContainerBase()
-{
-}
-
-void ControlContainerBase::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
- UnoControlContainer::createPeer( rxToolkit, rParentPeer );
-}
-
-void ControlContainerBase::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
-{
- Reference< XPropertySet > xP( rxModel, UNO_QUERY );
-
- ::rtl::OUString aDefCtrl;
- xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
- Reference < XControl > xCtrl;
- maContext.createComponent( aDefCtrl, xCtrl );
-
- DBG_ASSERT( xCtrl.is(), "UnoDialogControl::ImplInsertControl: could not create the control!" );
- if ( xCtrl.is() )
- {
- xCtrl->setModel( rxModel );
- addControl( rName, xCtrl );
- // will implicitly call addingControl, where we can add the PropertiesChangeListener to the model
- // (which we formerly did herein)
- // 08.01.2001 - 96008 - fs@openoffice.org
-
- ImplSetPosSize( xCtrl );
- }
-}
-
-void ControlContainerBase::ImplRemoveControl( Reference< XControlModel >& rxModel )
-{
- Sequence< Reference< XControl > > aControls = getControls();
- Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
- if ( xCtrl.is() )
- {
- removeControl( xCtrl );
- try
- {
- Reference< XComponent > const xControlComp( xCtrl, UNO_QUERY_THROW );
- xControlComp->dispose();
- }
- catch (const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-}
-
-void ControlContainerBase::ImplSetPosSize( Reference< XControl >& rxCtrl )
-{
- Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
-
- sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ) >>= nX;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nY;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
- MapMode aMode( MAP_APPFONT );
- OutputDevice*pOutDev = Application::GetDefaultDevice();
- if ( pOutDev )
- {
- ::Size aTmp( nX, nY );
- aTmp = pOutDev->LogicToPixel( aTmp, aMode );
- nX = aTmp.Width();
- nY = aTmp.Height();
- aTmp = ::Size( nWidth, nHeight );
- aTmp = pOutDev->LogicToPixel( aTmp, aMode );
- nWidth = aTmp.Width();
- nHeight = aTmp.Height();
- }
- else
- {
- Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
- Reference< XDevice > xD( xPeer, UNO_QUERY );
-
- SimpleFontMetric aFM;
- FontDescriptor aFD;
- Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
- aVal >>= aFD;
- if ( aFD.StyleName.getLength() )
- {
- Reference< XFont > xFont = xD->getFont( aFD );
- aFM = xFont->getFontMetric();
- }
- else
- {
- Reference< XGraphics > xG = xD->createGraphics();
- aFM = xG->getFontMetric();
- }
-
- sal_Int16 nH = aFM.Ascent + aFM.Descent;
- sal_Int16 nW = nH/2; // calculate avarage width?!
-
- nX *= nW;
- nX /= 4;
- nWidth *= nW;
- nWidth /= 4;
- nY *= nH;
- nY /= 8;
- nHeight *= nH;
- nHeight /= 8;
- }
- Reference < XWindow > xW( rxCtrl, UNO_QUERY );
- xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
-}
-
-void ControlContainerBase::dispose() throw(RuntimeException)
-{
- EventObject aEvt;
- aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
- // Notify our listener helper about dispose
- // --- SAFE ---
-
- SolarMutexClearableGuard aGuard;
- Reference< XEventListener > xListener( mxListener, UNO_QUERY );
- mxListener.clear();
- aGuard.clear();
- // --- SAFE ---
-
- if ( xListener.is() )
- xListener->disposing( aEvt );
- UnoControlContainer::dispose();
-}
-
-void SAL_CALL ControlContainerBase::disposing(
- const EventObject& Source )
-throw(RuntimeException)
-{
- UnoControlContainer::disposing( Source );
-}
-
-sal_Bool ControlContainerBase::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- // destroy the old tab controller, if existent
- if ( mxTabController.is() )
- {
- mxTabController->setModel( NULL ); // just to be sure, should not be necessary
- removeTabController( mxTabController );
- ::comphelper::disposeComponent( mxTabController ); // just to be sure, should not be necessary
- mxTabController.clear();
- }
-
- if ( getModel().is() )
- {
- Sequence< Reference< XControl > > aControls = getControls();
- const Reference< XControl >* pCtrls = aControls.getConstArray();
- const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
-
- for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
- removeControl( *pCtrls );
- // will implicitly call removingControl, which will remove the PropertyChangeListener
- // (which we formerly did herein)
- // 08.01.2001 - 96008 - fs@openoffice.org
-
- Reference< XContainer > xC( getModel(), UNO_QUERY );
- if ( xC.is() )
- xC->removeContainerListener( this );
-
- Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
- if ( xChangeNotifier.is() )
- xChangeNotifier->removeChangesListener( this );
- }
-
- sal_Bool bRet = UnoControl::setModel( rxModel );
-
- if ( getModel().is() )
- {
- Reference< XNameAccess > xNA( getModel(), UNO_QUERY );
- if ( xNA.is() )
- {
- Sequence< ::rtl::OUString > aNames = xNA->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_uInt32 nCtrls = aNames.getLength();
-
- Reference< XControlModel > xCtrlModel;
- for( sal_uInt32 n = 0; n < nCtrls; ++n, ++pNames )
- {
- xNA->getByName( *pNames ) >>= xCtrlModel;
- ImplInsertControl( xCtrlModel, *pNames );
- }
- }
-
- Reference< XContainer > xC( getModel(), UNO_QUERY );
- if ( xC.is() )
- xC->addContainerListener( this );
-
- Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
- if ( xChangeNotifier.is() )
- xChangeNotifier->addChangesListener( this );
- }
-
- Reference< XTabControllerModel > xTabbing( getModel(), UNO_QUERY );
- if ( xTabbing.is() )
- {
- mxTabController = new StdTabController;
- mxTabController->setModel( xTabbing );
- addTabController( mxTabController );
- }
- ImplStartListingForResourceEvents();
-
- return bRet;
-}
-void ControlContainerBase::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- UnoControl::setDesignMode( bOn );
-
- Sequence< Reference< XControl > > xCtrls = getControls();
- sal_Int32 nControls = xCtrls.getLength();
- Reference< XControl >* pControls = xCtrls.getArray();
- for ( sal_Int32 n = 0; n < nControls; n++ )
- pControls[n]->setDesignMode( bOn );
-
- // #109067# in design mode the tab controller is not notified about
- // tab index changes, therefore the tab order must be activated
- // when switching from design mode to live mode
- if ( mxTabController.is() && !bOn )
- mxTabController->activateTabOrder();
-}
-
-void ControlContainerBase::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- Reference< XControlModel > xModel;
- ::rtl::OUString aName;
-
- Event.Accessor >>= aName;
- Event.Element >>= xModel;
- ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementInserted: illegal element!" );
- try
- {
- ImplInsertControl( xModel, aName );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-
-void ControlContainerBase::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- Reference< XControlModel > xModel;
- Event.Element >>= xModel;
- ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementRemoved: illegal element!" );
- try
- {
- ImplRemoveControl( xModel );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-
-void ControlContainerBase::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- Reference< XControlModel > xModel;
- Event.ReplacedElement >>= xModel;
- try
- {
- OSL_ENSURE( xModel.is(), "UnoDialogControl::elementReplaced: invalid ReplacedElement!" );
- if ( xModel.is() )
- ImplRemoveControl( xModel );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- ::rtl::OUString aName;
- Event.Accessor >>= aName;
- Event.Element >>= xModel;
- ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementReplaced: invalid new element!" );
- try
- {
- ImplInsertControl( xModel, aName );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-
-// XPropertiesChangeListener
-void ControlContainerBase::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
-{
- if( !isDesignMode() && !mbCreatingCompatiblePeer )
- {
- ::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
- ::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
- ::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
- ::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
-
- sal_Int32 nLen = rEvents.getLength();
- for( sal_Int32 i = 0; i < nLen; i++ )
- {
- const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
- Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
- sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
- if ( ( rEvt.PropertyName == s1 ) ||
- ( rEvt.PropertyName == s2 ) ||
- ( rEvt.PropertyName == s3 ) ||
- ( rEvt.PropertyName == s4 ) )
- {
- if ( bOwnModel )
- {
- if ( !mbPosModified && !mbSizeModified )
- {
- // Don't set new pos/size if we get new values from window listener
- Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
- ImplSetPosSize( xThis );
- }
- }
- else
- {
- Sequence<Reference<XControl> > aControlSequence(getControls());
- Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
- ImplSetPosSize( aControlRef );
- }
- break;
- }
- }
- }
-
- UnoControlContainer::ImplModelPropertiesChanged( rEvents );
-}
-
-void ControlContainerBase::addingControl( const Reference< XControl >& _rxControl )
-{
- SolarMutexGuard aGuard;
- UnoControlContainer::addingControl( _rxControl );
-
- if ( _rxControl.is() )
- {
- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
- if ( xProps.is() )
- {
- Sequence< ::rtl::OUString > aNames( 4 );
- ::rtl::OUString* pNames = aNames.getArray();
- *pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionX") );
- *pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionY") );
- *pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Width"));
- *pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Height"));
-
- xProps->addPropertiesChangeListener( aNames, this );
- }
- }
-}
-
-void ControlContainerBase::removingControl( const Reference< XControl >& _rxControl )
-{
- SolarMutexGuard aGuard;
- UnoControlContainer::removingControl( _rxControl );
-
- if ( _rxControl.is() )
- {
- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
- if ( xProps.is() )
- xProps->removePropertiesChangeListener( this );
- }
-
-}
-
-void SAL_CALL ControlContainerBase::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
-{
- SolarMutexGuard aGuard;
- // a tab controller model may have changed
-
- // #109067# in design mode don't notify the tab controller
- // about tab index changes
- if ( mxTabController.is() && !mbDesignMode )
- mxTabController->activateTabOrder();
-}
-void lcl_ApplyResolverToNestedContainees( const Reference< resource::XStringResourceResolver >& xStringResourceResolver, const Reference< XControlContainer >& xContainer )
-{
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
-
- Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
-
- Sequence< rtl::OUString > aPropNames(1);
- aPropNames[0] = aPropName;
-
- const Sequence< Reference< awt::XControl > > aSeq = xContainer->getControls();
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
- {
- Reference< XControl > xControl( aSeq[i] );
- Reference< XPropertySet > xPropertySet;
-
- if ( xControl.is() )
- xPropertySet = Reference< XPropertySet >( xControl->getModel(), UNO_QUERY );
-
- if ( !xPropertySet.is() )
- continue;
-
- try
- {
- Reference< resource::XStringResourceResolver > xCurrStringResourceResolver;
- Any aOldValue = xPropertySet->getPropertyValue( aPropName );
- if ( ( aOldValue >>= xCurrStringResourceResolver )
- && ( xStringResourceResolver == xCurrStringResourceResolver )
- )
- {
- Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
- Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
- xMultiPropSet->firePropertiesChangeEvent( aPropNames, xListener );
- }
- else
- xPropertySet->setPropertyValue( aPropName, xNewStringResourceResolver );
- }
- catch (const Exception&)
- {
- }
-
- uno::Reference< XControlContainer > xNestedContainer( xControl, uno::UNO_QUERY );
- if ( xNestedContainer.is() )
- lcl_ApplyResolverToNestedContainees( xStringResourceResolver, xNestedContainer );
-
- }
-
-}
-void ControlContainerBase::ImplStartListingForResourceEvents()
-{
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver;
-
- // Add our helper as listener to retrieve notifications about changes
- Reference< util::XModifyListener > rListener( mxListener );
- ResourceListener* pResourceListener = static_cast< ResourceListener* >( rListener.get() );
-
- // resource listener will stop listening if resolver reference is empty
- if ( pResourceListener )
- pResourceListener->startListening( xStringResourceResolver );
- ImplUpdateResourceResolver();
-}
-
-void ControlContainerBase::ImplUpdateResourceResolver()
-{
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
- if ( !xStringResourceResolver.is() )
- return;
-
- lcl_ApplyResolverToNestedContainees( xStringResourceResolver, this );
-
- // propagate resource resolver changes to language dependent props of the dialog
- Reference< XPropertySet > xPropertySet( getModel(), UNO_QUERY );
- if ( xPropertySet.is() )
- {
- Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
- Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
- xMultiPropSet->firePropertiesChangeEvent( lcl_getLanguageDependentProperties(), xListener );
- }
-}
-
-
-uno::Reference< graphic::XGraphic > ControlContainerBase::Impl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
-{
- uno::Reference< graphic::XGraphic > xGraphic;
- if ( !_rURL.getLength() )
- return xGraphic;
-
- try
- {
- uno::Reference< graphic::XGraphicProvider > xProvider;
- if ( maContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
- {
- uno::Sequence< beans::PropertyValue > aMediaProperties(1);
- aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- aMediaProperties[0].Value <<= _rURL;
- xGraphic = xProvider->queryGraphic( aMediaProperties );
- }
- }
- catch (const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return xGraphic;
-}
-//// ----------------------------------------------------
-//// Helper Method to convert relative url to physical location
-//// ----------------------------------------------------
-
-::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
-{
-
- ::rtl::OUString baseLocation;
- ::rtl::OUString url;
-
- rbase >>= baseLocation;
- rUrl >>= url;
-
- ::rtl::OUString absoluteURL( url );
- if ( url.getLength() > 0 )
- {
- INetURLObject urlObj(baseLocation);
- urlObj.removeSegment();
- baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-
- const INetURLObject protocolCheck( url );
- const INetProtocol protocol = protocolCheck.GetProtocol();
- if ( protocol == INET_PROT_NOT_VALID )
- {
- ::rtl::OUString testAbsoluteURL;
- if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) )
- absoluteURL = testAbsoluteURL;
- }
- }
-
- return absoluteURL;
-}
-
-void
-ControlModelContainerBase::updateUserFormChildren( const Reference< XNameContainer >& xAllChildren, const rtl::OUString& aName, ChildOperation Operation, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xTarget ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-{
- if ( Operation < Insert || Operation > Remove )
- throw IllegalArgumentException();
-
- if ( xAllChildren.is() )
- {
- if ( Operation == Remove )
- {
- Reference< XControlModel > xOldModel( xAllChildren->getByName( aName ), UNO_QUERY );
- xAllChildren->removeByName( aName );
-
- Reference< XNameContainer > xChildContainer( xOldModel, UNO_QUERY );
- if ( xChildContainer.is() )
- {
- Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
- // container control is being removed from this container, reset the
- // global list of containees
- if ( xProps.is() )
- xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( uno::Reference< XNameContainer >() ) );
- Sequence< rtl::OUString > aChildNames = xChildContainer->getElementNames();
- for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index )
- updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, Reference< XControlModel > () );
- }
- }
- else if ( Operation == Insert )
- {
- xAllChildren->insertByName( aName, uno::makeAny( xTarget ) );
- Reference< XNameContainer > xChildContainer( xTarget, UNO_QUERY );
- if ( xChildContainer.is() )
- {
- // container control is being added from this container, reset the
- // global list of containees to point to the correct global list
- Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
- if ( xProps.is() )
- xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( xAllChildren ) );
- Sequence< rtl::OUString > aChildNames = xChildContainer->getElementNames();
- for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index )
- {
- Reference< XControlModel > xChildTarget( xChildContainer->getByName( aChildNames[ index ] ), UNO_QUERY );
- updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, xChildTarget );
- }
- }
- }
- }
- else
- throw IllegalArgumentException();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
deleted file mode 100644
index 25ee88686b..0000000000
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ /dev/null
@@ -1,1142 +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 <vcl/window.hxx>
-#include <vcl/wall.hxx>
-#include <osl/mutex.hxx>
-#include <toolkit/controls/dialogcontrol.hxx>
-#include <toolkit/helper/property.hxx>
-#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/controls/stdtabcontroller.hxx>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <com/sun/star/awt/WindowAttribute.hpp>
-#include <com/sun/star/resource/XStringResourceResolver.hpp>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <comphelper/sequence.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/outdev.hxx>
-
-#include <toolkit/helper/vclunohelper.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/image.hxx>
-#include <map>
-#include <boost/unordered_map.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <algorithm>
-#include <functional>
-#include "tools/urlobj.hxx"
-#include "osl/file.hxx"
-
-#include <vcl/tabctrl.hxx>
-#include <toolkit/awt/vclxwindows.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::util;
-
-#define PROPERTY_DIALOGSOURCEURL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogSourceURL" ))
-#define PROPERTY_IMAGEURL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ))
-#define PROPERTY_GRAPHIC ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ))
-//
-
-// we probably will need both a hash of control models and hash of controls
-// => use some template magic
-
-typedef ::cppu::WeakImplHelper1< container::XNameContainer > SimpleNameContainer_BASE;
-
-template< typename T >
-class SimpleNamedThingContainer : public SimpleNameContainer_BASE
-{
- typedef boost::unordered_map< rtl::OUString, Reference< T >, ::rtl::OUStringHash,
- ::std::equal_to< ::rtl::OUString > > NamedThingsHash;
- NamedThingsHash things;
- ::osl::Mutex m_aMutex;
-public:
- // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( !hasByName( aName ) )
- throw NoSuchElementException();
- Reference< T > xElement;
- if ( ! ( aElement >>= xElement ) )
- throw IllegalArgumentException();
- things[ aName ] = xElement;
- }
- virtual Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( !hasByName( aName ) )
- throw NoSuchElementException();
- return uno::makeAny( things[ aName ] );
- }
- virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- Sequence< ::rtl::OUString > aResult( things.size() );
- typename NamedThingsHash::iterator it = things.begin();
- typename NamedThingsHash::iterator it_end = things.end();
- rtl::OUString* pName = aResult.getArray();
- for (; it != it_end; ++it, ++pName )
- *pName = it->first;
- return aResult;
- }
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- return ( things.find( aName ) != things.end() );
- }
- virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( hasByName( aName ) )
- throw ElementExistException();
- Reference< T > xElement;
- if ( ! ( aElement >>= xElement ) )
- throw IllegalArgumentException();
- things[ aName ] = xElement;
- }
- virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( !hasByName( aName ) )
- throw NoSuchElementException();
- things.erase( things.find( aName ) );
- }
- virtual Type SAL_CALL getElementType( ) throw (RuntimeException)
- {
- return T::static_type( NULL );
- }
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- return ( things.size() > 0 );
- }
-};
-
-////HELPER
-::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
-
-// ----------------------------------------------------
-// class UnoControlDialogModel
-// ----------------------------------------------------
-UnoControlDialogModel::UnoControlDialogModel( const Reference< XMultiServiceFactory >& i_factory )
- :ControlModelContainerBase( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
-// ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-// ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_TITLE );
- ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
- ImplRegisterProperty( BASEPROPERTY_DESKTOP_AS_PARENT );
- ImplRegisterProperty( BASEPROPERTY_DECORATION );
- ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
- ImplRegisterProperty( BASEPROPERTY_GRAPHIC );
- ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
-
- Any aBool;
- aBool <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
- // #TODO separate class for 'UserForm' ( instead of re-using Dialog ? )
- uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
- ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
-}
-
-UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
- : ControlModelContainerBase( rModel )
-{
-}
-
-UnoControlDialogModel::~UnoControlDialogModel()
-{
-}
-
-UnoControlModel* UnoControlDialogModel::Clone() const
-{
- // clone the container itself
- UnoControlDialogModel* pClone = new UnoControlDialogModel( *this );
-
- Clone_Impl(*pClone);
-
- return pClone;
-}
-
-
-::rtl::OUString UnoControlDialogModel::getServiceName( ) throw(RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel );
-}
-
-Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- Any aAny;
-
- switch ( nPropId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialog );
- break;
- default:
- aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
- }
-
- return aAny;
-}
-
-::cppu::IPropertyArrayHelper& UnoControlDialogModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// XMultiPropertySet
-Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) throw(RuntimeException)
-{
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ============================================================================
-// = class UnoDialogControl
-// ============================================================================
-
-UnoDialogControl::UnoDialogControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
- :UnoDialogControl_Base( i_factory )
- ,maTopWindowListeners( *this )
- ,mbWindowListener(false)
-{
- maComponentInfos.nWidth = 300;
- maComponentInfos.nHeight = 450;
- }
-
-UnoDialogControl::~UnoDialogControl()
-{
-}
-
-::rtl::OUString UnoDialogControl::GetComponentServiceName()
-{
-
- sal_Bool bDecoration( sal_True );
- ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
- if ( bDecoration )
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dialog"));
- else
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TabPage"));
-}
-
-void UnoDialogControl::dispose() throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- EventObject aEvt;
- aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
- maTopWindowListeners.disposeAndClear( aEvt );
- ControlContainerBase::dispose();
-}
-
-void SAL_CALL UnoDialogControl::disposing(
- const EventObject& Source )
-throw(RuntimeException)
-{
- ControlContainerBase::disposing( Source );
-}
-
-sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
-{
- // #Can we move all the Resource stuff to the ControlContainerBase ?
- SolarMutexGuard aGuard;
- sal_Bool bRet = ControlContainerBase::setModel( rxModel );
- ImplStartListingForResourceEvents();
- return bRet;
-}
-
-void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- UnoControlContainer::createPeer( rxToolkit, rParentPeer );
-
- Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
- if ( xTW.is() )
- {
- xTW->setMenuBar( mxMenuBar );
-
- if ( !mbWindowListener )
- {
- Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
- addWindowListener( xWL );
- mbWindowListener = true;
- }
-
- if ( maTopWindowListeners.getLength() )
- xTW->addTopWindowListener( &maTopWindowListeners );
- }
-}
-
-void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc )
-{
- sal_Bool bDecoration( sal_True );
- ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
- if ( !bDecoration )
- {
- // Now we have to manipulate the WindowDescriptor
- rDesc.WindowAttributes = rDesc.WindowAttributes | ::com::sun::star::awt::WindowAttribute::NODECORATION;
- }
-
- // We have to set the graphic property before the peer
- // will be created. Otherwise the properties will be copied
- // into the peer via propertiesChangeEvents. As the order of
- // can lead to overwrites we have to set the graphic property
- // before the propertiesChangeEvents are sent!
- ::rtl::OUString aImageURL;
- Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
- ::rtl::OUString absoluteUrl =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
- xGraphic = ControlContainerBase::Impl_getGraphicFromURL_nothrow( absoluteUrl );
- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
- }
-}
-
-void UnoDialogControl::addTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
-{
- maTopWindowListeners.addInterface( rxListener );
- if( getPeer().is() && maTopWindowListeners.getLength() == 1 )
- {
- Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
- xTW->addTopWindowListener( &maTopWindowListeners );
- }
-}
-
-void UnoDialogControl::removeTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
-{
- if( getPeer().is() && maTopWindowListeners.getLength() == 1 )
- {
- Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
- xTW->removeTopWindowListener( &maTopWindowListeners );
- }
- maTopWindowListeners.removeInterface( rxListener );
-}
-
-void UnoDialogControl::toFront( ) throw (RuntimeException)
-{
- SolarMutexGuard aGuard;
- if ( getPeer().is() )
- {
- Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
- if( xTW.is() )
- xTW->toFront();
- }
-}
-
-void UnoDialogControl::toBack( ) throw (RuntimeException)
-{
- SolarMutexGuard aGuard;
- if ( getPeer().is() )
- {
- Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
- if( xTW.is() )
- xTW->toBack();
- }
-}
-
-void UnoDialogControl::setMenuBar( const Reference< XMenuBar >& rxMenuBar ) throw (RuntimeException)
-{
- SolarMutexGuard aGuard;
- mxMenuBar = rxMenuBar;
- if ( getPeer().is() )
- {
- Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
- if( xTW.is() )
- xTW->setMenuBar( mxMenuBar );
- }
-}
-static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
-{
- ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
- return aTmp;
-}
-// ::com::sun::star::awt::XWindowListener
-void SAL_CALL UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent& e )
-throw (::com::sun::star::uno::RuntimeException)
-{
- OutputDevice*pOutDev = Application::GetDefaultDevice();
- DBG_ASSERT( pOutDev, "Missing Default Device!" );
- if ( pOutDev && !mbSizeModified )
- {
- // Currentley we are simply using MAP_APPFONT
- ::Size aAppFontSize( e.Width, e.Height );
-
- Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW );
- Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY );
- OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" );
-
- // #i87592 In design mode the drawing layer works with sizes with decoration.
- // Therefore we have to substract them before writing back to the properties (model).
- if ( xDialogDevice.is() && mbDesignMode )
- {
- DeviceInfo aDeviceInfo( xDialogDevice->getInfo() );
- aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
- aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
- }
-
- aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize );
-
- // Remember that changes have been done by listener. No need to
- // update the position because of property change event.
- mbSizeModified = true;
- Sequence< rtl::OUString > aProps( 2 );
- Sequence< Any > aValues( 2 );
- // Properties in a sequence must be sorted!
- aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ));
- aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ));
- aValues[0] <<= aAppFontSize.Height();
- aValues[1] <<= aAppFontSize.Width();
-
- ImplSetPropertyValues( aProps, aValues, true );
- mbSizeModified = false;
- }
-}
-
-void SAL_CALL UnoDialogControl::windowMoved( const ::com::sun::star::awt::WindowEvent& e )
-throw (::com::sun::star::uno::RuntimeException)
-{
- OutputDevice*pOutDev = Application::GetDefaultDevice();
- DBG_ASSERT( pOutDev, "Missing Default Device!" );
- if ( pOutDev && !mbPosModified )
- {
- // Currentley we are simply using MAP_APPFONT
- Any aAny;
- ::Size aTmp( e.X, e.Y );
- aTmp = ImplMapPixelToAppFont( pOutDev, aTmp );
-
- // Remember that changes have been done by listener. No need to
- // update the position because of property change event.
- mbPosModified = true;
- Sequence< rtl::OUString > aProps( 2 );
- Sequence< Any > aValues( 2 );
- aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ));
- aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ));
- aValues[0] <<= aTmp.Width();
- aValues[1] <<= aTmp.Height();
-
- ImplSetPropertyValues( aProps, aValues, true );
- mbPosModified = false;
- }
-}
-
-void SAL_CALL UnoDialogControl::windowShown( const EventObject& e ) throw (RuntimeException)
-{
- (void)e;
-}
-
-void SAL_CALL UnoDialogControl::windowHidden( const EventObject& e ) throw (RuntimeException)
-{
- (void)e;
-}
-
-void SAL_CALL UnoDialogControl::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
-{
- Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
- if ( xPeerDialog.is() )
- xPeerDialog->endDialog( i_result );
-}
-
-void SAL_CALL UnoDialogControl::setHelpId( const rtl::OUString& i_id ) throw (RuntimeException)
-{
- Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
- if ( xPeerDialog.is() )
- xPeerDialog->setHelpId( i_id );
-}
-
-void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
- Any aAny;
- aAny <<= Title;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ), aAny, sal_True );
-}
-
-::rtl::OUString UnoDialogControl::getTitle() throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
- return ImplGetPropertyValue_UString( BASEPROPERTY_TITLE );
-}
-
-sal_Int16 UnoDialogControl::execute() throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
- sal_Int16 nDone = -1;
- if ( getPeer().is() )
- {
- Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
- if( xDlg.is() )
- {
- GetComponentInfos().bVisible = sal_True;
- nDone = xDlg->execute();
- GetComponentInfos().bVisible = sal_False;
- }
- }
- return nDone;
-}
-
-void UnoDialogControl::endExecute() throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
- if ( getPeer().is() )
- {
- Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
- if( xDlg.is() )
- {
- xDlg->endExecute();
- GetComponentInfos().bVisible = sal_False;
- }
- }
-}
-
-// XModifyListener
-void SAL_CALL UnoDialogControl::modified(
- const lang::EventObject& /*rEvent*/ )
-throw (RuntimeException)
-{
- ImplUpdateResourceResolver();
-}
-
-void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
-{
- sal_Int32 nLen = rEvents.getLength();
- for( sal_Int32 i = 0; i < nLen; i++ )
- {
- const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
- Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
- sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
- if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
- {
- ::rtl::OUString aImageURL;
- Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
- ::rtl::OUString absoluteUrl =
- getPhysicalLocation( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL )),
- uno::makeAny(aImageURL));
-
- xGraphic = Impl_getGraphicFromURL_nothrow( absoluteUrl );
- }
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC), uno::makeAny( xGraphic ), sal_True );
- break;
- }
- }
- ControlContainerBase::ImplModelPropertiesChanged(rEvents);
-}
-
-// ----------------------------------------------------
-// class MultiPageControl
-// ----------------------------------------------------
-UnoMultiPageControl::UnoMultiPageControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory) : ControlContainerBase( i_factory ), maTabListeners( *this )
-{
- maComponentInfos.nWidth = 280;
- maComponentInfos.nHeight = 400;
-}
-
-UnoMultiPageControl::~UnoMultiPageControl()
-{
-}
-// XTabListener
-
-void SAL_CALL UnoMultiPageControl::inserted( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
-{
-}
-void SAL_CALL UnoMultiPageControl::removed( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
-{
-}
-void SAL_CALL UnoMultiPageControl::changed( ::sal_Int32 /*ID*/, const Sequence< NamedValue >& /*Properties*/ ) throw (RuntimeException)
-{
-}
-void SAL_CALL UnoMultiPageControl::activated( ::sal_Int32 ID ) throw (RuntimeException)
-{
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), sal_False );
-
-}
-void SAL_CALL UnoMultiPageControl::deactivated( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
-{
-}
-void SAL_CALL UnoMultiPageControl::disposing(const EventObject&) throw (RuntimeException)
-{
-}
-
-void SAL_CALL UnoMultiPageControl::dispose() throw (RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- maTabListeners.disposeAndClear( aEvt );
- ControlContainerBase::dispose();
-}
-
-// com::sun::star::awt::XSimpleTabController
-::sal_Int32 SAL_CALL UnoMultiPageControl::insertTab() throw (RuntimeException)
-{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
- return xMultiPage->insertTab();
-}
-
-void SAL_CALL UnoMultiPageControl::removeTab( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
- xMultiPage->removeTab( ID );
-}
-
-void SAL_CALL UnoMultiPageControl::setTabProps( ::sal_Int32 ID, const Sequence< NamedValue >& Properties ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
- xMultiPage->setTabProps( ID, Properties );
-}
-
-Sequence< NamedValue > SAL_CALL UnoMultiPageControl::getTabProps( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
- return xMultiPage->getTabProps( ID );
-}
-
-void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
- xMultiPage->activateTab( ID );
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), sal_True );
-
-}
-
-::sal_Int32 SAL_CALL UnoMultiPageControl::getActiveTabID() throw (RuntimeException)
-{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
- return xMultiPage->getActiveTabID();
-}
-
-void SAL_CALL UnoMultiPageControl::addTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
-{
- maTabListeners.addInterface( Listener );
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( xMultiPage.is() && maTabListeners.getLength() == 1 )
- xMultiPage->addTabListener( &maTabListeners );
-}
-
-void SAL_CALL UnoMultiPageControl::removeTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
-{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( xMultiPage.is() && maTabListeners.getLength() == 1 )
- xMultiPage->removeTabListener( &maTabListeners );
- maTabListeners.removeInterface( Listener );
-}
-
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoMultiPageControl )
- getCppuType( ( uno::Reference< awt::XSimpleTabController>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XTabListener>* ) NULL ),
- ControlContainerBase::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-// uno::XInterface
-uno::Any UnoMultiPageControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XTabListener*, this ), SAL_STATIC_CAST( awt::XSimpleTabController*, this ) );
- return (aRet.hasValue() ? aRet : ControlContainerBase::queryAggregation( rType ));
-}
-
-::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
-{
- sal_Bool bDecoration( sal_True );
- ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
- if ( bDecoration )
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tabcontrol"));
- // Hopefully we can tweak the tabcontrol to display without tabs
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tabcontrolnotabs"));
-}
-
-void UnoMultiPageControl::bindPage( const uno::Reference< awt::XControl >& _rxControl )
-{
- uno::Reference< awt::XWindowPeer > xPage( _rxControl->getPeer() );
- uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xProps( _rxControl->getModel(), uno::UNO_QUERY );
-
- VCLXTabPage* pXPage = dynamic_cast< VCLXTabPage* >( xPage.get() );
- TabPage* pPage = pXPage ? pXPage->getTabPage() : NULL;
- if ( xTabCntrl.is() && pPage )
- {
- VCLXMultiPage* pXTab = dynamic_cast< VCLXMultiPage* >( xTabCntrl.get() );
- if ( pXTab )
- {
- rtl::OUString sTitle;
- xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
- pXTab->insertTab( pPage, sTitle);
- }
- }
-
-}
-
-void UnoMultiPageControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
-
- UnoControlContainer::createPeer( rxToolkit, rParentPeer );
-
- uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
- sal_uInt32 nCtrls = aCtrls.getLength();
- for( sal_uInt32 n = 0; n < nCtrls; n++ )
- bindPage( aCtrls[ n ] );
- sal_Int32 nActiveTab(0);
- Reference< XPropertySet > xMultiProps( getModel(), UNO_QUERY );
- xMultiProps->getPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ) ) >>= nActiveTab;
-
- uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
- if ( xTabCntrl.is() )
- {
- xTabCntrl->addTabListener( this );
- if ( nActiveTab && nCtrls ) // Ensure peer is initialise with correct activated tab
- {
- xTabCntrl->activateTab( nActiveTab );
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( nActiveTab ), sal_True );
- }
- }
-}
-
-void UnoMultiPageControl::impl_createControlPeerIfNecessary( const uno::Reference< awt::XControl >& _rxControl)
-{
- OSL_PRECOND( _rxControl.is(), "UnoMultiPageControl::impl_createControlPeerIfNecessary: invalid control, this will crash!" );
-
- // if the container already has a peer, then also create a peer for the control
- uno::Reference< awt::XWindowPeer > xMyPeer( getPeer() );
-
- if( xMyPeer.is() )
- {
- _rxControl->createPeer( NULL, xMyPeer );
- bindPage( _rxControl );
- ImplActivateTabControllers();
- }
-
-}
-
-// ------------- UnoMultiPageModel -----------------
-
-UnoMultiPageModel::UnoMultiPageModel( const Reference< XMultiServiceFactory >& i_factory ) : ControlModelContainerBase( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
-
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
- //ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
- ImplRegisterProperty( BASEPROPERTY_MULTIPAGEVALUE );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
-
- Any aBool;
- aBool <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_DECORATION, aBool );
- // MultiPage Control has the tab stop property. And the default value is True.
- ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
-
- uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
- ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
-}
-
-UnoMultiPageModel::UnoMultiPageModel( const UnoMultiPageModel& rModel )
- : ControlModelContainerBase( rModel )
-{
-}
-
-UnoMultiPageModel::~UnoMultiPageModel()
-{
-}
-
-UnoControlModel*
-UnoMultiPageModel::Clone() const
-{
- // clone the container itself
- UnoMultiPageModel* pClone = new UnoMultiPageModel( *this );
- Clone_Impl( *pClone );
- return pClone;
-}
-
-::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
-}
-
-uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
- return aAny;
- }
- return ControlModelContainerBase::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-void UnoMultiPageModel::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-{
- Reference< XServiceInfo > xInfo;
- aElement >>= xInfo;
-
- if ( !xInfo.is() )
- throw IllegalArgumentException();
-
- // Only a Page model can be inserted into the multipage
- if ( !xInfo->supportsService( rtl::OUString::createFromAscii( szServiceName_UnoPageModel ) ) )
- throw IllegalArgumentException();
-
- return ControlModelContainerBase::insertByName( aName, aElement );
-}
-
-// ----------------------------------------------------------------------------
-sal_Bool SAL_CALL UnoMultiPageModel::getGroupControl( ) throw (RuntimeException)
-{
- return sal_True;
-}
-
-// ----------------------------------------------------
-// class UnoPageControl
-// ----------------------------------------------------
-UnoPageControl::UnoPageControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory ) : ControlContainerBase( i_factory )
-{
- maComponentInfos.nWidth = 280;
- maComponentInfos.nHeight = 400;
-}
-
-UnoPageControl::~UnoPageControl()
-{
-}
-
-::rtl::OUString UnoPageControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tabpage"));
-}
-
-
-// ------------- UnoPageModel -----------------
-
-UnoPageModel::UnoPageModel( const Reference< XMultiServiceFactory >& i_factory ) : ControlModelContainerBase( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
-
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_TITLE );
- ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
-// ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
-
- Any aBool;
- aBool <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
- //ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
-
- uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
- ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
-}
-
-UnoPageModel::UnoPageModel( const UnoPageModel& rModel )
- : ControlModelContainerBase( rModel )
-{
-}
-
-UnoPageModel::~UnoPageModel()
-{
-}
-
-UnoControlModel*
-UnoPageModel::Clone() const
-{
- // clone the container itself
- UnoPageModel* pClone = new UnoPageModel( *this );
- Clone_Impl( *pClone );
- return pClone;
-}
-
-::rtl::OUString UnoPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoPageModel );
-}
-
-uno::Any UnoPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoPageControl );
- return aAny;
- }
- return ControlModelContainerBase::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoPageModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ----------------------------------------------------------------------------
-sal_Bool SAL_CALL UnoPageModel::getGroupControl( ) throw (RuntimeException)
-{
- return sal_False;
-}
-
-// Frame control
-
-// ----------------------------------------------------
-// class UnoFrameControl
-// ----------------------------------------------------
-UnoFrameControl::UnoFrameControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory ) : ControlContainerBase( i_factory )
-{
- maComponentInfos.nWidth = 280;
- maComponentInfos.nHeight = 400;
-}
-
-UnoFrameControl::~UnoFrameControl()
-{
-}
-
-::rtl::OUString UnoFrameControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("frame"));
-}
-
-void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
-{
- bool bOwnCtrl = false;
- rtl::OUString sTitle;
- if ( rxCtrl.get() == Reference<XControl>( this ).get() )
- bOwnCtrl = true;
- Reference< XPropertySet > xProps( getModel(), UNO_QUERY );
- //xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
- xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ) ) >>= sTitle;
-
- ControlContainerBase::ImplSetPosSize( rxCtrl );
- Reference < XWindow > xW( rxCtrl, UNO_QUERY );
- if ( !bOwnCtrl && xW.is() && sTitle.getLength() )
- {
- awt::Rectangle aSizePos = xW->getPosSize();
-
- sal_Int32 nX = aSizePos.X, nY = aSizePos.Y, nWidth = aSizePos.Width, nHeight = aSizePos.Height;
- // Retrieve the values set by the base class
- OutputDevice*pOutDev = Application::GetDefaultDevice();
- if ( pOutDev )
- {
- if ( !bOwnCtrl && sTitle.getLength() )
- {
- // Adjust Y based on height of Title
- ::Rectangle aRect = pOutDev->GetTextRect( aRect, sTitle );
- nY = nY + ( aRect.GetHeight() / 2 );
- }
- }
- else
- {
- Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
- Reference< XDevice > xD( xPeer, UNO_QUERY );
-
- SimpleFontMetric aFM;
- FontDescriptor aFD;
- Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
- aVal >>= aFD;
- if ( aFD.StyleName.getLength() )
- {
- Reference< XFont > xFont = xD->getFont( aFD );
- aFM = xFont->getFontMetric();
- }
- else
- {
- Reference< XGraphics > xG = xD->createGraphics();
- aFM = xG->getFontMetric();
- }
-
- sal_Int16 nH = aFM.Ascent + aFM.Descent;
- if ( !bOwnCtrl && sTitle.getLength() )
- // offset y based on height of font ( not sure if my guess at the correct calculation is correct here )
- nY = nY + ( nH / 8); // how do I test this
- }
- xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
- }
-}
-
-// ------------- UnoFrameModel -----------------
-
-UnoFrameModel::UnoFrameModel( const Reference< XMultiServiceFactory >& i_factory ) : ControlModelContainerBase( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_LABEL );
- ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
- ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
- ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
-
- uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
- ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
-}
-
-UnoFrameModel::UnoFrameModel( const UnoFrameModel& rModel )
- : ControlModelContainerBase( rModel )
-{
-}
-
-UnoFrameModel::~UnoFrameModel()
-{
-}
-
-UnoControlModel*
-UnoFrameModel::Clone() const
-{
- // clone the container itself
- UnoFrameModel* pClone = new UnoFrameModel( *this );
- Clone_Impl( *pClone );
- return pClone;
-}
-
-::rtl::OUString UnoFrameModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoFrameModel );
-}
-
-uno::Any UnoFrameModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoFrameControl );
- return aAny;
- }
- return ControlModelContainerBase::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoFrameModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoFrameModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/eventcontainer.cxx b/toolkit/source/controls/eventcontainer.cxx
deleted file mode 100644
index e1eb4bfd43..0000000000
--- a/toolkit/source/controls/eventcontainer.cxx
+++ /dev/null
@@ -1,214 +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 <osl/mutex.hxx>
-#include <cppuhelper/queryinterface.hxx>
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
-
-#include "toolkit/controls/eventcontainer.hxx"
-#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::container;
-using namespace com::sun::star::registry;
-using namespace com::sun::star::script;
-using namespace cppu;
-using namespace osl;
-using namespace std;
-
-using ::rtl::OUString;
-
-namespace toolkit
-{
-
-// Methods XElementAccess
-Type NameContainer_Impl::getElementType()
- throw(RuntimeException)
-{
- return mType;
-}
-
-sal_Bool NameContainer_Impl::hasElements()
- throw(RuntimeException)
-{
- sal_Bool bRet = (mnElementCount > 0);
- return bRet;
-}
-
-// Methods XNameAccess
-Any NameContainer_Impl::getByName( const OUString& aName )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
- if( aIt == mHashMap.end() )
- {
- throw NoSuchElementException();
- }
- sal_Int32 iHashResult = (*aIt).second;
- Any aRetAny = mValues.getConstArray()[ iHashResult ];
- return aRetAny;
-}
-
-Sequence< OUString > NameContainer_Impl::getElementNames()
- throw(RuntimeException)
-{
- return mNames;
-}
-
-sal_Bool NameContainer_Impl::hasByName( const OUString& aName )
- throw(RuntimeException)
-{
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
- sal_Bool bRet = ( aIt != mHashMap.end() );
- return bRet;
-}
-
-
-// Methods XNameReplace
-void NameContainer_Impl::replaceByName( const OUString& aName, const Any& aElement )
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- Type aAnyType = aElement.getValueType();
- if( mType != aAnyType )
- throw IllegalArgumentException();
-
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
- if( aIt == mHashMap.end() )
- {
- throw NoSuchElementException();
- }
- sal_Int32 iHashResult = (*aIt).second;
- Any aOldElement = mValues.getConstArray()[ iHashResult ];
- mValues.getArray()[ iHashResult ] = aElement;
-
- // Fire event
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElement;
- aEvent.ReplacedElement = aOldElement;
- aEvent.Accessor <<= aName;
- maContainerListeners.elementReplaced( aEvent );
-}
-
-
-// Methods XNameContainer
-void NameContainer_Impl::insertByName( const OUString& aName, const Any& aElement )
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-{
- Type aAnyType = aElement.getValueType();
- if( mType != aAnyType )
- throw IllegalArgumentException();
-
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
- if( aIt != mHashMap.end() )
- {
- throw ElementExistException();
- }
-
- sal_Int32 nCount = mNames.getLength();
- mNames.realloc( nCount + 1 );
- mValues.realloc( nCount + 1 );
- mNames.getArray()[ nCount ] = aName;
- mValues.getArray()[ nCount ] = aElement;
- mHashMap[ aName ] = nCount;
-
- // Fire event
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElement;
- aEvent.Accessor <<= aName;
- maContainerListeners.elementInserted( aEvent );
-}
-
-void NameContainer_Impl::removeByName( const OUString& Name )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- NameContainerNameMap::iterator aIt = mHashMap.find( Name );
- if( aIt == mHashMap.end() )
- {
- throw NoSuchElementException();
- }
-
- sal_Int32 iHashResult = (*aIt).second;
- Any aOldElement = mValues.getConstArray()[ iHashResult ];
-
- // Fire event
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element = aOldElement;
- aEvent.Accessor <<= Name;
- maContainerListeners.elementRemoved( aEvent );
-
- mHashMap.erase( aIt );
- sal_Int32 iLast = mNames.getLength() - 1;
- if( iLast != iHashResult )
- {
- OUString* pNames = mNames.getArray();
- Any* pValues = mValues.getArray();
- pNames[ iHashResult ] = pNames[ iLast ];
- pValues[ iHashResult ] = pValues[ iLast ];
- mHashMap[ pNames[ iHashResult ] ] = iHashResult;
- }
- mNames.realloc( iLast );
- mValues.realloc( iLast );
-
-}
-
-// Methods XContainer
-void NameContainer_Impl::addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException)
-{
- maContainerListeners.addInterface( l );
-}
-
-void NameContainer_Impl::removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException)
-{
- maContainerListeners.removeInterface( l );
-}
-
-
-
-// Ctor
-ScriptEventContainer::ScriptEventContainer( void )
- : NameContainer_Impl( getCppuType( (ScriptEventDescriptor*) NULL ) )
-{
-}
-
-}
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx
deleted file mode 100644
index 0eb6f45eb3..0000000000
--- a/toolkit/source/controls/formattedcontrol.cxx
+++ /dev/null
@@ -1,473 +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/controls/formattedcontrol.hxx>
-#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/helper/property.hxx>
-
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-
-#include <tools/diagnose_ex.h>
-#include <comphelper/processfactory.hxx>
-#include <osl/diagnose.h>
-
-//........................................................................
-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;
- using namespace ::com::sun::star::util;
-
- // -------------------------------------------------------------------
- namespace
- {
- // ...............................................................
- ::osl::Mutex& getDefaultFormatsMutex()
- {
- static ::osl::Mutex s_aDefaultFormatsMutex;
- return s_aDefaultFormatsMutex;
- }
-
- // ...............................................................
- Reference< XNumberFormatsSupplier >& lcl_getDefaultFormatsAccess_nothrow()
- {
- static Reference< XNumberFormatsSupplier > s_xDefaultFormats;
- return s_xDefaultFormats;
- }
-
- // ...............................................................
- bool& lcl_getTriedCreation()
- {
- static bool s_bTriedCreation = false;
- return s_bTriedCreation;
- }
-
- // ...............................................................
- const Reference< XNumberFormatsSupplier >& lcl_getDefaultFormats_throw()
- {
- ::osl::MutexGuard aGuard( getDefaultFormatsMutex() );
-
- bool& rbTriedCreation = lcl_getTriedCreation();
- Reference< XNumberFormatsSupplier >& rDefaultFormats( lcl_getDefaultFormatsAccess_nothrow() );
- if ( !rDefaultFormats.is() && !rbTriedCreation )
- {
- rbTriedCreation = true;
- rDefaultFormats = Reference< XNumberFormatsSupplier >(
- ::comphelper::createProcessComponent(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatsSupplier" ) ) ),
- UNO_QUERY_THROW
- );
- }
- if ( !rDefaultFormats.is() )
- throw RuntimeException();
-
- return rDefaultFormats;
- }
-
- // ...............................................................
- static oslInterlockedCount s_refCount(0);
-
- // ...............................................................
- void lcl_registerDefaultFormatsClient()
- {
- osl_incrementInterlockedCount( &s_refCount );
- }
-
- // ...............................................................
- void lcl_revokeDefaultFormatsClient()
- {
- ::osl::ClearableMutexGuard aGuard( getDefaultFormatsMutex() );
- if ( 0 == osl_decrementInterlockedCount( &s_refCount ) )
- {
- Reference< XNumberFormatsSupplier >& rDefaultFormats( lcl_getDefaultFormatsAccess_nothrow() );
- Reference< XNumberFormatsSupplier > xReleasePotentialLastReference( rDefaultFormats );
- rDefaultFormats.clear();
- lcl_getTriedCreation() = false;
-
- aGuard.clear();
- xReleasePotentialLastReference.clear();
- }
- }
- }
-
- // ===================================================================
- // = UnoControlFormattedFieldModel
- // ===================================================================
- // -------------------------------------------------------------------
- UnoControlFormattedFieldModel::UnoControlFormattedFieldModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
- ,m_bRevokedAsClient( false )
- ,m_bSettingValueAndText( false )
- {
- ImplRegisterProperty( BASEPROPERTY_ALIGN );
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_DEFAULT );
- ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_VALUE );
- ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MAX );
- ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MIN );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_FORMATKEY );
- ImplRegisterProperty( BASEPROPERTY_FORMATSSUPPLIER );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_MAXTEXTLEN );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_REPEAT );
- ImplRegisterProperty( BASEPROPERTY_REPEAT_DELAY );
- ImplRegisterProperty( BASEPROPERTY_READONLY );
- ImplRegisterProperty( BASEPROPERTY_SPIN );
- ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT );
- ImplRegisterProperty( BASEPROPERTY_TABSTOP );
- ImplRegisterProperty( BASEPROPERTY_TEXT );
- ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
- ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
- ImplRegisterProperty( BASEPROPERTY_ENFORCE_FORMAT );
- ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
- ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
- ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
- ImplRegisterProperty( BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR );
-
- Any aTreatAsNumber;
- aTreatAsNumber <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_TREATASNUMBER, aTreatAsNumber );
-
- lcl_registerDefaultFormatsClient();
- }
-
- // -------------------------------------------------------------------
- UnoControlFormattedFieldModel::~UnoControlFormattedFieldModel()
- {
- }
-
- // -------------------------------------------------------------------
- ::rtl::OUString UnoControlFormattedFieldModel::getServiceName() throw(RuntimeException)
- {
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedFieldModel );
- }
-
- // -------------------------------------------------------------------
- void SAL_CALL UnoControlFormattedFieldModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
- {
- UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-
- switch ( nHandle )
- {
- case BASEPROPERTY_EFFECTIVE_VALUE:
- if ( !m_bSettingValueAndText )
- impl_updateTextFromValue_nothrow();
- break;
- case BASEPROPERTY_FORMATSSUPPLIER:
- impl_updateCachedFormatter_nothrow();
- impl_updateTextFromValue_nothrow();
- break;
- case BASEPROPERTY_FORMATKEY:
- impl_updateCachedFormatKey_nothrow();
- impl_updateTextFromValue_nothrow();
- break;
- }
- }
-
- // -------------------------------------------------------------------
- void UnoControlFormattedFieldModel::impl_updateTextFromValue_nothrow()
- {
- if ( !m_xCachedFormatter.is() )
- impl_updateCachedFormatter_nothrow();
- if ( !m_xCachedFormatter.is() )
- return;
-
- try
- {
- Any aEffectiveValue;
- getFastPropertyValue( aEffectiveValue, BASEPROPERTY_EFFECTIVE_VALUE );
-
- ::rtl::OUString sStringValue;
- if ( !( aEffectiveValue >>= sStringValue ) )
- {
- double nDoubleValue(0);
- if ( aEffectiveValue >>= nDoubleValue )
- {
- sal_Int32 nFormatKey( 0 );
- if ( m_aCachedFormat.hasValue() )
- m_aCachedFormat >>= nFormatKey;
- sStringValue = m_xCachedFormatter->convertNumberToString( nFormatKey, nDoubleValue );
- }
- }
-
- Reference< XPropertySet > xThis( *this, UNO_QUERY );
- xThis->setPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), makeAny( sStringValue ) );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- // -------------------------------------------------------------------
- void UnoControlFormattedFieldModel::impl_updateCachedFormatter_nothrow()
- {
- Any aFormatsSupplier;
- getFastPropertyValue( aFormatsSupplier, BASEPROPERTY_FORMATSSUPPLIER );
- try
- {
- Reference< XNumberFormatsSupplier > xSupplier( aFormatsSupplier, UNO_QUERY );
- if ( !xSupplier.is() )
- xSupplier = lcl_getDefaultFormats_throw();
-
- if ( !m_xCachedFormatter.is() )
- {
- m_xCachedFormatter = Reference< XNumberFormatter >(
- ::comphelper::createProcessComponent( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter" ) ) ),
- UNO_QUERY_THROW
- );
- }
- m_xCachedFormatter->attachNumberFormatsSupplier( xSupplier );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- // -------------------------------------------------------------------
- void UnoControlFormattedFieldModel::impl_updateCachedFormatKey_nothrow()
- {
- Any aFormatKey;
- getFastPropertyValue( aFormatKey, BASEPROPERTY_FORMATKEY );
- m_aCachedFormat = aFormatKey;
- }
-
- // -------------------------------------------------------------------
- void UnoControlFormattedFieldModel::dispose( ) throw(RuntimeException)
- {
- UnoControlModel::dispose();
-
- ::osl::MutexGuard aGuard( GetMutex() );
- if ( !m_bRevokedAsClient )
- {
- lcl_revokeDefaultFormatsClient();
- m_bRevokedAsClient = true;
- }
- }
-
- // -------------------------------------------------------------------
- void UnoControlFormattedFieldModel::ImplNormalizePropertySequence( const sal_Int32 _nCount, sal_Int32* _pHandles,
- Any* _pValues, sal_Int32* _pValidHandles ) const SAL_THROW(())
- {
- ImplEnsureHandleOrder( _nCount, _pHandles, _pValues, BASEPROPERTY_EFFECTIVE_VALUE, BASEPROPERTY_TEXT );
-
- UnoControlModel::ImplNormalizePropertySequence( _nCount, _pHandles, _pValues, _pValidHandles );
- }
-
- // -------------------------------------------------------------------
- namespace
- {
- class ResetFlagOnExit
- {
- private:
- bool& m_rFlag;
-
- public:
- ResetFlagOnExit( bool& _rFlag )
- :m_rFlag( _rFlag )
- {
- }
- ~ResetFlagOnExit()
- {
- m_rFlag = false;
- }
- };
- }
-
- // -------------------------------------------------------------------
- void SAL_CALL UnoControlFormattedFieldModel::setPropertyValues( const Sequence< ::rtl::OUString >& _rPropertyNames, const Sequence< Any >& _rValues ) throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
- {
- bool bSettingValue = false;
- bool bSettingText = false;
- for ( const ::rtl::OUString* pPropertyNames = _rPropertyNames.getConstArray();
- pPropertyNames != _rPropertyNames.getConstArray() + _rPropertyNames.getLength();
- ++pPropertyNames
- )
- {
- if ( BASEPROPERTY_EFFECTIVE_VALUE == GetPropertyId( *pPropertyNames ) )
- bSettingValue = true;
-
- if ( BASEPROPERTY_TEXT == GetPropertyId( *pPropertyNames ) )
- bSettingText = true;
- }
-
- m_bSettingValueAndText = ( bSettingValue && bSettingText );
- ResetFlagOnExit aResetFlag( m_bSettingValueAndText );
- UnoControlModel::setPropertyValues( _rPropertyNames, _rValues );
- }
-
- // -------------------------------------------------------------------
- sal_Bool UnoControlFormattedFieldModel::convertFastPropertyValue(
- Any& rConvertedValue, Any& rOldValue, sal_Int32 nPropId,
- const Any& rValue ) throw (IllegalArgumentException)
- {
- if ( BASEPROPERTY_EFFECTIVE_DEFAULT == nPropId && rValue.hasValue() )
- {
- double dVal = 0;
- sal_Int32 nVal = 0;
- ::rtl::OUString sVal;
- sal_Bool bStreamed = (rValue >>= dVal);
- if ( bStreamed )
- {
- rConvertedValue <<= dVal;
- }
- else
- {
- bStreamed = (rValue >>= nVal);
- if ( bStreamed )
- {
- rConvertedValue <<= static_cast<double>(nVal);
- }
- else
- {
- bStreamed = (rValue >>= sVal);
- if ( bStreamed )
- {
- rConvertedValue <<= sVal;
- }
- }
- }
-
- if ( bStreamed )
- {
- getFastPropertyValue( rOldValue, nPropId );
- return !CompareProperties( rConvertedValue, rOldValue );
- }
-
- throw IllegalArgumentException(
- ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to convert the given value for the property "))
- += GetPropertyName((sal_uInt16)nPropId) )
- += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (double, integer, or string expected).")),
- static_cast< XPropertySet* >(this),
- 1);
- }
-
- return UnoControlModel::convertFastPropertyValue( rConvertedValue, rOldValue, nPropId, rValue );
- }
-
- // -------------------------------------------------------------------
- Any UnoControlFormattedFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- {
- Any aReturn;
- switch (nPropId)
- {
- case BASEPROPERTY_DEFAULTCONTROL: aReturn <<= ::rtl::OUString( ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedField ) ); break;
-
- case BASEPROPERTY_TREATASNUMBER: aReturn <<= (sal_Bool)sal_True; break;
-
- case BASEPROPERTY_EFFECTIVE_DEFAULT:
- case BASEPROPERTY_EFFECTIVE_VALUE:
- case BASEPROPERTY_EFFECTIVE_MAX:
- case BASEPROPERTY_EFFECTIVE_MIN:
- case BASEPROPERTY_FORMATKEY:
- case BASEPROPERTY_FORMATSSUPPLIER:
- // (void)
- break;
-
- default : aReturn = UnoControlModel::ImplGetDefaultValue( nPropId ); break;
- }
-
- return aReturn;
- }
-
- // -------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper& UnoControlFormattedFieldModel::getInfoHelper()
- {
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
- }
-
- // beans::XMultiPropertySet
- // -------------------------------------------------------------------
- Reference< XPropertySetInfo > UnoControlFormattedFieldModel::getPropertySetInfo( ) throw(RuntimeException)
- {
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
- }
-
- // ===================================================================
- // = UnoFormattedFieldControl
- // ===================================================================
- // -------------------------------------------------------------------
- UnoFormattedFieldControl::UnoFormattedFieldControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoSpinFieldControl( i_factory )
- {
- }
-
- // -------------------------------------------------------------------
- ::rtl::OUString UnoFormattedFieldControl::GetComponentServiceName()
- {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FormattedField"));
- }
-
- // -------------------------------------------------------------------
- void UnoFormattedFieldControl::textChanged(const TextEvent& e) throw(RuntimeException)
- {
- Reference< XVclWindowPeer > xPeer(getPeer(), UNO_QUERY);
- OSL_ENSURE(xPeer.is(), "UnoFormattedFieldControl::textChanged : what kind of peer do I have ?");
-
- Sequence< ::rtl::OUString > aNames( 2 );
- aNames[0] = GetPropertyName( BASEPROPERTY_EFFECTIVE_VALUE );
- aNames[1] = GetPropertyName( BASEPROPERTY_TEXT );
-
- Sequence< Any > aValues( 2 );
- aValues[0] = xPeer->getProperty( aNames[0] );
- aValues[1] = xPeer->getProperty( aNames[1] );
-
- ImplSetPropertyValues( aNames, aValues, sal_False );
-
- if ( GetTextListeners().getLength() )
- GetTextListeners().textChanged( e );
- }
-
-//........................................................................
-} // namespace toolkit
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/geometrycontrolmodel.cxx b/toolkit/source/controls/geometrycontrolmodel.cxx
deleted file mode 100644
index 5517cb214f..0000000000
--- a/toolkit/source/controls/geometrycontrolmodel.cxx
+++ /dev/null
@@ -1,650 +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/controls/geometrycontrolmodel.hxx"
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <osl/diagnose.h>
-#include <rtl/instance.hxx>
-#include <comphelper/property.hxx>
-#include <comphelper/sequence.hxx>
-#include <toolkit/controls/eventcontainer.hxx>
-#include <toolkit/helper/property.hxx>
-#include <tools/debug.hxx>
-#include <algorithm>
-#include <functional>
-#include <comphelper/sequence.hxx>
-
-
-#define GCM_PROPERTY_ID_POS_X 1
-#define GCM_PROPERTY_ID_POS_Y 2
-#define GCM_PROPERTY_ID_WIDTH 3
-#define GCM_PROPERTY_ID_HEIGHT 4
-#define GCM_PROPERTY_ID_NAME 5
-#define GCM_PROPERTY_ID_TABINDEX 6
-#define GCM_PROPERTY_ID_STEP 7
-#define GCM_PROPERTY_ID_TAG 8
-#define GCM_PROPERTY_ID_RESOURCERESOLVER 9
-
-#define GCM_PROPERTY_POS_X ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionX"))
-#define GCM_PROPERTY_POS_Y ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionY"))
-#define GCM_PROPERTY_WIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Width"))
-#define GCM_PROPERTY_HEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Height"))
-#define GCM_PROPERTY_NAME ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name"))
-#define GCM_PROPERTY_TABINDEX ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TabIndex"))
-#define GCM_PROPERTY_STEP ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Step"))
-#define GCM_PROPERTY_TAG ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Tag"))
-#define GCM_PROPERTY_RESOURCERESOLVER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ResourceResolver"))
-
-#define DEFAULT_ATTRIBS() PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT
-
-//........................................................................
-// namespace toolkit
-// {
-//........................................................................
-
- 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::util;
- using namespace ::com::sun::star::container;
- using namespace ::comphelper;
-
- //====================================================================
- //= OGeometryControlModel_Base
- //====================================================================
- //--------------------------------------------------------------------
- OGeometryControlModel_Base::OGeometryControlModel_Base(::com::sun::star::uno::XAggregation* _pAggregateInstance)
- :OPropertySetAggregationHelper( m_aBHelper )
- ,OPropertyContainer( m_aBHelper )
- ,OGCM_Base( m_aMutex )
- ,m_nPosX(0)
- ,m_nPosY(0)
- ,m_nWidth(0)
- ,m_nHeight(0)
- ,m_nTabIndex(-1)
- ,m_nStep(0)
- ,m_bCloneable(sal_False)
- {
- OSL_ENSURE(NULL != _pAggregateInstance, "OGeometryControlModel_Base::OGeometryControlModel_Base: invalid aggregate!");
-
- increment(m_refCount);
- {
- m_xAggregate = _pAggregateInstance;
-
- { // check if the aggregat is cloneable
- Reference< XCloneable > xCloneAccess(m_xAggregate, UNO_QUERY);
- m_bCloneable = xCloneAccess.is();
- }
-
- setAggregation(m_xAggregate);
- m_xAggregate->setDelegator(static_cast< XWeak* >(this));
- }
- decrement(m_refCount);
-
- registerProperties();
- }
-
- //--------------------------------------------------------------------
- OGeometryControlModel_Base::OGeometryControlModel_Base(Reference< XCloneable >& _rxAggregateInstance)
- :OPropertySetAggregationHelper( m_aBHelper )
- ,OPropertyContainer( m_aBHelper )
- ,OGCM_Base( m_aMutex )
- ,m_nPosX(0)
- ,m_nPosY(0)
- ,m_nWidth(0)
- ,m_nHeight(0)
- ,m_nTabIndex(-1)
- ,m_nStep(0)
- ,m_bCloneable(_rxAggregateInstance.is())
- {
- increment(m_refCount);
- {
- {
- // ensure that the temporary gets destructed NOW
- m_xAggregate = Reference< XAggregation >(_rxAggregateInstance, UNO_QUERY);
- }
- OSL_ENSURE(m_xAggregate.is(), "OGeometryControlModel_Base::OGeometryControlModel_Base: invalid object given!");
-
- // now the aggregate has a ref count of 2, but before setting the delegator it must be 1
- _rxAggregateInstance.clear();
- // now it should be the 1 we need here ...
-
- setAggregation(m_xAggregate);
- m_xAggregate->setDelegator(static_cast< XWeak* >(this));
- }
- decrement(m_refCount);
-
- registerProperties();
- }
-
- //--------------------------------------------------------------------
- Sequence< Type > SAL_CALL OGeometryControlModel_Base::getTypes( ) throw (RuntimeException)
- {
- // our own types
- Sequence< Type > aTypes = ::comphelper::concatSequences(
- OPropertySetAggregationHelper::getTypes(),
- OPropertyContainer::getTypes(),
- OGCM_Base::getTypes()
- );
-
- if ( m_xAggregate.is() )
- {
- // retrieve the types of the aggregate
- Reference< XTypeProvider > xAggregateTypeProv;
- m_xAggregate->queryAggregation( ::getCppuType( &xAggregateTypeProv ) ) >>= xAggregateTypeProv;
- OSL_ENSURE( xAggregateTypeProv.is(), "OGeometryControlModel_Base::getTypes: aggregate should be a type provider!" );
- Sequence< Type > aAggTypes;
- if ( xAggregateTypeProv.is() )
- aAggTypes = xAggregateTypeProv->getTypes();
-
- // concat the sequences
- sal_Int32 nOldSize = aTypes.getLength();
- aTypes.realloc( nOldSize + aAggTypes.getLength() );
- ::std::copy(
- aAggTypes.getConstArray(),
- aAggTypes.getConstArray() + aAggTypes.getLength(),
- aTypes.getArray() + nOldSize
- );
- }
-
- return aTypes;
- }
-
- //--------------------------------------------------------------------
- void OGeometryControlModel_Base::registerProperties()
- {
- // register our members for the property handling of the OPropertyContainer
- registerProperty(GCM_PROPERTY_POS_X, GCM_PROPERTY_ID_POS_X, DEFAULT_ATTRIBS(), &m_nPosX, ::getCppuType(&m_nPosX));
- registerProperty(GCM_PROPERTY_POS_Y, GCM_PROPERTY_ID_POS_Y, DEFAULT_ATTRIBS(), &m_nPosY, ::getCppuType(&m_nPosY));
- registerProperty(GCM_PROPERTY_WIDTH, GCM_PROPERTY_ID_WIDTH, DEFAULT_ATTRIBS(), &m_nWidth, ::getCppuType(&m_nWidth));
- registerProperty(GCM_PROPERTY_HEIGHT, GCM_PROPERTY_ID_HEIGHT, DEFAULT_ATTRIBS(), &m_nHeight, ::getCppuType(&m_nHeight));
- registerProperty(GCM_PROPERTY_NAME, GCM_PROPERTY_ID_NAME, DEFAULT_ATTRIBS(), &m_aName, ::getCppuType(&m_aName));
- registerProperty(GCM_PROPERTY_TABINDEX, GCM_PROPERTY_ID_TABINDEX, DEFAULT_ATTRIBS(), &m_nTabIndex, ::getCppuType(&m_nTabIndex));
- registerProperty(GCM_PROPERTY_STEP, GCM_PROPERTY_ID_STEP, DEFAULT_ATTRIBS(), &m_nStep, ::getCppuType(&m_nStep));
- registerProperty(GCM_PROPERTY_TAG, GCM_PROPERTY_ID_TAG, DEFAULT_ATTRIBS(), &m_aTag, ::getCppuType(&m_aTag));
- registerProperty(GCM_PROPERTY_RESOURCERESOLVER, GCM_PROPERTY_ID_RESOURCERESOLVER, DEFAULT_ATTRIBS(), &m_xStrResolver, ::getCppuType(&m_xStrResolver));
- }
-
- //--------------------------------------------------------------------
- ::com::sun::star::uno::Any OGeometryControlModel_Base::ImplGetDefaultValueByHandle(sal_Int32 nHandle) const
- {
- ::com::sun::star::uno::Any aDefault;
-
- switch ( nHandle )
- {
- case GCM_PROPERTY_ID_POS_X: aDefault <<= (sal_Int32) 0; break;
- case GCM_PROPERTY_ID_POS_Y: aDefault <<= (sal_Int32) 0; break;
- case GCM_PROPERTY_ID_WIDTH: aDefault <<= (sal_Int32) 0; break;
- case GCM_PROPERTY_ID_HEIGHT: aDefault <<= (sal_Int32) 0; break;
- case GCM_PROPERTY_ID_NAME: aDefault <<= ::rtl::OUString(); break;
- case GCM_PROPERTY_ID_TABINDEX: aDefault <<= (sal_Int16) -1; break;
- case GCM_PROPERTY_ID_STEP: aDefault <<= (sal_Int32) 0; break;
- case GCM_PROPERTY_ID_TAG: aDefault <<= ::rtl::OUString(); break;
- case GCM_PROPERTY_ID_RESOURCERESOLVER: aDefault <<= Reference< resource::XStringResourceResolver >(); break;
- default: OSL_FAIL( "ImplGetDefaultValueByHandle - unknown Property" );
- }
-
- return aDefault;
- }
-
- //--------------------------------------------------------------------
- ::com::sun::star::uno::Any OGeometryControlModel_Base::ImplGetPropertyValueByHandle(sal_Int32 nHandle) const
- {
- ::com::sun::star::uno::Any aValue;
-
- switch ( nHandle )
- {
- case GCM_PROPERTY_ID_POS_X: aValue <<= m_nPosX; break;
- case GCM_PROPERTY_ID_POS_Y: aValue <<= m_nPosY; break;
- case GCM_PROPERTY_ID_WIDTH: aValue <<= m_nWidth; break;
- case GCM_PROPERTY_ID_HEIGHT: aValue <<= m_nHeight; break;
- case GCM_PROPERTY_ID_NAME: aValue <<= m_aName; break;
- case GCM_PROPERTY_ID_TABINDEX: aValue <<= m_nTabIndex; break;
- case GCM_PROPERTY_ID_STEP: aValue <<= m_nStep; break;
- case GCM_PROPERTY_ID_TAG: aValue <<= m_aTag; break;
- case GCM_PROPERTY_ID_RESOURCERESOLVER: aValue <<= m_xStrResolver; break;
- default: OSL_FAIL( "ImplGetPropertyValueByHandle - unknown Property" );
- }
-
- return aValue;
- }
-
- //--------------------------------------------------------------------
- void OGeometryControlModel_Base::ImplSetPropertyValueByHandle(sal_Int32 nHandle, const :: com::sun::star::uno::Any& aValue)
- {
- switch ( nHandle )
- {
- case GCM_PROPERTY_ID_POS_X: aValue >>= m_nPosX; break;
- case GCM_PROPERTY_ID_POS_Y: aValue >>= m_nPosY; break;
- case GCM_PROPERTY_ID_WIDTH: aValue >>= m_nWidth; break;
- case GCM_PROPERTY_ID_HEIGHT: aValue >>= m_nHeight; break;
- case GCM_PROPERTY_ID_NAME: aValue >>= m_aName; break;
- case GCM_PROPERTY_ID_TABINDEX: aValue >>= m_nTabIndex; break;
- case GCM_PROPERTY_ID_STEP: aValue >>= m_nStep; break;
- case GCM_PROPERTY_ID_TAG: aValue >>= m_aTag; break;
- case GCM_PROPERTY_ID_RESOURCERESOLVER: aValue >>= m_xStrResolver; break;
- default: OSL_FAIL( "ImplSetPropertyValueByHandle - unknown Property" );
- }
- }
-
- //--------------------------------------------------------------------
- Any SAL_CALL OGeometryControlModel_Base::queryAggregation( const Type& _rType ) throw(RuntimeException)
- {
- Any aReturn;
- if (_rType.equals(::getCppuType(static_cast< Reference< XCloneable>* >(NULL))) && !m_bCloneable)
- // somebody is asking for the XCloneable interface, but our aggregate does not support it
- // -> outta here
- // (need this extra check, cause OGCM_Base::queryAggregation would return this interface
- // in every case)
- return aReturn;
-
- aReturn = OGCM_Base::queryAggregation(_rType);
- // the basic interfaces (XInterface, XAggregation etc)
-
- if (!aReturn.hasValue())
- aReturn = OPropertySetAggregationHelper::queryInterface(_rType);
- // the property set related interfaces
-
- if (!aReturn.hasValue() && m_xAggregate.is())
- aReturn = m_xAggregate->queryAggregation(_rType);
- // the interfaces our aggregate can provide
-
- return aReturn;
- }
-
- //--------------------------------------------------------------------
- Any SAL_CALL OGeometryControlModel_Base::queryInterface( const Type& _rType ) throw(RuntimeException)
- {
- return OGCM_Base::queryInterface(_rType);
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OGeometryControlModel_Base::acquire( ) throw()
- {
- OGCM_Base::acquire();
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OGeometryControlModel_Base::release( ) throw()
- {
- OGCM_Base::release();
- }
-
- //--------------------------------------------------------------------
- void OGeometryControlModel_Base::releaseAggregation()
- {
- // release the aggregate (_before_ clearing m_xAggregate)
- if (m_xAggregate.is())
- m_xAggregate->setDelegator(NULL);
- setAggregation(NULL);
- }
-
- //--------------------------------------------------------------------
- OGeometryControlModel_Base::~OGeometryControlModel_Base()
- {
- releaseAggregation();
- }
-
- //--------------------------------------------------------------------
- sal_Bool SAL_CALL OGeometryControlModel_Base::convertFastPropertyValue(Any& _rConvertedValue, Any& _rOldValue,
- sal_Int32 _nHandle, const Any& _rValue) throw (IllegalArgumentException)
- {
- return OPropertyContainer::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue);
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OGeometryControlModel_Base::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (Exception)
- {
- OPropertyContainer::setFastPropertyValue_NoBroadcast(_nHandle, _rValue);
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OGeometryControlModel_Base::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
- {
- OPropertyArrayAggregationHelper& rPH = static_cast<OPropertyArrayAggregationHelper&>(const_cast<OGeometryControlModel_Base*>(this)->getInfoHelper());
- ::rtl::OUString sPropName;
- sal_Int32 nOriginalHandle = -1;
-
- if (rPH.fillAggregatePropertyInfoByHandle(&sPropName, &nOriginalHandle, _nHandle))
- OPropertySetAggregationHelper::getFastPropertyValue(_rValue, _nHandle);
- else
- OPropertyContainer::getFastPropertyValue(_rValue, _nHandle);
- }
-
- //--------------------------------------------------------------------
- ::com::sun::star::beans::PropertyState OGeometryControlModel_Base::getPropertyStateByHandle(sal_Int32 nHandle)
- {
- ::com::sun::star::uno::Any aValue = ImplGetPropertyValueByHandle( nHandle );
- ::com::sun::star::uno::Any aDefault = ImplGetDefaultValueByHandle( nHandle );
-
- return CompareProperties( aValue, aDefault ) ? ::com::sun::star::beans::PropertyState_DEFAULT_VALUE : ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
- }
-
- //--------------------------------------------------------------------
- void OGeometryControlModel_Base::setPropertyToDefaultByHandle(sal_Int32 nHandle)
- {
- ImplSetPropertyValueByHandle( nHandle , ImplGetDefaultValueByHandle( nHandle ) );
- }
-
- //--------------------------------------------------------------------
- ::com::sun::star::uno::Any OGeometryControlModel_Base::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
- {
- return ImplGetDefaultValueByHandle( nHandle );
- }
-
- //--------------------------------------------------------------------
- Reference< XPropertySetInfo> SAL_CALL OGeometryControlModel_Base::getPropertySetInfo() throw(RuntimeException)
- {
- return OPropertySetAggregationHelper::createPropertySetInfo(getInfoHelper());
- }
-
- //--------------------------------------------------------------------
- Reference< XCloneable > SAL_CALL OGeometryControlModel_Base::createClone( ) throw(RuntimeException)
- {
- OSL_ENSURE(m_bCloneable, "OGeometryControlModel_Base::createClone: invalid call!");
- if (!m_bCloneable)
- return Reference< XCloneable >();
-
- // let the aggregate create it's own clone
- // the interface
- Reference< XCloneable > xCloneAccess;
- m_xAggregate->queryAggregation(::getCppuType(&xCloneAccess)) >>= xCloneAccess;
- OSL_ENSURE(xCloneAccess.is(), "OGeometryControlModel_Base::createClone: suspicious aggregate!");
- if (!xCloneAccess.is())
- return Reference< XCloneable >();
- // the aggregate's clone
- Reference< XCloneable > xAggregateClone = xCloneAccess->createClone();
- OSL_ENSURE(xAggregateClone.is(), "OGeometryControlModel_Base::createClone: suspicious return of the aggregate!");
-
- // create a new wrapper aggregating this return value
- OGeometryControlModel_Base* pOwnClone = createClone_Impl(xAggregateClone);
- OSL_ENSURE(pOwnClone, "OGeometryControlModel_Base::createClone: invalid derivee behaviour!");
- OSL_ENSURE(!xAggregateClone.is(), "OGeometryControlModel_Base::createClone: invalid ctor behaviour!");
- // should have been reset
-
- // set properties
- pOwnClone->m_nPosX = m_nPosX;
- pOwnClone->m_nPosY = m_nPosY;
- pOwnClone->m_nWidth = m_nWidth;
- pOwnClone->m_nHeight = m_nHeight;
- pOwnClone->m_aName = m_aName;
- pOwnClone->m_nTabIndex = m_nTabIndex;
- pOwnClone->m_nStep = m_nStep;
- pOwnClone->m_aTag = m_aTag;
-
-
- // Clone event container
- Reference< ::com::sun::star::script::XScriptEventsSupplier > xEventsSupplier =
- static_cast< ::com::sun::star::script::XScriptEventsSupplier* >( this );
- Reference< ::com::sun::star::script::XScriptEventsSupplier > xCloneEventsSupplier =
- static_cast< ::com::sun::star::script::XScriptEventsSupplier* >( pOwnClone );
-
- if( xEventsSupplier.is() && xCloneEventsSupplier.is() )
- {
- Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents();
- Reference< XNameContainer > xCloneEventCont = xCloneEventsSupplier->getEvents();
-
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames =
- xEventCont->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_Int32 i, nNameCount = aNames.getLength();
-
- for( i = 0 ; i < nNameCount ; i++ )
- {
- ::rtl::OUString aName = pNames[ i ];
- ::com::sun::star::uno::Any aElement = xEventCont->getByName( aName );
- xCloneEventCont->insertByName( aName, aElement );
- }
- }
-
- return pOwnClone;
- }
-
- //--------------------------------------------------------------------
- Reference< XNameContainer > SAL_CALL OGeometryControlModel_Base::getEvents() throw(RuntimeException)
- {
- if( !mxEventContainer.is() )
- mxEventContainer = (XNameContainer*)new toolkit::ScriptEventContainer();
- return mxEventContainer;
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OGeometryControlModel_Base::disposing()
- {
- OGCM_Base::disposing();
- OPropertySetAggregationHelper::disposing();
-
- Reference<XComponent> xComp;
- if ( query_aggregation( m_xAggregate, xComp ) )
- xComp->dispose();
- }
-
- //====================================================================
- //= OCommonGeometryControlModel
- //====================================================================
- //--------------------------------------------------------------------
-
- typedef ::boost::unordered_map< ::rtl::OUString, sal_Int32, ::rtl::OUStringHash > HashMapString2Int;
- typedef ::std::vector< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > > PropSeqArray;
- typedef ::std::vector< ::std::vector< sal_Int32 > > IntArrayArray;
-
- // for creating class-unique PropertySetInfo's, we need some info:
- namespace { struct ServiceSpecifierMap : public rtl::Static< HashMapString2Int, ServiceSpecifierMap > {}; }
- // this one maps from a String, which is the service specifier for our
- // aggregate, to a unique id
-
- namespace { struct AggregateProperties : public rtl::Static< PropSeqArray, AggregateProperties > {}; }
- // this one contains the properties which belong to all the unique ids
- // in ServiceSpecifierMap
-
- namespace { struct AmbiguousPropertyIds : public rtl::Static< IntArrayArray, AmbiguousPropertyIds > {}; }
- // the ids of the properties which we as well as our aggregate supply
- // For such props, we let our base class handle them, and whenever such
- // a prop is set, we forward this to our aggregate.
-
- // With this, we can ensure that two instances of this class share the
- // same PropertySetInfo if and only if both aggregates have the same
- // service specifier.
-
-
- //--------------------------------------------------------------------
- OCommonGeometryControlModel::OCommonGeometryControlModel( Reference< XCloneable >& _rxAgg, const ::rtl::OUString& _rServiceSpecifier )
- :OGeometryControlModel_Base( _rxAgg )
- ,m_sServiceSpecifier( _rServiceSpecifier )
- ,m_nPropertyMapId( 0 )
- {
- Reference< XPropertySetInfo > xPI;
- if ( m_xAggregateSet.is() )
- xPI = m_xAggregateSet->getPropertySetInfo();
- if ( !xPI.is() )
- {
- releaseAggregation();
- throw IllegalArgumentException();
- }
-
- HashMapString2Int &rMap = ServiceSpecifierMap::get();
- HashMapString2Int::iterator aPropMapIdPos = rMap.find( m_sServiceSpecifier );
- if ( rMap.end() == aPropMapIdPos )
- {
- PropSeqArray &rAggProperties = AggregateProperties::get();
- m_nPropertyMapId = rAggProperties.size();
- rAggProperties.push_back( xPI->getProperties() );
- AmbiguousPropertyIds::get().push_back( IntArrayArray::value_type() );
-
- rMap[ m_sServiceSpecifier ] = m_nPropertyMapId;
- }
- else
- m_nPropertyMapId = aPropMapIdPos->second;
- }
-
- //--------------------------------------------------------------------
- struct PropertyNameLess : public ::std::binary_function< Property, Property, bool >
- {
- bool operator()( const Property& _rLHS, const Property& _rRHS )
- {
- return _rLHS.Name < _rRHS.Name ? true : false;
- }
- };
-
- //--------------------------------------------------------------------
- struct PropertyNameEqual : public ::std::unary_function< Property, bool >
- {
- const ::rtl::OUString& m_rCompare;
- PropertyNameEqual( const ::rtl::OUString& _rCompare ) : m_rCompare( _rCompare ) { }
-
- bool operator()( const Property& _rLHS )
- {
- return _rLHS.Name == m_rCompare ? true : false;
- }
- };
-
- //--------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper* OCommonGeometryControlModel::createArrayHelper( sal_Int32 _nId ) const
- {
- OSL_ENSURE( _nId == m_nPropertyMapId, "OCommonGeometryControlModel::createArrayHelper: invalid argument!" );
- OSL_ENSURE( _nId < (sal_Int32)AggregateProperties::get().size(), "OCommonGeometryControlModel::createArrayHelper: invalid status info (1)!" );
- OSL_ENSURE( _nId < (sal_Int32)AmbiguousPropertyIds::get().size(), "OCommonGeometryControlModel::createArrayHelper: invalid status info (2)!" );
-
- // our own properties
- Sequence< Property > aProps;
- OPropertyContainer::describeProperties( aProps );
-
- // the aggregate properties
- Sequence< Property > aAggregateProps;
- aAggregateProps = AggregateProperties::get()[ _nId ];
-
- // look for duplicates, and remember them
- IntArrayArray::value_type& rDuplicateIds = AmbiguousPropertyIds::get()[ _nId ];
- // for this, sort the aggregate properties
- ::std::sort(
- aAggregateProps.getArray(),
- aAggregateProps.getArray() + aAggregateProps.getLength(),
- PropertyNameLess()
- );
- const Property* pAggProps = aAggregateProps.getConstArray();
- const Property* pAggPropsEnd = aAggregateProps.getConstArray() + aAggregateProps.getLength();
-
- // now loop through our own props
- const Property* pProp = aProps.getConstArray();
- const Property* pPropEnd = aProps.getConstArray() + aProps.getLength();
- while ( pProp < pPropEnd )
- {
- // look for the current property in the properties of our aggregate
- const Property* pAggPropPos = ::std::find_if( pAggProps, pAggPropsEnd, PropertyNameEqual( pProp->Name ) );
- if ( pAggPropPos != pAggPropsEnd )
- { // found a duplicate
- // -> remove from the aggregate property sequence
- ::comphelper::removeElementAt( aAggregateProps, pAggPropPos - pAggProps );
- // which means we have to adjust the pointers
- pAggProps = aAggregateProps.getConstArray(),
- pAggPropsEnd = aAggregateProps.getConstArray() + aAggregateProps.getLength(),
-
- // and additionally, remember the id of this property
- rDuplicateIds.push_back( pProp->Handle );
- }
-
- ++pProp;
- }
-
- // now, finally, sort the duplicates
- ::std::sort( rDuplicateIds.begin(), rDuplicateIds.end(), ::std::less< sal_Int32 >() );
-
- return new OPropertyArrayAggregationHelper(aProps, aAggregateProps);
- }
-
- //--------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper& SAL_CALL OCommonGeometryControlModel::getInfoHelper()
- {
- return *getArrayHelper( m_nPropertyMapId );
- }
-
- //--------------------------------------------------------------------
- OGeometryControlModel_Base* OCommonGeometryControlModel::createClone_Impl( Reference< XCloneable >& _rxAggregateInstance )
- {
- return new OCommonGeometryControlModel( _rxAggregateInstance, m_sServiceSpecifier );
- }
-
- namespace
- {
- class theOCommonGeometryControlModelImplementationId :
- public rtl::Static< ::cppu::OImplementationId, theOCommonGeometryControlModelImplementationId > {};
- }
-
- //--------------------------------------------------------------------
- Sequence< sal_Int8 > SAL_CALL OCommonGeometryControlModel::getImplementationId( ) throw (RuntimeException)
- {
- return theOCommonGeometryControlModelImplementationId::get().getImplementationId();
- }
-
- //--------------------------------------------------------------------
- struct Int32Equal : public ::std::unary_function< sal_Int32, bool >
- {
- sal_Int32 m_nCompare;
- Int32Equal( sal_Int32 _nCompare ) : m_nCompare( _nCompare ) { }
-
- bool operator()( sal_Int32 _nLHS )
- {
- return _nLHS == m_nCompare ? true : false;
- }
- };
-
- //--------------------------------------------------------------------
- void SAL_CALL OCommonGeometryControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw ( Exception )
- {
- OGeometryControlModel_Base::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
-
- // look if this id is one we recognized as duplicate
- IntArrayArray::value_type& rDuplicateIds = AmbiguousPropertyIds::get()[ m_nPropertyMapId ];
-
- IntArrayArray::value_type::const_iterator aPos = ::std::find_if(
- rDuplicateIds.begin(),
- rDuplicateIds.end(),
- Int32Equal( _nHandle )
- );
-
- if ( rDuplicateIds.end() != aPos )
- {
- // yes, it is such a property
- ::rtl::OUString sPropName;
- sal_Int16 nAttributes(0);
- static_cast< OPropertyArrayAggregationHelper* >( getArrayHelper( m_nPropertyMapId ) )->fillPropertyMembersByHandle( &sPropName, &nAttributes, _nHandle );
-
- if ( m_xAggregateSet.is() && sPropName.getLength() )
- m_xAggregateSet->setPropertyValue( sPropName, _rValue );
- }
- }
-
-//........................................................................
-// } // namespace toolkit
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
deleted file mode 100644
index 5a22a859aa..0000000000
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
+++ /dev/null
@@ -1,394 +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 "defaultgridcolumnmodel.hxx"
-#include "gridcolumn.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-/** === end UNO includes === **/
-
-#include <comphelper/sequence.hxx>
-#include <comphelper/componentguard.hxx>
-#include <toolkit/helper/servicenames.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
-
-//......................................................................................................................
-namespace toolkit
-//......................................................................................................................
-{
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::lang::XMultiServiceFactory;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::awt::grid::XGridColumn;
- using ::com::sun::star::uno::XInterface;
- using ::com::sun::star::lang::XMultiServiceFactory;
- using ::com::sun::star::lang::XComponent;
- using ::com::sun::star::lang::EventObject;
- using ::com::sun::star::container::XContainerListener;
- using ::com::sun::star::container::ContainerEvent;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::lang::IndexOutOfBoundsException;
- using ::com::sun::star::util::XCloneable;
- using ::com::sun::star::lang::IllegalArgumentException;
- /** === end UNO using === **/
-
- //==================================================================================================================
- //= DefaultGridColumnModel
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- DefaultGridColumnModel::DefaultGridColumnModel( const Reference< XMultiServiceFactory >& i_factory )
- :DefaultGridColumnModel_Base( m_aMutex )
- ,m_aContext( i_factory )
- ,m_aContainerListeners( m_aMutex )
- ,m_aColumns()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- DefaultGridColumnModel::DefaultGridColumnModel( DefaultGridColumnModel const & i_copySource )
- :cppu::BaseMutex()
- ,DefaultGridColumnModel_Base( m_aMutex )
- ,m_aContext( i_copySource.m_aContext )
- ,m_aContainerListeners( m_aMutex )
- ,m_aColumns()
- {
- Columns aColumns;
- aColumns.reserve( i_copySource.m_aColumns.size() );
- try
- {
- for ( Columns::const_iterator col = i_copySource.m_aColumns.begin();
- col != i_copySource.m_aColumns.end();
- ++col
- )
- {
- Reference< XCloneable > const xCloneable( *col, UNO_QUERY_THROW );
- Reference< XGridColumn > const xClone( xCloneable->createClone(), UNO_QUERY_THROW );
-
- GridColumn* const pGridColumn = GridColumn::getImplementation( xClone );
- if ( pGridColumn == NULL )
- throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid clone source implementation" ) ), *this );
- // that's indeed a RuntimeException, not an IllegalArgumentException or some such:
- // a DefaultGridColumnModel implementation whose columns are not GridColumn implementations
- // is borked.
- pGridColumn->setIndex( col - i_copySource.m_aColumns.begin() );
-
- aColumns.push_back( xClone );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- if ( aColumns.size() == i_copySource.m_aColumns.size() )
- m_aColumns.swap( aColumns );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- DefaultGridColumnModel::~DefaultGridColumnModel()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (RuntimeException)
- {
- return m_aColumns.size();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XGridColumn > SAL_CALL DefaultGridColumnModel::createColumn( ) throw (RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return new GridColumn();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL DefaultGridColumnModel::addColumn( const Reference< XGridColumn > & i_column ) throw (RuntimeException, IllegalArgumentException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- GridColumn* const pGridColumn = GridColumn::getImplementation( i_column );
- if ( pGridColumn == NULL )
- throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid column implementation" ) ), *this, 1 );
-
- m_aColumns.push_back( i_column );
- sal_Int32 index = m_aColumns.size() - 1;
- pGridColumn->setIndex( index );
-
- // fire insertion notifications
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Accessor <<= index;
- aEvent.Element <<= i_column;
-
- aGuard.clear();
- m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
-
- return index;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridColumnModel::removeColumn( ::sal_Int32 i_columnIndex ) throw (RuntimeException, IndexOutOfBoundsException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- if ( ( i_columnIndex < 0 ) || ( size_t( i_columnIndex ) >= m_aColumns.size() ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-
- Columns::iterator const pos = m_aColumns.begin() + i_columnIndex;
- Reference< XGridColumn > const xColumn( *pos );
- m_aColumns.erase( pos );
-
- // update indexes of all subsequent columns
- sal_Int32 columnIndex( i_columnIndex );
- for ( Columns::iterator updatePos = m_aColumns.begin() + columnIndex;
- updatePos != m_aColumns.end();
- ++updatePos, ++columnIndex
- )
- {
- GridColumn* pColumnImpl = GridColumn::getImplementation( *updatePos );
- ENSURE_OR_CONTINUE( pColumnImpl, "DefaultGridColumnModel::removeColumn: invalid column implementation!" );
- pColumnImpl->setIndex( columnIndex );
- }
-
- // fire removal notifications
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Accessor <<= i_columnIndex;
- aEvent.Element <<= xColumn;
-
- aGuard.clear();
- m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent );
-
- // dispose the removed column
- try
- {
- Reference< XComponent > const xColComp( xColumn, UNO_QUERY_THROW );
- xColComp->dispose();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< Reference< XGridColumn > > SAL_CALL DefaultGridColumnModel::getColumns() throw (RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return ::comphelper::containerToSequence( m_aColumns );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (IndexOutOfBoundsException, RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- if ( index >=0 && index < ((sal_Int32)m_aColumns.size()))
- return m_aColumns[index];
-
- throw IndexOutOfBoundsException();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridColumnModel::setDefaultColumns(sal_Int32 rowElements) throw (RuntimeException)
- {
- ::std::vector< ContainerEvent > aRemovedColumns;
- ::std::vector< ContainerEvent > aInsertedColumns;
-
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- // remove existing columns
- while ( !m_aColumns.empty() )
- {
- const size_t lastColIndex = m_aColumns.size() - 1;
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Accessor <<= sal_Int32( lastColIndex );
- aEvent.Element <<= m_aColumns[ lastColIndex ];
- aRemovedColumns.push_back( aEvent );
-
- m_aColumns.erase( m_aColumns.begin() + lastColIndex );
- }
-
- // add new columns
- for ( sal_Int32 i=0; i<rowElements; ++i )
- {
- ::rtl::Reference< GridColumn > const pGridColumn = new GridColumn();
- Reference< XGridColumn > const xColumn( pGridColumn.get() );
- ::rtl::OUStringBuffer colTitle;
- colTitle.appendAscii( "Column " );
- colTitle.append( i + 1 );
- pGridColumn->setTitle( colTitle.makeStringAndClear() );
- pGridColumn->setColumnWidth( 80 /* APPFONT */ );
- pGridColumn->setFlexibility( 1 );
- pGridColumn->setResizeable( sal_True );
- pGridColumn->setDataColumnIndex( i );
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Accessor <<= i;
- aEvent.Element <<= xColumn;
- aInsertedColumns.push_back( aEvent );
-
- m_aColumns.push_back( xColumn );
- pGridColumn->setIndex( i );
- }
- }
-
- // fire removal notifications
- for ( ::std::vector< ContainerEvent >::const_iterator event = aRemovedColumns.begin();
- event != aRemovedColumns.end();
- ++event
- )
- {
- m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, *event );
- }
-
- // fire insertion notifications
- for ( ::std::vector< ContainerEvent >::const_iterator event = aInsertedColumns.begin();
- event != aInsertedColumns.end();
- ++event
- )
- {
- m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, *event );
- }
-
- // dispose removed columns
- for ( ::std::vector< ContainerEvent >::const_iterator event = aRemovedColumns.begin();
- event != aRemovedColumns.end();
- ++event
- )
- {
- try
- {
- const Reference< XComponent > xColComp( event->Element, UNO_QUERY_THROW );
- xColComp->dispose();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL DefaultGridColumnModel::getImplementationName( ) throw (RuntimeException)
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.DefaultGridColumnModel" ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString& i_serviceName ) throw (RuntimeException)
- {
- const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() );
- for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i )
- if ( aServiceNames[i] == i_serviceName )
- return sal_True;
- return sal_False;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL DefaultGridColumnModel::getSupportedServiceNames( ) throw (RuntimeException)
- {
- const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName_DefaultGridColumnModel ) );
- const Sequence< ::rtl::OUString > aSeq( &aServiceName, 1 );
- return aSeq;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridColumnModel::addContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
- {
- if ( i_listener.is() )
- m_aContainerListeners.addInterface( i_listener );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridColumnModel::removeContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
- {
- if ( i_listener.is() )
- m_aContainerListeners.removeInterface( i_listener );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridColumnModel::disposing()
- {
- DefaultGridColumnModel_Base::disposing();
-
- EventObject aEvent( *this );
- m_aContainerListeners.disposeAndClear( aEvent );
-
- ::osl::MutexGuard aGuard( m_aMutex );
-
- // remove, dispose and clear columns
- while ( !m_aColumns.empty() )
- {
- try
- {
- const Reference< XComponent > xColComponent( m_aColumns[ 0 ], UNO_QUERY_THROW );
- xColComponent->dispose();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- m_aColumns.erase( m_aColumns.begin() );
- }
-
- Columns aEmpty;
- m_aColumns.swap( aEmpty );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XCloneable > SAL_CALL DefaultGridColumnModel::createClone( ) throw (RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return new DefaultGridColumnModel( *this );
- }
-
-//......................................................................................................................
-} // namespace toolkit
-//......................................................................................................................
-
-//----------------------------------------------------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rFactory)
-{
- return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel( _rFactory ) );
-}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
deleted file mode 100644
index 17994b5fea..0000000000
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
+++ /dev/null
@@ -1,100 +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.
- *
- ************************************************************************/
-
-/** === begin UNO includes === **/
-#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
-#include <com/sun/star/awt/grid/XGridColumn.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/style/VerticalAlignment.hpp>
-#include <com/sun/star/util/Color.hpp>
-/** === end UNO includes === **/
-
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase2.hxx>
-#include <comphelper/componentcontext.hxx>
-#include <vector>
-
-namespace comphelper
-{
- class ComponentGuard;
-}
-
-namespace toolkit
-{
-
-//enum broadcast_type { column_added, column_removed, column_changed};
-
-typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::awt::grid::XGridColumnModel
- , ::com::sun::star::lang::XServiceInfo
- > DefaultGridColumnModel_Base;
-
-class DefaultGridColumnModel :public ::cppu::BaseMutex
- ,public DefaultGridColumnModel_Base
-{
-public:
- DefaultGridColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
- DefaultGridColumnModel( DefaultGridColumnModel const & i_copySource );
- virtual ~DefaultGridColumnModel();
-
- // XGridColumnModel
- virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL createColumn( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL removeColumn( ::sal_Int32 i_columnIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XContainer
- virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
-
- // XCloneable
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
-private:
- typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > Columns;
-
- ::comphelper::ComponentContext m_aContext;
- ::cppu::OInterfaceContainerHelper m_aContainerListeners;
- Columns m_aColumns;
-};
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
deleted file mode 100644
index 4be3f1076a..0000000000
--- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx
+++ /dev/null
@@ -1,442 +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 "defaultgriddatamodel.hxx"
-
-#include <comphelper/stlunosequence.hxx>
-#include <comphelper/componentguard.hxx>
-#include <toolkit/helper/servicenames.hxx>
-#include <tools/diagnose_ex.h>
-#include <rtl/ref.hxx>
-
-#include <algorithm>
-
-//......................................................................................................................
-namespace toolkit
-//......................................................................................................................
-{
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::XInterface;
- using ::com::sun::star::lang::XComponent;
- using ::com::sun::star::lang::EventObject;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::util::XCloneable;
- /** === end UNO using === **/
-
- using ::comphelper::stl_begin;
- using ::comphelper::stl_end;
-
- //==================================================================================================================
- //= DefaultGridDataModel
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- DefaultGridDataModel::DefaultGridDataModel()
- :DefaultGridDataModel_Base( m_aMutex )
- ,m_aRowHeaders()
- ,m_nColumnCount(0)
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- DefaultGridDataModel::DefaultGridDataModel( DefaultGridDataModel const & i_copySource )
- :cppu::BaseMutex()
- ,DefaultGridDataModel_Base( m_aMutex )
- ,m_aData( i_copySource.m_aData )
- ,m_aRowHeaders( i_copySource.m_aRowHeaders )
- ,m_nColumnCount( i_copySource.m_nColumnCount )
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- DefaultGridDataModel::~DefaultGridDataModel()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void DefaultGridDataModel::broadcast( GridDataEvent const & i_event,
- void ( SAL_CALL XGridDataListener::*i_listenerMethod )( GridDataEvent const & ), ::comphelper::ComponentGuard & i_instanceLock )
- {
- ::cppu::OInterfaceContainerHelper* pListeners = rBHelper.getContainer( XGridDataListener::static_type() );
- if ( !pListeners )
- return;
-
- i_instanceLock.clear();
- pListeners->notifyEach( i_listenerMethod, i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL DefaultGridDataModel::getRowCount() throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_aData.size();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL DefaultGridDataModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_nColumnCount;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- DefaultGridDataModel::CellData const & DefaultGridDataModel::impl_getCellData_throw( sal_Int32 const i_column, sal_Int32 const i_row ) const
- {
- if ( ( i_row < 0 ) || ( size_t( i_row ) > m_aData.size() )
- || ( i_column < 0 ) || ( i_column > m_nColumnCount )
- )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< DefaultGridDataModel* >( this ) );
-
- RowData const & rRow( m_aData[ i_row ] );
- if ( size_t( i_column ) < rRow.size() )
- return rRow[ i_column ];
-
- static CellData s_aEmpty;
- return s_aEmpty;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- DefaultGridDataModel::RowData& DefaultGridDataModel::impl_getRowDataAccess_throw( sal_Int32 const i_rowIndex, size_t const i_requiredColumnCount )
- {
- OSL_ENSURE( i_requiredColumnCount <= size_t( m_nColumnCount ), "DefaultGridDataModel::impl_getRowDataAccess_throw: invalid column count!" );
- if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-
- RowData& rRowData( m_aData[ i_rowIndex ] );
- if ( rRowData.size() < i_requiredColumnCount )
- rRowData.resize( i_requiredColumnCount );
- return rRowData;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- DefaultGridDataModel::CellData& DefaultGridDataModel::impl_getCellDataAccess_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex )
- {
- if ( ( i_columnIndex < 0 ) || ( i_columnIndex >= m_nColumnCount ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-
- RowData& rRowData( impl_getRowDataAccess_throw( i_rowIndex, size_t( i_columnIndex + 1 ) ) );
- return rRowData[ i_columnIndex ];
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Any SAL_CALL DefaultGridDataModel::getCellData( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return impl_getCellData_throw( i_column, i_row ).first;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Any SAL_CALL DefaultGridDataModel::getCellToolTip( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return impl_getCellData_throw( i_column, i_row ).second;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Any SAL_CALL DefaultGridDataModel::getRowHeading( ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- if ( ( i_row < 0 ) || ( size_t( i_row ) >= m_aRowHeaders.size() ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-
- return m_aRowHeaders[ i_row ];
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::addRow( const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- sal_Int32 const columnCount = i_data.getLength();
-
- // store header name
- m_aRowHeaders.push_back( i_heading );
-
- // store row m_aData
- impl_addRow( i_data );
-
- // update column count
- if ( columnCount > m_nColumnCount )
- m_nColumnCount = columnCount;
-
- sal_Int32 const rowIndex = sal_Int32( m_aData.size() - 1 );
- broadcast(
- GridDataEvent( *this, -1, -1, rowIndex, rowIndex ),
- &XGridDataListener::rowsInserted,
- aGuard
- );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void DefaultGridDataModel::impl_addRow( Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount )
- {
- OSL_PRECOND( ( i_assumedColCount <= 0 ) || ( i_assumedColCount >= i_rowData.getLength() ),
- "DefaultGridDataModel::impl_addRow: invalid column count!" );
-
- RowData newRow( i_assumedColCount > 0 ? i_assumedColCount : i_rowData.getLength() );
- RowData::iterator cellData = newRow.begin();
- for ( const Any* pData = stl_begin( i_rowData ); pData != stl_end( i_rowData ); ++pData, ++cellData )
- cellData->first = *pData;
-
- m_aData.push_back( newRow );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::addRows( const Sequence< Any >& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, RuntimeException)
- {
- if ( i_headings.getLength() != i_data.getLength() )
- throw IllegalArgumentException( ::rtl::OUString(), *this, -1 );
-
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- sal_Int32 const rowCount = i_headings.getLength();
- if ( rowCount == 0 )
- return;
-
- // determine max col count in the new data
- sal_Int32 maxColCount = 0;
- for ( sal_Int32 row=0; row<rowCount; ++row )
- if ( i_data[row].getLength() > maxColCount )
- maxColCount = i_data[row].getLength();
-
- if ( maxColCount < m_nColumnCount )
- maxColCount = m_nColumnCount;
-
- for ( sal_Int32 row=0; row<rowCount; ++row )
- {
- m_aRowHeaders.push_back( i_headings[row] );
- impl_addRow( i_data[row], maxColCount );
- }
-
- if ( maxColCount > m_nColumnCount )
- m_nColumnCount = maxColCount;
-
- sal_Int32 const firstRow = sal_Int32( m_aData.size() - rowCount );
- sal_Int32 const lastRow = sal_Int32( m_aData.size() - 1 );
- broadcast(
- GridDataEvent( *this, -1, -1, firstRow, lastRow ),
- &XGridDataListener::rowsInserted,
- aGuard
- );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::removeRow( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-
- m_aRowHeaders.erase( m_aRowHeaders.begin() + i_rowIndex );
- m_aData.erase( m_aData.begin() + i_rowIndex );
-
- broadcast(
- GridDataEvent( *this, -1, -1, i_rowIndex, i_rowIndex ),
- &XGridDataListener::rowsRemoved,
- aGuard
- );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::removeAllRows( ) throw (RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- m_aRowHeaders.clear();
- m_aData.clear();
-
- broadcast(
- GridDataEvent( *this, -1, -1, -1, -1 ),
- &XGridDataListener::rowsRemoved,
- aGuard
- );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::updateCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- impl_getCellDataAccess_throw( i_columnIndex, i_rowIndex ).first = i_value;
-
- broadcast(
- GridDataEvent( *this, i_columnIndex, i_columnIndex, i_rowIndex, i_rowIndex ),
- &XGridDataListener::dataChanged,
- aGuard
- );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::updateRowData( const Sequence< ::sal_Int32 >& i_columnIndexes, ::sal_Int32 i_rowIndex, const Sequence< Any >& i_values ) throw (IndexOutOfBoundsException, IllegalArgumentException, RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-
- if ( i_columnIndexes.getLength() != i_values.getLength() )
- throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
-
- sal_Int32 const columnCount = i_columnIndexes.getLength();
- if ( columnCount == 0 )
- return;
-
- for ( sal_Int32 col = 0; col < columnCount; ++col )
- {
- if ( ( i_columnIndexes[col] < 0 ) || ( i_columnIndexes[col] > m_nColumnCount ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
- }
-
- RowData& rDataRow = m_aData[ i_rowIndex ];
- for ( sal_Int32 col = 0; col < columnCount; ++col )
- {
- sal_Int32 const columnIndex = i_columnIndexes[ col ];
- if ( size_t( columnIndex ) >= rDataRow.size() )
- rDataRow.resize( columnIndex + 1 );
-
- rDataRow[ columnIndex ].first = i_values[ col ];
- }
-
- sal_Int32 const firstAffectedColumn = *::std::min_element( stl_begin( i_columnIndexes ), stl_end( i_columnIndexes ) );
- sal_Int32 const lastAffectedColumn = *::std::max_element( stl_begin( i_columnIndexes ), stl_end( i_columnIndexes ) );
- broadcast(
- GridDataEvent( *this, firstAffectedColumn, lastAffectedColumn, i_rowIndex, i_rowIndex ),
- &XGridDataListener::dataChanged,
- aGuard
- );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::updateRowHeading( ::sal_Int32 i_rowIndex, const Any& i_heading ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aRowHeaders.size() ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-
- m_aRowHeaders[ i_rowIndex ] = i_heading;
-
- broadcast(
- GridDataEvent( *this, -1, -1, i_rowIndex, i_rowIndex ),
- &XGridDataListener::rowHeadingChanged,
- aGuard
- );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::updateCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- impl_getCellDataAccess_throw( i_columnIndex, i_rowIndex ).second = i_value;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::updateRowToolTip( ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
-
- RowData& rRowData = impl_getRowDataAccess_throw( i_rowIndex, m_nColumnCount );
- for ( RowData::iterator cell = rRowData.begin(); cell != rRowData.end(); ++cell )
- cell->second = i_value;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::addGridDataListener( const Reference< grid::XGridDataListener >& i_listener ) throw (RuntimeException)
- {
- rBHelper.addListener( XGridDataListener::static_type(), i_listener );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::removeGridDataListener( const Reference< grid::XGridDataListener >& i_listener ) throw (RuntimeException)
- {
- rBHelper.removeListener( XGridDataListener::static_type(), i_listener );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL DefaultGridDataModel::disposing()
- {
- ::com::sun::star::lang::EventObject aEvent;
- aEvent.Source.set( *this );
- rBHelper.aLC.disposeAndClear( aEvent );
-
- ::osl::MutexGuard aGuard( m_aMutex );
- GridData aEmptyData;
- m_aData.swap( aEmptyData );
-
- ::std::vector< Any > aEmptyRowHeaders;
- m_aRowHeaders.swap( aEmptyRowHeaders );
-
- m_nColumnCount = 0;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL DefaultGridDataModel::getImplementationName( ) throw (RuntimeException)
- {
- static const ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridDataModel" ) );
- return aImplName;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
- {
- return ServiceName.equalsAscii( szServiceName_DefaultGridDataModel );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getSupportedServiceNames( ) throw (RuntimeException)
- {
- static const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName_DefaultGridDataModel ) );
- static const Sequence< ::rtl::OUString > aSeq( &aServiceName, 1 );
- return aSeq;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XCloneable > SAL_CALL DefaultGridDataModel::createClone( ) throw (RuntimeException)
- {
- return new DefaultGridDataModel( *this );
- }
-
-//......................................................................................................................
-} // namespace toolkit
-//......................................................................................................................
-
-Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
-{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel() );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
deleted file mode 100644
index aa6ef6b184..0000000000
--- a/toolkit/source/controls/grid/defaultgriddatamodel.hxx
+++ /dev/null
@@ -1,121 +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 <com/sun/star/awt/grid/XMutableGridDataModel.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase2.hxx>
-#include <toolkit/helper/mutexandbroadcasthelper.hxx>
-
-#include <vector>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::awt::grid;
-using namespace ::com::sun::star::lang;
-
-namespace comphelper
-{
- class ComponentGuard;
-}
-
-namespace toolkit
-{
-
-enum broadcast_type { row_added, row_removed, data_changed};
-
-typedef ::cppu::WeakComponentImplHelper2 < XMutableGridDataModel
- , XServiceInfo
- > DefaultGridDataModel_Base;
-
-class DefaultGridDataModel :public ::cppu::BaseMutex
- ,public DefaultGridDataModel_Base
-{
-public:
- DefaultGridDataModel();
- DefaultGridDataModel( DefaultGridDataModel const & i_copySource );
- virtual ~DefaultGridDataModel();
-
- // XMutableGridDataModel
- virtual void SAL_CALL addRow( const Any& i_heading, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Data ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& Headings, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& Data ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeRow( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeAllRows( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateCellData( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRowData( const ::com::sun::star::uno::Sequence< ::sal_Int32 >& ColumnIndexes, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRowHeading( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Heading ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateCellToolTip( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRowToolTip( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
-
- // XGridDataModel
- virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getCellToolTip( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getRowHeading( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
- // XCloneable
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
- virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
-
-private:
- typedef ::std::pair< Any, Any > CellData;
- typedef ::std::vector< CellData > RowData;
- typedef ::std::vector< RowData > GridData;
-
- void broadcast(
- GridDataEvent const & i_event,
- void ( SAL_CALL ::com::sun::star::awt::grid::XGridDataListener::*i_listenerMethod )( ::com::sun::star::awt::grid::GridDataEvent const & ),
- ::comphelper::ComponentGuard & i_instanceLock
- );
-
- void impl_addRow( Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount = -1 );
-
- CellData const & impl_getCellData_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex ) const;
- CellData& impl_getCellDataAccess_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex );
- RowData& impl_getRowDataAccess_throw( sal_Int32 const i_rowIndex, size_t const i_requiredColumnCount );
-
- GridData m_aData;
- ::std::vector< ::com::sun::star::uno::Any > m_aRowHeaders;
- sal_Int32 m_nColumnCount;
-};
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
deleted file mode 100644
index 4476e69154..0000000000
--- a/toolkit/source/controls/grid/gridcolumn.cxx
+++ /dev/null
@@ -1,331 +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 "gridcolumn.hxx"
-
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <toolkit/helper/servicenames.hxx>
-
-namespace toolkit
-{
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::awt;
- using namespace ::com::sun::star::awt::grid;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::util;
- using namespace ::com::sun::star::style;
-
- //==================================================================================================================
- //= DefaultGridColumnModel
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- GridColumn::GridColumn()
- :GridColumn_Base( m_aMutex )
- ,m_aIdentifier()
- ,m_nIndex(-1)
- ,m_nDataColumnIndex(-1)
- ,m_nColumnWidth(4)
- ,m_nMaxWidth(0)
- ,m_nMinWidth(0)
- ,m_nFlexibility(1)
- ,m_bResizeable(true)
- ,m_eHorizontalAlign( HorizontalAlignment_LEFT )
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- GridColumn::GridColumn( GridColumn const & i_copySource )
- :cppu::BaseMutex()
- ,GridColumn_Base( m_aMutex )
- ,m_aIdentifier( i_copySource.m_aIdentifier )
- ,m_nIndex( -1 )
- ,m_nDataColumnIndex( i_copySource.m_nDataColumnIndex )
- ,m_nColumnWidth( i_copySource.m_nColumnWidth )
- ,m_nMaxWidth( i_copySource.m_nMaxWidth )
- ,m_nMinWidth( i_copySource.m_nMinWidth )
- ,m_nFlexibility( i_copySource.m_nFlexibility )
- ,m_bResizeable( i_copySource.m_bResizeable )
- ,m_sTitle( i_copySource.m_sTitle )
- ,m_sHelpText( i_copySource.m_sHelpText )
- ,m_eHorizontalAlign( i_copySource.m_eHorizontalAlign )
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- GridColumn::~GridColumn()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void GridColumn::broadcast_changed( sal_Char const * const i_asciiAttributeName, Any i_oldValue, Any i_newValue,
- ::comphelper::ComponentGuard& i_Guard )
- {
- Reference< XInterface > const xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent const aEvent(
- xSource, ::rtl::OUString::createFromAscii( i_asciiAttributeName ),
- i_oldValue, i_newValue, m_nIndex
- );
-
- ::cppu::OInterfaceContainerHelper* pIter = rBHelper.getContainer( XGridColumnListener::static_type() );
-
- i_Guard.clear();
- if( pIter )
- pIter->notifyEach( &XGridColumnListener::columnChanged, aEvent );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::com::sun::star::uno::Any SAL_CALL GridColumn::getIdentifier() throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_aIdentifier;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- m_aIdentifier = value;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_nColumnWidth;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
- {
- impl_set( m_nColumnWidth, value, "ColumnWidth" );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL GridColumn::getMaxWidth() throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_nMaxWidth;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
- {
- impl_set( m_nMaxWidth, value, "MaxWidth" );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL GridColumn::getMinWidth() throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_nMinWidth;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
- {
- impl_set( m_nMinWidth, value, "MinWidth" );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL GridColumn::getTitle() throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_sTitle;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException)
- {
- impl_set( m_sTitle, value, "Title" );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL GridColumn::getHelpText() throw (RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_sHelpText;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setHelpText( const ::rtl::OUString & value ) throw (RuntimeException)
- {
- impl_set( m_sHelpText, value, "HelpText" );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- sal_Bool SAL_CALL GridColumn::getResizeable() throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_bResizeable;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
- {
- impl_set( m_bResizeable, value, "Resizeable" );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL GridColumn::getFlexibility() throw (RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_nFlexibility;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setFlexibility( ::sal_Int32 i_value ) throw (IllegalArgumentException, RuntimeException)
- {
- if ( i_value < 0 )
- throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
- impl_set( m_nFlexibility, i_value, "Flexibility" );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_eHorizontalAlign;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException)
- {
- impl_set( m_eHorizontalAlign, align, "HorizontalAlign" );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::addGridColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
- {
- rBHelper.addListener( XGridColumnListener::static_type(), xListener );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::removeGridColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
- {
- rBHelper.removeListener( XGridColumnListener::static_type(), xListener );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::disposing()
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- m_aIdentifier.clear();
- m_sTitle = m_sHelpText = ::rtl::OUString();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL GridColumn::getIndex() throw (RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_nIndex;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void GridColumn::setIndex( sal_Int32 const i_index )
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- m_nIndex = i_index;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL GridColumn::getDataColumnIndex() throw(RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_nDataColumnIndex;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(RuntimeException)
- {
- impl_set( m_nDataColumnIndex, i_dataColumnIndex, "DataColumnIndex" );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL GridColumn::getImplementationName( ) throw (RuntimeException)
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.GridColumn" ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- sal_Bool SAL_CALL GridColumn::supportsService( const ::rtl::OUString& i_serviceName ) throw (RuntimeException)
- {
- const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() );
- for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i )
- if ( aServiceNames[i] == i_serviceName )
- return sal_True;
- return sal_False;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GridColumn::getSupportedServiceNames( ) throw (RuntimeException)
- {
- const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName_GridColumn ) );
- const Sequence< ::rtl::OUString > aSeq( &aServiceName, 1 );
- return aSeq;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XCloneable > SAL_CALL GridColumn::createClone( ) throw (RuntimeException)
- {
- return new GridColumn( *this );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- sal_Int64 SAL_CALL GridColumn::getSomething( const Sequence< sal_Int8 >& i_identifier ) throw(RuntimeException)
- {
- if ( ( i_identifier.getLength() == 16 ) && ( i_identifier == getUnoTunnelId() ) )
- return ::sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) );
- return 0;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< sal_Int8 > GridColumn::getUnoTunnelId() throw()
- {
- static ::cppu::OImplementationId const aId;
- return aId.getImplementationId();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- GridColumn* GridColumn::getImplementation( const Reference< XInterface >& i_component )
- {
- Reference< XUnoTunnel > const xTunnel( i_component, UNO_QUERY );
- if ( xTunnel.is() )
- return reinterpret_cast< GridColumn* >( ::sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( getUnoTunnelId() ) ) );
- return NULL;
- }
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridColumn_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
-{
- return *( new ::toolkit::GridColumn );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx
deleted file mode 100644
index d2727dacab..0000000000
--- a/toolkit/source/controls/grid/gridcolumn.hxx
+++ /dev/null
@@ -1,138 +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 <com/sun/star/awt/grid/XGridColumn.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/style/HorizontalAlignment.hpp>
-
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase3.hxx>
-#include <comphelper/componentguard.hxx>
-#include <rtl/ref.hxx>
-#include <toolkit/helper/mutexandbroadcasthelper.hxx>
-
-#include <vector>
-
-namespace toolkit
-{
-
-typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::awt::grid::XGridColumn
- , ::com::sun::star::lang::XServiceInfo
- , ::com::sun::star::lang::XUnoTunnel
- > GridColumn_Base;
-class GridColumn :public ::cppu::BaseMutex
- ,public GridColumn_Base
-{
-public:
- GridColumn();
- GridColumn( GridColumn const & i_copySource );
- virtual ~GridColumn();
-
- // ::com::sun::star::awt::grid::XGridColumn
- virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setResizeable(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getFlexibility() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setFlexibility( ::sal_Int32 _flexibility ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getHelpText() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setHelpText(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getDataColumnIndex() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
- // XCloneable (base of XGridColumn)
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XUnoTunnel and friends
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& i_identifier ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelId() throw();
- static GridColumn* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_component );
-
- // attribute access
- void setIndex( sal_Int32 const i_index );
-
-private:
- void broadcast_changed(
- sal_Char const * const i_asciiAttributeName,
- ::com::sun::star::uno::Any i_oldValue,
- ::com::sun::star::uno::Any i_newValue,
- ::comphelper::ComponentGuard& i_Guard
- );
-
- template< class TYPE >
- void impl_set( TYPE & io_attribute, TYPE const & i_newValue, sal_Char const * i_attributeName )
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- if ( io_attribute == i_newValue )
- return;
-
- TYPE const aOldValue( io_attribute );
- io_attribute = i_newValue;
- broadcast_changed( i_attributeName, ::com::sun::star::uno::makeAny( aOldValue ), ::com::sun::star::uno::makeAny( io_attribute ), aGuard );
- }
-
- ::com::sun::star::uno::Any m_aIdentifier;
- sal_Int32 m_nIndex;
- sal_Int32 m_nDataColumnIndex;
- sal_Int32 m_nColumnWidth;
- sal_Int32 m_nMaxWidth;
- sal_Int32 m_nMinWidth;
- sal_Int32 m_nFlexibility;
- sal_Bool m_bResizeable;
- ::rtl::OUString m_sTitle;
- ::rtl::OUString m_sHelpText;
- ::com::sun::star::style::HorizontalAlignment m_eHorizontalAlign;
-};
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
deleted file mode 100644
index 69fb1e1f4f..0000000000
--- a/toolkit/source/controls/grid/gridcontrol.cxx
+++ /dev/null
@@ -1,456 +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 "gridcontrol.hxx"
-#include "grideventforwarder.hxx"
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/view/SelectionType.hpp>
-#include <com/sun/star/awt/grid/XGridDataModel.hpp>
-#include <com/sun/star/awt/grid/XMutableGridDataModel.hpp>
-#include <com/sun/star/awt/grid/DefaultGridDataModel.hpp>
-#include <com/sun/star/awt/grid/SortableGridDataModel.hpp>
-#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
-#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/helper/property.hxx>
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#include <comphelper/processfactory.hxx>
-#include <tools/diagnose_ex.h>
-#include <tools/color.hxx>
-
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::awt::grid;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::view;
-
-namespace toolkit
-{
-//======================================================================================================================
-//= UnoGridModel
-//======================================================================================================================
-namespace
-{
- Reference< XGridDataModel > lcl_getDefaultDataModel_throw( ::comphelper::ComponentContext const & i_context )
- {
- Reference< XMutableGridDataModel > const xDelegatorModel( DefaultGridDataModel::create( i_context.getUNOContext() ), UNO_QUERY_THROW );
- Reference< XGridDataModel > const xDataModel( SortableGridDataModel::create( i_context.getUNOContext(), xDelegatorModel ), UNO_QUERY_THROW );
- return xDataModel;
- }
-
- Reference< XGridColumnModel > lcl_getDefaultColumnModel_throw( ::comphelper::ComponentContext const & i_context )
- {
- Reference< XGridColumnModel > const xColumnModel( i_context.createComponent( "com.sun.star.awt.grid.DefaultGridColumnModel" ), UNO_QUERY_THROW );
- return xColumnModel;
- }
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-UnoGridModel::UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_SIZEABLE ); // resizeable
- ImplRegisterProperty( BASEPROPERTY_HSCROLL );
- ImplRegisterProperty( BASEPROPERTY_VSCROLL );
- ImplRegisterProperty( BASEPROPERTY_TABSTOP );
- ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER );
- ImplRegisterProperty( BASEPROPERTY_ROW_HEADER_WIDTH );
- ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER );
- ImplRegisterProperty( BASEPROPERTY_COLUMN_HEADER_HEIGHT );
- ImplRegisterProperty( BASEPROPERTY_ROW_HEIGHT );
- ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL, makeAny( lcl_getDefaultDataModel_throw( maContext ) ) );
- ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL, makeAny( lcl_getDefaultColumnModel_throw( maContext ) ) );
- ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE );
- ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
- ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
- ImplRegisterProperty( BASEPROPERTY_TEXTLINECOLOR );
- ImplRegisterProperty( BASEPROPERTY_USE_GRID_LINES );
- ImplRegisterProperty( BASEPROPERTY_GRID_LINE_COLOR );
- ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND );
- ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_TEXT_COLOR );
- ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS );
- ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-UnoGridModel::UnoGridModel( const UnoGridModel& rModel )
- :UnoControlModel( rModel )
-{
- osl_incrementInterlockedCount( &m_refCount );
- {
- Reference< XGridDataModel > xDataModel;
- // clone the data model
- const Reference< XFastPropertySet > xCloneSource( &const_cast< UnoGridModel& >( rModel ) );
- try
- {
- const Reference< XCloneable > xCloneable( xCloneSource->getFastPropertyValue( BASEPROPERTY_GRID_DATAMODEL ), UNO_QUERY_THROW );
- xDataModel.set( xCloneable->createClone(), UNO_QUERY_THROW );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- if ( !xDataModel.is() )
- xDataModel = lcl_getDefaultDataModel_throw( maContext );
- UnoControlModel::setFastPropertyValue_NoBroadcast( BASEPROPERTY_GRID_DATAMODEL, makeAny( xDataModel ) );
- // do *not* use setFastPropertyValue here: The UnoControlModel ctor did a simple copy of all property values,
- // so before this call here, we share our data model with the own of the clone source. setFastPropertyValue,
- // then, disposes the old data model - which means the data model which in fact belongs to the clone source.
- // so, call the UnoControlModel's impl-method for setting the value.
-
- // clone the column model
- Reference< XGridColumnModel > xColumnModel;
- try
- {
- const Reference< XCloneable > xCloneable( xCloneSource->getFastPropertyValue( BASEPROPERTY_GRID_COLUMNMODEL ), UNO_QUERY_THROW );
- xColumnModel.set( xCloneable->createClone(), UNO_QUERY_THROW );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- if ( !xColumnModel.is() )
- xColumnModel = lcl_getDefaultColumnModel_throw( maContext );
- UnoControlModel::setFastPropertyValue_NoBroadcast( BASEPROPERTY_GRID_COLUMNMODEL, makeAny( xColumnModel ) );
- // same comment as above: do not use our own setPropertyValue here.
- }
- osl_decrementInterlockedCount( &m_refCount );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-UnoControlModel* UnoGridModel::Clone() const
-{
- return new UnoGridModel( *this );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-namespace
-{
- void lcl_dispose_nothrow( const Any& i_component )
- {
- try
- {
- const Reference< XComponent > xComponent( i_component, UNO_QUERY_THROW );
- xComponent->dispose();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridModel::dispose( ) throw(RuntimeException)
-{
- lcl_dispose_nothrow( getFastPropertyValue( BASEPROPERTY_GRID_COLUMNMODEL ) );
- lcl_dispose_nothrow( getFastPropertyValue( BASEPROPERTY_GRID_DATAMODEL ) );
-
- UnoControlModel::dispose();
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
-{
- Any aOldSubModel;
- if ( ( nHandle == BASEPROPERTY_GRID_COLUMNMODEL ) || ( nHandle == BASEPROPERTY_GRID_DATAMODEL ) )
- {
- aOldSubModel = getFastPropertyValue( nHandle );
- if ( aOldSubModel == rValue )
- {
- OSL_ENSURE( false, "UnoGridModel::setFastPropertyValue_NoBroadcast: setting the same value, again!" );
- // shouldn't this have been caught by convertFastPropertyValue?
- aOldSubModel.clear();
- }
- }
-
- UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-
- if ( aOldSubModel.hasValue() )
- lcl_dispose_nothrow( aOldSubModel );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-OUString UnoGridModel::getServiceName() throw(RuntimeException)
-{
- return OUString::createFromAscii( szServiceName_GridControlModel );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- switch( nPropId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_GridControl ) );
- case BASEPROPERTY_GRID_SELECTIONMODE:
- return uno::makeAny( SelectionType(1) );
- case BASEPROPERTY_GRID_SHOWROWHEADER:
- case BASEPROPERTY_USE_GRID_LINES:
- return uno::makeAny( (sal_Bool)sal_False );
- case BASEPROPERTY_ROW_HEADER_WIDTH:
- return uno::makeAny( sal_Int32( 10 ) );
- case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
- return uno::makeAny( (sal_Bool)sal_True );
- case BASEPROPERTY_COLUMN_HEADER_HEIGHT:
- case BASEPROPERTY_ROW_HEIGHT:
- case BASEPROPERTY_GRID_HEADER_BACKGROUND:
- case BASEPROPERTY_GRID_HEADER_TEXT_COLOR:
- case BASEPROPERTY_GRID_LINE_COLOR:
- case BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS:
- return Any();
- default:
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
-
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& UnoGridModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-// XMultiPropertySet
-Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(RuntimeException)
-{
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-//======================================================================================================================
-//= UnoGridControl
-//======================================================================================================================
-UnoGridControl::UnoGridControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoGridControl_Base( i_factory )
- ,mSelectionMode(SelectionType(1))
- ,m_aSelectionListeners( *this )
- ,m_pEventForwarder( new GridEventForwarder( *this ) )
-{
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-UnoGridControl::~UnoGridControl()
-{
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-OUString UnoGridControl::GetComponentServiceName()
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("Grid"));
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- m_aSelectionListeners.disposeAndClear( aEvt );
- UnoControl::dispose();
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoControlBase::createPeer( rxToolkit, rParentPeer );
-
- const Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
- xGrid->addSelectionListener(&m_aSelectionListeners);
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-namespace
-{
- void lcl_setEventForwarding( const Reference< XControlModel >& i_gridControlModel, const ::boost::scoped_ptr< GridEventForwarder >& i_listener,
- bool const i_add )
- {
- const Reference< XPropertySet > xModelProps( i_gridControlModel, UNO_QUERY );
- if ( !xModelProps.is() )
- return;
-
- try
- {
- Reference< XContainer > const xColModel(
- xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnModel" ) ) ),
- UNO_QUERY_THROW );
- if ( i_add )
- xColModel->addContainerListener( i_listener.get() );
- else
- xColModel->removeContainerListener( i_listener.get() );
-
- Reference< XGridDataModel > const xDataModel(
- xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridDataModel" ) ) ),
- UNO_QUERY_THROW
- );
- Reference< XMutableGridDataModel > const xMutableDataModel( xDataModel, UNO_QUERY );
- if ( xMutableDataModel.is() )
- {
- if ( i_add )
- xMutableDataModel->addGridDataListener( i_listener.get() );
- else
- xMutableDataModel->removeGridDataListener( i_listener.get() );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-sal_Bool SAL_CALL UnoGridControl::setModel( const Reference< XControlModel >& i_model ) throw(RuntimeException)
-{
- lcl_setEventForwarding( getModel(), m_pEventForwarder, false );
- if ( !UnoGridControl_Base::setModel( i_model ) )
- return sal_False;
- lcl_setEventForwarding( getModel(), m_pEventForwarder, true );
- return sal_True;
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-::sal_Int32 UnoGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
- return xGrid->getRowAtPoint( x, y );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-::sal_Int32 UnoGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
- return xGrid->getColumnAtPoint( x, y );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-::sal_Int32 SAL_CALL UnoGridControl::getCurrentColumn( ) throw (RuntimeException)
-{
- Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
- return xGrid->getCurrentColumn();
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-::sal_Int32 SAL_CALL UnoGridControl::getCurrentRow( ) throw (RuntimeException)
-{
- Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
- return xGrid->getCurrentRow();
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRow( i_rowIndex );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectAllRows();
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRow( i_rowIndex );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectAllRows();
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
-{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-::sal_Bool SAL_CALL UnoGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
-{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectionEmpty();
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-::sal_Bool SAL_CALL UnoGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
-{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
-{
- m_aSelectionListeners.addInterface( listener );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
-{
- m_aSelectionListeners.removeInterface( listener );
-}
-
-}//namespace toolkit
-
-Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
-{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridControl( i_factory ) );
-}
-
-Reference< XInterface > SAL_CALL GridControlModel_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
-{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridModel( i_factory ) );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
deleted file mode 100644
index 6c1dcac029..0000000000
--- a/toolkit/source/controls/grid/gridcontrol.hxx
+++ /dev/null
@@ -1,135 +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_GRID_CONTROL_HXX
-#define TOOLKIT_GRID_CONTROL_HXX
-
-#include <com/sun/star/awt/grid/XGridControl.hpp>
-#include <com/sun/star/view/SelectionType.hpp>
-
-#include <toolkit/controls/unocontrolbase.hxx>
-#include <toolkit/controls/unocontrolmodel.hxx>
-#include <toolkit/helper/servicenames.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <comphelper/sequence.hxx>
-#include <toolkit/helper/listenermultiplexer.hxx>
-
-#include <boost/scoped_ptr.hpp>
-
-namespace toolkit
-{
-
-class GridEventForwarder;
-
-// ===================================================================
-// = UnoGridModel
-// ===================================================================
-class UnoGridModel : public UnoControlModel
-{
-protected:
- ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
- ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-
-public:
- UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
- UnoGridModel( const UnoGridModel& rModel );
-
- UnoControlModel* Clone() const;
-
- // ::com::sun::star::lang::XComponent
- void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::beans::XMultiPropertySet
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::io::XPersistObject
- ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-
- // OPropertySetHelper
- void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
-
- // XServiceInfo
- DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel, UnoControlModel, szServiceName_GridControlModel )
-};
-
-
-// ===================================================================
-// = UnoGridControl
-// ===================================================================
-typedef ::cppu::ImplInheritanceHelper1 < UnoControlBase
- , ::com::sun::star::awt::grid::XGridControl
- > UnoGridControl_Base;
-class UnoGridControl : public UnoGridControl_Base
-{
-public:
- UnoGridControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
- ::rtl::OUString GetComponentServiceName();
-
- // ::com::sun::star::lang::XComponent
- void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::awt::XControl
- void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
- sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::awt::grid::XGridControl
- virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::awt::grid::XGridSelection
- virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- DECLIMPL_SERVICEINFO_DERIVED( UnoGridControl, UnoControlBase, szServiceName_GridControl )
-
- using UnoControl::getPeer;
-
-protected:
- ~UnoGridControl();
-
-private:
- ::com::sun::star::view::SelectionType mSelectionMode;
- SelectionListenerMultiplexer m_aSelectionListeners;
- ::boost::scoped_ptr< GridEventForwarder > m_pEventForwarder;
-};
-
-} // toolkit
-
-#endif // _TOOLKIT_TREE_CONTROL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/grideventforwarder.cxx b/toolkit/source/controls/grid/grideventforwarder.cxx
deleted file mode 100644
index 13a22e86e3..0000000000
--- a/toolkit/source/controls/grid/grideventforwarder.cxx
+++ /dev/null
@@ -1,152 +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 "grideventforwarder.hxx"
-#include "gridcontrol.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-//......................................................................................................................
-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::awt::grid::GridDataEvent;
- using ::com::sun::star::container::ContainerEvent;
- using ::com::sun::star::lang::EventObject;
- /** === end UNO using === **/
-
- //==================================================================================================================
- //= GridEventForwarder
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- GridEventForwarder::GridEventForwarder( UnoGridControl& i_parent )
- :m_parent( i_parent )
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- GridEventForwarder::~GridEventForwarder()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridEventForwarder::acquire() throw()
- {
- m_parent.acquire();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridEventForwarder::release() throw()
- {
- m_parent.release();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridEventForwarder::rowsInserted( const GridDataEvent& i_event ) throw (RuntimeException)
- {
- Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
- if ( xPeer.is() )
- xPeer->rowsInserted( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridEventForwarder::rowsRemoved( const GridDataEvent& i_event ) throw (RuntimeException)
- {
- Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
- if ( xPeer.is() )
- xPeer->rowsRemoved( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridEventForwarder::dataChanged( const GridDataEvent& i_event ) throw (RuntimeException)
- {
- Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
- if ( xPeer.is() )
- xPeer->dataChanged( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridEventForwarder::rowHeadingChanged( const GridDataEvent& i_event ) throw (RuntimeException)
- {
- Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
- if ( xPeer.is() )
- xPeer->rowHeadingChanged( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridEventForwarder::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
- {
- Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
- if ( xPeer.is() )
- xPeer->elementInserted( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridEventForwarder::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
- {
- Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
- if ( xPeer.is() )
- xPeer->elementRemoved( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridEventForwarder::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
- {
- Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
- if ( xPeer.is() )
- xPeer->elementReplaced( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridEventForwarder::disposing( const EventObject& i_event ) throw (RuntimeException)
- {
- Reference< XEventListener > xPeer( m_parent.getPeer(), UNO_QUERY );
- if ( xPeer.is() )
- xPeer->disposing( i_event );
- }
-
-//......................................................................................................................
-} // namespace toolkit
-//......................................................................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/grideventforwarder.hxx b/toolkit/source/controls/grid/grideventforwarder.hxx
deleted file mode 100644
index 45254a9d30..0000000000
--- a/toolkit/source/controls/grid/grideventforwarder.hxx
+++ /dev/null
@@ -1,88 +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_GRIDEVENTFORWARDER_HXX
-#define TOOLKIT_GRIDEVENTFORWARDER_HXX
-
-/** === begin UNO includes === **/
-#include <com/sun/star/awt/grid/XGridDataListener.hpp>
-#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
-#include <com/sun/star/container/XContainerListener.hpp>
-/** === end UNO includes === **/
-
-#include <cppuhelper/implbase2.hxx>
-
-//......................................................................................................................
-namespace toolkit
-{
-//......................................................................................................................
-
- class UnoGridControl;
-
- //==================================================================================================================
- //= GridEventForwarder
- //==================================================================================================================
- typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::grid::XGridDataListener
- , ::com::sun::star::container::XContainerListener
- > GridEventForwarder_Base;
-
- class GridEventForwarder : public GridEventForwarder_Base
- {
- public:
- GridEventForwarder( UnoGridControl& i_parent );
- virtual ~GridEventForwarder();
-
- public:
- // XInterface
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // XGridDataListener
- virtual void SAL_CALL rowsInserted( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rowsRemoved( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL dataChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rowHeadingChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
-
- // XContainerListener
- virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
-
- private:
- UnoGridControl& m_parent;
- };
-
-//......................................................................................................................
-} // namespace toolkit
-//......................................................................................................................
-
-#endif // TOOLKIT_GRIDEVENTFORWARDER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/initguard.hxx b/toolkit/source/controls/grid/initguard.hxx
deleted file mode 100644
index 33a8d58c44..0000000000
--- a/toolkit/source/controls/grid/initguard.hxx
+++ /dev/null
@@ -1,67 +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 SVTOOLS_INITGUARD_HXX
-#define SVTOOLS_INITGUARD_HXX
-
-/** === begin UNO includes === **/
-#include <com/sun/star/lang/NotInitializedException.hpp>
-/** === end UNO includes === **/
-
-#include <comphelper/componentguard.hxx>
-
-//......................................................................................................................
-namespace toolkit
-{
-//......................................................................................................................
-
- //==================================================================================================================
- //= InitGuard
- //==================================================================================================================
- template < class IMPL >
- class InitGuard : public ::comphelper::ComponentGuard
- {
- public:
- InitGuard( IMPL& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper )
- :comphelper::ComponentGuard( i_component, i_broadcastHelper )
- {
- if ( !i_component.isInitialized() )
- throw ::com::sun::star::lang::NotInitializedException( ::rtl::OUString(), *&i_component );
- }
-
- ~InitGuard()
- {
- }
- };
-
-//......................................................................................................................
-} // namespace toolkit
-//......................................................................................................................
-
-#endif // SVTOOLS_INITGUARD_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
deleted file mode 100644
index 08675ebc7e..0000000000
--- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx
+++ /dev/null
@@ -1,880 +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 "sortablegriddatamodel.hxx"
-#include "toolkit/helper/servicenames.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/i18n/XCollator.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
-/** === end UNO includes === **/
-
-#include <comphelper/anycompare.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <tools/diagnose_ex.h>
-#include <tools/debug.hxx>
-#include <vcl/svapp.hxx>
-
-#include <set>
-
-//......................................................................................................................
-namespace toolkit
-{
-//......................................................................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::TypeClass;
- using ::com::sun::star::uno::TypeClass_VOID;
- 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::IndexOutOfBoundsException;
- using ::com::sun::star::lang::IllegalArgumentException;
- using ::com::sun::star::awt::grid::XGridDataListener;
- using ::com::sun::star::beans::Pair;
- using ::com::sun::star::util::XCloneable;
- using ::com::sun::star::i18n::XCollator;
- using ::com::sun::star::lang::IllegalArgumentException;
- using ::com::sun::star::lang::XMultiServiceFactory;
- using ::com::sun::star::awt::grid::GridDataEvent;
- using ::com::sun::star::lang::EventObject;
- using ::com::sun::star::ucb::AlreadyInitializedException;
- /** === end UNO using === **/
-
-#ifdef DBG_UTIL
- const char* SortableGridDataModel_checkInvariants( const void* _pInstance )
- {
- return static_cast< const SortableGridDataModel* >( _pInstance )->checkInvariants();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- const char* SortableGridDataModel::checkInvariants() const
- {
- if ( m_publicToPrivateRowIndex.size() != m_privateToPublicRowIndex.size() )
- return "inconsistent index maps";
-
- if ( m_delegator.is() )
- {
- if ( m_publicToPrivateRowIndex.size() != size_t( m_delegator->getRowCount() ) )
- return "wrong cached row count";
- }
- else
- {
- if ( !m_publicToPrivateRowIndex.empty() )
- return "disposed or not initialized, but having a non-empty map";
- }
-
- for ( size_t publicIndex=0; publicIndex<m_publicToPrivateRowIndex.size(); ++publicIndex )
- {
- ::sal_Int32 const privateIndex = m_publicToPrivateRowIndex[ publicIndex ];
- if ( ( privateIndex < 0 ) || ( size_t( privateIndex ) >= m_privateToPublicRowIndex.size() ) )
- return "invalid cached private index";
-
- if ( m_privateToPublicRowIndex[ privateIndex ] != sal_Int32( publicIndex ) )
- return "index map traversal not commutavive";
- }
-
- if ( impl_isSorted_nothrow() && m_publicToPrivateRowIndex.empty() )
- return "sorted, but no row index translation tables";
-
- if ( !impl_isSorted_nothrow() && !m_publicToPrivateRowIndex.empty() )
- return "unsorted, but have index translation tables";
-
- return NULL;
- }
-#endif
-
-#define DBG_CHECK_ME() \
- DBG_CHKTHIS( SortableGridDataModel, SortableGridDataModel_checkInvariants )
-
- //------------------------------------------------------------------------------------------------------------------
- namespace
- {
- template< class STLCONTAINER >
- static void lcl_clear( STLCONTAINER& i_container )
- {
- STLCONTAINER empty;
- empty.swap( i_container );
- }
- }
-
- //==================================================================================================================
- //= SortableGridDataModel
- //==================================================================================================================
- DBG_NAME( SortableGridDataModel )
- //------------------------------------------------------------------------------------------------------------------
- SortableGridDataModel::SortableGridDataModel( Reference< XMultiServiceFactory > const & i_factory )
- :SortableGridDataModel_Base( m_aMutex )
- ,SortableGridDataModel_PrivateBase()
- ,m_context( i_factory )
- ,m_isInitialized( false )
- ,m_delegator()
- ,m_collator()
- ,m_currentSortColumn( -1 )
- ,m_sortAscending( true )
- ,m_publicToPrivateRowIndex()
- ,m_privateToPublicRowIndex()
- {
- DBG_CTOR( SortableGridDataModel, SortableGridDataModel_checkInvariants );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- SortableGridDataModel::SortableGridDataModel( SortableGridDataModel const & i_copySource )
- :cppu::BaseMutex()
- ,SortableGridDataModel_Base( m_aMutex )
- ,SortableGridDataModel_PrivateBase()
- ,m_context( i_copySource.m_context )
- ,m_isInitialized( true )
- ,m_delegator()
- ,m_collator( i_copySource.m_collator )
- ,m_currentSortColumn( i_copySource.m_currentSortColumn )
- ,m_sortAscending( i_copySource.m_sortAscending )
- ,m_publicToPrivateRowIndex( i_copySource.m_publicToPrivateRowIndex )
- ,m_privateToPublicRowIndex( i_copySource.m_privateToPublicRowIndex )
- {
- DBG_CTOR( SortableGridDataModel, SortableGridDataModel_checkInvariants );
-
- ENSURE_OR_THROW( i_copySource.m_delegator.is(),
- "not expected to be called for a disposed copy source!" );
- m_delegator.set( i_copySource.m_delegator->createClone(), UNO_QUERY_THROW );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- SortableGridDataModel::~SortableGridDataModel()
- {
- if ( !rBHelper.bDisposed )
- {
- acquire();
- dispose();
- }
-
- DBG_DTOR( SortableGridDataModel, SortableGridDataModel_checkInvariants );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Any SAL_CALL SortableGridDataModel::queryInterface( const Type& aType ) throw (RuntimeException)
- {
- Any aReturn( SortableGridDataModel_Base::queryInterface( aType ) );
- if ( !aReturn.hasValue() )
- aReturn = SortableGridDataModel_PrivateBase::queryInterface( aType );
- return aReturn;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::acquire( ) throw ()
- {
- SortableGridDataModel_Base::acquire();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::release( ) throw ()
- {
- SortableGridDataModel_Base::release();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< Type > SAL_CALL SortableGridDataModel::getTypes( ) throw (RuntimeException)
- {
- return SortableGridDataModel_Base::getTypes();
- // don't expose the types got via SortableGridDataModel_PrivateBase - they're private, after all
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< ::sal_Int8 > SAL_CALL SortableGridDataModel::getImplementationId( ) throw (RuntimeException)
- {
- static ::cppu::OImplementationId aId;
- return aId.getImplementationId();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- namespace
- {
- Reference< XCollator > lcl_loadDefaultCollator_throw( ::comphelper::ComponentContext const & i_context )
- {
- Reference< XCollator > const xCollator( i_context.createComponent( "com.sun.star.i18n.Collator" ), UNO_QUERY_THROW );
- xCollator->loadDefaultCollator( Application::GetSettings().GetLocale(), 0 );
- return xCollator;
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::initialize( const Sequence< Any >& i_arguments ) throw (Exception, RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- if ( m_delegator.is() )
- throw AlreadyInitializedException( ::rtl::OUString(), *this );
-
- Reference< XMutableGridDataModel > xDelegator;
- Reference< XCollator > xCollator;
- switch ( i_arguments.getLength() )
- {
- case 1: // SortableGridDataModel.create( XMutableGridDataModel )
- xDelegator.set( i_arguments[0], UNO_QUERY );
- xCollator = lcl_loadDefaultCollator_throw( m_context );
- break;
-
- case 2: // SortableGridDataModel.createWithCollator( XMutableGridDataModel, XCollator )
- xDelegator.set( i_arguments[0], UNO_QUERY );
- xCollator.set( i_arguments[1], UNO_QUERY );
- if ( !xCollator.is() )
- throw IllegalArgumentException( ::rtl::OUString(), *this, 2 );
- break;
- }
- if ( !xDelegator.is() )
- throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
-
- m_delegator = xDelegator;
- m_collator = xCollator;
-
- m_delegator->addGridDataListener( this );
-
- m_isInitialized = true;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- GridDataEvent SortableGridDataModel::impl_createPublicEvent( GridDataEvent const & i_originalEvent ) const
- {
- GridDataEvent aEvent( i_originalEvent );
- aEvent.Source = *const_cast< SortableGridDataModel* >( this );
- aEvent.FirstRow = impl_getPublicRowIndex_nothrow( aEvent.FirstRow );
- aEvent.LastRow = impl_getPublicRowIndex_nothrow( aEvent.LastRow );
- return aEvent;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SortableGridDataModel::impl_broadcast( void ( SAL_CALL XGridDataListener::*i_listenerMethod )( const GridDataEvent & ),
- GridDataEvent const & i_publicEvent, MethodGuard& i_instanceLock )
- {
- ::cppu::OInterfaceContainerHelper* pListeners = rBHelper.getContainer( XGridDataListener::static_type() );
- if ( pListeners == NULL )
- return;
-
- i_instanceLock.clear();
- pListeners->notifyEach( i_listenerMethod, i_publicEvent );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::rowsInserted( const GridDataEvent& i_event ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- // if the data is not sorted, broadcast the event unchanged
- if ( !impl_isSorted_nothrow() )
- {
- GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
- impl_broadcast( &XGridDataListener::rowsInserted, aEvent, aGuard );
- return;
- }
-
- bool needReIndex = false;
- if ( i_event.FirstRow > i_event.LastRow )
- {
- OSL_ENSURE( false, "SortableGridDataModel::rowsInserted: invalid event - invalid row indexes!" );
- needReIndex = true;
- }
- else if ( size_t( i_event.FirstRow ) > m_privateToPublicRowIndex.size() )
- {
- OSL_ENSURE( false, "SortableGridDataModel::rowsInserted: invalid event - too large row index!" );
- needReIndex = true;
- }
-
- if ( needReIndex )
- {
- impl_rebuildIndexesAndNotify( aGuard );
- return;
- }
-
- // we do not insert the new rows into the sort order - if somebody adds rows while we're sorted, s/he has
- // to resort. Instead, we simply append the rows, no matter where they were inserted in the delegator data
- // model.
- sal_Int32 const nPublicFirstRow = sal_Int32( m_privateToPublicRowIndex.size() );
- sal_Int32 nPublicLastRow = nPublicFirstRow;
- for ( sal_Int32 newRow = i_event.FirstRow; newRow <= i_event.LastRow; ++newRow, ++nPublicLastRow )
- {
- m_privateToPublicRowIndex.push_back( nPublicLastRow );
- m_publicToPrivateRowIndex.push_back( nPublicLastRow );
- }
-
- // broadcast the event
- GridDataEvent const aEvent( *this, -1, -1, nPublicFirstRow, nPublicLastRow );
- impl_broadcast( &XGridDataListener::rowsInserted, aEvent, aGuard );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- namespace
- {
- void lcl_decrementValuesGreaterThan( ::std::vector< ::sal_Int32 > & io_indexMap, sal_Int32 const i_threshold )
- {
- for ( ::std::vector< ::sal_Int32 >::iterator loop = io_indexMap.begin();
- loop != io_indexMap.end();
- ++loop
- )
- {
- if ( *loop >= i_threshold )
- --*loop;
- }
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SortableGridDataModel::impl_rebuildIndexesAndNotify( MethodGuard& i_instanceLock )
- {
- OSL_PRECOND( impl_isSorted_nothrow(), "SortableGridDataModel::impl_rebuildIndexesAndNotify: illegal call!" );
-
- // clear the indexes
- lcl_clear( m_publicToPrivateRowIndex );
- lcl_clear( m_privateToPublicRowIndex );
-
- // broadcast an artificial event, saying that all rows have been removed
- GridDataEvent const aRemovalEvent( *this, -1, -1, -1, -1 );
- impl_broadcast( &XGridDataListener::rowsRemoved, aRemovalEvent, i_instanceLock );
- i_instanceLock.reset();
-
- // rebuild the index
- impl_reIndex_nothrow( m_currentSortColumn, m_sortAscending );
-
- // broadcast an artificial event, saying that n rows have been added
- GridDataEvent const aAdditionEvent( *this, -1, -1, 0, m_delegator->getRowCount() - 1 );
- impl_broadcast( &XGridDataListener::rowsInserted, aAdditionEvent, i_instanceLock );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::rowsRemoved( const GridDataEvent& i_event ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- // if the data is not sorted, broadcast the event unchanged
- if ( !impl_isSorted_nothrow() )
- {
- GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
- impl_broadcast( &XGridDataListener::rowsRemoved, aEvent, aGuard );
- return;
- }
-
- // if all rows have been removed, also simply multiplex to own listeners
- if ( i_event.FirstRow < 0 )
- {
- lcl_clear( m_publicToPrivateRowIndex );
- lcl_clear( m_privateToPublicRowIndex );
- GridDataEvent aEvent( i_event );
- aEvent.Source = *this;
- impl_broadcast( &XGridDataListener::rowsRemoved, aEvent, aGuard );
- return;
- }
-
- bool needReIndex = false;
- if ( i_event.FirstRow != i_event.LastRow )
- {
- OSL_ENSURE( false, "SortableGridDataModel::rowsRemoved: missing implementation - removal of multiple rows!" );
- needReIndex = true;
- }
- else if ( size_t( i_event.FirstRow ) >= m_privateToPublicRowIndex.size() )
- {
- OSL_ENSURE( false, "SortableGridDataModel::rowsRemoved: inconsistent/wrong data!" );
- needReIndex = true;
- }
-
- if ( needReIndex )
- {
- impl_rebuildIndexesAndNotify( aGuard );
- return;
- }
-
- // build public event version
- GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
-
- // remove the entries from the index maps
- sal_Int32 const privateIndex = i_event.FirstRow;
- sal_Int32 const publicIndex = aEvent.FirstRow;
-
- m_publicToPrivateRowIndex.erase( m_publicToPrivateRowIndex.begin() + publicIndex );
- m_privateToPublicRowIndex.erase( m_privateToPublicRowIndex.begin() + privateIndex );
-
- // adjust remaining entries in the index maps
- lcl_decrementValuesGreaterThan( m_publicToPrivateRowIndex, privateIndex );
- lcl_decrementValuesGreaterThan( m_privateToPublicRowIndex, publicIndex );
-
- // broadcast the event
- impl_broadcast( &XGridDataListener::rowsRemoved, aEvent, aGuard );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::dataChanged( const GridDataEvent& i_event ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
- impl_broadcast( &XGridDataListener::dataChanged, aEvent, aGuard );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::rowHeadingChanged( const GridDataEvent& i_event ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
- impl_broadcast( &XGridDataListener::rowHeadingChanged, aEvent, aGuard );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::disposing( const EventObject& i_event ) throw (RuntimeException)
- {
- // not interested in
- OSL_UNUSED( i_event );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- namespace
- {
- class CellDataLessComparison : public ::std::binary_function< sal_Int32, sal_Int32, bool >
- {
- public:
- CellDataLessComparison(
- ::std::vector< Any > const & i_data,
- ::comphelper::IKeyPredicateLess& i_predicate,
- sal_Bool const i_sortAscending
- )
- :m_data( i_data )
- ,m_predicate( i_predicate )
- ,m_sortAscending( i_sortAscending )
- {
- }
-
- bool operator()( sal_Int32 const i_lhs, sal_Int32 const i_rhs ) const
- {
- Any const & lhs = m_data[ i_lhs ];
- Any const & rhs = m_data[ i_rhs ];
- // <VOID/> is less than everything else
- if ( !lhs.hasValue() )
- return m_sortAscending;
- if ( !rhs.hasValue() )
- return !m_sortAscending;
-
- // actually compare
- if ( m_sortAscending )
- return m_predicate.isLess( lhs, rhs );
- else
- return m_predicate.isLess( rhs, lhs );
- }
-
- private:
- ::std::vector< Any > const & m_data;
- ::comphelper::IKeyPredicateLess const & m_predicate;
- sal_Bool const m_sortAscending;
- };
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SortableGridDataModel::impl_reIndex_nothrow( ::sal_Int32 const i_columnIndex, sal_Bool const i_sortAscending )
- {
- ::sal_Int32 const rowCount( getRowCount() );
- ::std::vector< ::sal_Int32 > aPublicToPrivate( rowCount );
-
- try
- {
- // build an unsorted translation table, and retrieve the unsorted data
- ::std::vector< Any > aColumnData( rowCount );
- Type dataType;
- for ( ::sal_Int32 rowIndex = 0; rowIndex < rowCount; ++rowIndex )
- {
- aColumnData[ rowIndex ] = m_delegator->getCellData( i_columnIndex, rowIndex );
- aPublicToPrivate[ rowIndex ] = rowIndex;
-
- // determine the data types we assume for the complete column
- if ( ( dataType.getTypeClass() == TypeClass_VOID ) && aColumnData[ rowIndex ].hasValue() )
- dataType = aColumnData[ rowIndex ].getValueType();
- }
-
- // get predicate object
- ::std::auto_ptr< ::comphelper::IKeyPredicateLess > const pPredicate( ::comphelper::getStandardLessPredicate( dataType, m_collator ) );
- ENSURE_OR_RETURN_VOID( pPredicate.get(), "SortableGridDataModel::impl_reIndex_nothrow: no sortable data found!" );
-
- // then sort
- CellDataLessComparison const aComparator( aColumnData, *pPredicate, i_sortAscending );
- ::std::sort( aPublicToPrivate.begin(), aPublicToPrivate.end(), aComparator );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- return;
- }
-
- // also build the "private to public" mapping
- ::std::vector< sal_Int32 > aPrivateToPublic( aPublicToPrivate.size() );
- for ( size_t i=0; i<aPublicToPrivate.size(); ++i )
- aPrivateToPublic[ aPublicToPrivate[i] ] = i;
-
- m_publicToPrivateRowIndex.swap( aPublicToPrivate );
- m_privateToPublicRowIndex.swap( aPrivateToPublic );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::sortByColumn( ::sal_Int32 i_columnIndex, ::sal_Bool i_sortAscending ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- if ( ( i_columnIndex < 0 ) || ( i_columnIndex >= getColumnCount() ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
-
- impl_reIndex_nothrow( i_columnIndex, i_sortAscending );
-
- m_currentSortColumn = i_columnIndex;
- m_sortAscending = i_sortAscending;
-
- impl_broadcast(
- &XGridDataListener::dataChanged,
- GridDataEvent( *this, -1, -1, -1, -1 ),
- aGuard
- );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::removeColumnSort( ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- lcl_clear( m_publicToPrivateRowIndex );
- lcl_clear( m_privateToPublicRowIndex );
-
- m_currentSortColumn = -1;
- m_sortAscending = sal_True;
-
- impl_broadcast(
- &XGridDataListener::dataChanged,
- GridDataEvent( *this, -1, -1, -1, -1 ),
- aGuard
- );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Pair< ::sal_Int32, ::sal_Bool > SAL_CALL SortableGridDataModel::getCurrentSortOrder( ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- return Pair< ::sal_Int32, ::sal_Bool >( m_currentSortColumn, m_sortAscending );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::addRow( const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- delegator->addRow( i_heading, i_data );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::addRows( const Sequence< Any >& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- delegator->addRows( i_headings, i_data );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::removeRow( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- delegator->removeRow( rowIndex );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::removeAllRows( ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- delegator->removeAllRows();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::updateCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- delegator->updateCellData( i_columnIndex, rowIndex, i_value );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::updateRowData( const Sequence< ::sal_Int32 >& i_columnIndexes, ::sal_Int32 i_rowIndex, const Sequence< Any >& i_values ) throw (IndexOutOfBoundsException, IllegalArgumentException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- delegator->updateRowData( i_columnIndexes, rowIndex, i_values );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::updateRowHeading( ::sal_Int32 i_rowIndex, const Any& i_heading ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- delegator->updateRowHeading( rowIndex, i_heading );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::updateCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- delegator->updateCellToolTip( i_columnIndex, rowIndex, i_value );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::updateRowToolTip( ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- delegator->updateRowToolTip( rowIndex, i_value );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::addGridDataListener( const Reference< XGridDataListener >& i_listener ) throw (RuntimeException)
- {
- rBHelper.addListener( XGridDataListener::static_type(), i_listener );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::removeGridDataListener( const Reference< XGridDataListener >& i_listener ) throw (RuntimeException)
- {
- rBHelper.removeListener( XGridDataListener::static_type(), i_listener );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL SortableGridDataModel::getRowCount() throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- return delegator->getRowCount();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL SortableGridDataModel::getColumnCount() throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- return delegator->getColumnCount();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Any SAL_CALL SortableGridDataModel::getCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- return delegator->getCellData( i_columnIndex, rowIndex );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Any SAL_CALL SortableGridDataModel::getCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- return delegator->getCellToolTip( i_columnIndex, rowIndex );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Any SAL_CALL SortableGridDataModel::getRowHeading( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
-
- Reference< XMutableGridDataModel > const delegator( m_delegator );
- aGuard.clear();
- return delegator->getRowHeading( rowIndex );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SortableGridDataModel::disposing()
- {
- m_currentSortColumn = -1;
-
- Reference< XComponent > const delegatorComponent( m_delegator.get() );
- m_delegator->removeGridDataListener( this );
- m_delegator.clear();
- delegatorComponent->dispose();
-
- Reference< XComponent > const collatorComponent( m_collator, UNO_QUERY );
- m_collator.clear();
- if ( collatorComponent.is() )
- collatorComponent->dispose();
-
- lcl_clear( m_publicToPrivateRowIndex );
- lcl_clear( m_privateToPublicRowIndex );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XCloneable > SAL_CALL SortableGridDataModel::createClone( ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this, rBHelper );
- DBG_CHECK_ME();
-
- return new SortableGridDataModel( *this );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL SortableGridDataModel::getImplementationName( ) throw (RuntimeException)
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.SortableGridDataModel" ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Bool SAL_CALL SortableGridDataModel::supportsService( const ::rtl::OUString& i_serviceName ) throw (RuntimeException)
- {
- Sequence< ::rtl::OUString > const aServiceNames( getSupportedServiceNames() );
- for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i )
- if ( aServiceNames[i] == i_serviceName )
- return sal_True;
- return sal_False;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL SortableGridDataModel::getSupportedServiceNames( ) throw (RuntimeException)
- {
- Sequence< ::rtl::OUString > aServiceNames(1);
- aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_SortableGridDataModel );
- return aServiceNames;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SortableGridDataModel::impl_getPrivateRowIndex_throw( ::sal_Int32 const i_publicRowIndex ) const
- {
- if ( ( i_publicRowIndex < 0 ) || ( i_publicRowIndex >= m_delegator->getRowCount() ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< SortableGridDataModel* >( this ) );
-
- if ( !impl_isSorted_nothrow() )
- // no need to translate anything
- return i_publicRowIndex;
-
- ENSURE_OR_RETURN( size_t( i_publicRowIndex ) < m_publicToPrivateRowIndex.size(),
- "SortableGridDataModel::impl_getPrivateRowIndex_throw: inconsistency!", i_publicRowIndex );
- // obviously the translation table contains too few elements - it should have exactly |getRowCount()|
- // elements
-
- return m_publicToPrivateRowIndex[ i_publicRowIndex ];
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SortableGridDataModel::impl_getPublicRowIndex_nothrow( ::sal_Int32 const i_privateRowIndex ) const
- {
- if ( !impl_isSorted_nothrow() )
- // no need to translate anything
- return i_privateRowIndex;
-
- if ( i_privateRowIndex < 0 )
- return i_privateRowIndex;
-
- ENSURE_OR_RETURN( size_t( i_privateRowIndex ) < m_privateToPublicRowIndex.size(),
- "SortableGridDataModel::impl_getPublicRowIndex_nothrow: invalid index!", i_privateRowIndex );
-
- return m_privateToPublicRowIndex[ i_privateRowIndex ];
- }
-
-//......................................................................................................................
-} // namespace toolkit
-//......................................................................................................................
-
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SortableGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
-{
- return *( new ::toolkit::SortableGridDataModel( i_factory ) );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.hxx b/toolkit/source/controls/grid/sortablegriddatamodel.hxx
deleted file mode 100644
index 832dfa3b29..0000000000
--- a/toolkit/source/controls/grid/sortablegriddatamodel.hxx
+++ /dev/null
@@ -1,201 +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_SORTABLEGRIDDATAMODEL_HXX
-#define TOOLKIT_SORTABLEGRIDDATAMODEL_HXX
-
-#include "initguard.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/awt/grid/XSortableMutableGridDataModel.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/i18n/XCollator.hpp>
-#include <com/sun/star/awt/grid/XGridDataListener.hpp>
-/** === end UNO includes === **/
-
-#include <comphelper/componentcontext.hxx>
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase3.hxx>
-#include <cppuhelper/implbase1.hxx>
-
-//......................................................................................................................
-namespace toolkit
-{
-//......................................................................................................................
-
- class SortableGridDataModel;
- typedef InitGuard< SortableGridDataModel > MethodGuard;
-
- //==================================================================================================================
- //= SortableGridDataModel
- //==================================================================================================================
- typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::awt::grid::XSortableMutableGridDataModel
- , ::com::sun::star::lang::XServiceInfo
- , ::com::sun::star::lang::XInitialization
- > SortableGridDataModel_Base;
- typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::grid::XGridDataListener
- > SortableGridDataModel_PrivateBase;
- class SortableGridDataModel :public ::cppu::BaseMutex
- ,public SortableGridDataModel_Base
- ,public SortableGridDataModel_PrivateBase
- {
- public:
- SortableGridDataModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory );
- SortableGridDataModel( SortableGridDataModel const & i_copySource );
-
- bool isInitialized() const { return m_isInitialized; }
-
-#ifdef DBG_UTIL
- const char* checkInvariants() const;
-#endif
-
- protected:
- ~SortableGridDataModel();
-
- public:
- // XSortableGridData
- virtual void SAL_CALL sortByColumn( ::sal_Int32 ColumnIndex, ::sal_Bool SortAscending ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeColumnSort( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::beans::Pair< ::sal_Int32, ::sal_Bool > SAL_CALL getCurrentSortOrder( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XMutableGridDataModel
- virtual void SAL_CALL addRow( const ::com::sun::star::uno::Any& Heading, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Data ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Headings, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& Data ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeRow( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeAllRows( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateCellData( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRowData( const ::com::sun::star::uno::Sequence< ::sal_Int32 >& ColumnIndexes, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRowHeading( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Heading ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateCellToolTip( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRowToolTip( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
-
- // XGridDataModel
- virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getCellToolTip( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getRowHeading( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
- // XCloneable
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XGridDataListener
- virtual void SAL_CALL rowsInserted( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rowsRemoved( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL dataChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rowHeadingChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
-
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire( ) throw ();
- virtual void SAL_CALL release( ) throw ();
-
- // XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
-
- private:
- /** translates the given public index into one to be passed to our delegator
- @throws ::com::sun::star::lang::IndexOutOfBoundsException
- if the given index does not denote a valid row
- */
- ::sal_Int32 impl_getPrivateRowIndex_throw( ::sal_Int32 const i_publicRowIndex ) const;
-
- /** translates the given private row index to a public one
- */
- ::sal_Int32 impl_getPublicRowIndex_nothrow( ::sal_Int32 const i_privateRowIndex ) const;
-
- inline bool impl_isSorted_nothrow() const
- {
- return m_currentSortColumn >= 0;
- }
-
- /** rebuilds the index translation structure.
-
- Neither <member>m_currentSortColumn</member> nor <member>m_sortAscending</member> are touched by this method.
- Also, the given column index is not checked, this is the responsibility of the caller.
- */
- void impl_reIndex_nothrow( ::sal_Int32 const i_columnIndex, sal_Bool const i_sortAscending );
-
- /** translates the given event, obtained from our delegator, to a version which can be broadcasted to our own
- clients.
- */
- ::com::sun::star::awt::grid::GridDataEvent
- impl_createPublicEvent( ::com::sun::star::awt::grid::GridDataEvent const & i_originalEvent ) const;
-
- /** broadcasts the given event to our registered XGridDataListeners
- */
- void impl_broadcast(
- void ( SAL_CALL ::com::sun::star::awt::grid::XGridDataListener::*i_listenerMethod )( const ::com::sun::star::awt::grid::GridDataEvent & ),
- ::com::sun::star::awt::grid::GridDataEvent const & i_publicEvent,
- MethodGuard& i_instanceLock
- );
-
- /** rebuilds our indexes, notifying row removal and row addition events
-
- First, a rowsRemoved event is notified to our registered listeners. Then, the index translation tables are
- rebuilt, and a rowsInserted event is notified.
-
- Only to be called when we're sorted.
- */
- void impl_rebuildIndexesAndNotify( MethodGuard& i_instanceLock );
-
- private:
- ::comphelper::ComponentContext m_context;
- bool m_isInitialized;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XMutableGridDataModel > m_delegator;
- ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > m_collator;
- ::sal_Int32 m_currentSortColumn;
- ::sal_Bool m_sortAscending;
- ::std::vector< ::sal_Int32 > m_publicToPrivateRowIndex;
- ::std::vector< ::sal_Int32 > m_privateToPublicRowIndex;
- };
-
-//......................................................................................................................
-} // namespace toolkit
-//......................................................................................................................
-
-#endif // TOOLKIT_SORTABLEGRIDDATAMODEL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx
deleted file mode 100644
index a771802faf..0000000000
--- a/toolkit/source/controls/roadmapcontrol.cxx
+++ /dev/null
@@ -1,503 +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/controls/roadmapcontrol.hxx>
-#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/helper/property.hxx>
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#include <comphelper/processfactory.hxx>
-#include <osl/diagnose.h>
-
-//........................................................................
-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;
- using namespace ::com::sun::star::container;
-
-// ----------------------------------------------------
-// helper
-// ----------------------------------------------------
-
-static void lcl_throwIllegalArgumentException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw IllegalArgumentException();
-}
-
-static void lcl_throwIndexOutOfBoundsException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw IndexOutOfBoundsException();
-}
-
- // ===================================================================
- // = UnoControlRoadmapModel
- // ===================================================================
- // -------------------------------------------------------------------
- UnoControlRoadmapModel::UnoControlRoadmapModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlRoadmapModel_Base( i_factory )
- ,maContainerListeners( *this )
- {
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
- ImplRegisterProperty( BASEPROPERTY_GRAPHIC );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_COMPLETE );
- ImplRegisterProperty( BASEPROPERTY_ACTIVATED );
- ImplRegisterProperty( BASEPROPERTY_CURRENTITEMID );
- ImplRegisterProperty( BASEPROPERTY_TABSTOP );
- ImplRegisterProperty( BASEPROPERTY_TEXT );
- }
-
- // -------------------------------------------------------------------
- ::rtl::OUString UnoControlRoadmapModel::getServiceName() throw(RuntimeException)
- {
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlRoadmapModel );
- }
-
-
- // -------------------------------------------------------------------
- Any UnoControlRoadmapModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- {
- Any aReturn;
- switch (nPropId)
- {
- case BASEPROPERTY_COMPLETE:
- aReturn <<= (sal_Bool) sal_True;
- break;
- case BASEPROPERTY_ACTIVATED:
- aReturn <<= (sal_Bool) sal_True;
- break;
- case BASEPROPERTY_CURRENTITEMID:
- aReturn <<= (sal_Int16) -1;
- break;
- case BASEPROPERTY_TEXT:
- break;
- case BASEPROPERTY_BORDER:
- aReturn <<= (sal_Int16) 2; // No Border
- break;
- case BASEPROPERTY_DEFAULTCONTROL:
- aReturn <<= ::rtl::OUString( ::rtl::OUString::createFromAscii( szServiceName_UnoControlRoadmap ) );
- break;
- default : aReturn = UnoControlRoadmapModel_Base::ImplGetDefaultValue( nPropId ); break;
- }
-
- return aReturn;
- }
-
-
- Reference< XInterface > SAL_CALL UnoControlRoadmapModel::createInstance( ) throw (Exception, ::com::sun::star::uno::RuntimeException)
- {
- ORoadmapEntry* pRoadmapItem = new ORoadmapEntry();
- Reference< XInterface > xNewRoadmapItem = (::cppu::OWeakObject*)pRoadmapItem;
- return xNewRoadmapItem;
- }
-
-
- Reference< XInterface > SAL_CALL UnoControlRoadmapModel::createInstanceWithArguments( const Sequence< Any >& /*aArguments*/ ) throw (Exception, RuntimeException)
- {
- // Todo: implementation of the arguments handling
- ORoadmapEntry* pRoadmapItem = new ORoadmapEntry();
- Reference< XInterface > xNewRoadmapItem = (::cppu::OWeakObject*)pRoadmapItem;
- return xNewRoadmapItem;
- }
-
-
- IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoControlRoadmapModel, UnoControlRoadmapModel_Base, UnoControlRoadmapModel_IBase )
-
-
- // -------------------------------------------------------------------
- ::com::sun::star::uno::Any SAL_CALL UnoControlRoadmapModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
- {
- Any aRet = UnoControlRoadmapModel_Base::queryAggregation( rType );
- if ( !aRet.hasValue() )
- aRet = UnoControlRoadmapModel_IBase::queryInterface( rType );
- return aRet;
- }
-
-
- // -------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper& UnoControlRoadmapModel::getInfoHelper()
- {
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
- }
-
-
- // beans::XMultiPropertySet
- // -------------------------------------------------------------------
- Reference< XPropertySetInfo > UnoControlRoadmapModel::getPropertySetInfo( ) throw(RuntimeException)
- {
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
- }
-
-
- sal_Int32 SAL_CALL UnoControlRoadmapModel::getCount() throw(RuntimeException)
- {
- return maRoadmapItems.size();
- }
-
- Any SAL_CALL UnoControlRoadmapModel::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
- {
- if (( Index >= (sal_Int32)maRoadmapItems.size()) || (Index < 0))
- lcl_throwIndexOutOfBoundsException( );
- Any aAny;
- aAny = makeAny( maRoadmapItems.at( Index ));
- return aAny;
- }
-
-
-
- void UnoControlRoadmapModel::MakeRMItemValidation( sal_Int32 Index, Reference< XInterface > xRoadmapItem )
- {
- if ((Index > (sal_Int32)maRoadmapItems.size()) || ( Index < 0 ) )
- lcl_throwIndexOutOfBoundsException( );
- if ( !xRoadmapItem.is() )
- lcl_throwIllegalArgumentException();
- Reference< XServiceInfo > xServiceInfo( xRoadmapItem, UNO_QUERY );
- sal_Bool bIsRoadmapItem = xServiceInfo->supportsService( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.RoadmapItem")) );
- if ( !bIsRoadmapItem )
- lcl_throwIllegalArgumentException();
- }
-
-
- void UnoControlRoadmapModel::SetRMItemDefaultProperties( const sal_Int32 , Reference< XInterface > xRoadmapItem)
- {
- Any aAny;
- Reference< XPropertySet > xPropertySet( xRoadmapItem, UNO_QUERY );
- Reference< XPropertySet > xProps( xRoadmapItem, UNO_QUERY );
- if ( xProps.is() )
- {
- sal_Int32 LocID = 0;
- Any aValue = xPropertySet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ID")) );
- aValue >>= LocID;
- if (LocID < 0) // index may not be smaller than zero
- {
- aAny <<= GetUniqueID();
- xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ID")), aAny );
- }
- }
- }
-
-
-// The performance of this method could certainly be improved.
-// As long as only vectors with up to 10 elements are
-// involved it should be sufficient
- sal_Int32 UnoControlRoadmapModel::GetUniqueID()
- {
- Any aAny;
- sal_Bool bIncrement = sal_True;
- sal_Int32 CurID = 0;
- sal_Int32 n_CurItemID = 0;
- Reference< XInterface > CurRoadmapItem;
- while ( bIncrement )
- {
- bIncrement = sal_False;
- for ( RoadmapItemHolderList::iterator i = maRoadmapItems.begin(); i < maRoadmapItems.end(); ++i )
- {
- CurRoadmapItem = *i;
- Reference< XPropertySet > xPropertySet( CurRoadmapItem, UNO_QUERY );
- aAny = xPropertySet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ID")) );
- aAny >>= n_CurItemID;
- if (n_CurItemID == CurID)
- {
- bIncrement = sal_True;
- CurID++;
- break;
- }
- }
- }
- return CurID;
- }
-
-
- ContainerEvent UnoControlRoadmapModel::GetContainerEvent(sal_Int32 Index, Reference< XInterface > xRoadmapItem)
- {
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= xRoadmapItem;
- aEvent.Accessor = makeAny(Index);
- return aEvent;
- }
-
-
- sal_Int16 UnoControlRoadmapModel::GetCurrentItemID( Reference< XPropertySet > xPropertySet )
- {
- Any aAny = xPropertySet->getPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ) );
- sal_Int16 n_CurrentItemID = 0;
- aAny >>= n_CurrentItemID;
- return n_CurrentItemID;
- }
-
-
- void SAL_CALL UnoControlRoadmapModel::insertByIndex( const sal_Int32 Index, const Any& _Element)
- throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
- {
- if ( ( Index >= ( (sal_Int32)maRoadmapItems.size() + 1 ) ) || (Index < 0))
- lcl_throwIndexOutOfBoundsException( );
- Reference< XInterface > xRoadmapItem;
- _Element >>= xRoadmapItem;
- MakeRMItemValidation( Index, xRoadmapItem);
- SetRMItemDefaultProperties( Index, xRoadmapItem );
- maRoadmapItems.insert( maRoadmapItems.begin() + Index, xRoadmapItem);
- ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem);
- maContainerListeners.elementInserted( aEvent );
- Reference< XPropertySet > xPropertySet( (XAggregation*) (::cppu::OWeakAggObject*)this, UNO_QUERY );
- sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet );
- if ( Index <= n_CurrentItemID )
- {
- Any aAny;
- aAny <<= ( sal_Int16 ) ( n_CurrentItemID + 1 );
- xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
- }
- }
-
-
-
- void SAL_CALL UnoControlRoadmapModel::removeByIndex( sal_Int32 Index)
- throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
- {
- if (( Index > (sal_Int32)maRoadmapItems.size()) || (Index < 0))
- lcl_throwIndexOutOfBoundsException( );
- Reference< XInterface > xRoadmapItem;
- maRoadmapItems.erase( maRoadmapItems.begin() + Index );
- ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem);
- maContainerListeners.elementRemoved( aEvent );
- Reference< XPropertySet > xPropertySet( (XAggregation*) (::cppu::OWeakAggObject*)this, UNO_QUERY );
- sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet );
- Any aAny;
- if ( Index <= n_CurrentItemID )
- {
- if ( n_CurrentItemID >= (sal_Int32)maRoadmapItems.size() )
- {
- n_CurrentItemID = sal::static_int_cast< sal_Int16 >(
- maRoadmapItems.size()-1);
- if ( n_CurrentItemID < 0 )
- return;
- aAny <<= n_CurrentItemID;
- }
- else if (Index == n_CurrentItemID)
- aAny <<= ( sal_Int16 ) -1;
- else if( Index < n_CurrentItemID)
- aAny <<= ( sal_Int16 ) ( n_CurrentItemID - 1 );
- xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
- }
- }
-
-
- void SAL_CALL UnoControlRoadmapModel::replaceByIndex( const sal_Int32 Index, const Any& _Element)
- throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
- {
- Reference< XInterface > xRoadmapItem;
- _Element >>= xRoadmapItem;
- MakeRMItemValidation( Index, xRoadmapItem);
- SetRMItemDefaultProperties( Index, xRoadmapItem );
- maRoadmapItems.erase( maRoadmapItems.begin() + Index );
- maRoadmapItems.insert( maRoadmapItems.begin() + Index, xRoadmapItem); //push_back( xRoadmapItem );
- ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem);
- maContainerListeners.elementReplaced( aEvent );
- }
-
-
- Type SAL_CALL UnoControlRoadmapModel::getElementType() throw(RuntimeException)
- {
- Type aType = getCppuType( ( Reference< XPropertySet>* ) NULL );
- return aType;
- }
-
-
- sal_Bool SAL_CALL UnoControlRoadmapModel::hasElements() throw(RuntimeException)
- {
- return !maRoadmapItems.empty();
- }
-
-
- void SAL_CALL UnoControlRoadmapModel::addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
- {
- maContainerListeners.addInterface( xListener );
- }
-
- void SAL_CALL UnoControlRoadmapModel::removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
- {
- maContainerListeners.removeInterface( xListener );
- }
-
- // ===================================================================
- // = UnoRoadmapControl
- // ===================================================================
- // -------------------------------------------------------------------
- UnoRoadmapControl::UnoRoadmapControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlRoadmap_Base( i_factory )
- ,maItemListeners( *this )
- {
- }
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoRoadmapControl, UnoControlRoadmap_Base, UnoControlRoadmap_IBase )
-IMPLEMENT_FORWARD_XINTERFACE2( UnoRoadmapControl, UnoControlRoadmap_Base, UnoControlRoadmap_IBase )
-
-
-sal_Bool SAL_CALL UnoRoadmapControl::setModel(const Reference< XControlModel >& _rModel) throw ( RuntimeException )
- {
-
-
- Reference< XContainer > xC( getModel(), UNO_QUERY );
- if ( xC.is() )
- xC->removeContainerListener( this );
-
- sal_Bool bReturn = UnoControlBase::setModel( _rModel );
-
- xC = xC.query( getModel());
- if ( xC.is() )
- xC->addContainerListener( this );
-
- return bReturn;
- }
-
-
- // -------------------------------------------------------------------
- ::rtl::OUString UnoRoadmapControl::GetComponentServiceName()
- {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Roadmap"));
- }
-
-
-
- void UnoRoadmapControl::dispose() throw(RuntimeException)
- {
- EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- maItemListeners.disposeAndClear( aEvt );
- UnoControl::dispose();
- }
-
-
-
-void UnoRoadmapControl::elementInserted( const ContainerEvent& rEvent )throw(RuntimeException)
-{
- Reference< XInterface > xRoadmapItem;
- rEvent.Element >>= xRoadmapItem;
- Reference< XPropertySet > xRoadmapPropertySet( xRoadmapItem, UNO_QUERY );
- if ( xRoadmapPropertySet.is() )
- xRoadmapPropertySet->addPropertyChangeListener( rtl::OUString(), this );
-
- Reference< XContainerListener > xPeer(getPeer(), UNO_QUERY);
- if ( xPeer.is() )
- {
- xPeer->elementInserted( rEvent );
- Reference < XPropertySet > xPropertySet( xPeer, UNO_QUERY );
- if ( xPropertySet.is() )
- xPropertySet->addPropertyChangeListener( rtl::OUString(), this );
- }
-}
-
-
-void UnoRoadmapControl::elementRemoved( const ContainerEvent& rEvent )throw(RuntimeException)
-{
- Reference< XContainerListener > xPeer(getPeer(), UNO_QUERY);
- if ( xPeer.is() )
- xPeer->elementRemoved( rEvent );
- Reference< XInterface > xRoadmapItem;
- rEvent.Element >>= xRoadmapItem;
- Reference< XPropertySet > xPropertySet( xRoadmapItem, UNO_QUERY );
- if ( xPropertySet.is() )
- xPropertySet->removePropertyChangeListener( rtl::OUString(), this );
-}
-
-
-void UnoRoadmapControl::elementReplaced( const ContainerEvent& rEvent )throw(RuntimeException)
-{
- Reference< XContainerListener > xPeer(getPeer(), UNO_QUERY);
- if ( xPeer.is() )
- xPeer->elementReplaced( rEvent );
-}
-
-
-void SAL_CALL UnoRoadmapControl::itemStateChanged( const ItemEvent& rEvent ) throw (RuntimeException)
-{
- sal_Int16 CurItemIndex = sal::static_int_cast< sal_Int16 >(rEvent.ItemId);
- Any aAny;
- aAny <<= CurItemIndex;
- Reference< XControlModel > xModel( getModel( ), UNO_QUERY );
- Reference< XPropertySet > xPropertySet( xModel, UNO_QUERY );
- xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
- if ( maItemListeners.getLength() )
- maItemListeners.itemStateChanged( rEvent );
-}
-
-
-void SAL_CALL UnoRoadmapControl::addItemListener( const Reference< XItemListener >& l ) throw (RuntimeException)
-{
- maItemListeners.addInterface( l );
- if( getPeer().is() && maItemListeners.getLength() == 1 )
- {
- Reference < XItemEventBroadcaster > xRoadmap( getPeer(), UNO_QUERY );
- xRoadmap->addItemListener( this );
- }
-}
-
-
-void SAL_CALL UnoRoadmapControl::removeItemListener( const Reference< XItemListener >& l ) throw (RuntimeException)
-{
- if( getPeer().is() && maItemListeners.getLength() == 1 )
- {
- Reference < XItemEventBroadcaster > xRoadmap( getPeer(), UNO_QUERY );
- xRoadmap->removeItemListener( this );
- }
-
- maItemListeners.removeInterface( l );
-}
-
-
-void SAL_CALL UnoRoadmapControl::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException)
-{
- Reference< XPropertyChangeListener > xPeer(getPeer(), UNO_QUERY);
- if ( xPeer.is() )
- xPeer->propertyChange( evt );
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/roadmapentry.cxx b/toolkit/source/controls/roadmapentry.cxx
deleted file mode 100644
index 91635e3d62..0000000000
--- a/toolkit/source/controls/roadmapentry.cxx
+++ /dev/null
@@ -1,126 +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/controls/roadmapentry.hxx>
-
-#include <rtl/ustring.hxx>
-
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-
-
-ORoadmapEntry::ORoadmapEntry() : ORoadmapEntry_Base( )
- ,OPropertyContainer( GetBroadcastHelper() )
-{
- // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember
-
- registerProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")), RM_PROPERTY_ID_LABEL,
- ::com::sun::star::beans::PropertyAttribute::BOUND |
- ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
- & m_sLabel, ::getCppuType( &m_sLabel ) );
- m_nID = -1;
- registerProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ID")), RM_PROPERTY_ID_ID,
- ::com::sun::star::beans::PropertyAttribute::BOUND |
- ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
- & m_nID, ::getCppuType( &m_nID ) );
- m_bEnabled = sal_True;
- registerProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Enabled")), RM_PROPERTY_ID_ENABLED,
- ::com::sun::star::beans::PropertyAttribute::BOUND |
- ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
- & m_bEnabled, ::getCppuType( &m_bEnabled ) );
-
- registerProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Interactive")), RM_PROPERTY_ID_INTERACTIVE,
- ::com::sun::star::beans::PropertyAttribute::BOUND |
- ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
- & m_bInteractive, ::getCppuType( &m_bInteractive ) );
-
-
- // ...
-
- // Note that the list of registered properties has to be fixed: Different
- // instances of this class have to register the same set of properties with
- // the same attributes.
- //
- // This is because all instances of the class share the same PropertySetInfo
- // which has been built from the registered property of _one_ instance.
-}
-
-//--------------------------------------------------------------------------
-IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
- // order matters:
- // the first is the class name
- // the second is the class which implements the ref-counting
- // the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes
- // whose XInterface and XTypeProvider implementations should be merged
-
-//--------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star:: beans::XPropertySetInfo > SAL_CALL
- ORoadmapEntry::getPropertySetInfo()
- throw(::com::sun::star::uno::RuntimeException)
-{
- return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >(
- createPropertySetInfo( getInfoHelper() ) );
-}
-
-::rtl::OUString SAL_CALL ORoadmapEntry::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
-{
- ::rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.RoadmapItem"));
- return aStr;
-}
-
-sal_Bool SAL_CALL ORoadmapEntry::supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
-{
- return ServiceName.equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.RoadmapItem")) );
-}
-
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ORoadmapEntry::getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1);
- ::rtl::OUString* pArray = aRet.getArray();
- pArray[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.RoadmapItem"));
- return aRet;
-}
-//--------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& ORoadmapEntry::getInfoHelper()
-{
- return *getArrayHelper();
-}
-
-//--------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* ORoadmapEntry::createArrayHelper() const
-{
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps;
- // describes all properties which have been registered in the ctor
- describeProperties( aProps );
-
- return new ::cppu::OPropertyArrayHelper( aProps );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/spinningprogress.cxx b/toolkit/source/controls/spinningprogress.cxx
deleted file mode 100644
index 54ad173996..0000000000
--- a/toolkit/source/controls/spinningprogress.cxx
+++ /dev/null
@@ -1,143 +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/controls/spinningprogress.hxx"
-#include "toolkit/helper/servicenames.hxx"
-#include "toolkit/helper/unopropertyarrayhelper.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
-#include <vcl/throbber.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::beans::XPropertySetInfo;
- using ::com::sun::star::lang::XMultiServiceFactory;
- /** === end UNO using === **/
-
- //==================================================================================================================
- //= SpinningProgressControlModel
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- SpinningProgressControlModel::SpinningProgressControlModel( Reference< XMultiServiceFactory > const & i_factory )
- :SpinningProgressControlModel_Base( i_factory )
- {
- // default image sets
- osl_incrementInterlockedCount( &m_refCount );
- {
- try
- {
- Throbber::ImageSet aImageSets[] =
- {
- Throbber::IMAGES_16_PX, Throbber::IMAGES_32_PX, Throbber::IMAGES_64_PX
- };
- for ( size_t i=0; i < sizeof( aImageSets ) / sizeof( aImageSets[0] ); ++i )
- {
- const ::std::vector< ::rtl::OUString > aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets[i] ) );
- const Sequence< ::rtl::OUString > aImageURLs( &aDefaultURLs[0], aDefaultURLs.size() );
- insertImageSet( i, aImageURLs );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- osl_decrementInterlockedCount( &m_refCount );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- SpinningProgressControlModel::SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource )
- :SpinningProgressControlModel_Base( i_copySource )
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- SpinningProgressControlModel::~SpinningProgressControlModel()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- UnoControlModel* SpinningProgressControlModel::Clone() const
- {
- return new SpinningProgressControlModel( *this );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XPropertySetInfo > SAL_CALL SpinningProgressControlModel::getPropertySetInfo( ) throw(RuntimeException)
- {
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL SpinningProgressControlModel::getServiceName() throw(RuntimeException)
- {
- return ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString SAL_CALL SpinningProgressControlModel::getImplementationName( ) throw(RuntimeException)
- {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.toolkit.SpinningProgressControlModel"));
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL SpinningProgressControlModel::getSupportedServiceNames() throw(RuntimeException)
- {
- Sequence< ::rtl::OUString > aServiceNames(3);
- aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
- aServiceNames[1] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
- aServiceNames[2] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlModel"));
- return aServiceNames;
- }
-
-//......................................................................................................................
-} // namespace toolkit
-//......................................................................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx
deleted file mode 100644
index d5c2f06ef6..0000000000
--- a/toolkit/source/controls/stdtabcontroller.cxx
+++ /dev/null
@@ -1,437 +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/beans/XPropertySet.hpp>
-#include <com/sun/star/awt/XVclContainerPeer.hpp>
-
-#include <toolkit/controls/stdtabcontroller.hxx>
-#include <toolkit/controls/stdtabcontrollermodel.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <toolkit/helper/macros.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <rtl/memory.h>
-#include <rtl/uuid.h>
-
-#include <tools/debug.hxx>
-#include <vcl/window.hxx>
-#include <comphelper/sequence.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-
-// ----------------------------------------------------
-// class StdTabController
-// ----------------------------------------------------
-StdTabController::StdTabController()
-{
-}
-
-StdTabController::~StdTabController()
-{
-}
-
-sal_Bool StdTabController::ImplCreateComponentSequence(
- Sequence< Reference< XControl > >& rControls,
- const Sequence< Reference< XControlModel > >& rModels,
- Sequence< Reference< XWindow > >& rComponents,
- Sequence< Any>* pTabStops,
- sal_Bool bPeerComponent ) const
-{
- sal_Bool bOK = sal_True;
-
- // nur die wirklich geforderten Controls
- sal_Int32 nModels = rModels.getLength();
- if (nModels != rControls.getLength())
- {
- Sequence< Reference< XControl > > aSeq( nModels );
- const Reference< XControlModel >* pModels = rModels.getConstArray();
- Reference< XControl > xCurrentControl;
-
- sal_Int32 nRealControls = 0;
- for (sal_Int32 n = 0; n < nModels; ++n, ++pModels)
- {
- xCurrentControl = FindControl(rControls, *pModels);
- if (xCurrentControl.is())
- aSeq.getArray()[nRealControls++] = xCurrentControl;
- }
- aSeq.realloc(nRealControls);
- rControls = aSeq;
- }
-#ifdef DBG_UTIL
- DBG_ASSERT( rControls.getLength() <= rModels.getLength(), "StdTabController:ImplCreateComponentSequence: inconsistence!" );
- // there may be less controls than models, but never more controls than models
-#endif
-
-
- const Reference< XControl > * pControls = rControls.getConstArray();
- sal_uInt32 nCtrls = rControls.getLength();
- rComponents.realloc( nCtrls );
- Reference< XWindow > * pComps = rComponents.getArray();
- Any* pTabs = NULL;
-
-
- if ( pTabStops )
- {
- *pTabStops = Sequence< Any>( nCtrls );
- pTabs = pTabStops->getArray();
- }
-
- for ( sal_uInt32 n = 0; bOK && ( n < nCtrls ); n++ )
- {
- // Zum Model passendes Control suchen
- Reference< XControl > xCtrl(pControls[n]);
- if ( xCtrl.is() )
- {
- if (bPeerComponent)
- pComps[n] = Reference< XWindow > (xCtrl->getPeer(), UNO_QUERY);
- else
- pComps[n] = Reference< XWindow > (xCtrl, UNO_QUERY);
-
- // TabStop-Property
- if ( pTabs )
- {
- // opt: String fuer TabStop als Konstante
- static const ::rtl::OUString aTabStopName( RTL_CONSTASCII_USTRINGPARAM("Tabstop") );
-
- Reference< XPropertySet > xPSet( xCtrl->getModel(), UNO_QUERY );
- Reference< XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
- if( xInfo->hasPropertyByName( aTabStopName ) )
- *pTabs++ = xPSet->getPropertyValue( aTabStopName );
- else
- ++pTabs;
- }
- }
- else
- {
- OSL_TRACE( "ImplCreateComponentSequence: Control not found" );
- bOK = sal_False;
- }
- }
- return bOK;
-}
-
-void StdTabController::ImplActivateControl( sal_Bool bFirst ) const
-{
- // HACK wegen #53688#, muss auf ein Interface abgebildet werden, wenn Controls Remote liegen koennen.
- Reference< XTabController > xTabController(const_cast< ::cppu::OWeakObject* >(static_cast< const ::cppu::OWeakObject* >(this)), UNO_QUERY);
- Sequence< Reference< XControl > > aCtrls = xTabController->getControls();
- const Reference< XControl > * pControls = aCtrls.getConstArray();
- sal_uInt32 nCount = aCtrls.getLength();
-
- for ( sal_uInt32 n = bFirst ? 0 : nCount; bFirst ? ( n < nCount ) : n; )
- {
- sal_uInt32 nCtrl = bFirst ? n++ : --n;
- DBG_ASSERT( pControls[nCtrl].is(), "Control nicht im Container!" );
- if ( pControls[nCtrl].is() )
- {
- Reference< XWindowPeer > xCP = pControls[nCtrl]->getPeer();
- if ( xCP.is() )
- {
- VCLXWindow* pC = VCLXWindow::GetImplementation( xCP );
- if ( pC && pC->GetWindow() && ( pC->GetWindow()->GetStyle() & WB_TABSTOP ) )
- {
- pC->GetWindow()->GrabFocus();
- break;
- }
- }
- }
- }
-}
-
-// XInterface
-Any StdTabController::queryAggregation( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( XTabController*, this ),
- SAL_STATIC_CAST( XServiceInfo*, this ),
- SAL_STATIC_CAST( XTypeProvider*, this ) );
- return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
-}
-
-// XTypeProvider
-IMPL_XTYPEPROVIDER_START( StdTabController )
- getCppuType( ( Reference< XTabController>* ) NULL ),
- getCppuType( ( Reference< XServiceInfo>* ) NULL )
-IMPL_XTYPEPROVIDER_END
-
-void StdTabController::setModel( const Reference< XTabControllerModel >& Model ) throw(RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- mxModel = Model;
-}
-
-Reference< XTabControllerModel > StdTabController::getModel( ) throw(RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- return mxModel;
-}
-
-void StdTabController::setContainer( const Reference< XControlContainer >& Container ) throw(RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- mxControlContainer = Container;
-}
-
-Reference< XControlContainer > StdTabController::getContainer( ) throw(RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- return mxControlContainer;
-}
-
-Sequence< Reference< XControl > > StdTabController::getControls( ) throw(RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- Sequence< Reference< XControl > > aSeq;
-
- if ( mxControlContainer.is() )
- {
- Sequence< Reference< XControlModel > > aModels = mxModel->getControlModels();
- const Reference< XControlModel > * pModels = aModels.getConstArray();
-
- Sequence< Reference< XControl > > xCtrls = mxControlContainer->getControls();
-
- sal_uInt32 nCtrls = aModels.getLength();
- aSeq = Sequence< Reference< XControl > >( nCtrls );
- for ( sal_uInt32 n = 0; n < nCtrls; n++ )
- {
- Reference< XControlModel > xCtrlModel = pModels[n];
- // Zum Model passendes Control suchen
- Reference< XControl > xCtrl = FindControl( xCtrls, xCtrlModel );
- aSeq.getArray()[n] = xCtrl;
- }
- }
- return aSeq;
-}
-
-void StdTabController::autoTabOrder( ) throw(RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- DBG_ASSERT( mxControlContainer.is(), "autoTabOrder: No ControlContainer!" );
- if ( !mxControlContainer.is() )
- return;
-
- Sequence< Reference< XControlModel > > aSeq = mxModel->getControlModels();
- Sequence< Reference< XWindow > > aCompSeq;
-
- // vieleicht erhalte ich hier einen TabController,
- // der schneller die Liste meiner Controls ermittelt
- Reference< XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY);
- Sequence< Reference< XControl > > aControls = xTabController->getControls();
-
- // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im Container,
- // dann kommt spaeter nochmal ein autoTabOrder...
- if( !ImplCreateComponentSequence( aControls, aSeq, aCompSeq, NULL, sal_False ) )
- return;
-
- sal_uInt32 nCtrls = aCompSeq.getLength();
- Reference< XWindow > * pComponents = aCompSeq.getArray();
-
- ComponentEntryList aCtrls;
- size_t n;
- for ( n = 0; n < nCtrls; n++ )
- {
- XWindow* pC = (XWindow*)pComponents[n].get();
- ComponentEntry* pE = new ComponentEntry;
- pE->pComponent = pC;
- awt::Rectangle aPosSize = pC->getPosSize();
- pE->aPos.X() = aPosSize.X;
- pE->aPos.Y() = aPosSize.Y;
-
- sal_uInt16 nPos;
- for ( nPos = 0; nPos < aCtrls.size(); nPos++ )
- {
- ComponentEntry* pEntry = aCtrls[ nPos ];
- if ( pEntry->aPos.Y() >= pE->aPos.Y() )
- {
- while ( pEntry && ( pEntry->aPos.Y() == pE->aPos.Y() )
- && ( pEntry->aPos.X() < pE->aPos.X() ) )
- {
- pEntry = aCtrls[ ++nPos ];
- }
- break;
- }
- }
- if ( nPos < aCtrls.size() ) {
- ComponentEntryList::iterator it = aCtrls.begin();
- ::std::advance( it, nPos );
- aCtrls.insert( it, pE );
- } else {
- aCtrls.push_back( pE );
- }
- }
-
- Sequence< Reference< XControlModel > > aNewSeq( nCtrls );
- for ( n = 0; n < nCtrls; n++ )
- {
- ComponentEntry* pE = aCtrls[ n ];
- Reference< XControl > xUC( pE->pComponent, UNO_QUERY );
- aNewSeq.getArray()[n] = xUC->getModel();
- delete pE;
- }
- aCtrls.clear();
-
- mxModel->setControlModels( aNewSeq );
-}
-
-void StdTabController::activateTabOrder( ) throw(RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- // Am Container die Tab-Reihenfolge aktivieren...
-
- Reference< XControl > xC( mxControlContainer, UNO_QUERY );
- Reference< XVclContainerPeer > xVclContainerPeer;
- if ( xC.is() )
- xVclContainerPeer = xVclContainerPeer.query( xC->getPeer() );
- if ( !xC.is() || !xVclContainerPeer.is() )
- return;
-
- // vieleicht erhalte ich hier einen TabController,
- // der schneller die Liste meiner Controls ermittelt
- Reference< XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY);
-
- // Flache Liste besorgen...
- Sequence< Reference< XControlModel > > aModels = mxModel->getControlModels();
- Sequence< Reference< XWindow > > aCompSeq;
- Sequence< Any> aTabSeq;
-
- // DG: Aus Optimierungsgruenden werden die Controls mittels getControls() geholt,
- // dieses hoert sich zwar wiedersinning an, fuehrt aber im konkreten Fall (Forms) zu sichtbaren
- // Geschwindigkeitsvorteilen
- Sequence< Reference< XControl > > aControls = xTabController->getControls();
-
- // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im Container,
- // dann kommt spaeter nochmal ein activateTabOrder...
- if( !ImplCreateComponentSequence( aControls, aModels, aCompSeq, &aTabSeq, sal_True ) )
- return;
-
- xVclContainerPeer->setTabOrder( aCompSeq, aTabSeq, mxModel->getGroupControl() );
-
- ::rtl::OUString aName;
- Sequence< Reference< XControlModel > > aThisGroupModels;
- Sequence< Reference< XWindow > > aControlComponents;
-
- sal_uInt32 nGroups = mxModel->getGroupCount();
- for ( sal_uInt32 nG = 0; nG < nGroups; nG++ )
- {
- mxModel->getGroup( nG, aThisGroupModels, aName );
-
- aControls = xTabController->getControls();
- // ImplCreateComponentSequence has a really strange semantics regarding it's first parameter:
- // upon method entry, it expects a super set of the controls which it returns
- // this means we need to completely fill this sequence with all available controls before
- // calling into ImplCreateComponentSequence
-
- aControlComponents.realloc( 0 );
-
- ImplCreateComponentSequence( aControls, aThisGroupModels, aControlComponents, NULL, sal_True );
- xVclContainerPeer->setGroup( aControlComponents );
- }
-}
-
-void StdTabController::activateFirst( ) throw(RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ImplActivateControl( sal_True );
-}
-
-void StdTabController::activateLast( ) throw(RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ImplActivateControl( sal_False );
-}
-
-
-Reference< XControl > StdTabController::FindControl( Sequence< Reference< XControl > >& rCtrls,
- const Reference< XControlModel > & rxCtrlModel )
-{
-
-/*
- // MT: Funktioniert nicht mehr, weil ich nicht mehr bei mir angemeldet bin,
- // weil DG das abfaengt.
-
- // #54677# Beim Laden eines HTML-Dokuments wird nach jedem Control ein
- // activateTabOrder gerufen und jede Menge Zeit in dieser Methode verbraten.
- // Die Anzahl dieser Schleifendurchlaufe steigt quadratisch, also versuchen
- // das Control direkt vom Model zu erhalten.
- // => Wenn genau ein Control als PropertyChangeListener angemeldet ist,
- // dann muss das auch das richtige sein.
-
- UnoControlModel* pUnoCtrlModel = UnoControlModel::GetImplementation( rxCtrlModel );
-
-
- if ( pUnoCtrlModel )
- {
- ListenerIterator aIt( pUnoCtrlModel->maPropertiesListeners );
- while( aIt.hasMoreElements() )
- {
- XEventListener* pL = aIt.next();
- Reference< XControl > xC( pL, UNO_QUERY );
- if ( xC.is() )
- {
- if( xC->getContext() == mxControlContainer )
- {
- xCtrl = xC;
- break;
- }
- }
- }
- }
- if ( !xCtrl.is() && rxCtrlModel.is())
-*/
- DBG_ASSERT( rxCtrlModel.is(), "ImplFindControl - welches ?!" );
-
- const Reference< XControl > * pCtrls = rCtrls.getConstArray();
- sal_Int32 nCtrls = rCtrls.getLength();
- for ( sal_Int32 n = 0; n < nCtrls; n++ )
- {
- Reference< XControlModel > xModel(pCtrls[n].is() ? pCtrls[n]->getModel() : Reference< XControlModel > ());
- if ( (XControlModel*)xModel.get() == (XControlModel*)rxCtrlModel.get() )
- {
- Reference< XControl > xCtrl( pCtrls[n] );
- ::comphelper::removeElementAt( rCtrls, n );
- return xCtrl;
- }
- }
- return Reference< XControl > ();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/stdtabcontrollermodel.cxx b/toolkit/source/controls/stdtabcontrollermodel.cxx
deleted file mode 100644
index 132e303eb3..0000000000
--- a/toolkit/source/controls/stdtabcontrollermodel.cxx
+++ /dev/null
@@ -1,434 +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/io/XMarkableStream.hpp>
-
-#include <toolkit/controls/stdtabcontrollermodel.hxx>
-#include <toolkit/helper/macros.hxx>
-#include <toolkit/helper/servicenames.hxx>
-#include <toolkit/helper/property.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <rtl/memory.h>
-#include <rtl/uuid.h>
-
-#include <tools/debug.hxx>
-
-#define UNOCONTROL_STREAMVERSION (short)2
-
-// ----------------------------------------------------
-// class UnoControlModelEntryList
-// ----------------------------------------------------
-UnoControlModelEntryList::UnoControlModelEntryList()
-{
-}
-
-UnoControlModelEntryList::~UnoControlModelEntryList()
-{
- Reset();
-}
-
-void UnoControlModelEntryList::Reset()
-{
- for ( size_t n = maList.size(); n; )
- DestroyEntry( --n );
-}
-
-void UnoControlModelEntryList::DestroyEntry( size_t nEntry )
-{
- UnoControlModelEntryListBase::iterator it = maList.begin();
- ::std::advance( it, nEntry );
-
- if ( (*it)->bGroup )
- delete (*it)->pGroup;
- else
- delete (*it)->pxControl;
-
- delete *it;
- maList.erase( it );
-}
-
-size_t UnoControlModelEntryList::size() const {
- return maList.size();
-}
-
-UnoControlModelEntry* UnoControlModelEntryList::operator[]( size_t i ) const {
- return ( i < maList.size() ) ? maList[ i ] : NULL;
-}
-
-void UnoControlModelEntryList::push_back( UnoControlModelEntry* item ) {
- maList.push_back( item );
-}
-
-void UnoControlModelEntryList::insert( size_t i, UnoControlModelEntry* item ) {
- if ( i < maList.size() ) {
- UnoControlModelEntryListBase::iterator it = maList.begin();
- ::std::advance( it, i );
- maList.insert( it, item );
- } else {
- maList.push_back( item );
- }
-}
-
-
-// ----------------------------------------------------
-// class StdTabControllerModel
-// ----------------------------------------------------
-StdTabControllerModel::StdTabControllerModel()
-{
- mbGroupControl = sal_True;
-}
-
-StdTabControllerModel::~StdTabControllerModel()
-{
-}
-
-sal_uInt32 StdTabControllerModel::ImplGetControlCount( const UnoControlModelEntryList& rList ) const
-{
- sal_uInt32 nCount = 0;
- size_t nEntries = rList.size();
- for ( size_t n = 0; n < nEntries; n++ )
- {
- UnoControlModelEntry* pEntry = rList[ n ];
- if ( pEntry->bGroup )
- nCount += ImplGetControlCount( *pEntry->pGroup );
- else
- nCount++;
- }
- return nCount;
-}
-
-void StdTabControllerModel::ImplGetControlModels( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ** ppRefs, const UnoControlModelEntryList& rList ) const
-{
- size_t nEntries = rList.size();
- for ( size_t n = 0; n < nEntries; n++ )
- {
- UnoControlModelEntry* pEntry = rList[ n ];
- if ( pEntry->bGroup )
- ImplGetControlModels( ppRefs, *pEntry->pGroup );
- else
- {
- **ppRefs = *pEntry->pxControl;
- (*ppRefs)++;
- }
- }
-}
-
-void StdTabControllerModel::ImplSetControlModels( UnoControlModelEntryList& rList, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) const
-{
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = Controls.getConstArray();
- sal_uInt32 nControls = Controls.getLength();
- for ( sal_uInt32 n = 0; n < nControls; n++ )
- {
- UnoControlModelEntry* pNewEntry = new UnoControlModelEntry;
- pNewEntry->bGroup = sal_False;
- pNewEntry->pxControl = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ;
- *pNewEntry->pxControl = pRefs[n];
- rList.push_back( pNewEntry );
- }
-}
-
-sal_uInt32 StdTabControllerModel::ImplGetControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrl, const UnoControlModelEntryList& rList ) const
-{
- for ( size_t n = rList.size(); n; )
- {
- UnoControlModelEntry* pEntry = rList[ --n ];
- if ( !pEntry->bGroup && ( *pEntry->pxControl == xCtrl ) )
- return n;
- }
- return CONTROLPOS_NOTFOUND;
-}
-
-void ImplWriteControls( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rCtrls )
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
- DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
-
- sal_uInt32 nStoredControls = 0;
- sal_Int32 nDataBeginMark = xMark->createMark();
-
- OutStream->writeLong( 0L ); // DataLen
- OutStream->writeLong( 0L ); // nStoredControls
-
- sal_uInt32 nCtrls = rCtrls.getLength();
- for ( sal_uInt32 n = 0; n < nCtrls; n++ )
- {
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xI = rCtrls.getConstArray()[n];
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xPO( xI, ::com::sun::star::uno::UNO_QUERY );
- DBG_ASSERT( xPO.is(), "write: Control doesn't support XPersistObject" );
- if ( xPO.is() )
- {
- OutStream->writeObject( xPO );
- nStoredControls++;
- }
- }
- sal_Int32 nDataLen = xMark->offsetToMark( nDataBeginMark );
- xMark->jumpToMark( nDataBeginMark );
- OutStream->writeLong( nDataLen );
- OutStream->writeLong( nStoredControls );
- xMark->jumpToFurthest();
- xMark->deleteMark(nDataBeginMark);
-}
-
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > ImplReadControls( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > & InStream )
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( InStream, ::com::sun::star::uno::UNO_QUERY );
- DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
-
- sal_Int32 nDataBeginMark = xMark->createMark();
-
- sal_Int32 nDataLen = InStream->readLong();
- sal_uInt32 nCtrls = InStream->readLong();
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq( nCtrls );
- for ( sal_uInt32 n = 0; n < nCtrls; n++ )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xObj = InStream->readObject();
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xI( xObj, ::com::sun::star::uno::UNO_QUERY );
- aSeq.getArray()[n] = xI;
- }
-
- // Falls bereits mehr drinsteht als diese Version kennt:
- xMark->jumpToMark( nDataBeginMark );
- InStream->skipBytes( nDataLen );
- xMark->deleteMark(nDataBeginMark);
- return aSeq;
-}
-
-
-// ::com::sun::star::uno::XInterface
-::com::sun::star::uno::Any StdTabControllerModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XTabControllerModel*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ),
- SAL_STATIC_CAST( ::com::sun::star::io::XPersistObject*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
- return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
-}
-
-// ::com::sun::star::lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( StdTabControllerModel )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject>* ) NULL )
-IMPL_XTYPEPROVIDER_END
-
-sal_Bool StdTabControllerModel::getGroupControl( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- return mbGroupControl;
-}
-
-void StdTabControllerModel::setGroupControl( sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- mbGroupControl = GroupControl;
-}
-
-void StdTabControllerModel::setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- maControls.Reset();
- ImplSetControlModels( maControls, Controls );
-}
-
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > StdTabControllerModel::getControlModels( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq( ImplGetControlCount( maControls ) );
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = aSeq.getArray();
- ImplGetControlModels( &pRefs, maControls );
- return aSeq;
-}
-
-void StdTabControllerModel::setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- // Die Controls stehen eventuel flach in der Liste und werden jetzt gruppiert.
- // Verschachtelte Gruppen sind erstmal nicht moeglich...
- // Das erste Element der Gruppe welches auch schon in der flachen Liste
- // stand bestimmt die Position der Gruppe.
-
- UnoControlModelEntry* pNewEntry = new UnoControlModelEntry;
- pNewEntry->bGroup = sal_True;
- pNewEntry->pGroup = new UnoControlModelEntryList;
- pNewEntry->pGroup->SetName( GroupName );
- ImplSetControlModels( *pNewEntry->pGroup, Group );
-
- sal_Bool bInserted = sal_False;
- size_t nElements = pNewEntry->pGroup->size();
- for ( size_t n = 0; n < nElements; n++ )
- {
- UnoControlModelEntry* pEntry = (*pNewEntry->pGroup)[ n ];
- if ( !pEntry->bGroup )
- {
- sal_uInt32 nPos = ImplGetControlPos( *pEntry->pxControl, maControls );
- // Eigentlich sollten alle Controls vorher in der flachen Liste stehen
- DBG_ASSERT( nPos != CONTROLPOS_NOTFOUND, "setGroup - Element not found" );
- if ( nPos != CONTROLPOS_NOTFOUND )
- {
- maControls.DestroyEntry( nPos );
- if ( !bInserted )
- {
- maControls.insert( nPos, pNewEntry );
- bInserted = sal_True;
- }
- }
- }
- }
- if ( !bInserted )
- maControls.push_back( pNewEntry );
-}
-
-sal_Int32 StdTabControllerModel::getGroupCount( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- // erstmal nur eine Ebene...
- // Das Model und die Impl-Methoden arbeiten zwar rekursiv, aber das wird
- // erstmal nich nach aussen gegeben.
-
- sal_Int32 nGroups = 0;
- size_t nEntries = maControls.size();
- for ( size_t n = 0; n < nEntries; n++ )
- {
- UnoControlModelEntry* pEntry = maControls[ n ];
- if ( pEntry->bGroup )
- nGroups++;
- }
- return nGroups;
-}
-
-void StdTabControllerModel::getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rGroup, ::rtl::OUString& rName ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq;
- sal_uInt32 nG = 0;
- size_t nEntries = maControls.size();
- for ( size_t n = 0; n < nEntries; n++ )
- {
- UnoControlModelEntry* pEntry = maControls[ n ];
- if ( pEntry->bGroup )
- {
- if ( nG == (sal_uInt32)nGroup )
- {
- sal_uInt32 nCount = ImplGetControlCount( *pEntry->pGroup );
- aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >( nCount );
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = aSeq.getArray();
- ImplGetControlModels( &pRefs, *pEntry->pGroup );
- rName = pEntry->pGroup->GetName();
- break;
- }
- nG++;
- }
- }
- rGroup = aSeq;
-}
-
-void StdTabControllerModel::getGroupByName( const ::rtl::OUString& rName, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rGroup ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_uInt32 nGroup = 0;
- size_t nEntries = maControls.size();
- for ( size_t n = 0; n < nEntries; n++ )
- {
- UnoControlModelEntry* pEntry = maControls[ n ];
- if ( pEntry->bGroup )
- {
- if ( pEntry->pGroup->GetName() == rName )
- {
- ::rtl::OUString Dummy;
- getGroup( nGroup, rGroup, Dummy );
- break;
- }
- nGroup++;
- }
- }
-}
-
-
-// ::com::sun::star::io::XPersistObject
-::rtl::OUString StdTabControllerModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_TabControllerModel );
-}
-
-void StdTabControllerModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
- DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
-
- OutStream->writeShort( UNOCONTROL_STREAMVERSION );
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aCtrls = getControlModels();
- ImplWriteControls( OutStream, aCtrls );
-
- sal_uInt32 nGroups = getGroupCount();
- OutStream->writeLong( nGroups );
- for ( sal_uInt32 n = 0; n < nGroups; n++ )
- {
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aGroupCtrls;
- ::rtl::OUString aGroupName;
- getGroup( n, aGroupCtrls, aGroupName );
- OutStream->writeUTF( aGroupName );
- ImplWriteControls( OutStream, aGroupCtrls );
- }
-}
-
-void StdTabControllerModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = ImplReadControls( InStream );
- setControlModels( aSeq );
-
- sal_uInt32 nGroups = InStream->readLong();
- for ( sal_uInt32 n = 0; n < nGroups; n++ )
- {
- ::rtl::OUString aGroupName = InStream->readUTF();
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aCtrlSeq = ImplReadControls( InStream );
- setGroup( aCtrlSeq, aGroupName );
- }
-}
-
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx
deleted file mode 100644
index f02f2c1fb1..0000000000
--- a/toolkit/source/controls/tabpagecontainer.cxx
+++ /dev/null
@@ -1,296 +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/controls/tabpagecontainer.hxx>
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/helper/property.hxx>
-#include <toolkit/controls/geometrycontrolmodel.hxx>
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#include <comphelper/processfactory.hxx>
-#include <osl/diagnose.h>
-#include <vcl/svapp.hxx>
-#include <com/sun/star/awt/XControlModel.hpp>
-#include <tools/diagnose_ex.h>
-
-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;
-
-#define WRONG_TYPE_EXCEPTION "Type must be ::com::sun::star::awt::tab::XTabPageModel!"
-// ----------------------------------------------------
-// class UnoControlTabPageContainerModel
-// ----------------------------------------------------
-UnoControlTabPageContainerModel::UnoControlTabPageContainerModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlTabPageContainerModel_Base( i_factory )
- ,maContainerListeners( *this )
-{
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_TEXT );
-}
-
-::rtl::OUString UnoControlTabPageContainerModel::getServiceName() throw(RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainerModel );
-}
-
-uno::Any UnoControlTabPageContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- switch(nPropId)
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainer ) );
- case BASEPROPERTY_BORDER:
- return uno::makeAny((sal_Int16) 0); // No Border
- default:
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
-}
-
-::cppu::IPropertyArrayHelper& UnoControlTabPageContainerModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlTabPageContainerModel::getPropertySetInfo( ) throw(RuntimeException)
-{
- static Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-void SAL_CALL UnoControlTabPageContainerModel::insertByIndex( ::sal_Int32 nIndex, const com::sun::star::uno::Any& aElement) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- uno::Reference < ::awt::tab::XTabPageModel > xTabPageModel;
- if(aElement >>= xTabPageModel)
- {
- if ( sal_Int32( m_aTabPageVector.size()) ==nIndex )
- m_aTabPageVector.push_back( xTabPageModel );
- else if ( sal_Int32( m_aTabPageVector.size()) > nIndex )
- {
- std::vector< uno::Reference< ::awt::tab::XTabPageModel > >::iterator aIter = m_aTabPageVector.begin();
- aIter += nIndex;
- m_aTabPageVector.insert( aIter, xTabPageModel );
- }
- else
- throw IndexOutOfBoundsException( ::rtl::OUString(), (OWeakObject *)this );
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElement;
- aEvent.Accessor <<= ::rtl::OUString::valueOf(nIndex);
- maContainerListeners.elementInserted( aEvent );
- }
- else
- throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( WRONG_TYPE_EXCEPTION )),
- (OWeakObject *)this, 2 );
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL UnoControlTabPageContainerModel::removeByIndex( ::sal_Int32 /*Index*/ ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-{
-}
-// XIndexReplace
-void SAL_CALL UnoControlTabPageContainerModel::replaceByIndex( ::sal_Int32 /*Index*/, const uno::Any& /*Element*/ ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-{
-}
-// -----------------------------------------------------------------------------
-// XIndexAccess
-::sal_Int32 SAL_CALL UnoControlTabPageContainerModel::getCount( ) throw (uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- return sal_Int32( m_aTabPageVector.size());
-}
-// -----------------------------------------------------------------------------
-uno::Any SAL_CALL UnoControlTabPageContainerModel::getByIndex( ::sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- if ( nIndex < 0 || nIndex > sal_Int32(m_aTabPageVector.size()) )
- throw lang::IndexOutOfBoundsException();
- return uno::makeAny(m_aTabPageVector[nIndex]);
-}
-// -----------------------------------------------------------------------------
-// XElementAccess
-uno::Type SAL_CALL UnoControlTabPageContainerModel::getElementType( ) throw (uno::RuntimeException)
-{
- return ::getCppuType(static_cast< Reference< com::sun::star::awt::XControlModel>* >(NULL));
-}
-// -----------------------------------------------------------------------------
-::sal_Bool SAL_CALL UnoControlTabPageContainerModel::hasElements( ) throw (uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- return !m_aTabPageVector.empty();
-}
-// XContainer
-void UnoControlTabPageContainerModel::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
-{
- maContainerListeners.addInterface( l );
-}
-
-void UnoControlTabPageContainerModel::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
-{
- maContainerListeners.removeInterface( l );
-}
-
-// ----------------------------------------------------
-// class UnoControlTabPageContainer
-// ----------------------------------------------------
-UnoControlTabPageContainer::UnoControlTabPageContainer( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlTabPageContainer_Base( i_factory )
- ,m_aTabPageListeners( *this )
-{
-}
-
-OUString UnoControlTabPageContainer::GetComponentServiceName()
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("TabPageContainer"));
-}
-
-void SAL_CALL UnoControlTabPageContainer::dispose( ) throw(RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- m_aTabPageListeners.disposeAndClear( aEvt );
- UnoControl::dispose();
-}
-
-void UnoControlTabPageContainer::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoControlBase::createPeer( rxToolkit, rParentPeer );
-
- Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
- if ( m_aTabPageListeners.getLength() )
- xTPContainer->addTabPageListener(&m_aTabPageListeners);
-}
-
-// -------------------------------------------------------------------
-// XTabPageContainer
-
-::sal_Int16 SAL_CALL UnoControlTabPageContainer::getActiveTabPageID() throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
- return xTPContainer->getActiveTabPageID();
-}
-void SAL_CALL UnoControlTabPageContainer::setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
- xTPContainer->setActiveTabPageID(_activetabpageid);
-}
-::sal_Int32 SAL_CALL UnoControlTabPageContainer::getTabPageCount( ) throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
- return xTPContainer->getTabPageCount();
-}
-::sal_Bool SAL_CALL UnoControlTabPageContainer::isTabPageActive( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
- return xTPContainer->isTabPageActive(tabPageIndex);
-}
-Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL UnoControlTabPageContainer::getTabPage( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
- return xTPContainer->getTabPage(tabPageIndex);
-}
-Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL UnoControlTabPageContainer::getTabPageByID( ::sal_Int16 tabPageID ) throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
- return xTPContainer->getTabPageByID(tabPageID);
-}
-void SAL_CALL UnoControlTabPageContainer::addTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
-{
- m_aTabPageListeners.addInterface( listener );
- if( getPeer().is() && m_aTabPageListeners.getLength() == 1 )
- {
- uno::Reference < awt::tab::XTabPageContainer > xTabPageContainer( getPeer(), uno::UNO_QUERY );
- xTabPageContainer->addTabPageListener( &m_aTabPageListeners );
- }
-}
-void SAL_CALL UnoControlTabPageContainer::removeTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
-{
- if( getPeer().is() && m_aTabPageListeners.getLength() == 1 )
- {
- uno::Reference < awt::tab::XTabPageContainer > xTabPageContainer( getPeer(), uno::UNO_QUERY );
- xTabPageContainer->addTabPageListener( &m_aTabPageListeners );
- }
- m_aTabPageListeners.removeInterface( listener );
-}
-
-void UnoControlTabPageContainer::updateFromModel()
-{
- UnoControlTabPageContainer_Base::updateFromModel();
- Reference< XContainerListener > xContainerListener( getPeer(), UNO_QUERY );
- ENSURE_OR_RETURN_VOID( xContainerListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
-
- ContainerEvent aEvent;
- aEvent.Source = getModel();
- Sequence< Reference< XControl > > aControls = getControls();
- const Reference< XControl >* pCtrls = aControls.getConstArray();
- const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
-
- for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
- {
- aEvent.Element <<= *pCtrls;
- xContainerListener->elementInserted( aEvent );
- }
-}
-void SAL_CALL UnoControlTabPageContainer::addControl( const ::rtl::OUString& Name, const Reference< ::com::sun::star::awt::XControl >& Control ) throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ControlContainerBase::addControl(Name,Control);
- Reference< XContainerListener > xContainerListener( getPeer(), UNO_QUERY );
- ContainerEvent aEvent;
- aEvent.Source = getModel();
- aEvent.Element <<= Control;
- xContainerListener->elementInserted( aEvent );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx
deleted file mode 100644
index ceae58a76e..0000000000
--- a/toolkit/source/controls/tabpagemodel.cxx
+++ /dev/null
@@ -1,396 +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 <vcl/window.hxx>
-#include <vcl/wall.hxx>
-#include <toolkit/controls/tabpagemodel.hxx>
-#include <toolkit/helper/property.hxx>
-#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/controls/stdtabcontroller.hxx>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <com/sun/star/awt/WindowAttribute.hpp>
-#include <com/sun/star/awt/UnoControlDialogModelProvider.hpp>
-#include <com/sun/star/resource/XStringResourceResolver.hpp>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <comphelper/sequence.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/outdev.hxx>
-
-#include <toolkit/helper/vclunohelper.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/image.hxx>
-#include <toolkit/controls/geometrycontrolmodel.hxx>
-
-#include <map>
-#include <algorithm>
-#include <functional>
-#include "tools/urlobj.hxx"
-#include "osl/file.hxx"
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::util;
-
-////HELPER
-::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
-
-// ----------------------------------------------------
-// class TabPageModel
-// ----------------------------------------------------
-
-//TabPageModel::TabPageModel()
-//{
-//}
-//TabPageModel::TabPageModel( uno::Reference< uno::XComponentContext > const & xCompContext)
-//{
-// (void) xCompContext;
-//}
-//
-//TabPageModel::~TabPageModel()
-//{
-//}
-//
-//////----- XInitialization -------------------------------------------------------------------
-//void SAL_CALL TabPageModel::initialize (const Sequence<Any>& rArguments)
-//{
-// sal_Int16 nPageId;
-// if ( rArguments.getLength() == 1 )
-// {
-// if ( !( rArguments[ 0 ] >>= nPageId ))
-// throw lang::IllegalArgumentException();
-// m_nTabPageId = nPageId;
-// }
-// else
-// m_nTabPageId = -1;
-//}
-//::sal_Int16 SAL_CALL TabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
-//{
-// return m_nTabPageId;
-//}
-//::sal_Bool SAL_CALL TabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException)
-//{
-// return m_bEnabled;
-//}
-//void SAL_CALL TabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
-//{
-// m_bEnabled = _enabled;
-//}
-//::rtl::OUString SAL_CALL TabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException)
-//{
-// return m_sTitle;
-//}
-//void SAL_CALL TabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
-//{
-// m_sTitle = _title;
-//}
-//::rtl::OUString SAL_CALL TabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException)
-//{
-// return m_sImageURL;
-//}
-//void SAL_CALL TabPageModel::setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException)
-//{
-// m_sImageURL = _imageurl;
-//}
-//::rtl::OUString SAL_CALL TabPageModel::getTooltip() throw (::com::sun::star::uno::RuntimeException)
-//{
-// return m_sTooltip;
-//}
-//void SAL_CALL TabPageModel::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
-//{
-// m_sTooltip = _tooltip;
-//}
-
-// ----------------------------------------------------
-// class UnoControlTabPageModel
-// ----------------------------------------------------
-UnoControlTabPageModel::UnoControlTabPageModel( Reference< XMultiServiceFactory > const & i_factory )
- :ControlModelContainerBase( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_TITLE );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
-}
-
-::rtl::OUString UnoControlTabPageModel::getServiceName( ) throw(RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageModel );
-}
-
-Any UnoControlTabPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- Any aAny;
-
- switch ( nPropId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPage );
- break;
- default:
- aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
- }
-
- return aAny;
-}
-
-::cppu::IPropertyArrayHelper& UnoControlTabPageModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlTabPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-////----- XInitialization -------------------------------------------------------------------
-void SAL_CALL UnoControlTabPageModel::initialize (const Sequence<Any>& rArguments)
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
-{
- sal_Int16 nPageId = -1;
- if ( rArguments.getLength() == 1 )
- {
- if ( !( rArguments[ 0 ] >>= nPageId ))
- throw lang::IllegalArgumentException();
- m_nTabPageId = nPageId;
- }
- else if ( rArguments.getLength() == 2 )
- {
- if ( !( rArguments[ 0 ] >>= nPageId ))
- throw lang::IllegalArgumentException();
- m_nTabPageId = nPageId;
- ::rtl::OUString sURL;
- if ( !( rArguments[ 1 ] >>= sURL ))
- throw lang::IllegalArgumentException();
- Reference<container::XNameContainer > xDialogModel = awt::UnoControlDialogModelProvider::create( maContext.getUNOContext(),sURL);
- if ( xDialogModel.is() )
- {
- Sequence< ::rtl::OUString> aNames = xDialogModel->getElementNames();
- const ::rtl::OUString* pIter = aNames.getConstArray();
- const ::rtl::OUString* pEnd = pIter + aNames.getLength();
- for(;pIter != pEnd;++pIter)
- {
- try
- {
- Any aElement(xDialogModel->getByName(*pIter));
- xDialogModel->removeByName(*pIter);
- insertByName(*pIter,aElement);
- }
- catch(const Exception& ex)
- {
- (void)ex;
- }
- }
- Reference<XPropertySet> xDialogProp(xDialogModel,UNO_QUERY);
- if ( xDialogProp.is() )
- {
- static const ::rtl::OUString s_sResourceResolver(RTL_CONSTASCII_USTRINGPARAM("ResourceResolver"));
- Reference<XPropertySet> xThis(*this,UNO_QUERY);
- xThis->setPropertyValue(s_sResourceResolver,xDialogProp->getPropertyValue(s_sResourceResolver));
- xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_TITLE),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_TITLE)));
- xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_IMAGEURL),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_IMAGEURL)));
- xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_HELPTEXT),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_HELPTEXT)));
- xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED)));
- xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_HELPURL),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_HELPURL)));
- }
- }
- }
- else
- m_nTabPageId = -1;
-}
-//===== Service ===============================================================
-::rtl::OUString UnoControlTabPageModel_getImplementationName (void) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tab.UnoControlTabPageModel"));
-}
-
-Sequence<rtl::OUString> SAL_CALL UnoControlTabPageModel_getSupportedServiceNames (void)
- throw (RuntimeException)
-{
- const ::rtl::OUString sServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tab.UnoControlTabPageModel"));
- return Sequence<rtl::OUString>(&sServiceName, 1);
-}
-//=============================================================================
-// = class UnoControlTabPage
-// ============================================================================
-
-UnoControlTabPage::UnoControlTabPage( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlTabPage_Base( i_factory )
- ,m_bWindowListener(false)
-{
- maComponentInfos.nWidth = 280;
- maComponentInfos.nHeight = 400;
-}
-UnoControlTabPage::~UnoControlTabPage()
-{
-}
-
-::rtl::OUString UnoControlTabPage::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TabPageModel"));
-}
-
-void UnoControlTabPage::dispose() throw(RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
-
- EventObject aEvt;
- aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
- ControlContainerBase::dispose();
-}
-
-void SAL_CALL UnoControlTabPage::disposing( const EventObject& Source )throw(RuntimeException)
-{
- ControlContainerBase::disposing( Source );
-}
-
-void UnoControlTabPage::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ImplUpdateResourceResolver();
-
- UnoControlContainer::createPeer( rxToolkit, rParentPeer );
-
- Reference < tab::XTabPage > xTabPage( getPeer(), UNO_QUERY );
- if ( xTabPage.is() )
- {
- if ( !m_bWindowListener )
- {
- Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
- addWindowListener( xWL );
- m_bWindowListener = true;
- }
- }
-}
-
-static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
-{
- ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
- return aTmp;
-}
-// ::com::sun::star::awt::XWindowListener
-void SAL_CALL UnoControlTabPage::windowResized( const ::com::sun::star::awt::WindowEvent& e )
-throw (::com::sun::star::uno::RuntimeException)
-{
- OutputDevice*pOutDev = Application::GetDefaultDevice();
- DBG_ASSERT( pOutDev, "Missing Default Device!" );
- if ( pOutDev && !mbSizeModified )
- {
- // Currentley we are simply using MAP_APPFONT
- ::Size aAppFontSize( e.Width, e.Height );
-
- Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW );
- Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY );
- OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" );
- if ( xDialogDevice.is() )
- {
- DeviceInfo aDeviceInfo( xDialogDevice->getInfo() );
- aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
- aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
- }
-
- aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize );
-
- // Remember that changes have been done by listener. No need to
- // update the position because of property change event.
- mbSizeModified = true;
- Sequence< rtl::OUString > aProps( 2 );
- Sequence< Any > aValues( 2 );
- // Properties in a sequence must be sorted!
- aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ));
- aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ));
- aValues[0] <<= aAppFontSize.Height();
- aValues[1] <<= aAppFontSize.Width();
-
- ImplSetPropertyValues( aProps, aValues, true );
- mbSizeModified = false;
- }
-}
-
-void SAL_CALL UnoControlTabPage::windowMoved( const ::com::sun::star::awt::WindowEvent& e )
-throw (::com::sun::star::uno::RuntimeException)
-{
- OutputDevice*pOutDev = Application::GetDefaultDevice();
- DBG_ASSERT( pOutDev, "Missing Default Device!" );
- if ( pOutDev && !mbPosModified )
- {
- // Currentley we are simply using MAP_APPFONT
- Any aAny;
- ::Size aTmp( e.X, e.Y );
- aTmp = ImplMapPixelToAppFont( pOutDev, aTmp );
-
- // Remember that changes have been done by listener. No need to
- // update the position because of property change event.
- mbPosModified = true;
- Sequence< rtl::OUString > aProps( 2 );
- Sequence< Any > aValues( 2 );
- aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ));
- aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ));
- aValues[0] <<= aTmp.Width();
- aValues[1] <<= aTmp.Height();
-
- ImplSetPropertyValues( aProps, aValues, true );
- mbPosModified = false;
- }
-}
-
-void SAL_CALL UnoControlTabPage::windowShown( const ::com::sun::star::lang::EventObject& e )
-throw (::com::sun::star::uno::RuntimeException)
-{
- (void)e;
-}
-
-void SAL_CALL UnoControlTabPage::windowHidden( const ::com::sun::star::lang::EventObject& e )
-throw (::com::sun::star::uno::RuntimeException)
-{
- (void)e;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/tkscrollbar.cxx b/toolkit/source/controls/tkscrollbar.cxx
deleted file mode 100644
index ff56558972..0000000000
--- a/toolkit/source/controls/tkscrollbar.cxx
+++ /dev/null
@@ -1,298 +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/controls/tkscrollbar.hxx"
-#include "toolkit/helper/property.hxx"
-#include "toolkit/helper/unopropertyarrayhelper.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <tools/debug.hxx>
-
-// for introspection
-#include <toolkit/awt/vclxwindows.hxx>
-
-//........................................................................
-namespace toolkit
-{
-//........................................................................
-
- using namespace ::com::sun::star;
-
- //====================================================================
- //= UnoControlScrollBarModel
- //====================================================================
- //--------------------------------------------------------------------
- UnoControlScrollBarModel::UnoControlScrollBarModel( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
- {
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXScrollBar );
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString UnoControlScrollBarModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
- {
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlScrollBarModel );
- }
-
- //--------------------------------------------------------------------
- uno::Any UnoControlScrollBarModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- {
- switch ( nPropId )
- {
- case BASEPROPERTY_LIVE_SCROLL:
- return uno::makeAny( (sal_Bool)sal_False );
- case BASEPROPERTY_DEFAULTCONTROL:
- return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlScrollBar ) );
-
- default:
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
- }
-
- //--------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper& UnoControlScrollBarModel::getInfoHelper()
- {
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
- }
-
- //--------------------------------------------------------------------
- uno::Reference< beans::XPropertySetInfo > UnoControlScrollBarModel::getPropertySetInfo( ) throw(uno::RuntimeException)
- {
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
- }
-
-
- //====================================================================
- //= UnoControlScrollBarModel
- //====================================================================
- UnoScrollBarControl::UnoScrollBarControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
- :UnoControlBase( i_factory )
- ,maAdjustmentListeners( *this )
- {
- }
-
- ::rtl::OUString UnoScrollBarControl::GetComponentServiceName()
- {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScrollBar"));
- }
-
- // ::com::sun::star::uno::XInterface
- uno::Any UnoScrollBarControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
- {
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XAdjustmentListener*, this ),
- SAL_STATIC_CAST( awt::XScrollBar*, this ) );
- return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
- }
-
- // ::com::sun::star::lang::XTypeProvider
- IMPL_XTYPEPROVIDER_START( UnoScrollBarControl )
- getCppuType( ( uno::Reference< awt::XAdjustmentListener>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XScrollBar>* ) NULL ),
- UnoControlBase::getTypes()
- IMPL_XTYPEPROVIDER_END
-
- void UnoScrollBarControl::dispose() throw(uno::RuntimeException)
- {
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- maAdjustmentListeners.disposeAndClear( aEvt );
- UnoControl::dispose();
- }
-
- void UnoScrollBarControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
- {
- UnoControl::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
- xScrollBar->addAdjustmentListener( this );
- }
-
- // ::com::sun::star::awt::XAdjustmentListener
- void UnoScrollBarControl::adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
- {
- switch ( rEvent.Type )
- {
- case ::com::sun::star::awt::AdjustmentType_ADJUST_LINE:
- case ::com::sun::star::awt::AdjustmentType_ADJUST_PAGE:
- case ::com::sun::star::awt::AdjustmentType_ADJUST_ABS:
- {
- uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
-
- if ( xScrollBar.is() )
- {
- uno::Any aAny;
- aAny <<= xScrollBar->getValue();
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLVALUE ), aAny, sal_False );
- }
- }
- break;
- default:
- {
- OSL_FAIL( "UnoScrollBarControl::adjustmentValueChanged - unknown Type" );
-
- }
- }
-
- if ( maAdjustmentListeners.getLength() )
- maAdjustmentListeners.adjustmentValueChanged( rEvent );
- }
-
- // ::com::sun::star::awt::XScrollBar
- void UnoScrollBarControl::addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
- {
- maAdjustmentListeners.addInterface( l );
- }
-
- void UnoScrollBarControl::removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
- {
- maAdjustmentListeners.removeInterface( l );
- }
-
- void UnoScrollBarControl::setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLVALUE ), uno::makeAny( n ), sal_True );
- }
-
- void UnoScrollBarControl::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException)
- {
- uno::Any aAny;
- aAny <<= nValue;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLVALUE ), aAny, sal_True );
- aAny <<= nVisible;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VISIBLESIZE ), aAny, sal_True );
- aAny <<= nMax;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLVALUE_MAX ), aAny, sal_True );
- }
-
- sal_Int32 UnoScrollBarControl::getValue() throw(::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 n = 0;
- if ( getPeer().is() )
- {
- uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
- n = xScrollBar->getValue();
- }
- return n;
- }
-
- void UnoScrollBarControl::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLVALUE_MAX ), uno::makeAny( n ), sal_True );
- }
-
- sal_Int32 UnoScrollBarControl::getMaximum() throw(::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 n = 0;
- if ( getPeer().is() )
- {
- uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
- n = xScrollBar->getMaximum();
- }
- return n;
- }
-
- void UnoScrollBarControl::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINEINCREMENT ), uno::makeAny( n ), sal_True );
- }
-
- sal_Int32 UnoScrollBarControl::getLineIncrement() throw(::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 n = 0;
- if ( getPeer().is() )
- {
- uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
- n = xScrollBar->getLineIncrement();
- }
- return n;
- }
-
- void UnoScrollBarControl::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_BLOCKINCREMENT ), uno::makeAny( n ), sal_True );
- }
-
- sal_Int32 UnoScrollBarControl::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 n = 0;
- if ( getPeer().is() )
- {
- uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
- n = xScrollBar->getBlockIncrement();
- }
- return n;
- }
-
- void UnoScrollBarControl::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VISIBLESIZE ), uno::makeAny( n ), sal_True );
- }
-
- sal_Int32 UnoScrollBarControl::getVisibleSize() throw(::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 n = 0;
- if ( getPeer().is() )
- {
- uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
- n = xScrollBar->getVisibleSize();
- }
- return n;
- }
-
- void UnoScrollBarControl::setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ORIENTATION ), uno::makeAny( n ), sal_True );
- }
-
- sal_Int32 UnoScrollBarControl::getOrientation() throw(::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 n = 0;
- if ( getPeer().is() )
- {
- uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
- n = xScrollBar->getOrientation();
- }
- return n;
- }
-
-
-
-//........................................................................
-} // namespace toolkit
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/tksimpleanimation.cxx b/toolkit/source/controls/tksimpleanimation.cxx
deleted file mode 100644
index 92c5595d03..0000000000
--- a/toolkit/source/controls/tksimpleanimation.cxx
+++ /dev/null
@@ -1,193 +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/controls/tksimpleanimation.hxx"
-#include "toolkit/helper/property.hxx"
-#include "toolkit/helper/unopropertyarrayhelper.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <tools/debug.hxx>
-
-//........................................................................
-namespace toolkit
-{
-//........................................................................
-
- using namespace ::com::sun::star;
-
- //====================================================================
- //= UnoSimpleAnimationControlModel
- //====================================================================
- //--------------------------------------------------------------------
- UnoSimpleAnimationControlModel::UnoSimpleAnimationControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
- {
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_REPEAT );
- ImplRegisterProperty( BASEPROPERTY_STEP_TIME );
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString UnoSimpleAnimationControlModel::getServiceName()
- throw( uno::RuntimeException )
- {
- return ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
- }
-
- //--------------------------------------------------------------------
- uno::Any UnoSimpleAnimationControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- {
- switch ( nPropId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControl ) );
-
- case BASEPROPERTY_STEP_TIME:
- return uno::makeAny( (sal_Int32) 100 );
-
- case BASEPROPERTY_REPEAT:
- return uno::makeAny( (sal_Bool)sal_True );
-
- default:
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
- }
-
- //--------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper& UnoSimpleAnimationControlModel::getInfoHelper()
- {
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
- }
-
- //--------------------------------------------------------------------
- uno::Reference< beans::XPropertySetInfo > UnoSimpleAnimationControlModel::getPropertySetInfo( )
- throw( uno::RuntimeException )
- {
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString SAL_CALL UnoSimpleAnimationControlModel::getImplementationName()
- throw( uno::RuntimeException )
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoSimpleAnimationControlModel" ) );
- }
-
- //--------------------------------------------------------------------
- uno::Sequence< ::rtl::OUString > SAL_CALL UnoSimpleAnimationControlModel::getSupportedServiceNames()
- throw( uno::RuntimeException )
- {
- uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 2 );
- aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
- return aServices;
- }
-
- //====================================================================
- //= UnoSimpleAnimationControl
- //====================================================================
- //--------------------------------------------------------------------
- UnoSimpleAnimationControl::UnoSimpleAnimationControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
- :UnoSimpleAnimationControl_Base( i_factory )
- {
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString UnoSimpleAnimationControl::GetComponentServiceName()
- {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SimpleAnimation"));
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString SAL_CALL UnoSimpleAnimationControl::getImplementationName()
- throw( uno::RuntimeException )
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoSimpleAnimationControl" ) );
- }
-
- //--------------------------------------------------------------------
- uno::Sequence< ::rtl::OUString > SAL_CALL UnoSimpleAnimationControl::getSupportedServiceNames()
- throw( uno::RuntimeException )
- {
- uno::Sequence< ::rtl::OUString > aServices( UnoSimpleAnimationControl_Base::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControl );
- return aServices;
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoSimpleAnimationControl::start() throw ( uno::RuntimeException )
- {
- uno::Reference< XSimpleAnimation > xAnimation;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xAnimation.set( getPeer(), uno::UNO_QUERY );
- }
- if ( xAnimation.is() )
- xAnimation->start();
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoSimpleAnimationControl::stop() throw ( uno::RuntimeException )
- {
- uno::Reference< XSimpleAnimation > xAnimation;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xAnimation.set( getPeer(), uno::UNO_QUERY );
- }
- if ( xAnimation.is() )
- xAnimation->stop();
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoSimpleAnimationControl::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& ImageList )
- throw ( uno::RuntimeException )
- {
- uno::Reference< XSimpleAnimation > xAnimation;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xAnimation.set( getPeer(), uno::UNO_QUERY );
- }
- if ( xAnimation.is() )
- xAnimation->setImageList( ImageList );
- }
-
-//........................................................................
-} // namespace toolkit
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/tkspinbutton.cxx b/toolkit/source/controls/tkspinbutton.cxx
deleted file mode 100644
index 44bca1bb96..0000000000
--- a/toolkit/source/controls/tkspinbutton.cxx
+++ /dev/null
@@ -1,354 +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/controls/tkspinbutton.hxx"
-#include "toolkit/helper/property.hxx"
-#include "toolkit/helper/unopropertyarrayhelper.hxx"
-#include <com/sun/star/awt/ScrollBarOrientation.hpp>
-
-
-#include <cppuhelper/typeprovider.hxx>
-#include <tools/debug.hxx>
-
-//........................................................................
-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;
-
- //====================================================================
- //= UnoSpinButtonModel
- //====================================================================
- //--------------------------------------------------------------------
- UnoSpinButtonModel::UnoSpinButtonModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
- {
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_ORIENTATION );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_REPEAT );
- ImplRegisterProperty( BASEPROPERTY_REPEAT_DELAY );
- ImplRegisterProperty( BASEPROPERTY_SYMBOL_COLOR );
- ImplRegisterProperty( BASEPROPERTY_SPINVALUE );
- ImplRegisterProperty( BASEPROPERTY_SPINVALUE_MIN );
- ImplRegisterProperty( BASEPROPERTY_SPINVALUE_MAX );
- ImplRegisterProperty( BASEPROPERTY_SPININCREMENT );
- ImplRegisterProperty( BASEPROPERTY_TABSTOP );
- ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
- ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString UnoSpinButtonModel::getServiceName( ) throw (RuntimeException)
- {
- return ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonModel );
- }
-
- //--------------------------------------------------------------------
- Any UnoSpinButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- {
- switch ( nPropId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- return makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonControl ) );
-
- case BASEPROPERTY_BORDER:
- return makeAny( (sal_Int16) 0 );
-
- case BASEPROPERTY_REPEAT:
- return makeAny( (sal_Bool)sal_True );
-
- default:
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
- }
-
- //--------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper& UnoSpinButtonModel::getInfoHelper()
- {
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
- }
-
- //--------------------------------------------------------------------
- Reference< XPropertySetInfo > UnoSpinButtonModel::getPropertySetInfo( ) throw(RuntimeException)
- {
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString SAL_CALL UnoSpinButtonModel::getImplementationName( ) throw(RuntimeException)
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoSpinButtonModel" ) );
- }
-
- //--------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL UnoSpinButtonModel::getSupportedServiceNames() throw(RuntimeException)
- {
- Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonModel );
- return aServices;
- }
-
- //====================================================================
- //= UnoSpinButtonControl
- //====================================================================
- //--------------------------------------------------------------------
- UnoSpinButtonControl::UnoSpinButtonControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlBase( i_factory )
- ,maAdjustmentListeners( *this )
- {
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString UnoSpinButtonControl::GetComponentServiceName()
- {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SpinButton"));
- }
-
- //--------------------------------------------------------------------
- Any UnoSpinButtonControl::queryAggregation( const Type & rType ) throw(RuntimeException)
- {
- Any aRet = UnoControlBase::queryAggregation( rType );
- if ( !aRet.hasValue() )
- aRet = UnoSpinButtonControl_Base::queryInterface( rType );
- return aRet;
- }
-
- //--------------------------------------------------------------------
- IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoSpinButtonControl, UnoControlBase, UnoSpinButtonControl_Base )
-
- //--------------------------------------------------------------------
- void UnoSpinButtonControl::dispose() throw(RuntimeException)
- {
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- if ( maAdjustmentListeners.getLength() )
- {
- Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
- if ( xSpinnable.is() )
- xSpinnable->removeAdjustmentListener( this );
-
- EventObject aDisposeEvent;
- aDisposeEvent.Source = *this;
-
- aGuard.clear();
- maAdjustmentListeners.disposeAndClear( aDisposeEvent );
- }
-
- UnoControl::dispose();
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString SAL_CALL UnoSpinButtonControl::getImplementationName( ) throw(RuntimeException)
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoSpinButtonControl" ) );
- }
-
- //--------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL UnoSpinButtonControl::getSupportedServiceNames() throw(RuntimeException)
- {
- Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonControl );
- return aServices;
- }
-
- //--------------------------------------------------------------------
- void UnoSpinButtonControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
- {
- UnoControl::createPeer( rxToolkit, rParentPeer );
-
- Reference < XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
- if ( xSpinnable.is() )
- xSpinnable->addAdjustmentListener( this );
- }
-
- //--------------------------------------------------------------------
- void UnoSpinButtonControl::adjustmentValueChanged( const AdjustmentEvent& rEvent ) throw(RuntimeException)
- {
- switch ( rEvent.Type )
- {
- case AdjustmentType_ADJUST_LINE:
- case AdjustmentType_ADJUST_PAGE:
- case AdjustmentType_ADJUST_ABS:
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE ), makeAny( rEvent.Value ), sal_False );
- break;
- default:
- OSL_FAIL( "UnoSpinButtonControl::adjustmentValueChanged - unknown Type" );
- }
-
- if ( maAdjustmentListeners.getLength() )
- {
- AdjustmentEvent aEvent( rEvent );
- aEvent.Source = *this;
- maAdjustmentListeners.adjustmentValueChanged( aEvent );
- }
- }
-
- //--------------------------------------------------------------------
- void UnoSpinButtonControl::addAdjustmentListener( const Reference< XAdjustmentListener > & listener ) throw(RuntimeException)
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- maAdjustmentListeners.addInterface( listener );
- }
-
- //--------------------------------------------------------------------
- void UnoSpinButtonControl::removeAdjustmentListener( const Reference< XAdjustmentListener > & listener ) throw(RuntimeException)
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- maAdjustmentListeners.removeInterface( listener );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoSpinButtonControl::setValue( sal_Int32 value ) throw (RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE ), makeAny( value ), sal_True );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoSpinButtonControl::setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) throw (RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MIN ), makeAny( minValue ), sal_True );
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MAX ), makeAny( maxValue ), sal_True );
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE ), makeAny( currentValue ), sal_True );
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL UnoSpinButtonControl::getValue( ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- sal_Int32 nValue = 0;
-
- Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
- if ( xSpinnable.is() )
- nValue = xSpinnable->getValue();
-
- return nValue;
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoSpinButtonControl::setMinimum( sal_Int32 minValue ) throw (RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MIN ), makeAny( minValue ), sal_True );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoSpinButtonControl::setMaximum( sal_Int32 maxValue ) throw (RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MAX ), makeAny( maxValue ), sal_True );
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL UnoSpinButtonControl::getMinimum( ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- sal_Int32 nMin = 0;
-
- Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
- if ( xSpinnable.is() )
- nMin = xSpinnable->getMinimum();
-
- return nMin;
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL UnoSpinButtonControl::getMaximum( ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- sal_Int32 nMax = 0;
-
- Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
- if ( xSpinnable.is() )
- nMax = xSpinnable->getMaximum();
-
- return nMax;
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoSpinButtonControl::setSpinIncrement( sal_Int32 spinIncrement ) throw (RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPININCREMENT ), makeAny( spinIncrement ), sal_True );
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL UnoSpinButtonControl::getSpinIncrement( ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- sal_Int32 nIncrement = 0;
-
- Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
- if ( xSpinnable.is() )
- nIncrement = xSpinnable->getSpinIncrement();
-
- return nIncrement;
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoSpinButtonControl::setOrientation( sal_Int32 orientation ) throw (NoSupportException, RuntimeException)
- {
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ORIENTATION ), makeAny( orientation ), sal_True );
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL UnoSpinButtonControl::getOrientation( ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- sal_Int32 nOrientation = ScrollBarOrientation::HORIZONTAL;
-
- Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
- if ( xSpinnable.is() )
- nOrientation = xSpinnable->getOrientation();
-
- return nOrientation;
- }
-
-//........................................................................
-} // namespace toolkit
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/tkthrobber.cxx b/toolkit/source/controls/tkthrobber.cxx
deleted file mode 100644
index 2f7f5c5c37..0000000000
--- a/toolkit/source/controls/tkthrobber.cxx
+++ /dev/null
@@ -1,203 +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/controls/tkthrobber.hxx"
-#include "toolkit/helper/property.hxx"
-#include "toolkit/helper/unopropertyarrayhelper.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <tools/debug.hxx>
-
-//........................................................................
-namespace toolkit
-{
-//........................................................................
-
- using namespace ::com::sun::star;
-
- //====================================================================
- //= UnoThrobberControlModel
- //====================================================================
- //--------------------------------------------------------------------
- UnoThrobberControlModel::UnoThrobberControlModel( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
- {
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString UnoThrobberControlModel::getServiceName( ) throw ( uno::RuntimeException )
- {
- return ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
- }
-
- //--------------------------------------------------------------------
- uno::Any UnoThrobberControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- {
- switch ( nPropId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl ) );
- case BASEPROPERTY_BORDER:
- return uno::makeAny( (sal_Int16) 0 );
- default:
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
- }
-
- //--------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper& UnoThrobberControlModel::getInfoHelper()
- {
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
- }
-
- //--------------------------------------------------------------------
- uno::Reference< beans::XPropertySetInfo > UnoThrobberControlModel::getPropertySetInfo()
- throw( uno::RuntimeException )
- {
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString SAL_CALL UnoThrobberControlModel::getImplementationName()
- throw( uno::RuntimeException )
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoThrobberControlModel" ) );
- }
-
- //--------------------------------------------------------------------
- uno::Sequence< ::rtl::OUString > SAL_CALL UnoThrobberControlModel::getSupportedServiceNames()
- throw( uno::RuntimeException )
- {
- uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 2 );
- aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel );
- return aServices;
- }
-
- //====================================================================
- //= UnoThrobberControl
- //====================================================================
- //--------------------------------------------------------------------
- UnoThrobberControl::UnoThrobberControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
- :UnoControlBase( i_factory )
- {
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString UnoThrobberControl::GetComponentServiceName()
- {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Throbber"));
- }
-
- //--------------------------------------------------------------------
- uno::Any UnoThrobberControl::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException )
- {
- uno::Any aRet = UnoControlBase::queryAggregation( rType );
- if ( !aRet.hasValue() )
- aRet = UnoThrobberControl_Base::queryInterface( rType );
- return aRet;
- }
-
- //--------------------------------------------------------------------
- IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoThrobberControl, UnoControlBase, UnoThrobberControl_Base )
-
- //--------------------------------------------------------------------
- void UnoThrobberControl::dispose() throw( uno::RuntimeException )
- {
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
-
- UnoControl::dispose();
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString SAL_CALL UnoThrobberControl::getImplementationName()
- throw( uno::RuntimeException )
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoThrobberControl" ) );
- }
-
- //--------------------------------------------------------------------
- uno::Sequence< ::rtl::OUString > SAL_CALL UnoThrobberControl::getSupportedServiceNames()
- throw( uno::RuntimeException )
- {
- uno::Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
- aServices.realloc( aServices.getLength() + 2 );
- aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl );
- aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControl );
- return aServices;
- }
-
- //--------------------------------------------------------------------
- void UnoThrobberControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit,
- const uno::Reference< awt::XWindowPeer > & rParentPeer )
- throw( uno::RuntimeException )
- {
- UnoControl::createPeer( rxToolkit, rParentPeer );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoThrobberControl::start() throw ( uno::RuntimeException )
- {
- ::osl::MutexGuard aGuard( GetMutex() );
-
- uno::Reference< XThrobber > xAnimation( getPeer(), uno::UNO_QUERY );
- if ( xAnimation.is() )
- xAnimation->start();
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL UnoThrobberControl::stop() throw ( uno::RuntimeException )
- {
- ::osl::MutexGuard aGuard( GetMutex() );
-
- uno::Reference< XThrobber > xAnimation( getPeer(), uno::UNO_QUERY );
- if ( xAnimation.is() )
- xAnimation->stop();
- }
-
-//........................................................................
-} // namespace toolkit
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx
deleted file mode 100644
index b6be2dbc49..0000000000
--- a/toolkit/source/controls/tree/treecontrol.cxx
+++ /dev/null
@@ -1,514 +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 <treecontrol.hxx>
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/view/SelectionType.hpp>
-#include <com/sun/star/awt/tree/XTreeDataModel.hpp>
-#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/helper/property.hxx>
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#include <comphelper/processfactory.hxx>
-#include <osl/diagnose.h>
-
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt::tree;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::view;
-
-namespace toolkit
-{
-// ----------------------------------------------------
-// class UnoTreeModel
-// ----------------------------------------------------
-UnoTreeModel::UnoTreeModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_TABSTOP );
- ImplRegisterProperty( BASEPROPERTY_TREE_SELECTIONTYPE );
- ImplRegisterProperty( BASEPROPERTY_TREE_EDITABLE );
- ImplRegisterProperty( BASEPROPERTY_TREE_DATAMODEL );
- ImplRegisterProperty( BASEPROPERTY_TREE_ROOTDISPLAYED );
- ImplRegisterProperty( BASEPROPERTY_TREE_SHOWSHANDLES );
- ImplRegisterProperty( BASEPROPERTY_TREE_SHOWSROOTHANDLES );
- ImplRegisterProperty( BASEPROPERTY_ROW_HEIGHT );
- ImplRegisterProperty( BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING );
- ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
-}
-
-UnoTreeModel::UnoTreeModel( const UnoTreeModel& rModel )
-: UnoControlModel( rModel )
-{
-}
-
-UnoControlModel* UnoTreeModel::Clone() const
-{
- return new UnoTreeModel( *this );
-}
-
-OUString UnoTreeModel::getServiceName() throw(RuntimeException)
-{
- return OUString::createFromAscii( szServiceName_TreeControlModel );
-}
-
-Any UnoTreeModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- switch( nPropId )
- {
- case BASEPROPERTY_TREE_SELECTIONTYPE:
- return Any( SelectionType_NONE );
- case BASEPROPERTY_ROW_HEIGHT:
- return Any( sal_Int32( 0 ) );
- case BASEPROPERTY_TREE_DATAMODEL:
- return Any( Reference< XTreeDataModel >( 0 ) );
- case BASEPROPERTY_TREE_EDITABLE:
- case BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING:
- return Any( sal_False );
- case BASEPROPERTY_TREE_ROOTDISPLAYED:
- case BASEPROPERTY_TREE_SHOWSROOTHANDLES:
- case BASEPROPERTY_TREE_SHOWSHANDLES:
- return Any( sal_True );
- case BASEPROPERTY_DEFAULTCONTROL:
- return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_TreeControl ) );
- default:
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
-}
-
-::cppu::IPropertyArrayHelper& UnoTreeModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// XMultiPropertySet
-Reference< XPropertySetInfo > UnoTreeModel::getPropertySetInfo( ) throw(RuntimeException)
-{
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-// ----------------------------------------------------
-// class UnoTreeControl
-// ----------------------------------------------------
-UnoTreeControl::UnoTreeControl( const Reference< XMultiServiceFactory >& i_factory )
-: UnoTreeControl_Base( i_factory )
-, maSelectionListeners( *this )
-, maTreeExpansionListeners( *this )
-, maTreeEditListeners( *this )
-{
-}
-
-OUString UnoTreeControl::GetComponentServiceName()
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("Tree"));
-}
-
-// -------------------------------------------------------------------
-// ::com::sun::star::view::XSelectionSupplier
-// -------------------------------------------------------------------
-
-sal_Bool SAL_CALL UnoTreeControl::select( const Any& rSelection ) throw (IllegalArgumentException, RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->select( rSelection );
-}
-
-// -------------------------------------------------------------------
-
-Any SAL_CALL UnoTreeControl::getSelection() throw (RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::addSelectionChangeListener( const Reference< XSelectionChangeListener >& xListener ) throw (RuntimeException)
-{
- maSelectionListeners.addInterface( xListener );
- if( getPeer().is() && (maSelectionListeners.getLength() == 1) )
- {
- // maSelectionListeners acts as a proxy,
- // add it to the peer if this is the first listener added to that proxy
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->addSelectionChangeListener(&maSelectionListeners);
- }
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::removeSelectionChangeListener( const Reference< XSelectionChangeListener >& xListener ) throw (RuntimeException)
-{
- if( getPeer().is() && (maSelectionListeners.getLength() == 1) )
- {
- // maSelectionListeners acts as a proxy,
- // remove it from the peer if this is the last listener removed from that proxy
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeSelectionChangeListener(&maSelectionListeners);
- }
- maSelectionListeners.removeInterface( xListener );
-}
-
-// -------------------------------------------------------------------
-// ::com::sun::star::view::XMultiSelectionSupplier
-// -------------------------------------------------------------------
-
-sal_Bool SAL_CALL UnoTreeControl::addSelection( const Any& rSelection ) throw (IllegalArgumentException, RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->addSelection(rSelection);
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::removeSelection( const Any& rSelection ) throw (IllegalArgumentException, RuntimeException)
-{
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeSelection(rSelection);
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::clearSelection() throw (RuntimeException)
-{
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->clearSelection();
-}
-
-// -------------------------------------------------------------------
-
-sal_Int32 SAL_CALL UnoTreeControl::getSelectionCount() throw (RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getSelectionCount();
-}
-
-// -------------------------------------------------------------------
-
-Reference< XEnumeration > SAL_CALL UnoTreeControl::createSelectionEnumeration() throw (RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->createSelectionEnumeration();
-}
-
-// -------------------------------------------------------------------
-
-Reference< XEnumeration > SAL_CALL UnoTreeControl::createReverseSelectionEnumeration() throw (RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->createReverseSelectionEnumeration();
-}
-
-// --------------------------------------------------------------------
-// XTreeControl
-// --------------------------------------------------------------------
-
-OUString SAL_CALL UnoTreeControl::getDefaultExpandedGraphicURL() throw (RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getDefaultExpandedGraphicURL();
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::setDefaultExpandedGraphicURL( const OUString& _defaultexpansiongraphicurl ) throw (RuntimeException)
-{
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->setDefaultExpandedGraphicURL(_defaultexpansiongraphicurl);
-}
-
-// -------------------------------------------------------------------
-
-OUString SAL_CALL UnoTreeControl::getDefaultCollapsedGraphicURL() throw (RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getDefaultCollapsedGraphicURL();
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::setDefaultCollapsedGraphicURL( const OUString& _defaultcollapsedgraphicurl ) throw (RuntimeException)
-{
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->setDefaultCollapsedGraphicURL(_defaultcollapsedgraphicurl);
-}
-
-// -------------------------------------------------------------------
-
-sal_Bool SAL_CALL UnoTreeControl::isNodeExpanded( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isNodeExpanded(xNode);
-}
-
-// -------------------------------------------------------------------
-
-sal_Bool SAL_CALL UnoTreeControl::isNodeCollapsed( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isNodeCollapsed(xNode);
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::makeNodeVisible( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException)
-{
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->makeNodeVisible(xNode);
-}
-
-// -------------------------------------------------------------------
-
-sal_Bool SAL_CALL UnoTreeControl::isNodeVisible( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isNodeVisible(xNode);
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::expandNode( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException)
-{
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->expandNode(xNode);
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::collapseNode( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException)
-{
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->collapseNode(xNode);
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::addTreeExpansionListener( const Reference< XTreeExpansionListener >& xListener ) throw (RuntimeException)
-{
- maTreeExpansionListeners.addInterface( xListener );
- if( getPeer().is() && (maTreeExpansionListeners.getLength() == 1) )
- {
- // maSelectionListeners acts as a proxy,
- // add it to the peer if this is the first listener added to that proxy
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->addTreeExpansionListener(&maTreeExpansionListeners);
- }
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::removeTreeExpansionListener( const Reference< XTreeExpansionListener >& xListener ) throw (RuntimeException)
-{
- if( getPeer().is() && (maTreeExpansionListeners.getLength() == 1) )
- {
- // maSelectionListeners acts as a proxy,
- // remove it from the peer if this is the last listener removed from that proxy
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeTreeExpansionListener(&maTreeExpansionListeners);
- }
- maTreeExpansionListeners.removeInterface( xListener );
-}
-
-// -------------------------------------------------------------------
-
-Reference< XTreeNode > SAL_CALL UnoTreeControl::getNodeForLocation( sal_Int32 x, sal_Int32 y ) throw (RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getNodeForLocation(x,y);
-}
-
-// -------------------------------------------------------------------
-
-Reference< XTreeNode > SAL_CALL UnoTreeControl::getClosestNodeForLocation( sal_Int32 x, sal_Int32 y ) throw (RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getClosestNodeForLocation(x,y);
-}
-
-// -------------------------------------------------------------------
-
-awt::Rectangle SAL_CALL UnoTreeControl::getNodeRect( const Reference< XTreeNode >& Node ) throw (IllegalArgumentException, RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getNodeRect( Node );
-}
-
-// -------------------------------------------------------------------
-
-sal_Bool SAL_CALL UnoTreeControl::isEditing( ) throw (RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isEditing();
-}
-
-// -------------------------------------------------------------------
-
-sal_Bool SAL_CALL UnoTreeControl::stopEditing() throw (RuntimeException)
-{
- return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->stopEditing();
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::cancelEditing() throw (RuntimeException)
-{
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->cancelEditing();
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::startEditingAtNode( const Reference< XTreeNode >& xNode ) throw (IllegalArgumentException, RuntimeException)
-{
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->startEditingAtNode(xNode);
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::addTreeEditListener( const Reference< XTreeEditListener >& xListener ) throw (RuntimeException)
-{
- maTreeEditListeners.addInterface( xListener );
- if( getPeer().is() && (maTreeEditListeners.getLength() == 1) )
- {
- // maSelectionListeners acts as a proxy,
- // add it to the peer if this is the first listener added to that proxy
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->addTreeEditListener(&maTreeEditListeners);
- }
-}
-
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::removeTreeEditListener( const Reference< XTreeEditListener >& xListener ) throw (RuntimeException)
-{
- if( getPeer().is() && (maTreeEditListeners.getLength() == 1) )
- {
- // maSelectionListeners acts as a proxy,
- // remove it from the peer if this is the last listener removed from that proxy
- Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
- Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeTreeEditListener(&maTreeEditListeners);
- }
- maTreeEditListeners.removeInterface( xListener );
-}
-
-// -------------------------------------------------------------------
-// XComponent
-// -------------------------------------------------------------------
-
-void SAL_CALL UnoTreeControl::dispose( ) throw(RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = static_cast< ::cppu::OWeakObject* >(this);
- maSelectionListeners.disposeAndClear( aEvt );
- maTreeExpansionListeners.disposeAndClear( aEvt );
- UnoControl::dispose();
-}
-
-void UnoTreeControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoControlBase::createPeer( rxToolkit, rParentPeer );
-
- Reference< XTreeControl > xTree( getPeer(), UNO_QUERY_THROW );
- if( maSelectionListeners.getLength() )
- xTree->addSelectionChangeListener( &maSelectionListeners );
- if( maTreeExpansionListeners.getLength() )
- xTree->addTreeExpansionListener( &maTreeExpansionListeners );
-}
-
-}
-
-Reference< XInterface > SAL_CALL TreeControl_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
-{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeControl( i_factory ) );
-}
-
-Reference< XInterface > SAL_CALL TreeControlModel_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
-{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeModel( i_factory ) );
-}
-
-void SAL_CALL TreeEditListenerMultiplexer::nodeEditing( const Reference< XTreeNode >& Node ) throw (RuntimeException, ::com::sun::star::util::VetoException)
-{
- ::cppu::OInterfaceIteratorHelper aIt( *this );
- while( aIt.hasMoreElements() )
- {
- Reference< XTreeEditListener > xListener(static_cast< XTreeEditListener* >( aIt.next() ) );
- try
- {
- xListener->nodeEditing( Node );
- }
- catch( DisposedException& e )
- {
- OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" );
- if ( e.Context == xListener || !e.Context.is() )
- aIt.remove();
- }
- catch( RuntimeException& e )
- {
- (void)e;
- DISPLAY_EXCEPTION( TreeEditListenerMultiplexer, nodeEditing, e )
- }
- }
-}
-
-void SAL_CALL TreeEditListenerMultiplexer::nodeEdited( const Reference< XTreeNode >& Node, const OUString& NewText ) throw (RuntimeException)
-{
- ::cppu::OInterfaceIteratorHelper aIt( *this );
- while( aIt.hasMoreElements() )
- {
- Reference< XTreeEditListener > xListener( static_cast< XTreeEditListener* >( aIt.next() ) );
- try
- {
- xListener->nodeEdited( Node, NewText );
- }
- catch( DisposedException& e )
- {
- OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" );
- if ( e.Context == xListener || !e.Context.is() )
- aIt.remove();
- }
- catch( RuntimeException& e )
- {
- (void)e;
- DISPLAY_EXCEPTION( TreeEditListenerMultiplexer, nodeEdited, e )
- }
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/tree/treecontrol.hxx b/toolkit/source/controls/tree/treecontrol.hxx
deleted file mode 100644
index bfdaf7378a..0000000000
--- a/toolkit/source/controls/tree/treecontrol.hxx
+++ /dev/null
@@ -1,141 +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_TREE_CONTROL_HXX
-#define TOOLKIT_TREE_CONTROL_HXX
-
-#include <com/sun/star/awt/tree/XTreeControl.hpp>
-#include <toolkit/controls/unocontrols.hxx>
-#include <toolkit/controls/unocontrolmodel.hxx>
-#include <toolkit/helper/servicenames.hxx>
-#include <cppuhelper/implbase1.hxx>
-
-#include <toolkit/helper/listenermultiplexer.hxx>
-
-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;
-using namespace ::com::sun::star::container;
-
-// ===================================================================
-// = UnoTreeModel
-// ===================================================================
-class UnoTreeModel : public UnoControlModel
-{
-protected:
- Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
- ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-
-public:
- UnoTreeModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
- UnoTreeModel( const UnoTreeModel& rModel );
-
- UnoControlModel* Clone() const;
-
- // ::com::sun::star::beans::XMultiPropertySet
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::io::XPersistObject
- ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- DECLIMPL_SERVICEINFO_DERIVED( UnoTreeModel, UnoControlModel, szServiceName_TreeControlModel )
-};
-
-
-// ===================================================================
-// = UnoTreeControl
-// ===================================================================
-typedef ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::tree::XTreeControl > UnoTreeControl_Base;
-class UnoTreeControl : public UnoTreeControl_Base
-{
-public:
- UnoTreeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
- ::rtl::OUString GetComponentServiceName();
-
- // ::com::sun::star::lang::XComponent
- void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::awt::XControl
- void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::view::XSelectionSupplier
- virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::view::XMultiSelectionSupplier
- virtual ::sal_Bool SAL_CALL addSelection( const ::com::sun::star::uno::Any& Selection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeSelection( const ::com::sun::star::uno::Any& Selection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearSelection( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getSelectionCount( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createSelectionEnumeration( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createReverseSelectionEnumeration( ) throw (::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::awt::XTreeControl
- virtual ::rtl::OUString SAL_CALL getDefaultExpandedGraphicURL() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDefaultExpandedGraphicURL( const ::rtl::OUString& _defaultexpandedgraphicurl ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDefaultCollapsedGraphicURL() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDefaultCollapsedGraphicURL( const ::rtl::OUString& _defaultcollapsedgraphicurl ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isNodeExpanded( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isNodeCollapsed( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL makeNodeVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isNodeVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL expandNode( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL collapseNode( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Rectangle SAL_CALL getNodeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isEditing( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL stopEditing( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelEditing( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL startEditingAtNode( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addTreeEditListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeEditListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeTreeEditListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeEditListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- DECLIMPL_SERVICEINFO_DERIVED( UnoTreeControl, UnoControlBase, szServiceName_TreeControl )
-
- using UnoControl::getPeer;
-private:
- TreeSelectionListenerMultiplexer maSelectionListeners;
- TreeExpansionListenerMultiplexer maTreeExpansionListeners;
- TreeEditListenerMultiplexer maTreeEditListeners;
-};
-
-} // toolkit
-
-#endif // _TOOLKIT_TREE_CONTROL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/tree/treedatamodel.cxx b/toolkit/source/controls/tree/treedatamodel.cxx
deleted file mode 100644
index 780f82d4d6..0000000000
--- a/toolkit/source/controls/tree/treedatamodel.cxx
+++ /dev/null
@@ -1,676 +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/tree/XMutableTreeDataModel.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <rtl/ref.hxx>
-#include <toolkit/helper/mutexandbroadcasthelper.hxx>
-#include <toolkit/helper/servicenames.hxx>
-
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::awt::tree;
-using namespace ::com::sun::star::lang;
-
-namespace toolkit
-{
-
- enum broadcast_type { nodes_changed, nodes_inserted, nodes_removed, structure_changed };
-
-class MutableTreeNode;
-class MutableTreeDataModel;
-
-typedef rtl::Reference< MutableTreeNode > MutableTreeNodeRef;
-typedef std::vector< MutableTreeNodeRef > TreeNodeVector;
-typedef rtl::Reference< MutableTreeDataModel > MutableTreeDataModelRef;
-
-static void implThrowIllegalArgumentException() throw( IllegalArgumentException )
-{
- throw IllegalArgumentException();
-}
-
-class MutableTreeDataModel : public ::cppu::WeakAggImplHelper2< XMutableTreeDataModel, XServiceInfo >,
- public MutexAndBroadcastHelper
-{
-public:
- MutableTreeDataModel();
- virtual ~MutableTreeDataModel();
-
- void broadcast( broadcast_type eType, const Reference< XTreeNode >& xParentNode, const Reference< XTreeNode >* pNodes, sal_Int32 nNodes );
-
- // XMutableTreeDataModel
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode > SAL_CALL createNode( const ::com::sun::star::uno::Any& DisplayValue, ::sal_Bool ChildsOnDemand ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setRoot( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode >& RootNode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-
- // XTreeDataModel
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getRoot( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addTreeDataModelListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeDataModelListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeTreeDataModelListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeDataModelListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
-
- // XComponent
- virtual void SAL_CALL dispose( ) throw (RuntimeException);
- virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
- virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException);
- virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
-
-private:
- bool mbDisposed;
- Reference< XTreeNode > mxRootNode;
-};
-
-class MutableTreeNode: public ::cppu::WeakAggImplHelper2< XMutableTreeNode, XServiceInfo >
-{
- friend class MutableTreeDataModel;
-
-public:
- MutableTreeNode( const MutableTreeDataModelRef& xModel, const Any& rValue, sal_Bool bChildsOnDemand );
- virtual ~MutableTreeNode();
-
- void setParent( MutableTreeNode* pParent );
- void broadcast_changes();
- void broadcast_changes(const Reference< XTreeNode >& xNode, bool bNew);
-
- // XMutableTreeNode
- virtual ::com::sun::star::uno::Any SAL_CALL getDataValue() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDataValue( const ::com::sun::star::uno::Any& _datavalue ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL appendChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode >& ChildNode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertChildByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode >& ChildNode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeChildByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setHasChildrenOnDemand( ::sal_Bool ChildrenOnDemand ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDisplayValue( const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setNodeGraphicURL( const ::rtl::OUString& URL ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setExpandedGraphicURL( const ::rtl::OUString& URL ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCollapsedGraphicURL( const ::rtl::OUString& URL ) throw (::com::sun::star::uno::RuntimeException);
-
- // XTreeNode
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getChildAt( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getChildCount( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getIndex( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL hasChildrenOnDemand( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getDisplayValue( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getNodeGraphicURL( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getExpandedGraphicURL( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCollapsedGraphicURL( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException);
- virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
-
- static MutableTreeNode* getImplementation( const Reference< XTreeNode >& xNode, bool bThrows ) throw (IllegalArgumentException);
- Reference< XTreeNode > getReference( MutableTreeNode* pNode )
- {
- return Reference< XTreeNode >( pNode );
- }
-
-private:
- TreeNodeVector maChilds;
- Any maDisplayValue;
- Any maDataValue;
- sal_Bool mbHasChildsOnDemand;
- ::osl::Mutex maMutex;
- MutableTreeNode* mpParent;
- MutableTreeDataModelRef mxModel;
- OUString maNodeGraphicURL;
- OUString maExpandedGraphicURL;
- OUString maCollapsedGraphicURL;
- bool mbIsInserted;
-};
-
-///////////////////////////////////////////////////////////////////////
-// class MutableTreeDataModel
-///////////////////////////////////////////////////////////////////////
-
-MutableTreeDataModel::MutableTreeDataModel()
-: mbDisposed( false )
-{
-}
-
-//---------------------------------------------------------------------
-
-MutableTreeDataModel::~MutableTreeDataModel()
-{
-}
-
-//---------------------------------------------------------------------
-
-void MutableTreeDataModel::broadcast( broadcast_type eType, const Reference< XTreeNode >& xParentNode, const Reference< XTreeNode >* pNodes, sal_Int32 nNodes )
-{
- ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XTreeDataModelListener::static_type() );
- if( pIter )
- {
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- const Sequence< Reference< XTreeNode > > aNodes( pNodes, nNodes );
- TreeDataModelEvent aEvent( xSource, aNodes, xParentNode );
-
- ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
- while(aListIter.hasMoreElements())
- {
- XTreeDataModelListener* pListener = static_cast<XTreeDataModelListener*>(aListIter.next());
- switch( eType )
- {
- case nodes_changed: pListener->treeNodesChanged(aEvent); break;
- case nodes_inserted: pListener->treeNodesInserted(aEvent); break;
- case nodes_removed: pListener->treeNodesRemoved(aEvent); break;
- case structure_changed: pListener->treeStructureChanged(aEvent); break;
- }
- }
- }
-}
-
-//---------------------------------------------------------------------
-// XMutableTreeDataModel
-//---------------------------------------------------------------------
-
-Reference< XMutableTreeNode > SAL_CALL MutableTreeDataModel::createNode( const Any& aValue, sal_Bool bChildsOnDemand ) throw (RuntimeException)
-{
- return new MutableTreeNode( this, aValue, bChildsOnDemand );
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeDataModel::setRoot( const Reference< XMutableTreeNode >& xNode ) throw (IllegalArgumentException, RuntimeException)
-{
- if( !xNode.is() )
- throw IllegalArgumentException();
-
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- if( xNode != mxRootNode )
- {
- if( mxRootNode.is() )
- {
- MutableTreeNodeRef xOldImpl( dynamic_cast< MutableTreeNode* >( mxRootNode.get() ) );
- if( xOldImpl.is() )
- xOldImpl->mbIsInserted = false;
- }
-
- MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) );
- if( !xImpl.is() || xImpl->mbIsInserted )
- throw IllegalArgumentException();
-
- xImpl->mbIsInserted = true;
- mxRootNode.set(xImpl.get());
-
- Reference< XTreeNode > xParentNode;
- broadcast( structure_changed, xParentNode, &mxRootNode, 1 );
- }
-}
-
-//---------------------------------------------------------------------
-// XTreeDataModel
-//---------------------------------------------------------------------
-
-Reference< XTreeNode > SAL_CALL MutableTreeDataModel::getRoot( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- return mxRootNode;
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeDataModel::addTreeDataModelListener( const Reference< XTreeDataModelListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.addListener( XTreeDataModelListener::static_type(), xListener );
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeDataModel::removeTreeDataModelListener( const Reference< XTreeDataModelListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.removeListener( XTreeDataModelListener::static_type(), xListener );
-}
-
-//---------------------------------------------------------------------
-// XComponent
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeDataModel::dispose() throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- if( !mbDisposed )
- {
- mbDisposed = true;
- ::com::sun::star::lang::EventObject aEvent;
- aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
- BrdcstHelper.aLC.disposeAndClear( aEvent );
- }
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeDataModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.addListener( XEventListener::static_type(), xListener );
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeDataModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
-{
- BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
-}
-
-//---------------------------------------------------------------------
-// XServiceInfo
-//---------------------------------------------------------------------
-
-OUString SAL_CALL MutableTreeDataModel::getImplementationName( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.MutableTreeDataModel" ) );
- return aImplName;
-}
-
-//---------------------------------------------------------------------
-
-sal_Bool SAL_CALL MutableTreeDataModel::supportsService( const OUString& ServiceName ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- return ServiceName.equalsAscii( szServiceName_MutableTreeDataModel );
-}
-
-//---------------------------------------------------------------------
-
-Sequence< OUString > SAL_CALL MutableTreeDataModel::getSupportedServiceNames( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- static const OUString aServiceName( OUString::createFromAscii( szServiceName_MutableTreeDataModel ) );
- static const Sequence< OUString > aSeq( &aServiceName, 1 );
- return aSeq;
-}
-
-///////////////////////////////////////////////////////////////////////
-// class MutabelTreeNode
-///////////////////////////////////////////////////////////////////////
-
-MutableTreeNode::MutableTreeNode( const MutableTreeDataModelRef& xModel, const Any& rValue, sal_Bool bChildsOnDemand )
-: maDisplayValue( rValue )
-, mbHasChildsOnDemand( bChildsOnDemand )
-, mpParent( 0 )
-, mxModel( xModel )
-, mbIsInserted( false )
-{
-}
-
-//---------------------------------------------------------------------
-
-MutableTreeNode::~MutableTreeNode()
-{
- TreeNodeVector::iterator aIter( maChilds.begin() );
- while( aIter != maChilds.end() )
- (*aIter++)->setParent(0);
-}
-
-//---------------------------------------------------------------------
-
-void MutableTreeNode::setParent( MutableTreeNode* pParent )
-{
- mpParent = pParent;
-}
-
-//---------------------------------------------------------------------
-
-MutableTreeNode* MutableTreeNode::getImplementation( const Reference< XTreeNode >& xNode, bool bThrows ) throw (IllegalArgumentException)
-{
- MutableTreeNode* pImpl = dynamic_cast< MutableTreeNode* >( xNode.get() );
- if( bThrows && !pImpl )
- implThrowIllegalArgumentException();
-
- return pImpl;
-}
-
-//---------------------------------------------------------------------
-
-void MutableTreeNode::broadcast_changes()
-{
- if( mxModel.is() )
- {
- Reference< XTreeNode > xParent( getReference( mpParent ) );
- Reference< XTreeNode > xNode( getReference( this ) );
- mxModel->broadcast( nodes_changed, xParent, &xNode, 1 );
- }
-}
-
-//---------------------------------------------------------------------
-
-void MutableTreeNode::broadcast_changes(const Reference< XTreeNode >& xNode, bool bNew)
-{
- if( mxModel.is() )
- {
- Reference< XTreeNode > xParent( getReference( this ) );
- mxModel->broadcast( bNew ? nodes_inserted : nodes_removed, xParent, &xNode, 1 );
- }
-}
-
-//---------------------------------------------------------------------
-// XMutableTreeNode
-//---------------------------------------------------------------------
-
-Any SAL_CALL MutableTreeNode::getDataValue() throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- return maDataValue;
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeNode::setDataValue( const Any& _datavalue ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- maDataValue = _datavalue;
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeNode::appendChild( const Reference< XMutableTreeNode >& xChildNode ) throw (IllegalArgumentException, RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- Reference< XTreeNode > xNode( xChildNode.get() );
- MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) );
-
- if( !xImpl.is() || xImpl->mbIsInserted || (this == xImpl.get()) )
- throw IllegalArgumentException();
-
- maChilds.push_back( xImpl );
- xImpl->setParent(this);
- xImpl->mbIsInserted = true;
-
- broadcast_changes( xNode, true );
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const Reference< XMutableTreeNode >& xChildNode ) throw (IllegalArgumentException, IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
-
- if( (nChildIndex < 0) || (nChildIndex > (sal_Int32)maChilds.size()) )
- throw IndexOutOfBoundsException();
-
- Reference< XTreeNode > xNode( xChildNode.get() );
- MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) );
- if( !xImpl.is() || xImpl->mbIsInserted || (this == xImpl.get()) )
- throw IllegalArgumentException();
-
- xImpl->mbIsInserted = true;
-
- TreeNodeVector::iterator aIter( maChilds.begin() );
- while( (nChildIndex-- > 0) && (aIter != maChilds.end()) )
- aIter++;
-
- maChilds.insert( aIter, xImpl );
- xImpl->setParent( this );
-
- broadcast_changes( xNode, true );
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeNode::removeChildByIndex( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
-
- MutableTreeNodeRef xImpl;
-
- if( (nChildIndex >= 0) && (nChildIndex < (sal_Int32)maChilds.size()) )
- {
- TreeNodeVector::iterator aIter( maChilds.begin() );
- while( nChildIndex-- && (aIter != maChilds.end()) )
- aIter++;
-
- if( aIter != maChilds.end() )
- {
- xImpl = (*aIter);
- maChilds.erase( aIter );
- }
- }
-
- if( !xImpl.is() )
- throw IndexOutOfBoundsException();
-
- xImpl->setParent(0);
- xImpl->mbIsInserted = false;
-
- broadcast_changes( getReference( xImpl.get() ), false );
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeNode::setHasChildrenOnDemand( sal_Bool bChildsOnDemand ) throw (RuntimeException)
-{
- bool bChanged;
-
- {
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- bChanged = mbHasChildsOnDemand != bChildsOnDemand;
- mbHasChildsOnDemand = bChildsOnDemand;
- }
-
- if( bChanged )
- broadcast_changes();
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeNode::setDisplayValue( const Any& aValue ) throw (RuntimeException)
-{
- {
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- maDisplayValue = aValue;
- }
-
- broadcast_changes();
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeNode::setNodeGraphicURL( const OUString& rURL ) throw (RuntimeException)
-{
- bool bChanged;
-
- {
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- bChanged = maNodeGraphicURL != rURL;
- maNodeGraphicURL = rURL;
- }
-
- if( bChanged )
- broadcast_changes();
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeNode::setExpandedGraphicURL( const OUString& rURL ) throw (RuntimeException)
-{
- bool bChanged;
-
- {
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- bChanged = maExpandedGraphicURL != rURL;
- maExpandedGraphicURL = rURL;
- }
-
- if( bChanged )
- broadcast_changes();
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL MutableTreeNode::setCollapsedGraphicURL( const OUString& rURL ) throw (RuntimeException)
-{
- bool bChanged;
-
- {
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- bChanged = maCollapsedGraphicURL != rURL;
- maCollapsedGraphicURL = rURL;
- }
-
- if( bChanged )
- broadcast_changes();
-}
-
-//---------------------------------------------------------------------
-// XTreeNode
-//---------------------------------------------------------------------
-
-Reference< XTreeNode > SAL_CALL MutableTreeNode::getChildAt( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException,RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
-
- if( (nChildIndex < 0) || (nChildIndex >= (sal_Int32)maChilds.size()) )
- throw IndexOutOfBoundsException();
- return getReference( maChilds[nChildIndex].get() );
-}
-
-//---------------------------------------------------------------------
-
-sal_Int32 SAL_CALL MutableTreeNode::getChildCount( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- return (sal_Int32)maChilds.size();
-}
-
-//---------------------------------------------------------------------
-
-Reference< XTreeNode > SAL_CALL MutableTreeNode::getParent( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- return getReference( mpParent );
-}
-
-//---------------------------------------------------------------------
-
-sal_Int32 SAL_CALL MutableTreeNode::getIndex( const Reference< XTreeNode >& xNode ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
-
- MutableTreeNodeRef xImpl( MutableTreeNode::getImplementation( xNode, false ) );
- if( xImpl.is() )
- {
- sal_Int32 nChildCount = maChilds.size();
- while( nChildCount-- )
- {
- if( maChilds[nChildCount] == xImpl )
- return nChildCount;
- }
- }
-
- return -1;
-}
-
-//---------------------------------------------------------------------
-
-sal_Bool SAL_CALL MutableTreeNode::hasChildrenOnDemand( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- return mbHasChildsOnDemand;
-}
-
-//---------------------------------------------------------------------
-
-Any SAL_CALL MutableTreeNode::getDisplayValue( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- return maDisplayValue;
-}
-
-//---------------------------------------------------------------------
-
-OUString SAL_CALL MutableTreeNode::getNodeGraphicURL( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- return maNodeGraphicURL;
-}
-
-//---------------------------------------------------------------------
-
-OUString SAL_CALL MutableTreeNode::getExpandedGraphicURL( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- return maExpandedGraphicURL;
-}
-
-//---------------------------------------------------------------------
-
-OUString SAL_CALL MutableTreeNode::getCollapsedGraphicURL( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- return maCollapsedGraphicURL;
-}
-
-//---------------------------------------------------------------------
-// XServiceInfo
-//---------------------------------------------------------------------
-
-OUString SAL_CALL MutableTreeNode::getImplementationName( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.MutableTreeNode" ) );
- return aImplName;
-}
-
-//---------------------------------------------------------------------
-
-sal_Bool SAL_CALL MutableTreeNode::supportsService( const OUString& ServiceName ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.awt.tree.MutableTreeNode" ) );
-}
-
-//---------------------------------------------------------------------
-
-Sequence< OUString > SAL_CALL MutableTreeNode::getSupportedServiceNames( ) throw (RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- static const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.tree.MutableTreeNode" ) );
- static const Sequence< OUString > aSeq( &aServiceName, 1 );
- return aSeq;
-}
-
-}
-
-Reference< XInterface > SAL_CALL MutableTreeDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
-{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::MutableTreeDataModel );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
deleted file mode 100644
index 483ac66a6d..0000000000
--- a/toolkit/source/controls/unocontrol.cxx
+++ /dev/null
@@ -1,1610 +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/XControlContainer.hpp>
-#include <com/sun/star/awt/WindowAttribute.hpp>
-#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/resource/XStringResourceResolver.hpp>
-#include <toolkit/controls/unocontrol.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <rtl/memory.h>
-#include <rtl/uuid.h>
-#include <osl/mutex.hxx>
-#include <tools/string.hxx>
-#include <tools/table.hxx>
-#include <tools/date.hxx>
-#include <tools/time.hxx>
-#include <tools/urlobj.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <vcl/svapp.hxx>
-#include <vcl/wrkwin.hxx>
-#include <comphelper/stl_types.hxx>
-#include <comphelper/processfactory.hxx>
-#include <toolkit/helper/property.hxx>
-#include <toolkit/helper/servicenames.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <vcl/svapp.hxx>
-#include <osl/mutex.hxx>
-#include <toolkit/controls/accessiblecontrolcontext.hxx>
-#include <comphelper/container.hxx>
-
-#include <algorithm>
-#include <set>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
-
-using ::com::sun::star::accessibility::XAccessibleContext;
-using ::com::sun::star::accessibility::XAccessible;
-
-struct LanguageDependentProp
-{
- const char* pPropName;
- sal_Int32 nPropNameLength;
-};
-
-static const LanguageDependentProp aLanguageDependentProp[] =
-{
- { "Text", 4 },
- { "Label", 5 },
- { "Title", 5 },
- { "HelpText", 8 },
- { "CurrencySymbol", 14 },
- { "StringItemList", 14 },
- { 0, 0 }
-};
-
-static Sequence< ::rtl::OUString> lcl_ImplGetPropertyNames( const Reference< XMultiPropertySet > & rxModel )
-{
- Sequence< ::rtl::OUString> aNames;
- Reference< XPropertySetInfo > xPSInf = rxModel->getPropertySetInfo();
- DBG_ASSERT( xPSInf.is(), "UpdateFromModel: No PropertySetInfo!" );
- if ( xPSInf.is() )
- {
- Sequence< Property> aProps = xPSInf->getProperties();
- sal_Int32 nLen = aProps.getLength();
- aNames = Sequence< ::rtl::OUString>( nLen );
- ::rtl::OUString* pNames = aNames.getArray();
- const Property* pProps = aProps.getConstArray();
- for ( sal_Int32 n = 0; n < nLen; ++n, ++pProps, ++pNames)
- *pNames = pProps->Name;
- }
- return aNames;
-}
-
-// ====================================================
-class VclListenerLock
-{
-private:
- VCLXWindow* m_pLockWindow;
-
-public:
- inline VclListenerLock( VCLXWindow* _pLockWindow )
- :m_pLockWindow( _pLockWindow )
- {
- if ( m_pLockWindow )
- m_pLockWindow->suspendVclEventListening( );
- }
- inline ~VclListenerLock( )
- {
- if ( m_pLockWindow )
- m_pLockWindow->resumeVclEventListening( );
- }
-
-private:
- VclListenerLock(); // never implemented
- VclListenerLock( const VclListenerLock& ); // never implemented
- VclListenerLock& operator=( const VclListenerLock& ); // never implemented
-};
-
-typedef ::std::map< ::rtl::OUString, sal_Int32 > MapString2Int;
-struct UnoControl_Data
-{
- MapString2Int aSuspendedPropertyNotifications;
- /// true if and only if our model has a property ResourceResolver
- bool bLocalizationSupport;
-
- UnoControl_Data()
- :aSuspendedPropertyNotifications()
- ,bLocalizationSupport( false )
- {
- }
-};
-
-// ----------------------------------------------------
-// class UnoControl
-// ----------------------------------------------------
-DBG_NAME( UnoControl )
-UnoControl::UnoControl()
- :maContext( ::comphelper::getProcessServiceFactory() )
- ,maDisposeListeners( *this )
- ,maWindowListeners( *this )
- ,maFocusListeners( *this )
- ,maKeyListeners( *this )
- ,maMouseListeners( *this )
- ,maMouseMotionListeners( *this )
- ,maPaintListeners( *this )
- ,maModeChangeListeners( GetMutex() )
- ,mpData( new UnoControl_Data )
-{
- DBG_CTOR( UnoControl, NULL );
- OSL_ENSURE( false, "UnoControl::UnoControl: not implemented. Well, not really." );
- // just implemented to let the various FooImplInheritanceHelper compile, you should use the
- // version taking a service factory
-}
-
-UnoControl::UnoControl( const Reference< XMultiServiceFactory >& i_factory )
- : maContext( i_factory )
- , maDisposeListeners( *this )
- , maWindowListeners( *this )
- , maFocusListeners( *this )
- , maKeyListeners( *this )
- , maMouseListeners( *this )
- , maMouseMotionListeners( *this )
- , maPaintListeners( *this )
- , maModeChangeListeners( GetMutex() )
- , mpData( new UnoControl_Data )
-{
- DBG_CTOR( UnoControl, NULL );
- mbDisposePeer = sal_True;
- mbRefeshingPeer = sal_False;
- mbCreatingPeer = sal_False;
- mbCreatingCompatiblePeer = sal_False;
- mbDesignMode = sal_False;
-}
-
-UnoControl::~UnoControl()
-{
- DELETEZ( mpData );
- DBG_DTOR( UnoControl, NULL );
-}
-
-::rtl::OUString UnoControl::GetComponentServiceName()
-{
- return ::rtl::OUString();
-}
-
-Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer )
-{
- DBG_ASSERT( !mbCreatingCompatiblePeer, "ImplGetCompatiblePeer - rekursive?" );
-
- mbCreatingCompatiblePeer = sal_True;
-
- Reference< XWindowPeer > xCompatiblePeer;
-
- if ( bAcceptExistingPeer )
- xCompatiblePeer = getPeer();
-
- if ( !xCompatiblePeer.is() )
- {
- // Peer unsichtbar erzeugen...
- sal_Bool bVis = maComponentInfos.bVisible;
- if( bVis )
- maComponentInfos.bVisible = sal_False;
-
- Reference< XWindowPeer > xCurrentPeer = getPeer();
- setPeer( NULL );
-
- // queryInterface ourself, to allow aggregation
- Reference< XControl > xMe;
- OWeakAggObject::queryInterface( ::getCppuType( &xMe ) ) >>= xMe;
-
- Window* pParentWindow( NULL );
- {
- SolarMutexGuard aGuard;
- pParentWindow = dynamic_cast< Window* >( Application::GetDefaultDevice() );
- ENSURE_OR_THROW( pParentWindow != NULL, "could obtain a default parent window!" );
- }
- try
- {
- xMe->createPeer( NULL, pParentWindow->GetComponentInterface( sal_True ) );
- }
- catch( const Exception& )
- {
- mbCreatingCompatiblePeer = sal_False;
- throw;
- }
- xCompatiblePeer = getPeer();
- setPeer( xCurrentPeer );
-
- if ( xCompatiblePeer.is() && mxGraphics.is() )
- {
- Reference< XView > xPeerView( xCompatiblePeer, UNO_QUERY );
- if ( xPeerView.is() )
- xPeerView->setGraphics( mxGraphics );
- }
-
- if( bVis )
- maComponentInfos.bVisible = sal_True;
- }
-
- mbCreatingCompatiblePeer = sal_False;
-
- return xCompatiblePeer;
-}
-
-bool UnoControl::ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable )
-{
- if ( !mpData->bLocalizationSupport
- || ( _rPossiblyLocalizable.getLength() == 0 )
- || ( _rPossiblyLocalizable[0] != '&' )
- // TODO: make this reasonable. At the moment, everything which by accident starts with a & is considered
- // localizable, which is probably wrong.
- )
- return false;
-
- try
- {
- Reference< XPropertySet > xPropSet( mxModel, UNO_QUERY_THROW );
- Reference< resource::XStringResourceResolver > xStringResourceResolver(
- xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ),
- UNO_QUERY
- );
- if ( xStringResourceResolver.is() )
- {
- ::rtl::OUString aLocalizationKey( _rPossiblyLocalizable.copy( 1 ) );
- _rPossiblyLocalizable = xStringResourceResolver->resolveString( aLocalizationKey );
- return true;
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return false;
-}
-
-void UnoControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const Any& rVal )
-{
- // since a change made in propertiesChange, we can't be sure that this is called with an valid getPeer(),
- // this assumption may be false in some (seldom) multi-threading scenarios (cause propertiesChange
- // releases our mutex before calling here in)
- // That's why this additional check
-
- if ( mxVclWindowPeer.is() )
- {
- Any aConvertedValue( rVal );
-
- if ( mpData->bLocalizationSupport )
- {
- // We now support a mapping for language dependent properties. This is the
- // central method to implement it.
- if (( rPropName.equalsAsciiL( "Text", 4 )) ||
- ( rPropName.equalsAsciiL( "Label", 5 )) ||
- ( rPropName.equalsAsciiL( "Title", 5 )) ||
- ( rPropName.equalsAsciiL( "HelpText", 8 )) ||
- ( rPropName.equalsAsciiL( "CurrencySymbol", 14 )) ||
- ( rPropName.equalsAsciiL( "StringItemList", 14 )) )
- {
- ::rtl::OUString aValue;
- uno::Sequence< rtl::OUString > aSeqValue;
- if ( aConvertedValue >>= aValue )
- {
- if ( ImplCheckLocalize( aValue ) )
- aConvertedValue <<= aValue;
- }
- else if ( aConvertedValue >>= aSeqValue )
- {
- for ( sal_Int32 i = 0; i < aSeqValue.getLength(); i++ )
- ImplCheckLocalize( aSeqValue[i] );
- aConvertedValue <<= aSeqValue;
- }
- }
- }
-
- mxVclWindowPeer->setProperty( rPropName, aConvertedValue );
- }
-}
-
-void UnoControl::PrepareWindowDescriptor( WindowDescriptor& )
-{
-}
-
-Reference< XWindow > UnoControl::getParentPeer() const
-{
- Reference< XWindow > xPeer;
- if( mxContext.is() )
- {
- Reference< XControl > xContComp( mxContext, UNO_QUERY );
- if ( xContComp.is() )
- {
- Reference< XWindowPeer > xP = xContComp->getPeer();
- if ( xP.is() )
- xP->queryInterface( ::getCppuType((const Reference< XWindow >*)0) ) >>= xPeer;
- }
- }
- return xPeer;
-}
-
-void UnoControl::updateFromModel()
-{
- // Alle standard Properties werden ausgelesen und in das Peer uebertragen
- if( getPeer().is() )
- {
- Reference< XMultiPropertySet > xPropSet( mxModel, UNO_QUERY );
- if( xPropSet.is() )
- {
- Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet );
- xPropSet->firePropertiesChangeEvent( aNames, this );
- }
- }
-}
-
-
-// XTypeProvider
-IMPL_IMPLEMENTATION_ID( UnoControl )
-
-void UnoControl::disposeAccessibleContext()
-{
- Reference< XComponent > xContextComp( maAccessibleContext.get(), UNO_QUERY );
- if ( xContextComp.is() )
- {
- maAccessibleContext = NULL;
- try
- {
- xContextComp->removeEventListener( this );
- xContextComp->dispose();
- }
- catch( const Exception& )
- {
- OSL_FAIL( "UnoControl::disposeAccessibleContext: could not dispose my AccessibleContext!" );
- }
- }
-}
-
-void UnoControl::dispose( ) throw(RuntimeException)
-{
- Reference< XWindowPeer > xPeer;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- if( mbDisposePeer )
- {
- xPeer = mxPeer;
- }
- setPeer( NULL );
- }
- if( xPeer.is() )
- {
- xPeer->dispose();
- }
-
- // dispose and release our AccessibleContext
- disposeAccessibleContext();
-
- EventObject aDisposeEvent;
- aDisposeEvent.Source = static_cast< XAggregation* >( this );
-
- maDisposeListeners.disposeAndClear( aDisposeEvent );
- maWindowListeners.disposeAndClear( aDisposeEvent );
- maFocusListeners.disposeAndClear( aDisposeEvent );
- maKeyListeners.disposeAndClear( aDisposeEvent );
- maMouseListeners.disposeAndClear( aDisposeEvent );
- maMouseMotionListeners.disposeAndClear( aDisposeEvent );
- maPaintListeners.disposeAndClear( aDisposeEvent );
- maModeChangeListeners.disposeAndClear( aDisposeEvent );
-
- // Model wieder freigeben
- setModel( Reference< XControlModel > () );
- setContext( Reference< XInterface > () );
-}
-
-void UnoControl::addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- maDisposeListeners.addInterface( rxListener );
-}
-
-void UnoControl::removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- maDisposeListeners.removeInterface( rxListener );
-}
-
-sal_Bool UnoControl::requiresNewPeer( const ::rtl::OUString& /* _rPropertyName */ ) const
-{
- return sal_False;
-}
-
-// XPropertiesChangeListener
-void UnoControl::propertiesChange( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
-{
- Sequence< PropertyChangeEvent > aEvents( rEvents );
- {
- ::osl::MutexGuard aGuard( GetMutex() );
-
- if ( !mpData->aSuspendedPropertyNotifications.empty() )
- {
- // strip the property which we are currently updating (somewhere up the stack)
- PropertyChangeEvent* pEvents = aEvents.getArray();
- PropertyChangeEvent* pEventsEnd = pEvents + aEvents.getLength();
- for ( ; pEvents < pEventsEnd; )
- if ( mpData->aSuspendedPropertyNotifications.find( pEvents->PropertyName ) != mpData->aSuspendedPropertyNotifications.end() )
- {
- if ( pEvents != pEventsEnd )
- ::std::copy( pEvents + 1, pEventsEnd, pEvents );
- --pEventsEnd;
- }
- else
- ++pEvents;
- aEvents.realloc( pEventsEnd - aEvents.getConstArray() );
-
- if ( !aEvents.getLength() )
- return;
- }
- }
-
- ImplModelPropertiesChanged( aEvents );
-}
-
-void UnoControl::ImplLockPropertyChangeNotification( const ::rtl::OUString& rPropertyName, bool bLock )
-{
- MapString2Int::iterator pos = mpData->aSuspendedPropertyNotifications.find( rPropertyName );
- if ( bLock )
- {
- if ( pos == mpData->aSuspendedPropertyNotifications.end() )
- pos = mpData->aSuspendedPropertyNotifications.insert( MapString2Int::value_type( rPropertyName, 0 ) ).first;
- ++pos->second;
- }
- else
- {
- OSL_ENSURE( pos != mpData->aSuspendedPropertyNotifications.end(), "UnoControl::ImplLockPropertyChangeNotification: property not locked!" );
- if ( pos != mpData->aSuspendedPropertyNotifications.end() )
- {
- OSL_ENSURE( pos->second > 0, "UnoControl::ImplLockPropertyChangeNotification: invalid suspension counter!" );
- if ( 0 == --pos->second )
- mpData->aSuspendedPropertyNotifications.erase( pos );
- }
- }
-}
-
-void UnoControl::ImplLockPropertyChangeNotifications( const Sequence< ::rtl::OUString >& rPropertyNames, bool bLock )
-{
- for ( const ::rtl::OUString* pPropertyName = rPropertyNames.getConstArray();
- pPropertyName != rPropertyNames.getConstArray() + rPropertyNames.getLength();
- ++pPropertyName
- )
- ImplLockPropertyChangeNotification( *pPropertyName, bLock );
-}
-
-void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents )
-{
- ::osl::ClearableGuard< ::osl::Mutex > aGuard( GetMutex() );
-
- if( getPeer().is() )
- {
- DECLARE_STL_VECTOR( PropertyValue, PropertyValueVector);
- PropertyValueVector aPeerPropertiesToSet;
- sal_Int32 nIndependentPos = 0;
- bool bResourceResolverSet( false );
- // position where to insert the independent properties into aPeerPropertiesToSet,
- // dependent ones are inserted at the end of the vector
-
- sal_Bool bNeedNewPeer = sal_False;
- // some properties require a re-creation of the peer, 'cause they can't be changed on the fly
-
- Reference< XControlModel > xOwnModel( getModel(), UNO_QUERY );
- // our own model for comparison
- Reference< XPropertySet > xPS( xOwnModel, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI( xPS->getPropertySetInfo(), UNO_QUERY );
- OSL_ENSURE( xPSI.is(), "UnoControl::ImplModelPropertiesChanged: should have property set meta data!" );
-
- const PropertyChangeEvent* pEvents = rEvents.getConstArray();
-
- sal_Int32 nLen = rEvents.getLength();
- aPeerPropertiesToSet.reserve(nLen);
-
- for( sal_Int32 i = 0; i < nLen; ++i, ++pEvents )
- {
- Reference< XControlModel > xModel( pEvents->Source, UNO_QUERY );
- sal_Bool bOwnModel = xModel.get() == xOwnModel.get();
- if ( !bOwnModel )
- continue;
-
- // Detect changes on our resource resolver which invalidates
- // automatically some language dependent properties.
- if ( pEvents->PropertyName.equalsAsciiL( "ResourceResolver", 16 ))
- {
- Reference< resource::XStringResourceResolver > xStrResolver;
- if ( pEvents->NewValue >>= xStrResolver )
- bResourceResolverSet = xStrResolver.is();
- }
-
- sal_uInt16 nPType = GetPropertyId( pEvents->PropertyName );
- if ( mbDesignMode && mbDisposePeer && !mbRefeshingPeer && !mbCreatingPeer )
- {
- // if we're in design mode, then some properties can change which
- // require creating a *new* peer (since these properties cannot
- // be switched at existing peers)
- if ( nPType )
- bNeedNewPeer = ( nPType == BASEPROPERTY_BORDER )
- || ( nPType == BASEPROPERTY_MULTILINE )
- || ( nPType == BASEPROPERTY_DROPDOWN )
- || ( nPType == BASEPROPERTY_HSCROLL )
- || ( nPType == BASEPROPERTY_VSCROLL )
- || ( nPType == BASEPROPERTY_AUTOHSCROLL )
- || ( nPType == BASEPROPERTY_AUTOVSCROLL )
- || ( nPType == BASEPROPERTY_ORIENTATION )
- || ( nPType == BASEPROPERTY_SPIN )
- || ( nPType == BASEPROPERTY_ALIGN )
- || ( nPType == BASEPROPERTY_PAINTTRANSPARENT );
- else
- bNeedNewPeer = requiresNewPeer( pEvents->PropertyName );
-
- if ( bNeedNewPeer )
- break;
- }
-
- if ( nPType && ( nLen > 1 ) && DoesDependOnOthers( nPType ) )
- {
- // Properties die von anderen abhaengen erst hinterher einstellen,
- // weil sie von anderen Properties abhaengig sind, die aber erst spaeter
- // eingestellt werden, z.B. VALUE nach VALUEMIN/MAX.
- aPeerPropertiesToSet.push_back(PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE));
- }
- else
- {
- if ( bResourceResolverSet )
- {
- // The resource resolver property change should be one of the first ones.
- // All language dependent properties are dependent on this property.
- // As BASEPROPERTY_NATIVE_WIDGET_LOOK is not dependent on resource
- // resolver. We don't need to handle a special order for these two props.
- aPeerPropertiesToSet.insert(
- aPeerPropertiesToSet.begin(),
- PropertyValue( pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE ) );
- ++nIndependentPos;
- }
- else if ( nPType == BASEPROPERTY_NATIVE_WIDGET_LOOK )
- {
- // since *a lot* of other properties might be overruled by this one, we need
- // a special handling:
- // NativeWidgetLook needs to be set first: If it is set to ON, all other
- // properties describing the look (e.g. BackgroundColor) are ignored, anyway.
- // If it is switched OFF, then we need to do it first because else it will
- // overrule other look-related properties, and re-initialize them from system
- // defaults.
- aPeerPropertiesToSet.insert(
- aPeerPropertiesToSet.begin(),
- PropertyValue( pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE ) );
- ++nIndependentPos;
- }
- else
- {
- aPeerPropertiesToSet.insert(aPeerPropertiesToSet.begin() + nIndependentPos,
- PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE));
- ++nIndependentPos;
- }
- }
- }
-
- Reference< XWindow > xParent = getParentPeer();
- Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
- // call createPeer via a interface got from queryInterface, so the aggregating class can intercept it
-
- DBG_ASSERT( !bNeedNewPeer || xParent.is(), "Need new peer, but don't have a parent!" );
-
- // Check if we have to update language dependent properties
- if ( !bNeedNewPeer && bResourceResolverSet )
- {
- // Add language dependent properties into the peer property set.
- // Our resource resolver has been changed and we must be sure
- // that language dependent props use the new resolver.
- const LanguageDependentProp* pLangDepProp = aLanguageDependentProp;
- while ( pLangDepProp->pPropName != 0 )
- {
- bool bMustBeInserted( true );
- for ( sal_uInt32 i = 0; i < aPeerPropertiesToSet.size(); i++ )
- {
- if ( aPeerPropertiesToSet[i].Name.equalsAsciiL(
- pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))
- {
- bMustBeInserted = false;
- break;
- }
- }
-
- if ( bMustBeInserted )
- {
- // Add language dependent props at the end
- ::rtl::OUString aPropName( ::rtl::OUString::createFromAscii( pLangDepProp->pPropName ));
- if ( xPSI.is() && xPSI->hasPropertyByName( aPropName ) )
- {
- aPeerPropertiesToSet.push_back(
- PropertyValue( aPropName, 0, xPS->getPropertyValue( aPropName ), PropertyState_DIRECT_VALUE ) );
- }
- }
-
- ++pLangDepProp;
- }
- }
- aGuard.clear();
-
- // clear the guard before creating a new peer - as usual, our peer implementations use the SolarMutex
-
- if (bNeedNewPeer && xParent.is())
- {
- SolarMutexGuard aVclGuard;
- // and now this is the final withdrawal:
- // I have no other idea than locking the SolarMutex here ....
- // I really hate the fact that VCL is not theadsafe ....
-
- // Funktioniert beim Container nicht!
- getPeer()->dispose();
- mxPeer.clear();
- mxVclWindowPeer = NULL;
- mbRefeshingPeer = sal_True;
- Reference< XWindowPeer > xP( xParent, UNO_QUERY );
- xThis->createPeer( Reference< XToolkit > (), xP );
- mbRefeshingPeer = sal_False;
- aPeerPropertiesToSet.clear();
- }
-
- // lock the multiplexing of VCL events to our UNO listeners
- // this is for compatibility reasons: in OOo 1.0.x, changes which were done at the
- // model did not cause the listeners of the controls/peers to be called
- // Since the implementations for the listeners changed a lot towards 1.1, this
- // would not be the case anymore, if we would not do this listener-lock below
- // #i14703#
- Window* pVclPeer = VCLUnoHelper::GetWindow( getPeer() );
- VCLXWindow* pPeer = pVclPeer ? pVclPeer->GetWindowPeer() : NULL;
- VclListenerLock aNoVclEventMultiplexing( pPeer );
-
- // setting peer properties may result in an attemp to acquire the solar mutex, 'cause the peers
- // usually don't have an own mutex but use the SolarMutex instead.
- // To prevent deadlocks resulting from this, we do this without our own mutex locked
- PropertyValueVectorIterator aEnd = aPeerPropertiesToSet.end();
- for ( PropertyValueVectorIterator aLoop = aPeerPropertiesToSet.begin();
- aLoop != aEnd;
- ++aLoop
- )
- {
- ImplSetPeerProperty( aLoop->Name, aLoop->Value );
- }
- }
-}
-
-void UnoControl::disposing( const EventObject& rEvt ) throw(RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // bei "Multible Inheritance" nicht unterschiedliche Typen vergleichen.
-
- if ( maAccessibleContext.get() == rEvt.Source )
- {
- // just in case the context is disposed, but not released - ensure that we do not re-use it in the future
- maAccessibleContext = NULL;
- }
- else if( mxModel.get() == Reference< XControlModel >(rEvt.Source,UNO_QUERY).get() )
- {
- // #62337# if the model dies, it does not make sense for us to live ...
- Reference< XControl > xThis = this;
-
- aGuard.clear();
- xThis->dispose();
-
- DBG_ASSERT( !mxModel.is(), "UnoControl::disposing: invalid dispose behaviour!" );
- mxModel.clear();
- }
-}
-
-
-void SAL_CALL UnoControl::setOutputSize( const awt::Size& aSize ) throw (RuntimeException)
-{
- Reference< XWindow2 > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xPeerWindow = xPeerWindow.query( getPeer() );
- }
-
- if ( xPeerWindow.is() )
- xPeerWindow->setOutputSize( aSize );
-}
-
-namespace
-{
- template < typename RETVALTYPE >
- RETVALTYPE lcl_askPeer( const uno::Reference< awt::XWindowPeer >& _rxPeer, RETVALTYPE (SAL_CALL XWindow2::*_pMethod)(), RETVALTYPE _aDefault )
- {
- RETVALTYPE aReturn( _aDefault );
-
- Reference< XWindow2 > xPeerWindow( _rxPeer, UNO_QUERY );
- if ( xPeerWindow.is() )
- aReturn = (xPeerWindow.get()->*_pMethod)();
-
- return aReturn;
- }
-}
-
-awt::Size SAL_CALL UnoControl::getOutputSize( ) throw (RuntimeException)
-{
- return lcl_askPeer( getPeer(), &XWindow2::getOutputSize, awt::Size() );
-}
-
-::sal_Bool SAL_CALL UnoControl::isVisible( ) throw (RuntimeException)
-{
- return lcl_askPeer( getPeer(), &XWindow2::isVisible, maComponentInfos.bVisible );
-}
-
-::sal_Bool SAL_CALL UnoControl::isActive( ) throw (RuntimeException)
-{
- return lcl_askPeer( getPeer(), &XWindow2::isActive, sal_False );
-}
-
-::sal_Bool SAL_CALL UnoControl::isEnabled( ) throw (RuntimeException)
-{
- return lcl_askPeer( getPeer(), &XWindow2::isEnabled, maComponentInfos.bEnable );
-}
-
-::sal_Bool SAL_CALL UnoControl::hasFocus( ) throw (RuntimeException)
-{
- return lcl_askPeer( getPeer(), &XWindow2::hasFocus, sal_False );
-}
-
-// XWindow
-void UnoControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(RuntimeException)
-{
- Reference< XWindow > xWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
-
- if ( Flags & awt::PosSize::X )
- maComponentInfos.nX = X;
- if ( Flags & awt::PosSize::Y )
- maComponentInfos.nY = Y;
- if ( Flags & awt::PosSize::WIDTH )
- maComponentInfos.nWidth = Width;
- if ( Flags & awt::PosSize::HEIGHT )
- maComponentInfos.nHeight = Height;
- maComponentInfos.nFlags |= Flags;
-
- xWindow = xWindow.query( getPeer() );
- }
-
- if( xWindow.is() )
- xWindow->setPosSize( X, Y, Width, Height, Flags );
-}
-
-awt::Rectangle UnoControl::getPosSize( ) throw(RuntimeException)
-{
- awt::Rectangle aRect( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight);
- Reference< XWindow > xWindow;
-
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xWindow = xWindow.query( getPeer() );
- }
-
- if( xWindow.is() )
- aRect = xWindow->getPosSize();
- return aRect;
-}
-
-void UnoControl::setVisible( sal_Bool bVisible ) throw(RuntimeException)
-{
- Reference< XWindow > xWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
-
- // Visible status ist Sache der View
- maComponentInfos.bVisible = bVisible;
- xWindow = xWindow.query( getPeer() );
- }
- if ( xWindow.is() )
- xWindow->setVisible( bVisible );
-}
-
-void UnoControl::setEnable( sal_Bool bEnable ) throw(RuntimeException)
-{
- Reference< XWindow > xWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
-
- // Enable status ist Sache der View
- maComponentInfos.bEnable = bEnable;
- xWindow = xWindow.query( getPeer() );
- }
- if ( xWindow.is() )
- xWindow->setEnable( bEnable );
-}
-
-void UnoControl::setFocus( ) throw(RuntimeException)
-{
- Reference< XWindow > xWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xWindow = xWindow.query( getPeer() );
- }
- if ( xWindow.is() )
- xWindow->setFocus();
-}
-
-void UnoControl::addWindowListener( const Reference< XWindowListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- maWindowListeners.addInterface( rxListener );
- if ( maWindowListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->addWindowListener( &maWindowListeners );
-}
-
-void UnoControl::removeWindowListener( const Reference< XWindowListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- if ( maWindowListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- maWindowListeners.removeInterface( rxListener );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->removeWindowListener( &maWindowListeners );
-}
-
-void UnoControl::addFocusListener( const Reference< XFocusListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- maFocusListeners.addInterface( rxListener );
- if ( maFocusListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->addFocusListener( &maFocusListeners );
-}
-
-void UnoControl::removeFocusListener( const Reference< XFocusListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- if ( maFocusListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- maFocusListeners.removeInterface( rxListener );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->removeFocusListener( &maFocusListeners );
-}
-
-void UnoControl::addKeyListener( const Reference< XKeyListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- maKeyListeners.addInterface( rxListener );
- if ( maKeyListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->addKeyListener( &maKeyListeners);
-}
-
-void UnoControl::removeKeyListener( const Reference< XKeyListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- if ( maKeyListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- maKeyListeners.removeInterface( rxListener );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->removeKeyListener( &maKeyListeners);
-}
-
-void UnoControl::addMouseListener( const Reference< XMouseListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- maMouseListeners.addInterface( rxListener );
- if ( maMouseListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->addMouseListener( &maMouseListeners);
-}
-
-void UnoControl::removeMouseListener( const Reference< XMouseListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- if ( maMouseListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- maMouseListeners.removeInterface( rxListener );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->removeMouseListener( &maMouseListeners );
-}
-
-void UnoControl::addMouseMotionListener( const Reference< XMouseMotionListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- maMouseMotionListeners.addInterface( rxListener );
- if ( maMouseMotionListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->addMouseMotionListener( &maMouseMotionListeners);
-}
-
-void UnoControl::removeMouseMotionListener( const Reference< XMouseMotionListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- if ( maMouseMotionListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- maMouseMotionListeners.removeInterface( rxListener );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->removeMouseMotionListener( &maMouseMotionListeners );
-}
-
-void UnoControl::addPaintListener( const Reference< XPaintListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- maPaintListeners.addInterface( rxListener );
- if ( maPaintListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->addPaintListener( &maPaintListeners);
-}
-
-void UnoControl::removePaintListener( const Reference< XPaintListener >& rxListener ) throw(RuntimeException)
-{
- Reference< XWindow > xPeerWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- if ( maPaintListeners.getLength() == 1 )
- xPeerWindow = xPeerWindow.query( getPeer() );
- maPaintListeners.removeInterface( rxListener );
- }
- if ( xPeerWindow.is() )
- xPeerWindow->removePaintListener( &maPaintListeners );
-}
-
-// XView
-sal_Bool UnoControl::setGraphics( const Reference< XGraphics >& rDevice ) throw(RuntimeException)
-{
- Reference< XView > xView;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
-
- mxGraphics = rDevice;
- xView = xView.query( getPeer() );
- }
- return xView.is() ? xView->setGraphics( rDevice ) : sal_True;
-}
-
-Reference< XGraphics > UnoControl::getGraphics( ) throw(RuntimeException)
-{
- return mxGraphics;
-}
-
-awt::Size UnoControl::getSize( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- return awt::Size( maComponentInfos.nWidth, maComponentInfos.nHeight );
-}
-
-void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(RuntimeException)
-{
- Reference< XWindowPeer > xDrawPeer;
- Reference< XView > xDrawPeerView;
-
- bool bDisposeDrawPeer( false );
- {
- ::osl::MutexGuard aGuard( GetMutex() );
-
- xDrawPeer = ImplGetCompatiblePeer( sal_True );
- bDisposeDrawPeer = xDrawPeer.is() && ( xDrawPeer != getPeer() );
-
- xDrawPeerView.set( xDrawPeer, UNO_QUERY );
- DBG_ASSERT( xDrawPeerView.is(), "UnoControl::draw: no peer!" );
- }
-
- if ( xDrawPeerView.is() )
- {
- Reference< XVclWindowPeer > xWindowPeer;
- xWindowPeer.set( xDrawPeer, UNO_QUERY );
- if ( xWindowPeer.is() )
- xWindowPeer->setDesignMode( mbDesignMode );
- xDrawPeerView->draw( x, y );
- }
-
- if ( bDisposeDrawPeer )
- xDrawPeer->dispose();
-}
-
-void UnoControl::setZoom( float fZoomX, float fZoomY ) throw(RuntimeException)
-{
- Reference< XView > xView;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
-
- maComponentInfos.nZoomX = fZoomX;
- maComponentInfos.nZoomY = fZoomY;
-
- xView = xView.query( getPeer() );
- }
- if ( xView.is() )
- xView->setZoom( fZoomX, fZoomY );
-}
-
-// XControl
-void UnoControl::setContext( const Reference< XInterface >& rxContext ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- mxContext = rxContext;
-}
-
-Reference< XInterface > UnoControl::getContext( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- return mxContext;
-}
-
-void UnoControl::peerCreated()
-{
- Reference< XWindow > xWindow( getPeer(), UNO_QUERY );
- if ( !xWindow.is() )
- return;
-
- if ( maWindowListeners.getLength() )
- xWindow->addWindowListener( &maWindowListeners );
-
- if ( maFocusListeners.getLength() )
- xWindow->addFocusListener( &maFocusListeners );
-
- if ( maKeyListeners.getLength() )
- xWindow->addKeyListener( &maKeyListeners );
-
- if ( maMouseListeners.getLength() )
- xWindow->addMouseListener( &maMouseListeners );
-
- if ( maMouseMotionListeners.getLength() )
- xWindow->addMouseMotionListener( &maMouseMotionListeners );
-
- if ( maPaintListeners.getLength() )
- xWindow->addPaintListener( &maPaintListeners );
-}
-
-void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Reference< XWindowPeer >& rParentPeer ) throw(RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
-
- if ( !mxModel.is() )
- {
- RuntimeException aException;
- aException.Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("createPeer: no model!"));
- aException.Context = (XAggregation*)(::cppu::OWeakAggObject*)this;
- throw( aException );
- }
-
- if( !getPeer().is() )
- {
- mbCreatingPeer = sal_True;
-
- WindowClass eType;
- Reference< XToolkit > xToolkit = rxToolkit;
- if( rParentPeer.is() && mxContext.is() )
- {
- // kein TopWindow
- if ( !xToolkit.is() )
- xToolkit = rParentPeer->getToolkit();
- Any aAny = OWeakAggObject::queryInterface( ::getCppuType((const Reference< XControlContainer>*)0) );
- Reference< XControlContainer > xC;
- aAny >>= xC;
- if( xC.is() )
- // Es ist ein Container
- eType = WindowClass_CONTAINER;
- else
- eType = WindowClass_SIMPLE;
- }
- else
- { // Nur richtig, wenn es sich um ein Top Window handelt
- if( rParentPeer.is() )
- {
- if ( !xToolkit.is() )
- xToolkit = rParentPeer->getToolkit();
- eType = WindowClass_CONTAINER;
- }
- else
- {
- if ( !xToolkit.is() )
- xToolkit = VCLUnoHelper::CreateToolkit();
- eType = WindowClass_TOP;
- }
- }
- WindowDescriptor aDescr;
- aDescr.Type = eType;
- aDescr.WindowServiceName = GetComponentServiceName();
- aDescr.Parent = rParentPeer;
- aDescr.Bounds = getPosSize();
- aDescr.WindowAttributes = 0;
-
- // Border
- Reference< XPropertySet > xPSet( mxModel, UNO_QUERY );
- Reference< XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
-
- Any aVal;
- ::rtl::OUString aPropName = GetPropertyName( BASEPROPERTY_BORDER );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Int16 n = sal_Int16();
- if ( aVal >>= n )
- {
- if ( n )
- aDescr.WindowAttributes |= WindowAttribute::BORDER;
- else
- aDescr.WindowAttributes |= VclWindowPeerAttribute::NOBORDER;
- }
- }
-
- // DESKTOP_AS_PARENT
- if ( aDescr.Type == WindowClass_TOP )
- {
- aPropName = GetPropertyName( BASEPROPERTY_DESKTOP_AS_PARENT );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>= b ) && b)
- aDescr.ParentIndex = -1;
- }
- }
- // Moveable
- aPropName = GetPropertyName( BASEPROPERTY_MOVEABLE );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>= b ) && b)
- aDescr.WindowAttributes |= WindowAttribute::MOVEABLE;
- }
-
- // Closeable
- aPropName = GetPropertyName( BASEPROPERTY_CLOSEABLE );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>= b ) && b)
- aDescr.WindowAttributes |= WindowAttribute::CLOSEABLE;
- }
-
- // Dropdown
- aPropName = GetPropertyName( BASEPROPERTY_DROPDOWN );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>= b ) && b)
- aDescr.WindowAttributes |= VclWindowPeerAttribute::DROPDOWN;
- }
-
- // Spin
- aPropName = GetPropertyName( BASEPROPERTY_SPIN );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>= b ) && b)
- aDescr.WindowAttributes |= VclWindowPeerAttribute::SPIN;
- }
-
- // HScroll
- aPropName = GetPropertyName( BASEPROPERTY_HSCROLL );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>= b ) && b)
- aDescr.WindowAttributes |= VclWindowPeerAttribute::HSCROLL;
- }
-
- // VScroll
- aPropName = GetPropertyName( BASEPROPERTY_VSCROLL );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>= b ) && b)
- aDescr.WindowAttributes |= VclWindowPeerAttribute::VSCROLL;
- }
-
- // AutoHScroll
- aPropName = GetPropertyName( BASEPROPERTY_AUTOHSCROLL );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>= b ) && b)
- aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOHSCROLL;
- }
-
- // AutoVScroll
- aPropName = GetPropertyName( BASEPROPERTY_AUTOVSCROLL );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>= b ) && b)
- aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOVSCROLL;
- }
-
- //added for issue79712
- //NoLabel
- aPropName = GetPropertyName( BASEPROPERTY_NOLABEL );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>=b ) && b )
- aDescr.WindowAttributes |= VclWindowPeerAttribute::NOLABEL;
- }
- //issue79712 ends
-
- // Align
- aPropName = GetPropertyName( BASEPROPERTY_ALIGN );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- aVal = xPSet->getPropertyValue( aPropName );
- sal_Int16 n = sal_Int16();
- if ( aVal >>= n )
- {
- if ( n == PROPERTY_ALIGN_LEFT )
- aDescr.WindowAttributes |= VclWindowPeerAttribute::LEFT;
- else if ( n == PROPERTY_ALIGN_CENTER )
- aDescr.WindowAttributes |= VclWindowPeerAttribute::CENTER;
- else
- aDescr.WindowAttributes |= VclWindowPeerAttribute::RIGHT;
- }
- }
-
- // Ableitungen die Moeglichkeit geben die Attribute zu manipulieren
- PrepareWindowDescriptor(aDescr);
-
- // create the peer
- setPeer( xToolkit->createWindow( aDescr ) );
-
- // release the mutex guard (and work with copies of our members)
- // this is necessary as our peer may lock the SolarMutex (actually, all currently known peers do), so calling
- // into the peer with our own mutex locked may cause deadlocks
- // (We _really_ need peers which do not use the SolarMutex. It's really pissing me off that from time to
- // time deadlocks pop up because the low-level components like our peers use a mutex which ususally
- // is locked at the top of the stack (it protects the global message looping). This is always dangerous, and
- // can not always be solved by tampering with other mutexes.
- // Unfortunately, the VCL used in the peers is not threadsafe, and by definition needs a locked SolarMutex.)
- // 82300 - 12/21/00 - FS
- UnoControlComponentInfos aComponentInfos(maComponentInfos);
- sal_Bool bDesignMode(mbDesignMode);
-
- Reference< XGraphics > xGraphics( mxGraphics );
- Reference< XView > xView ( getPeer(), UNO_QUERY_THROW );
- Reference< XWindow > xWindow ( getPeer(), UNO_QUERY_THROW );
-
- aGuard.clear();
-
- // the updateFromModel is done without a locked mutex, too.
- // The reason is that the only thing this method does is firing property changes, and this in general has
- // to be done without locked mutexes (as every notification to external listeners).
- // 82300 - 12/21/00 - FS
- updateFromModel();
-
- xView->setZoom( aComponentInfos.nZoomX, aComponentInfos.nZoomY );
-
- setPosSize( aComponentInfos.nX, aComponentInfos.nY, aComponentInfos.nWidth, aComponentInfos.nHeight, aComponentInfos.nFlags );
-
- if( aComponentInfos.bVisible && !bDesignMode )
- // Erst nach dem setzen der Daten anzeigen
- xWindow->setVisible( aComponentInfos.bVisible );
-
- if( !aComponentInfos.bEnable )
- xWindow->setEnable( aComponentInfos.bEnable );
-
- xView->setGraphics( xGraphics );
-
- peerCreated();
-
- mbCreatingPeer = sal_False;
- }
-}
-
-Reference< XWindowPeer > UnoControl::getPeer() throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- return mxPeer;
-}
-
-sal_Bool UnoControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- Reference< XMultiPropertySet > xPropSet( mxModel, UNO_QUERY );
-
- // query for the XPropertiesChangeListener - our delegator is allowed to overwrite this interface
- Reference< XPropertiesChangeListener > xListener;
- queryInterface( ::getCppuType( &xListener ) ) >>= xListener;
-
- if( xPropSet.is() )
- xPropSet->removePropertiesChangeListener( xListener );
-
- mpData->bLocalizationSupport = false;
- mxModel = rxModel;
-
- if( mxModel.is() )
- {
- try
- {
- xPropSet.set( mxModel, UNO_QUERY_THROW );
- Reference< XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), UNO_SET_THROW );
-
- Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet );
- xPropSet->addPropertiesChangeListener( aNames, xListener );
-
- mpData->bLocalizationSupport = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- mxModel.clear();
- }
- }
-
- return mxModel.is();
-}
-
-Reference< XControlModel > UnoControl::getModel( ) throw(RuntimeException)
-{
- return mxModel;
-}
-
-Reference< XView > UnoControl::getView( ) throw(RuntimeException)
-{
- return static_cast< XView* >( this );
-}
-
-void UnoControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
-{
- ModeChangeEvent aModeChangeEvent;
-
- Reference< XWindow > xWindow;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- if ( bOn == mbDesignMode )
- return;
-
- // remember this
- mbDesignMode = bOn;
- xWindow = xWindow.query( getPeer() );
- // dispose our current AccessibleContext, if we have one
- // (changing the design mode implies having a new implementation for this context,
- // so the old one must be declared DEFUNC)
- disposeAccessibleContext();
-
- aModeChangeEvent.Source = *this;
- aModeChangeEvent.NewMode = mbDesignMode ? ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("design")) : ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("alive" ));
- }
-
- // ajust the visibility of our window
- if ( xWindow.is() )
- xWindow->setVisible( !bOn );
-
- // and notify our mode listeners
- maModeChangeListeners.notifyEach( &XModeChangeListener::modeChanged, aModeChangeEvent );
-}
-
-sal_Bool UnoControl::isDesignMode( ) throw(RuntimeException)
-{
- return mbDesignMode;
-}
-
-sal_Bool UnoControl::isTransparent( ) throw(RuntimeException)
-{
- return sal_False;
-}
-
-// XServiceInfo
-::rtl::OUString UnoControl::getImplementationName( ) throw(RuntimeException)
-{
- OSL_FAIL( "This method should be overloaded!" );
- return ::rtl::OUString();
-}
-
-sal_Bool UnoControl::supportsService( const ::rtl::OUString& rServiceName ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
- const ::rtl::OUString* pArray = aSNL.getConstArray();
- const ::rtl::OUString* pArrayEnd = aSNL.getConstArray() + aSNL.getLength();
- for (; pArray != pArrayEnd; ++pArray )
- if( *pArray == rServiceName )
- break;
-
- return pArray != pArrayEnd;
-}
-
-Sequence< ::rtl::OUString > UnoControl::getSupportedServiceNames( ) throw(RuntimeException)
-{
- ::rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControl" ) );
- return Sequence< ::rtl::OUString >( &sName, 1 );
-}
-
-// ------------------------------------------------------------------------
-Reference< XAccessibleContext > SAL_CALL UnoControl::getAccessibleContext( ) throw (RuntimeException)
-{
- // creation of the context will certainly require the SolarMutex ...
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( GetMutex() );
-
- Reference< XAccessibleContext > xCurrentContext( maAccessibleContext.get(), UNO_QUERY );
- if ( !xCurrentContext.is() )
- {
- if ( !mbDesignMode )
- { // in alive mode, use the AccessibleContext of the peer
- Reference< XAccessible > xPeerAcc( getPeer(), UNO_QUERY );
- if ( xPeerAcc.is() )
- xCurrentContext = xPeerAcc->getAccessibleContext( );
- }
- else
- // in design mode, use a fallback
- xCurrentContext = ::toolkit::OAccessibleControlContext::create( this );
-
- DBG_ASSERT( xCurrentContext.is(), "UnoControl::getAccessibleContext: invalid context (invalid peer?)!" );
- maAccessibleContext = xCurrentContext;
-
- // get notified when the context is disposed
- Reference< XComponent > xContextComp( xCurrentContext, UNO_QUERY );
- if ( xContextComp.is() )
- xContextComp->addEventListener( this );
- // In an ideal world, this is not necessary - there the object would be released as soon as it has been
- // disposed, and thus our weak reference would be empty, too.
- // But 'til this ideal world comes (means 'til we do never have any refcount/lifetime bugs anymore), we
- // need to listen for disposal and reset our weak reference then.
- }
-
- return xCurrentContext;
-}
-
-void SAL_CALL UnoControl::addModeChangeListener( const Reference< XModeChangeListener >& _rxListener ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- maModeChangeListeners.addInterface( _rxListener );
-}
-
-void SAL_CALL UnoControl::removeModeChangeListener( const Reference< XModeChangeListener >& _rxListener ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- maModeChangeListeners.removeInterface( _rxListener );
-}
-
-void SAL_CALL UnoControl::addModeChangeApproveListener( const Reference< XModeChangeApproveListener >& ) throw (NoSupportException, RuntimeException)
-{
- throw NoSupportException( );
-}
-
-void SAL_CALL UnoControl::removeModeChangeApproveListener( const Reference< XModeChangeApproveListener >& ) throw (NoSupportException, RuntimeException)
-{
- throw NoSupportException( );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-awt::Point SAL_CALL UnoControl::convertPointToLogic( const awt::Point& i_Point, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException)
-{
- Reference< XUnitConversion > xPeerConversion;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xPeerConversion = xPeerConversion.query( getPeer() );
- }
- if ( xPeerConversion.is() )
- return xPeerConversion->convertPointToLogic( i_Point, i_TargetUnit );
- return awt::Point( );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-awt::Point SAL_CALL UnoControl::convertPointToPixel( const awt::Point& i_Point, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException)
-{
- Reference< XUnitConversion > xPeerConversion;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xPeerConversion = xPeerConversion.query( getPeer() );
- }
- if ( xPeerConversion.is() )
- return xPeerConversion->convertPointToPixel( i_Point, i_SourceUnit );
- return awt::Point( );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-awt::Size SAL_CALL UnoControl::convertSizeToLogic( const awt::Size& i_Size, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException)
-{
- Reference< XUnitConversion > xPeerConversion;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xPeerConversion = xPeerConversion.query( getPeer() );
- }
- if ( xPeerConversion.is() )
- return xPeerConversion->convertSizeToLogic( i_Size, i_TargetUnit );
- return awt::Size( );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-awt::Size SAL_CALL UnoControl::convertSizeToPixel( const awt::Size& i_Size, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException)
-{
- Reference< XUnitConversion > xPeerConversion;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xPeerConversion = xPeerConversion.query( getPeer() );
- }
- if ( xPeerConversion.is() )
- return xPeerConversion->convertSizeToPixel( i_Size, i_SourceUnit );
- return awt::Size( );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-uno::Reference< awt::XStyleSettings > SAL_CALL UnoControl::getStyleSettings() throw (RuntimeException)
-{
- Reference< awt::XStyleSettingsSupplier > xPeerSupplier;
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- xPeerSupplier = xPeerSupplier.query( getPeer() );
- }
- if ( xPeerSupplier.is() )
- return xPeerSupplier->getStyleSettings();
- return NULL;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx
deleted file mode 100644
index bea2af3031..0000000000
--- a/toolkit/source/controls/unocontrolbase.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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_toolkit.hxx"
-#include <com/sun/star/awt/XLayoutConstrains.hpp>
-#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
-
-#include <toolkit/controls/unocontrolbase.hxx>
-#include <toolkit/helper/property.hxx>
-#include <comphelper/processfactory.hxx>
-
-#include <tools/debug.hxx>
-
-// ----------------------------------------------------
-// class UnoControlBase
-// ----------------------------------------------------
-
-UnoControlBase::UnoControlBase()
- :UnoControl( ::comphelper::getProcessServiceFactory() )
-{
- OSL_ENSURE( false, "UnoControlBase::UnoControlBase: not implemented. Well, not really." );
- // just implemented to let the various FooImplInheritanceHelper compile, you should use the
- // version taking a service factory
-}
-
-sal_Bool UnoControlBase::ImplHasProperty( sal_uInt16 nPropId )
-{
- ::rtl::OUString aPropName( GetPropertyName( nPropId ) );
- return ImplHasProperty( aPropName );
-}
-
-sal_Bool UnoControlBase::ImplHasProperty( const ::rtl::OUString& aPropertyName )
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
- if ( !xPSet.is() )
- return sal_False;
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
- if ( !xInfo.is() )
- return sal_False;
-
- return xInfo->hasPropertyByName( aPropertyName );
-}
-
-void UnoControlBase::ImplSetPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues, sal_Bool bUpdateThis )
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > xMPS( mxModel, ::com::sun::star::uno::UNO_QUERY );
- if ( !mxModel.is() )
- return;
-
- DBG_ASSERT( xMPS.is(), "UnoControlBase::ImplSetPropertyValues: no multi property set interface!" );
- if ( xMPS.is() )
- {
- if ( !bUpdateThis )
- ImplLockPropertyChangeNotifications( aPropertyNames, true );
-
- try
- {
- xMPS->setPropertyValues( aPropertyNames, aValues );
- }
- catch( const ::com::sun::star::uno::Exception& )
- {
- if ( !bUpdateThis )
- ImplLockPropertyChangeNotifications( aPropertyNames, false );
- }
- if ( !bUpdateThis )
- ImplLockPropertyChangeNotifications( aPropertyNames, false );
- }
- else
- {
- int dummy = 0;
- (void)dummy;
- }
-}
-
-void UnoControlBase::ImplSetPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Bool bUpdateThis )
-{
- // Model ggf. schon abgemeldet, aber ein Event schlaegt noch zu...
- if ( mxModel.is() )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
- if ( !bUpdateThis )
- ImplLockPropertyChangeNotification( aPropertyName, true );
-
- try
- {
- xPSet->setPropertyValue( aPropertyName, aValue );
- }
- catch( const com::sun::star::uno::Exception& )
- {
- if ( !bUpdateThis )
- ImplLockPropertyChangeNotification( aPropertyName, false );
- throw;
- }
- if ( !bUpdateThis )
- ImplLockPropertyChangeNotification( aPropertyName, false );
- }
-}
-
-::com::sun::star::uno::Any UnoControlBase::ImplGetPropertyValue( const ::rtl::OUString& aPropertyName )
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
- if ( xPSet.is() )
- return xPSet->getPropertyValue( aPropertyName );
- else
- return ::com::sun::star::uno::Any();
-}
-
-sal_Bool UnoControlBase::ImplGetPropertyValue_BOOL( sal_uInt16 nProp )
-{
- sal_Bool b = sal_False;
- if ( mxModel.is() )
- {
- ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
- aVal >>= b;
- }
- return b;
-}
-
-sal_Int16 UnoControlBase::ImplGetPropertyValue_INT16( sal_uInt16 nProp )
-{
- sal_Int16 n = 0;
- if ( mxModel.is() )
- {
- ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
- aVal >>= n;
- }
- return n;
-}
-
-sal_Int32 UnoControlBase::ImplGetPropertyValue_INT32( sal_uInt16 nProp )
-{
- sal_Int32 n = 0;
- if ( mxModel.is() )
- {
- ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
- aVal >>= n;
- }
- return n;
-}
-
-double UnoControlBase::ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp )
-{
- double n = 0;
- if ( mxModel.is() )
- {
- ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
- aVal >>= n;
- }
- return n;
-}
-
-::rtl::OUString UnoControlBase::ImplGetPropertyValue_UString( sal_uInt16 nProp )
-{
- ::rtl::OUString aStr;
- if ( mxModel.is() )
- {
- ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
- aVal >>= aStr;
- }
- return aStr;
-}
-
-::com::sun::star::awt::Size UnoControlBase::Impl_getMinimumSize()
-{
- ::com::sun::star::awt::Size aSz;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
- DBG_ASSERT( xP.is(), "Layout: No Peer!" );
- if ( xP.is() )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
- if ( xL.is() )
- aSz = xL->getMinimumSize();
-
- if ( !getPeer().is() || ( getPeer() != xP ) )
- xP->dispose();
- }
- return aSz;
-}
-
-::com::sun::star::awt::Size UnoControlBase::Impl_getPreferredSize()
-{
- ::com::sun::star::awt::Size aSz;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
- DBG_ASSERT( xP.is(), "Layout: No Peer!" );
- if ( xP.is() )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
- if ( xL.is() )
- aSz = xL->getPreferredSize();
-
- if ( !getPeer().is() || ( getPeer() != xP ) )
- xP->dispose();
- }
- return aSz;
-}
-
-::com::sun::star::awt::Size UnoControlBase::Impl_calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize )
-{
- ::com::sun::star::awt::Size aSz;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
- DBG_ASSERT( xP.is(), "Layout: No Peer!" );
- if ( xP.is() )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
- if ( xL.is() )
- aSz = xL->calcAdjustedSize( rNewSize );
-
- if ( !getPeer().is() || ( getPeer() != xP ) )
- xP->dispose();
- }
- return aSz;
-}
-
-::com::sun::star::awt::Size UnoControlBase::Impl_getMinimumSize( sal_Int16 nCols, sal_Int16 nLines )
-{
- ::com::sun::star::awt::Size aSz;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
- DBG_ASSERT( xP.is(), "Layout: No Peer!" );
- if ( xP.is() )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
- if ( xL.is() )
- aSz = xL->getMinimumSize( nCols, nLines );
-
- if ( !getPeer().is() || ( getPeer() != xP ) )
- xP->dispose();
- }
- return aSz;
-}
-
-void UnoControlBase::Impl_getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines )
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
- DBG_ASSERT( xP.is(), "Layout: No Peer!" );
- if ( xP.is() )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
- if ( xL.is() )
- xL->getColumnsAndLines( nCols, nLines );
-
- if ( !getPeer().is() || ( getPeer() != xP ) )
- xP->dispose();
- }
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
deleted file mode 100644
index 58f74a6429..0000000000
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ /dev/null
@@ -1,836 +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/XVclContainerPeer.hpp>
-#include <com/sun/star/beans/XPropertyChangeListener.hpp>
-
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <rtl/memory.h>
-#include <rtl/uuid.h>
-
-#include <toolkit/controls/unocontrolcontainer.hxx>
-#include <toolkit/helper/property.hxx>
-#include <toolkit/helper/servicenames.hxx>
-#include <comphelper/sequence.hxx>
-
-#include <tools/debug.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/window.hxx>
-
-#include <limits>
-#include <map>
-#include <boost/shared_ptr.hpp>
-
-using namespace ::com::sun::star;
-
-extern WorkWindow* lcl_GetDefaultWindow();
-
-// ----------------------------------------------------
-// class UnoControlHolder
-// ----------------------------------------------------
-struct UnoControlHolder
-{
- uno::Reference< awt::XControl > mxControl;
- ::rtl::OUString msName;
-
-public:
- UnoControlHolder( const ::rtl::OUString& rName, const uno::Reference< awt::XControl > & rControl )
- : mxControl( rControl ),
- msName( rName )
- {
- }
-
- inline const ::rtl::OUString& getName() const { return msName; }
- inline const uno::Reference< awt::XControl >& getControl() const { return mxControl; }
-};
-
-class UnoControlHolderList
-{
-public:
- typedef sal_Int32 ControlIdentifier;
-private:
- typedef ::boost::shared_ptr< UnoControlHolder > ControlInfo;
- typedef ::std::map< ControlIdentifier, ControlInfo > ControlMap;
-
-private:
- ControlMap maControls;
-
-public:
- UnoControlHolderList();
- ~UnoControlHolderList();
-
- /** adds a control with the given name to the list
- @param _rxControl
- the control to add. Must not be <NULL/>
- @param _pBName
- the name of the control, or <NULL/> if an automatic name should be generated
- @return
- the identifier of the newly added control
- */
- ControlIdentifier addControl( const uno::Reference< awt::XControl >& _rxControl, const ::rtl::OUString* _pName );
-
- /** returns the number of controls in the list
- */
- inline size_t size() const { return maControls.size(); }
-
- /** determines whether or not the list is empty
- */
- inline bool empty() const { return maControls.empty(); }
-
- /** retrieves all controls currently in the list
- @return
- the number of controls in the list
- */
- size_t getControls( uno::Sequence< uno::Reference< awt::XControl > >& _out_rControls ) const;
-
- /** retrieves all identifiers of all controls currently in the list
- @return
- the number of controls in the list
- */
- size_t getIdentifiers( uno::Sequence< sal_Int32 >& _out_rIdentifiers ) const;
-
- /** returns the first control which is registered under the given name
- */
- uno::Reference< awt::XControl >
- getControlForName( const ::rtl::OUString& _rName ) const;
-
- /** returns the identifier which a control is registered for, or -1 if the control
- isn't registered
- */
- ControlIdentifier
- getControlIdentifier( const uno::Reference< awt::XControl >& _rxControl );
-
- /** retrieves the control for a given id
- @param _nIdentifier
- the identifier for the control
- @param _out_rxControl
- takes the XControl upon successful return
- @return
- <TRUE/> if and only if a control with the given id is part of the list
- */
- bool getControlForIdentifier( ControlIdentifier _nIdentifier, uno::Reference< awt::XControl >& _out_rxControl ) const;
-
- /** removes a control from the list, given by id
- @param _nId
- The identifier of the control to remove.
- */
- void removeControlById( ControlIdentifier _nId );
-
- /** replaces a control from the list with another one
- @param _nId
- The identifier of the control to replace
- @param _rxNewControl
- the new control to put into the list
- */
- void replaceControlById( ControlIdentifier _nId, const uno::Reference< awt::XControl >& _rxNewControl );
-
-private:
- /** adds a control
- @param _rxControl
- the control to add to the container
- @param _pName
- pointer to the name of the control. Might be <NULL/>, in this case, a name is generated.
- @return
- the identifier of the newly inserted control
- */
- ControlIdentifier impl_addControl(
- const uno::Reference< awt::XControl >& _rxControl,
- const ::rtl::OUString* _pName
- );
-
- /** finds a free identifier
- @throw uno::RuntimeException
- if no free identifier can be found
- */
- ControlIdentifier impl_getFreeIdentifier_throw();
-
- /** finds a free name
- @throw uno::RuntimeException
- if no free name can be found
- */
- ::rtl::OUString impl_getFreeName_throw();
-};
-
-//------------------------------------------------------------------------
-UnoControlHolderList::UnoControlHolderList()
-{
-}
-
-//------------------------------------------------------------------------
-UnoControlHolderList::~UnoControlHolderList()
-{
-}
-
-//------------------------------------------------------------------------
-UnoControlHolderList::ControlIdentifier UnoControlHolderList::addControl( const uno::Reference< awt::XControl >& _rxControl, const ::rtl::OUString* _pName )
-{
- return impl_addControl( _rxControl, _pName );
-}
-
-//------------------------------------------------------------------------
-size_t UnoControlHolderList::getControls( uno::Sequence< uno::Reference< awt::XControl > >& _out_rControls ) const
-{
- _out_rControls.realloc( maControls.size() );
- uno::Reference< awt::XControl >* pControls = _out_rControls.getArray();
- for ( ControlMap::const_iterator loop = maControls.begin();
- loop != maControls.end();
- ++loop, ++pControls
- )
- *pControls = loop->second->getControl();
- return maControls.size();
-}
-
-//------------------------------------------------------------------------
-size_t UnoControlHolderList::getIdentifiers( uno::Sequence< sal_Int32 >& _out_rIdentifiers ) const
-{
- _out_rIdentifiers.realloc( maControls.size() );
- sal_Int32* pIndentifiers = _out_rIdentifiers.getArray();
- for ( ControlMap::const_iterator loop = maControls.begin();
- loop != maControls.end();
- ++loop, ++pIndentifiers
- )
- *pIndentifiers = loop->first;
- return maControls.size();
-}
-
-//------------------------------------------------------------------------
-uno::Reference< awt::XControl > UnoControlHolderList::getControlForName( const ::rtl::OUString& _rName ) const
-{
- for ( ControlMap::const_iterator loop = maControls.begin();
- loop != maControls.end();
- ++loop
- )
- if ( loop->second->getName() == _rName )
- return loop->second->getControl();
- return uno::Reference< awt::XControl >();
-}
-
-//------------------------------------------------------------------------
-UnoControlHolderList::ControlIdentifier UnoControlHolderList::getControlIdentifier( const uno::Reference< awt::XControl >& _rxControl )
-{
- for ( ControlMap::iterator loop = maControls.begin();
- loop != maControls.end();
- ++loop
- )
- {
- if ( loop->second->getControl().get() == _rxControl.get() )
- return loop->first;
- }
- return -1;
-}
-
-//------------------------------------------------------------------------
-bool UnoControlHolderList::getControlForIdentifier( UnoControlHolderList::ControlIdentifier _nIdentifier, uno::Reference< awt::XControl >& _out_rxControl ) const
-{
- ControlMap::const_iterator pos = maControls.find( _nIdentifier );
- if ( pos == maControls.end() )
- return false;
- _out_rxControl = pos->second->getControl();
- return true;
-}
-
-//------------------------------------------------------------------------
-void UnoControlHolderList::removeControlById( UnoControlHolderList::ControlIdentifier _nId )
-{
- ControlMap::iterator pos = maControls.find( _nId );
- DBG_ASSERT( pos != maControls.end(), "UnoControlHolderList::removeControlById: invalid id!" );
- if ( pos == maControls.end() )
- return;
-
- maControls.erase( pos );
-}
-
-//------------------------------------------------------------------------
-void UnoControlHolderList::replaceControlById( ControlIdentifier _nId, const uno::Reference< awt::XControl >& _rxNewControl )
-{
- DBG_ASSERT( _rxNewControl.is(), "UnoControlHolderList::replaceControlById: invalid new control!" );
-
- ControlMap::iterator pos = maControls.find( _nId );
- DBG_ASSERT( pos != maControls.end(), "UnoControlHolderList::replaceControlById: invalid id!" );
- if ( pos == maControls.end() )
- return;
-
- pos->second.reset( new UnoControlHolder( pos->second->getName(), _rxNewControl ) );
-}
-
-//------------------------------------------------------------------------
-UnoControlHolderList::ControlIdentifier UnoControlHolderList::impl_addControl( const uno::Reference< awt::XControl >& _rxControl, const ::rtl::OUString* _pName )
-{
- DBG_ASSERT( _rxControl.is(), "UnoControlHolderList::impl_addControl: invalid control!" );
-
- ::rtl::OUString sName = _pName ? *_pName : impl_getFreeName_throw();
- sal_Int32 nId = impl_getFreeIdentifier_throw();
-
- maControls[ nId ] = ControlInfo( new UnoControlHolder( sName, _rxControl ) );
- return nId;
-}
-
-//------------------------------------------------------------------------
-UnoControlHolderList::ControlIdentifier UnoControlHolderList::impl_getFreeIdentifier_throw()
-{
- for ( ControlIdentifier candidateId = 0; candidateId < ::std::numeric_limits< ControlIdentifier >::max(); ++candidateId )
- {
- ControlMap::const_iterator existent = maControls.find( candidateId );
- if ( existent == maControls.end() )
- return candidateId;
- }
- throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "out of identifiers" ) ), NULL );
-}
-
-//------------------------------------------------------------------------
-::rtl::OUString UnoControlHolderList::impl_getFreeName_throw()
-{
- ::rtl::OUString name( RTL_CONSTASCII_USTRINGPARAM( "control_" ) );
- for ( ControlIdentifier candidateId = 0; candidateId < ::std::numeric_limits< ControlIdentifier >::max(); ++candidateId )
- {
- ::rtl::OUString candidateName( name + ::rtl::OUString::valueOf( candidateId ) );
- ControlMap::const_iterator loop = maControls.begin();
- for ( ; loop != maControls.end(); ++loop )
- {
- if ( loop->second->getName() == candidateName )
- break;
- }
- if ( loop == maControls.end() )
- return candidateName;
- }
- throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "out of identifiers" ) ), NULL );
-}
-// ----------------------------------------------------
-// Function to set the controls' visibility according
-// to the dialog's "Step" property
-// ----------------------------------------------------
-void implUpdateVisibility
-(
- sal_Int32 nDialogStep,
- uno::Reference< awt::XControlContainer > xControlContainer
-)
-{
- uno::Sequence< uno::Reference< awt::XControl > >
- aCtrls = xControlContainer->getControls();
- const uno::Reference< awt::XControl >* pCtrls = aCtrls.getConstArray();
- sal_uInt32 nCtrls = aCtrls.getLength();
- sal_Bool bCompleteVisible = (nDialogStep == 0);
- for( sal_uInt32 n = 0; n < nCtrls; n++ )
- {
- uno::Reference< awt::XControl > xControl = pCtrls[ n ];
-
- sal_Bool bVisible = bCompleteVisible;
- if( !bVisible )
- {
- uno::Reference< awt::XControlModel > xModel( xControl->getModel() );
- uno::Reference< beans::XPropertySet > xPSet
- ( xModel, uno::UNO_QUERY );
- uno::Reference< beans::XPropertySetInfo >
- xInfo = xPSet->getPropertySetInfo();
- ::rtl::OUString aPropName(RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
- sal_Int32 nControlStep = 0;
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- uno::Any aVal = xPSet->getPropertyValue( aPropName );
- aVal >>= nControlStep;
- }
- bVisible = (nControlStep == 0) || (nControlStep == nDialogStep);
- }
-
- uno::Reference< awt::XWindow> xWindow
- ( xControl, uno::UNO_QUERY );
- if( xWindow.is() )
- xWindow->setVisible( bVisible );
- }
-}
-
-
-// ----------------------------------------------------
-// class DialogStepChangedListener
-// ----------------------------------------------------
-typedef ::cppu::WeakImplHelper1< beans::XPropertyChangeListener > PropertyChangeListenerHelper;
-
-class DialogStepChangedListener: public PropertyChangeListenerHelper
-{
-private:
- uno::Reference< awt::XControlContainer > mxControlContainer;
-
-public:
- DialogStepChangedListener( uno::Reference< awt::XControlContainer > xControlContainer )
- : mxControlContainer( xControlContainer ) {}
-
- // XEventListener
- virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw( uno::RuntimeException);
-
- // XPropertyChangeListener
- virtual void SAL_CALL propertyChange( const beans::PropertyChangeEvent& evt ) throw( uno::RuntimeException);
-
-};
-
-void SAL_CALL DialogStepChangedListener::disposing( const lang::EventObject& /*_rSource*/)
- throw( uno::RuntimeException)
-{
- mxControlContainer.clear();
-}
-
-void SAL_CALL DialogStepChangedListener::propertyChange( const beans::PropertyChangeEvent& evt )
- throw( uno::RuntimeException)
-{
- // evt.PropertyName HAS to be "Step" because we only use the listener for that
- sal_Int32 nDialogStep = 0;
- evt.NewValue >>= nDialogStep;
- implUpdateVisibility( nDialogStep, mxControlContainer );
-}
-
-// ----------------------------------------------------
-// class UnoControlContainer
-// ----------------------------------------------------
-UnoControlContainer::UnoControlContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
- :UnoControlContainer_Base( i_factory )
- ,maCListeners( *this )
-{
- mpControls = new UnoControlHolderList;
-}
-
-UnoControlContainer::UnoControlContainer( const uno::Reference< lang::XMultiServiceFactory >& i_factory, const uno::Reference< awt::XWindowPeer >& xP )
- :UnoControlContainer_Base( i_factory )
- ,maCListeners( *this )
-{
- setPeer( xP );
- mbDisposePeer = sal_False;
- mpControls = new UnoControlHolderList;
-}
-
-UnoControlContainer::~UnoControlContainer()
-{
- DELETEZ( mpControls );
-}
-
-void UnoControlContainer::ImplActivateTabControllers()
-{
- sal_uInt32 nCount = maTabControllers.getLength();
- for ( sal_uInt32 n = 0; n < nCount; n++ )
- {
- maTabControllers.getArray()[n]->setContainer( this );
- maTabControllers.getArray()[n]->activateTabOrder();
- }
-}
-
-// lang::XComponent
-void UnoControlContainer::dispose( ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- lang::EventObject aDisposeEvent;
- aDisposeEvent.Source = static_cast< uno::XAggregation* >( this );
-
- // DG: zuerst der Welt mitteilen, dass der Container wegfliegt. Dieses ist um einiges
- // schneller wenn die Welt sowohl an den Controls als auch am Container horcht
- maDisposeListeners.disposeAndClear( aDisposeEvent );
- maCListeners.disposeAndClear( aDisposeEvent );
-
-
- uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
- uno::Reference< awt::XControl >* pCtrls = aCtrls.getArray();
- uno::Reference< awt::XControl >* pCtrlsEnd = pCtrls + aCtrls.getLength();
-
- for( ; pCtrls < pCtrlsEnd; ++pCtrls )
- {
- removingControl( *pCtrls );
- // Control wegwerfen
- (*pCtrls)->dispose();
- }
-
-
- // alle Strukturen entfernen
- DELETEZ( mpControls );
- mpControls = new UnoControlHolderList;
-
- UnoControlBase::dispose();
-}
-
-// lang::XEventListener
-void UnoControlContainer::disposing( const lang::EventObject& _rEvt ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- uno::Reference< awt::XControl > xControl( _rEvt.Source, uno::UNO_QUERY );
- if ( xControl.is() )
- removeControl( xControl );
-
- UnoControlBase::disposing( _rEvt );
-}
-
-// container::XContainer
-void UnoControlContainer::addContainerListener( const uno::Reference< container::XContainerListener >& rxListener ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- maCListeners.addInterface( rxListener );
-}
-
-void UnoControlContainer::removeContainerListener( const uno::Reference< container::XContainerListener >& rxListener ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- maCListeners.removeInterface( rxListener );
-}
-
-
-::sal_Int32 SAL_CALL UnoControlContainer::insert( const uno::Any& _rElement ) throw (lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- uno::Reference< awt::XControl > xControl;
- if ( !( _rElement >>= xControl ) || !xControl.is() )
- throw lang::IllegalArgumentException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Elements must support the XControl interface." ) ),
- *this,
- 1
- );
-
- return impl_addControl( xControl, NULL );
-}
-
-void SAL_CALL UnoControlContainer::removeByIdentifier( ::sal_Int32 _nIdentifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- uno::Reference< awt::XControl > xControl;
- if ( !mpControls->getControlForIdentifier( _nIdentifier, xControl ) )
- throw container::NoSuchElementException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "There is no element with the given identifier." ) ),
- *this
- );
-
- impl_removeControl( _nIdentifier, xControl, NULL );
-}
-
-void SAL_CALL UnoControlContainer::replaceByIdentifer( ::sal_Int32 _nIdentifier, const uno::Any& _rElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- uno::Reference< awt::XControl > xExistentControl;
- if ( !mpControls->getControlForIdentifier( _nIdentifier, xExistentControl ) )
- throw container::NoSuchElementException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "There is no element with the given identifier." ) ),
- *this
- );
-
- uno::Reference< awt::XControl > xNewControl;
- if ( !( _rElement >>= xNewControl ) )
- throw lang::IllegalArgumentException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Elements must support the XControl interface." ) ),
- *this,
- 1
- );
-
- removingControl( xExistentControl );
-
- mpControls->replaceControlById( _nIdentifier, xNewControl );
-
- addingControl( xNewControl );
-
- impl_createControlPeerIfNecessary( xNewControl );
-
- if ( maCListeners.getLength() )
- {
- container::ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Accessor <<= _nIdentifier;
- aEvent.Element <<= xNewControl;
- aEvent.ReplacedElement <<= xExistentControl;
- maCListeners.elementReplaced( aEvent );
- }
-}
-
-uno::Any SAL_CALL UnoControlContainer::getByIdentifier( ::sal_Int32 _nIdentifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- uno::Reference< awt::XControl > xControl;
- if ( !mpControls->getControlForIdentifier( _nIdentifier, xControl ) )
- throw container::NoSuchElementException();
- return uno::makeAny( xControl );
-}
-
-uno::Sequence< ::sal_Int32 > SAL_CALL UnoControlContainer::getIdentifiers( ) throw (uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- uno::Sequence< ::sal_Int32 > aIdentifiers;
- mpControls->getIdentifiers( aIdentifiers );
- return aIdentifiers;
-}
-
-// container::XElementAccess
-uno::Type SAL_CALL UnoControlContainer::getElementType( ) throw (uno::RuntimeException)
-{
- return awt::XControlModel::static_type();
-}
-
-::sal_Bool SAL_CALL UnoControlContainer::hasElements( ) throw (uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- return !mpControls->empty();
-}
-
-// awt::XControlContainer
-void UnoControlContainer::setStatusText( const ::rtl::OUString& rStatusText ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- // In der Parenthierarchie nach unten gehen
- uno::Reference< awt::XControlContainer > xContainer( mxContext, uno::UNO_QUERY );
- if( xContainer.is() )
- xContainer->setStatusText( rStatusText );
-}
-
-uno::Sequence< uno::Reference< awt::XControl > > UnoControlContainer::getControls( ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- uno::Sequence< uno::Reference< awt::XControl > > aControls;
- mpControls->getControls( aControls );
- return aControls;
-}
-
-uno::Reference< awt::XControl > UnoControlContainer::getControl( const ::rtl::OUString& rName ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- return mpControls->getControlForName( rName );
-}
-
-void UnoControlContainer::addingControl( const uno::Reference< awt::XControl >& _rxControl )
-{
- if ( _rxControl.is() )
- {
- uno::Reference< uno::XInterface > xThis;
- OWeakAggObject::queryInterface( ::getCppuType( static_cast< uno::Reference< uno::XInterface >* >( NULL ) ) ) >>= xThis;
-
- _rxControl->setContext( xThis );
- _rxControl->addEventListener( this );
- }
-}
-
-void UnoControlContainer::impl_createControlPeerIfNecessary( const uno::Reference< awt::XControl >& _rxControl )
-{
- OSL_PRECOND( _rxControl.is(), "UnoControlContainer::impl_createControlPeerIfNecessary: invalid control, this will crash!" );
-
- // if the container already has a peer, then also create a peer for the control
- uno::Reference< awt::XWindowPeer > xMyPeer( getPeer() );
-
- if( xMyPeer.is() )
- {
- _rxControl->createPeer( NULL, xMyPeer );
- ImplActivateTabControllers();
- }
-
-}
-
-sal_Int32 UnoControlContainer::impl_addControl( const uno::Reference< awt::XControl >& _rxControl, const ::rtl::OUString* _pName )
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- UnoControlHolderList::ControlIdentifier id = mpControls->addControl( _rxControl, _pName );
-
- addingControl( _rxControl );
-
- impl_createControlPeerIfNecessary( _rxControl );
-
- if ( maCListeners.getLength() )
- {
- container::ContainerEvent aEvent;
- aEvent.Source = *this;
- _pName ? ( aEvent.Accessor <<= *_pName ) : ( aEvent.Accessor <<= (sal_Int32)id );
- aEvent.Element <<= _rxControl;
- maCListeners.elementInserted( aEvent );
- }
-
- return id;
-}
-
-void UnoControlContainer::addControl( const ::rtl::OUString& rName, const uno::Reference< awt::XControl >& rControl ) throw(uno::RuntimeException)
-{
- if ( rControl.is() )
- impl_addControl( rControl, &rName );
-}
-
-void UnoControlContainer::removingControl( const uno::Reference< awt::XControl >& _rxControl )
-{
- if ( _rxControl.is() )
- {
- _rxControl->removeEventListener( this );
- _rxControl->setContext( NULL );
- }
-}
-
-void UnoControlContainer::impl_removeControl( sal_Int32 _nId, const uno::Reference< awt::XControl >& _rxControl, const ::rtl::OUString* _pNameAccessor )
-{
-#ifdef DBG_UTIL
- {
- uno::Reference< awt::XControl > xControl;
- bool bHas = mpControls->getControlForIdentifier( _nId, xControl );
- DBG_ASSERT( bHas && xControl == _rxControl, "UnoControlContainer::impl_removeControl: inconsistency in the parameters!" );
- }
-#endif
- removingControl( _rxControl );
-
- mpControls->removeControlById( _nId );
-
- if ( maCListeners.getLength() )
- {
- container::ContainerEvent aEvent;
- aEvent.Source = *this;
- _pNameAccessor ? ( aEvent.Accessor <<= *_pNameAccessor ) : ( aEvent.Accessor <<= _nId );
- aEvent.Element <<= _rxControl;
- maCListeners.elementRemoved( aEvent );
- }
-}
-
-void UnoControlContainer::removeControl( const uno::Reference< awt::XControl >& _rxControl ) throw(uno::RuntimeException)
-{
- if ( _rxControl.is() )
- {
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- UnoControlHolderList::ControlIdentifier id = mpControls->getControlIdentifier( _rxControl );
- if ( id != -1 )
- impl_removeControl( id, _rxControl, NULL );
- }
-}
-
-
-
-// awt::XUnoControlContainer
-void UnoControlContainer::setTabControllers( const uno::Sequence< uno::Reference< awt::XTabController > >& TabControllers ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- maTabControllers = TabControllers;
-}
-
-uno::Sequence< uno::Reference< awt::XTabController > > UnoControlContainer::getTabControllers( ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- return maTabControllers;
-}
-
-void UnoControlContainer::addTabController( const uno::Reference< awt::XTabController >& TabController ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_uInt32 nCount = maTabControllers.getLength();
- maTabControllers.realloc( nCount + 1 );
- maTabControllers[ nCount ] = TabController;
-}
-
-void UnoControlContainer::removeTabController( const uno::Reference< awt::XTabController >& TabController ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_uInt32 nCount = maTabControllers.getLength();
- const uno::Reference< awt::XTabController >* pLoop = maTabControllers.getConstArray();
- for ( sal_uInt32 n = 0; n < nCount; ++n, ++pLoop )
- {
- if( pLoop->get() == TabController.get() )
- {
- ::comphelper::removeElementAt( maTabControllers, n );
- break;
- }
- }
-}
-
-// awt::XControl
-void UnoControlContainer::createPeer( const uno::Reference< awt::XToolkit >& rxToolkit, const uno::Reference< awt::XWindowPeer >& rParent ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- if( !getPeer().is() )
- {
- sal_Bool bVis = maComponentInfos.bVisible;
- if( bVis )
- UnoControl::setVisible( sal_False );
- // eigenes Peer erzeugen
- UnoControl::createPeer( rxToolkit, rParent );
-
- // alle Peers der Childs erzeugen
- if ( !mbCreatingCompatiblePeer )
- {
- // Evaluate "Step" property
- uno::Reference< awt::XControlModel > xModel( getModel() );
- uno::Reference< beans::XPropertySet > xPSet
- ( xModel, uno::UNO_QUERY );
- uno::Reference< beans::XPropertySetInfo >
- xInfo = xPSet->getPropertySetInfo();
- ::rtl::OUString aPropName(RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- ::com::sun::star::uno::Any aVal = xPSet->getPropertyValue( aPropName );
- sal_Int32 nDialogStep = 0;
- aVal >>= nDialogStep;
- uno::Reference< awt::XControlContainer > xContainer =
- SAL_STATIC_CAST( awt::XControlContainer*, this );
- implUpdateVisibility( nDialogStep, xContainer );
-
- uno::Reference< beans::XPropertyChangeListener > xListener =
- SAL_STATIC_CAST( beans::XPropertyChangeListener*,
- new DialogStepChangedListener( xContainer ) );
- xPSet->addPropertyChangeListener( aPropName, xListener );
- }
-
- uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
- sal_uInt32 nCtrls = aCtrls.getLength();
- for( sal_uInt32 n = 0; n < nCtrls; n++ )
- aCtrls.getArray()[n]->createPeer( rxToolkit, getPeer() );
-
- uno::Reference< awt::XVclContainerPeer > xC( getPeer(), uno::UNO_QUERY );
- if ( xC.is() )
- xC->enableDialogControl( sal_True );
- ImplActivateTabControllers();
- }
-
- if( bVis && !isDesignMode() )
- UnoControl::setVisible( sal_True );
- }
-}
-
-
-// awt::XWindow
-void UnoControlContainer::setVisible( sal_Bool bVisible ) throw(uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- UnoControl::setVisible( bVisible );
- if( !mxContext.is() && bVisible )
- // Es ist ein TopWindow, also automatisch anzeigen
- createPeer( uno::Reference< awt::XToolkit > (), uno::Reference< awt::XWindowPeer > () );
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/unocontrolcontainermodel.cxx b/toolkit/source/controls/unocontrolcontainermodel.cxx
deleted file mode 100644
index 3f4c61fa78..0000000000
--- a/toolkit/source/controls/unocontrolcontainermodel.cxx
+++ /dev/null
@@ -1,92 +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/controls/unocontrolcontainermodel.hxx>
-#include <toolkit/helper/property.hxx>
-#include <toolkit/helper/servicenames.hxx>
-#include <toolkit/helper/unopropertyarrayhelper.hxx>
-
-// ----------------------------------------------------
-// class UnoControlContainerModel
-// ----------------------------------------------------
-UnoControlContainerModel::UnoControlContainerModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_TEXT );
-}
-
-::rtl::OUString UnoControlContainerModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel );
-}
-
-::com::sun::star::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- ::com::sun::star::uno::Any aDefault;
- if ( nPropId == BASEPROPERTY_BORDER )
- aDefault <<= (sal_Int16) 0;
- else
- aDefault <<= UnoControlModel::ImplGetDefaultValue( nPropId );
- return aDefault;
-}
-
-
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper()
-{
- ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlContainerModel*)this)->GetMutex() );
-
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
deleted file mode 100644
index 286d946493..0000000000
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ /dev/null
@@ -1,1485 +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/beans/PropertyState.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/awt/FontDescriptor.hpp>
-#include <com/sun/star/awt/FontWidth.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
-#include <com/sun/star/awt/FontSlant.hpp>
-#include <com/sun/star/awt/MouseWheelBehavior.hpp>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <com/sun/star/awt/XDevice.hpp>
-#include <com/sun/star/text/WritingMode2.hpp>
-#include <com/sun/star/io/XMarkableStream.hpp>
-#include <toolkit/controls/unocontrolmodel.hxx>
-#include <toolkit/helper/macros.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <rtl/memory.h>
-#include <rtl/uuid.h>
-#include <tools/diagnose_ex.h>
-#include <tools/string.hxx>
-#include <tools/table.hxx>
-#include <tools/date.hxx>
-#include <tools/time.hxx>
-#include <tools/urlobj.hxx>
-#include <tools/debug.hxx>
-#include <toolkit/helper/property.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <toolkit/helper/emptyfontdescriptor.hxx>
-#include <com/sun/star/lang/Locale.hpp>
-#include <unotools/localedatawrapper.hxx>
-#include <unotools/configmgr.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/sequence.hxx>
-#include <comphelper/extract.hxx>
-#include <vcl/svapp.hxx>
-#include <uno/data.h>
-
-#include <memory>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::i18n;
-using ::com::sun::star::awt::FontDescriptor;
-
-struct ImplControlProperty
-{
-private:
- sal_uInt16 nId;
- ::com::sun::star::uno::Any aValue;
-
-public:
- ImplControlProperty( const ImplControlProperty& rProp ) : aValue( rProp.aValue )
- {
- nId = rProp.nId;
- }
-
- ImplControlProperty( sal_uInt16 nT )
- {
- nId = nT;
- }
-
- ImplControlProperty( sal_uInt16 nT, const ::com::sun::star::uno::Any& rValue ) : aValue( rValue )
- {
- nId = nT;
- }
-
- sal_uInt16 GetId() const { return nId; }
- const ::com::sun::star::uno::Any& GetValue() const { return aValue; }
- void SetValue( const ::com::sun::star::uno::Any& rValue ) { aValue = rValue; }
-};
-
-DECLARE_TABLE( ImplPropertyTable, ImplControlProperty* )
-
-#define UNOCONTROL_STREAMVERSION (short)2
-
-static void lcl_ImplMergeFontProperty( FontDescriptor& rFD, sal_uInt16 nPropId, const Any& rValue )
-{
- // some props are defined with other types than the matching FontDescriptor members have
- // (e.g. FontWidth, FontSlant)
- // 78474 - 09/19/2000 - FS
- float nExtractFloat = 0;
- sal_Int16 nExtractShort = 0;
-
- switch ( nPropId )
- {
- case BASEPROPERTY_FONTDESCRIPTORPART_NAME: rValue >>= rFD.Name;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: rValue >>= rFD.StyleName;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: rValue >>= rFD.Family;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: rValue >>= rFD.CharSet;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: rValue >>= nExtractFloat; rFD.Height = (sal_Int16)nExtractFloat;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue >>= rFD.Weight;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: if ( rValue >>= nExtractShort )
- rFD.Slant = (::com::sun::star::awt::FontSlant)nExtractShort;
- else
- rValue >>= rFD.Slant;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue >>= rFD.Underline;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: rValue >>= rFD.Strikeout;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: rValue >>= rFD.Width;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: rValue >>= rFD.Pitch;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: rValue >>= rFD.CharacterWidth;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: rValue >>= rFD.Orientation;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: rValue >>= rFD.Kerning;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: rValue >>= rFD.WordLineMode;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: rValue >>= rFD.Type;
- break;
- default: OSL_FAIL( "FontProperty?!" );
- }
-}
-
-// ----------------------------------------------------
-// class UnoControlModel
-// ----------------------------------------------------
-UnoControlModel::UnoControlModel()
- :UnoControlModel_Base()
- ,MutexAndBroadcastHelper()
- ,OPropertySetHelper( BrdcstHelper )
- ,maDisposeListeners( *this )
- ,maContext( ::comphelper::getProcessServiceFactory() )
-{
- OSL_ENSURE( false, "UnoControlModel::UnoControlModel: not implemented. Well, not really." );
- // just implemented to let the various FooImplInheritanceHelper compile, you should use the
- // version taking a service factory
- mpData = new ImplPropertyTable;
-}
-
-UnoControlModel::UnoControlModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel_Base()
- ,MutexAndBroadcastHelper()
- ,OPropertySetHelper( BrdcstHelper )
- ,maDisposeListeners( *this )
- ,maContext( i_factory )
-{
- // Die Properties muessen vom Model in die Tabelle gestopft werden,
- // nur vorhandene Properties sind gueltige Properties, auch wenn VOID.
- mpData = new ImplPropertyTable;
-}
-
-UnoControlModel::UnoControlModel( const UnoControlModel& rModel )
- : UnoControlModel_Base()
- , MutexAndBroadcastHelper()
- , OPropertySetHelper( BrdcstHelper )
- , maDisposeListeners( *this )
- , maContext( rModel.maContext )
-{
- mpData = new ImplPropertyTable;
-
- for ( sal_uInt32 n = rModel.mpData->Count(); n; )
- {
- ImplControlProperty* pProp = rModel.mpData->GetObject( --n );
- ImplControlProperty* pNew = new ImplControlProperty( *pProp );
- mpData->Insert( pNew->GetId(), pNew );
- }
-}
-
-UnoControlModel::~UnoControlModel()
-{
- for ( sal_uInt32 n = mpData->Count(); n; )
- delete mpData->GetObject( --n );
- delete mpData;
-}
-
-UnoControlModel* UnoControlModel::Clone() const
-{
- OSL_FAIL( "UnoControlModel::Clone() ?!" );
- return NULL;
-}
-
-::com::sun::star::uno::Sequence<sal_Int32> UnoControlModel::ImplGetPropertyIds() const
-{
- sal_uInt32 nIDs = mpData->Count();
- ::com::sun::star::uno::Sequence<sal_Int32> aIDs( nIDs );
- sal_Int32* pIDs = aIDs.getArray();
- for ( sal_uInt32 n = 0; n < nIDs; n++ )
- pIDs[n] = mpData->GetObjectKey( n );
- return aIDs;
-}
-
-sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
-{
- if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
- nPropId = BASEPROPERTY_FONTDESCRIPTOR;
-
- return mpData->Get( nPropId ) ? sal_True : sal_False;
-}
-
-::com::sun::star::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- ::com::sun::star::uno::Any aDefault;
-
- if (
- (nPropId == BASEPROPERTY_FONTDESCRIPTOR) ||
- (
- (nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START) &&
- (nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END)
- )
- )
- {
- EmptyFontDescriptor aFD;
- switch ( nPropId )
- {
- case BASEPROPERTY_FONTDESCRIPTOR: aDefault <<= aFD; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_NAME: aDefault <<= aFD.Name; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: aDefault <<= aFD.StyleName; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: aDefault <<= aFD.Family; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: aDefault <<= aFD.CharSet; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: aDefault <<= (float)aFD.Height; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: aDefault <<= aFD.Weight; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: aDefault <<= (sal_Int16)aFD.Slant; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: aDefault <<= aFD.Underline; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: aDefault <<= aFD.Strikeout; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: aDefault <<= aFD.Width; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: aDefault <<= aFD.Pitch; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: aDefault <<= aFD.CharacterWidth; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: aDefault <<= aFD.Orientation; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: aDefault <<= aFD.Kerning; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: aDefault <<= aFD.WordLineMode; break;
- case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: aDefault <<= aFD.Type; break;
- default: OSL_FAIL( "FontProperty?!" );
- }
- }
- else
- {
- switch ( nPropId )
- {
- case BASEPROPERTY_GRAPHIC:
- aDefault <<= Reference< graphic::XGraphic >();
- break;
-
- case BASEPROPERTY_REFERENCE_DEVICE:
- aDefault <<= Reference< awt::XDevice >();
- break;
-
- case BASEPROPERTY_ITEM_SEPARATOR_POS:
- case BASEPROPERTY_VERTICALALIGN:
- case BASEPROPERTY_BORDERCOLOR:
- case BASEPROPERTY_SYMBOL_COLOR:
- case BASEPROPERTY_TABSTOP:
- case BASEPROPERTY_TEXTCOLOR:
- case BASEPROPERTY_TEXTLINECOLOR:
- case BASEPROPERTY_DATE:
- case BASEPROPERTY_DATESHOWCENTURY:
- case BASEPROPERTY_TIME:
- case BASEPROPERTY_VALUE_DOUBLE:
- case BASEPROPERTY_PROGRESSVALUE:
- case BASEPROPERTY_SCROLLVALUE:
- case BASEPROPERTY_VISIBLESIZE:
- case BASEPROPERTY_BACKGROUNDCOLOR:
- case BASEPROPERTY_FILLCOLOR: break; // Void
-
- case BASEPROPERTY_FONTRELIEF:
- case BASEPROPERTY_FONTEMPHASISMARK:
- case BASEPROPERTY_MAXTEXTLEN:
- case BASEPROPERTY_STATE:
- case BASEPROPERTY_EXTDATEFORMAT:
- case BASEPROPERTY_EXTTIMEFORMAT:
- case BASEPROPERTY_ECHOCHAR: aDefault <<= (sal_Int16) 0; break;
- case BASEPROPERTY_BORDER: aDefault <<= (sal_Int16) 1; break;
- case BASEPROPERTY_DECIMALACCURACY: aDefault <<= (sal_Int16) 2; break;
- case BASEPROPERTY_LINECOUNT: aDefault <<= (sal_Int16) 5; break;
- case BASEPROPERTY_ALIGN: aDefault <<= (sal_Int16) PROPERTY_ALIGN_LEFT; break;
- case BASEPROPERTY_IMAGEALIGN: aDefault <<= (sal_Int16) 1 /*ImageAlign::TOP*/; break;
- case BASEPROPERTY_IMAGEPOSITION: aDefault <<= (sal_Int16) 12 /*ImagePosition::Centered*/; break;
- case BASEPROPERTY_PUSHBUTTONTYPE: aDefault <<= (sal_Int16) 0 /*PushButtonType::STANDARD*/; break;
- case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:aDefault <<= (sal_Int16) awt::MouseWheelBehavior::SCROLL_FOCUS_ONLY; break;
-
- case BASEPROPERTY_DATEMAX: aDefault <<= (sal_Int32) Date( 31, 12, 2200 ).GetDate(); break;
- case BASEPROPERTY_DATEMIN: aDefault <<= (sal_Int32) Date( 1, 1, 1900 ).GetDate(); break;
- case BASEPROPERTY_TIMEMAX: aDefault <<= (sal_Int32) Time( 23, 59 ).GetTime(); break;
- case BASEPROPERTY_TIMEMIN: aDefault <<= (sal_Int32) 0; break;
- case BASEPROPERTY_VALUEMAX_DOUBLE: aDefault <<= (double) 1000000; break;
- case BASEPROPERTY_VALUEMIN_DOUBLE: aDefault <<= (double) -1000000; break;
- case BASEPROPERTY_VALUESTEP_DOUBLE: aDefault <<= (double ) 1; break;
- case BASEPROPERTY_PROGRESSVALUE_MAX: aDefault <<= (sal_Int32) 100; break;
- case BASEPROPERTY_PROGRESSVALUE_MIN: aDefault <<= (sal_Int32) 0; break;
- case BASEPROPERTY_SCROLLVALUE_MAX: aDefault <<= (sal_Int32) 100; break;
- case BASEPROPERTY_SCROLLVALUE_MIN: aDefault <<= (sal_Int32) 0; break;
- case BASEPROPERTY_LINEINCREMENT: aDefault <<= (sal_Int32) 1; break;
- case BASEPROPERTY_BLOCKINCREMENT: aDefault <<= (sal_Int32) 10; break;
- case BASEPROPERTY_ORIENTATION: aDefault <<= (sal_Int32) 0; break;
- case BASEPROPERTY_SPINVALUE: aDefault <<= (sal_Int32) 0; break;
- case BASEPROPERTY_SPININCREMENT: aDefault <<= (sal_Int32) 1; break;
- case BASEPROPERTY_SPINVALUE_MIN: aDefault <<= (sal_Int32) 0; break;
- case BASEPROPERTY_SPINVALUE_MAX: aDefault <<= (sal_Int32) 100; break;
- case BASEPROPERTY_REPEAT_DELAY: aDefault <<= (sal_Int32) 50; break; // 50 milliseconds
- case BASEPROPERTY_DEFAULTCONTROL: aDefault <<= ((UnoControlModel*)this)->getServiceName(); break;
-
- case BASEPROPERTY_AUTOHSCROLL:
- case BASEPROPERTY_AUTOVSCROLL:
- case BASEPROPERTY_MOVEABLE:
- case BASEPROPERTY_CLOSEABLE:
- case BASEPROPERTY_SIZEABLE:
- case BASEPROPERTY_HSCROLL:
- case BASEPROPERTY_DEFAULTBUTTON:
- case BASEPROPERTY_MULTILINE:
- case BASEPROPERTY_MULTISELECTION:
- case BASEPROPERTY_TRISTATE:
- case BASEPROPERTY_DROPDOWN:
- case BASEPROPERTY_SPIN:
- case BASEPROPERTY_READONLY:
- case BASEPROPERTY_VSCROLL:
- case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
- case BASEPROPERTY_STRICTFORMAT:
- case BASEPROPERTY_REPEAT:
- case BASEPROPERTY_PAINTTRANSPARENT:
- case BASEPROPERTY_DESKTOP_AS_PARENT:
- case BASEPROPERTY_HARDLINEBREAKS:
- case BASEPROPERTY_NOLABEL: aDefault <<= (sal_Bool) sal_False; break;
-
- case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
- case BASEPROPERTY_HIDEINACTIVESELECTION:
- case BASEPROPERTY_ENFORCE_FORMAT:
- case BASEPROPERTY_AUTOCOMPLETE:
- case BASEPROPERTY_SCALEIMAGE:
- case BASEPROPERTY_ENABLED:
- case BASEPROPERTY_PRINTABLE:
- case BASEPROPERTY_ENABLEVISIBLE:
- case BASEPROPERTY_DECORATION: aDefault <<= (sal_Bool) sal_True; break;
-
- case BASEPROPERTY_GROUPNAME:
- case BASEPROPERTY_HELPTEXT:
- case BASEPROPERTY_HELPURL:
- case BASEPROPERTY_IMAGEURL:
- case BASEPROPERTY_DIALOGSOURCEURL:
- case BASEPROPERTY_EDITMASK:
- case BASEPROPERTY_LITERALMASK:
- case BASEPROPERTY_LABEL:
- case BASEPROPERTY_TITLE:
- case BASEPROPERTY_TEXT: aDefault <<= ::rtl::OUString(); break;
-
- case BASEPROPERTY_WRITING_MODE:
- case BASEPROPERTY_CONTEXT_WRITING_MODE:
- aDefault <<= text::WritingMode2::CONTEXT;
- break;
-
- case BASEPROPERTY_STRINGITEMLIST:
- {
- ::com::sun::star::uno::Sequence< ::rtl::OUString> aStringSeq;
- aDefault <<= aStringSeq;
-
- }
- break;
- case BASEPROPERTY_SELECTEDITEMS:
- {
- ::com::sun::star::uno::Sequence<sal_Int16> aINT16Seq;
- aDefault <<= aINT16Seq;
- }
- break;
- case BASEPROPERTY_CURRENCYSYMBOL:
- {
- Any aDefaultCurrency = ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::DEFAULTCURRENCY);
- DBG_ASSERT( TypeClass_STRING == aDefaultCurrency.getValueTypeClass(), "UnoControlModel::ImplGetDefaultValue: invalid currency config value!" );
-
- ::rtl::OUString sDefaultCurrency;
- aDefaultCurrency >>= sDefaultCurrency;
-
- // extract the bank symbol
- sal_Int32 nSepPos = sDefaultCurrency.indexOf( '-' );
- ::rtl::OUString sBankSymbol;
- if ( nSepPos >= 0 )
- {
- sBankSymbol = sDefaultCurrency.copy( 0, nSepPos );
- sDefaultCurrency = sDefaultCurrency.copy( nSepPos + 1 );
- }
-
- // the remaming is the locale
- Locale aLocale;
- nSepPos = sDefaultCurrency.indexOf( '-' );
- if ( nSepPos >= 0 )
- {
- aLocale.Language = sDefaultCurrency.copy( 0, nSepPos );
- aLocale.Country = sDefaultCurrency.copy( nSepPos + 1 );
- }
-
- LocaleDataWrapper aLocaleInfo( maContext.getLegacyServiceFactory(), aLocale );
- if ( !sBankSymbol.getLength() )
- sBankSymbol = aLocaleInfo.getCurrBankSymbol();
-
- // look for the currency entry (for this language) which has the given bank symbol
- Sequence< Currency2 > aAllCurrencies = aLocaleInfo.getAllCurrencies();
- const Currency2* pAllCurrencies = aAllCurrencies.getConstArray();
- const Currency2* pAllCurrenciesEnd = pAllCurrencies + aAllCurrencies.getLength();
-
- ::rtl::OUString sCurrencySymbol = aLocaleInfo.getCurrSymbol();
- if ( !sBankSymbol.getLength() )
- {
- DBG_ASSERT( pAllCurrencies != pAllCurrenciesEnd, "UnoControlModel::ImplGetDefaultValue: no currencies at all!" );
- if ( pAllCurrencies != pAllCurrenciesEnd )
- {
- sBankSymbol = pAllCurrencies->BankSymbol;
- sCurrencySymbol = pAllCurrencies->Symbol;
- }
- }
-
- if ( sBankSymbol.getLength() )
- {
- bool bLegacy = false;
- for ( ;pAllCurrencies != pAllCurrenciesEnd; ++pAllCurrencies )
- if ( pAllCurrencies->BankSymbol == sBankSymbol )
- {
- sCurrencySymbol = pAllCurrencies->Symbol;
- if ( pAllCurrencies->LegacyOnly )
- bLegacy = true;
- else
- break;
- }
- DBG_ASSERT( bLegacy || pAllCurrencies != pAllCurrenciesEnd, "UnoControlModel::ImplGetDefaultValue: did not find the given bank symbol!" );
- (void)bLegacy;
- }
-
- aDefault <<= sCurrencySymbol;
- }
- break;
-
- default: OSL_FAIL( "ImplGetDefaultValue - unknown Property" );
- }
- }
-
- return aDefault;
-}
-
-void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault )
-{
- ImplControlProperty* pProp = new ImplControlProperty( nPropId, rDefault );
- mpData->Insert( nPropId, pProp );
-}
-
-void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
-{
- ImplRegisterProperty( nPropId, ImplGetDefaultValue( nPropId ) );
-
- if ( nPropId == 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...
-
- ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
- ImplRegisterProperty( BASEPROPERTY_TEXTLINECOLOR );
- ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
- ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
- }
-}
-
-void UnoControlModel::ImplRegisterProperties( const std::list< sal_uInt16 > &rIds )
-{
- std::list< sal_uInt16 >::const_iterator iter;
- for( iter = rIds.begin(); iter != rIds.end(); ++iter)
- {
- if( !ImplHasProperty( *iter ) )
- ImplRegisterProperty( *iter, ImplGetDefaultValue( *iter ) );
- }
-}
-
-// ::com::sun::star::uno::XInterface
-::com::sun::star::uno::Any UnoControlModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- Any aRet = UnoControlModel_Base::queryAggregation( rType );
- if ( !aRet.hasValue() )
- aRet = ::cppu::OPropertySetHelper::queryInterface( rType );
- return aRet;
-}
-
-// ::com::sun::star::lang::XUnoTunnel
-IMPL_XUNOTUNNEL( UnoControlModel )
-
-// XInterface
-IMPLEMENT_FORWARD_REFCOUNT( UnoControlModel, UnoControlModel_Base )
-
-// ::com::sun::star::lang::XTypeProvider
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoControlModel, UnoControlModel_Base, ::cppu::OPropertySetHelper )
-
-
-uno::Reference< util::XCloneable > UnoControlModel::createClone() throw(::com::sun::star::uno::RuntimeException)
-{
- UnoControlModel* pClone = Clone();
- uno::Reference< util::XCloneable > xClone( (::cppu::OWeakObject*) pClone, uno::UNO_QUERY );
- return xClone;
-}
-
-// ::com::sun::star::lang::XComponent
-void UnoControlModel::dispose( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ::com::sun::star::lang::EventObject aEvt;
- aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this;
- maDisposeListeners.disposeAndClear( aEvt );
-
- BrdcstHelper.aLC.disposeAndClear( aEvt );
-
- // let the property set helper notify our property listeners
- OPropertySetHelper::disposing();
-}
-
-void UnoControlModel::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- maDisposeListeners.addInterface( rxListener );
-}
-
-void UnoControlModel::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- maDisposeListeners.removeInterface( rxListener );
-}
-
-
-// ::com::sun::star::beans::XPropertyState
-::com::sun::star::beans::PropertyState UnoControlModel::getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_uInt16 nPropId = GetPropertyId( PropertyName );
-
- ::com::sun::star::uno::Any aValue = getPropertyValue( PropertyName );
- ::com::sun::star::uno::Any aDefault = ImplGetDefaultValue( nPropId );
-
- return CompareProperties( aValue, aDefault ) ? ::com::sun::star::beans::PropertyState_DEFAULT_VALUE : ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
-}
-
-::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > UnoControlModel::getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_uInt32 nNames = PropertyNames.getLength();
- const ::rtl::OUString* pNames = PropertyNames.getConstArray();
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > aStates( nNames );
- ::com::sun::star::beans::PropertyState* pStates = aStates.getArray();
-
- for ( sal_uInt32 n = 0; n < nNames; n++ )
- pStates[n] = getPropertyState( pNames[n] );
-
- return aStates;
-}
-
-void UnoControlModel::setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
-{
- Any aDefaultValue;
- {
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- aDefaultValue = ImplGetDefaultValue( GetPropertyId( PropertyName ) );
- }
- setPropertyValue( PropertyName, aDefaultValue );
-}
-
-::com::sun::star::uno::Any UnoControlModel::getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- return ImplGetDefaultValue( GetPropertyId( rPropertyName ) );
-}
-
-
-// ::com::sun::star::io::XPersistObjec
-::rtl::OUString UnoControlModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- OSL_FAIL( "ServiceName von UnoControlModel ?!" );
- return ::rtl::OUString();
-}
-
-void UnoControlModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
- DBG_ASSERT( xMark.is(), "write: no ::com::sun::star::io::XMarkableStream!" );
-
- OutStream->writeShort( UNOCONTROL_STREAMVERSION );
-
- ImplPropertyTable aProps;
- sal_uInt32 i;
- for ( i = mpData->Count(); i; )
- {
- ImplControlProperty* pProp = mpData->GetObject( --i );
- if ( ( ( GetPropertyAttribs( pProp->GetId() ) & ::com::sun::star::beans::PropertyAttribute::TRANSIENT ) == 0 )
- && ( getPropertyState( GetPropertyName( pProp->GetId() ) ) != ::com::sun::star::beans::PropertyState_DEFAULT_VALUE ) )
- {
- aProps.Insert( pProp->GetId(), pProp );
- }
- }
-
- sal_uInt32 nProps = aProps.Count();
-
- // FontProperty wegen fehlender Unterscheidung zwischen 5.0 / 5.1
- // immer im alten Format mitspeichern.
- OutStream->writeLong( (long) aProps.IsKeyValid( BASEPROPERTY_FONTDESCRIPTOR ) ? ( nProps + 3 ) : nProps );
- for ( i = 0; i < nProps; i++ )
- {
- sal_Int32 nPropDataBeginMark = xMark->createMark();
- OutStream->writeLong( 0L ); // DataLen
-
- ImplControlProperty* pProp = aProps.GetObject( i );
- OutStream->writeShort( pProp->GetId() );
-
- sal_Bool bVoid = pProp->GetValue().getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
-
- OutStream->writeBoolean( bVoid );
-
- if ( !bVoid )
- {
- const ::com::sun::star::uno::Any& rValue = pProp->GetValue();
- const ::com::sun::star::uno::Type& rType = rValue.getValueType();
-
- if ( rType == ::getBooleanCppuType() )
- {
- sal_Bool b = false;
- rValue >>= b;
- OutStream->writeBoolean( b );
- }
- else if ( rType == ::getCppuType((const ::rtl::OUString*)0) )
- {
- ::rtl::OUString aUString;
- rValue >>= aUString;
- OutStream->writeUTF( aUString );
- }
- else if ( rType == ::getCppuType((const sal_uInt16*)0) )
- {
- sal_uInt16 n = 0;
- rValue >>= n;
- OutStream->writeShort( n );
- }
- else if ( rType == ::getCppuType((const sal_Int16*)0) )
- {
- sal_Int16 n = 0;
- rValue >>= n;
- OutStream->writeShort( n );
- }
- else if ( rType == ::getCppuType((const sal_uInt32*)0) )
- {
- sal_uInt32 n = 0;
- rValue >>= n;
- OutStream->writeLong( n );
- }
- else if ( rType == ::getCppuType((const sal_Int32*)0) )
- {
- sal_Int32 n = 0;
- rValue >>= n;
- OutStream->writeLong( n );
- }
- else if ( rType == ::getCppuType((const double*)0) )
- {
- double n = 0;
- rValue >>= n;
- OutStream->writeDouble( n );
- }
- else if ( rType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) )
- {
- ::com::sun::star::awt::FontDescriptor aFD;
- rValue >>= aFD;
- OutStream->writeUTF( aFD.Name );
- OutStream->writeShort( aFD.Height );
- OutStream->writeShort( aFD.Width );
- OutStream->writeUTF( aFD.StyleName );
- OutStream->writeShort( aFD.Family );
- OutStream->writeShort( aFD.CharSet );
- OutStream->writeShort( aFD.Pitch );
- OutStream->writeDouble( aFD.CharacterWidth );
- OutStream->writeDouble( aFD.Weight );
- OutStream->writeShort(
- sal::static_int_cast< sal_Int16 >(aFD.Slant) );
- OutStream->writeShort( aFD.Underline );
- OutStream->writeShort( aFD.Strikeout );
- OutStream->writeDouble( aFD.Orientation );
- OutStream->writeBoolean( aFD.Kerning );
- OutStream->writeBoolean( aFD.WordLineMode );
- OutStream->writeShort( aFD.Type );
- }
- else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) )
- {
- ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
- rValue >>= aSeq;
- long nEntries = aSeq.getLength();
- OutStream->writeLong( nEntries );
- for ( long n = 0; n < nEntries; n++ )
- OutStream->writeUTF( aSeq.getConstArray()[n] );
- }
- else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) )
- {
- ::com::sun::star::uno::Sequence<sal_uInt16> aSeq;
- rValue >>= aSeq;
- long nEntries = aSeq.getLength();
- OutStream->writeLong( nEntries );
- for ( long n = 0; n < nEntries; n++ )
- OutStream->writeShort( aSeq.getConstArray()[n] );
- }
- else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) )
- {
- ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
- rValue >>= aSeq;
- long nEntries = aSeq.getLength();
- OutStream->writeLong( nEntries );
- for ( long n = 0; n < nEntries; n++ )
- OutStream->writeShort( aSeq.getConstArray()[n] );
- }
- else if ( rType.getTypeClass() == TypeClass_ENUM )
- {
- sal_Int32 nAsInt = 0;
- ::cppu::enum2int( nAsInt, rValue );
- OutStream->writeLong( nAsInt );
- }
-#if OSL_DEBUG_LEVEL > 0
- else
- {
- ::rtl::OString sMessage( "UnoControlModel::write: don't know how to handle a property of type '" );
- ::rtl::OUString sTypeName( rType.getTypeName() );
- sMessage += ::rtl::OString( sTypeName.getStr(), sTypeName.getLength(), RTL_TEXTENCODING_ASCII_US );
- sMessage += "'.\n(Currently handling property '";
- ::rtl::OUString sPropertyName( GetPropertyName( pProp->GetId() ) );
- sMessage += ::rtl::OString( sPropertyName.getStr(), sPropertyName.getLength(), osl_getThreadTextEncoding() );
- sMessage += "'.)";
- OSL_FAIL( sMessage.getStr() );
- }
-#endif
- }
-
- sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
- xMark->jumpToMark( nPropDataBeginMark );
- OutStream->writeLong( nPropDataLen );
- xMark->jumpToFurthest();
- xMark->deleteMark(nPropDataBeginMark);
- }
-
- ImplControlProperty* pProp = aProps.Get( BASEPROPERTY_FONTDESCRIPTOR );
- if ( pProp )
- {
- // Solange wir keinen 5.0-Export haben, muss das alte
- // Format mit rausgeschrieben werden...
- ::com::sun::star::awt::FontDescriptor aFD;
- pProp->GetValue() >>= aFD;
-
- for ( sal_uInt16 n = BASEPROPERTY_FONT_TYPE; n <= BASEPROPERTY_FONT_ATTRIBS; n++ )
- {
- sal_Int32 nPropDataBeginMark = xMark->createMark();
- OutStream->writeLong( 0L ); // DataLen
- OutStream->writeShort( n ); // PropId
- OutStream->writeBoolean( sal_False ); // Void
-
- if ( n == BASEPROPERTY_FONT_TYPE )
- {
- OutStream->writeUTF( aFD.Name );
- OutStream->writeUTF( aFD.StyleName );
- OutStream->writeShort( aFD.Family );
- OutStream->writeShort( aFD.CharSet );
- OutStream->writeShort( aFD.Pitch );
- }
- else if ( n == BASEPROPERTY_FONT_SIZE )
- {
- OutStream->writeLong( aFD.Width );
- OutStream->writeLong( aFD.Height );
- OutStream->writeShort(
- sal::static_int_cast< sal_Int16 >(
- VCLUnoHelper::ConvertFontWidth( aFD.CharacterWidth )) );
- }
- else if ( n == BASEPROPERTY_FONT_ATTRIBS )
- {
- OutStream->writeShort(
- sal::static_int_cast< sal_Int16 >(
- VCLUnoHelper::ConvertFontWeight( aFD.Weight )) );
- OutStream->writeShort(
- sal::static_int_cast< sal_Int16 >(aFD.Slant) );
- OutStream->writeShort( aFD.Underline );
- OutStream->writeShort( aFD.Strikeout );
- OutStream->writeShort( (short)(aFD.Orientation * 10) );
- OutStream->writeBoolean( aFD.Kerning );
- OutStream->writeBoolean( aFD.WordLineMode );
- }
- else
- {
- OSL_FAIL( "Property?!" );
- }
-
- sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
- xMark->jumpToMark( nPropDataBeginMark );
- OutStream->writeLong( nPropDataLen );
- xMark->jumpToFurthest();
- xMark->deleteMark(nPropDataBeginMark);
- }
- }
-}
-
-void UnoControlModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( InStream, ::com::sun::star::uno::UNO_QUERY );
- DBG_ASSERT( xMark.is(), "read: no ::com::sun::star::io::XMarkableStream!" );
-
- short nVersion = InStream->readShort();
- sal_uInt32 nProps = (sal_uInt32)InStream->readLong();
- ::com::sun::star::uno::Sequence< ::rtl::OUString> aProps( nProps );
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aValues( nProps );
- sal_Bool bInvalidEntries = sal_False;
-
- // Dummerweise kein Mark fuer den gesamten Block, es koennen also
- // nur Properties geaendert werden, es koennen aber nicht spaeter mal Daten
- // fuer das Model hinter den Properties geschrieben werden.
-
- // Fuer den Import der alten ::com::sun::star::awt::FontDescriptor-Teile
- ::com::sun::star::awt::FontDescriptor* pFD = NULL;
-
- sal_uInt32 i;
- for ( i = 0; i < nProps; i++ )
- {
- sal_Int32 nPropDataBeginMark = xMark->createMark();
- sal_Int32 nPropDataLen = InStream->readLong();
-
- sal_uInt16 nPropId = (sal_uInt16)InStream->readShort();
-
- ::com::sun::star::uno::Any aValue;
- sal_Bool bIsVoid = InStream->readBoolean();
- if ( !bIsVoid )
- {
- const ::com::sun::star::uno::Type* pType = mpData->Get( nPropId ) ? GetPropertyType( nPropId ) : NULL;
- if ( pType )
- {
- if ( *pType == ::getBooleanCppuType() )
- {
- sal_Bool b = InStream->readBoolean();
- aValue <<= b;
- }
- else if ( *pType == ::getCppuType((const ::rtl::OUString*)0) )
- {
- ::rtl::OUString aUTF = InStream->readUTF();
- aValue <<= aUTF;
- }
- else if ( *pType == ::getCppuType((const sal_uInt16*)0) )
- {
- sal_uInt16 n = InStream->readShort();
- aValue <<= n;
- }
- else if ( *pType == ::getCppuType((const sal_Int16*)0) )
- {
- sal_Int16 n = InStream->readShort();
- aValue <<= n;
- }
- else if ( *pType == ::getCppuType((const sal_uInt32*)0) )
- {
- sal_uInt32 n = InStream->readLong();
- aValue <<= n;
- }
- else if ( *pType == ::getCppuType((const sal_Int32*)0) )
- {
- sal_Int32 n = InStream->readLong();
- aValue <<= n;
- }
- else if ( *pType == ::getCppuType((const double*)0) )
- {
- double n = InStream->readDouble();
- aValue <<= n;
- }
- else if ( *pType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) )
- {
- ::com::sun::star::awt::FontDescriptor aFD;
- aFD.Name = InStream->readUTF();
- aFD.Height = InStream->readShort();
- aFD.Width = InStream->readShort();
- aFD.StyleName = InStream->readUTF();
- aFD.Family = InStream->readShort();
- aFD.CharSet = InStream->readShort();
- aFD.Pitch = InStream->readShort();
- aFD.CharacterWidth = (float)InStream->readDouble();
- aFD.Weight = (float)InStream->readDouble();
- aFD.Slant = (::com::sun::star::awt::FontSlant)InStream->readShort();
- aFD.Underline = InStream->readShort();
- aFD.Strikeout = InStream->readShort();
- aFD.Orientation = (float)InStream->readDouble();
- aFD.Kerning = InStream->readBoolean();
- aFD.WordLineMode = InStream->readBoolean();
- aFD.Type = InStream->readShort();
- aValue <<= aFD;
- }
- else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) )
- {
- long nEntries = InStream->readLong();
- ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nEntries );
- for ( long n = 0; n < nEntries; n++ )
- aSeq.getArray()[n] = InStream->readUTF();
- aValue <<= aSeq;
-
- }
- else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) )
-
- {
- long nEntries = InStream->readLong();
- ::com::sun::star::uno::Sequence<sal_uInt16> aSeq( nEntries );
- for ( long n = 0; n < nEntries; n++ )
- aSeq.getArray()[n] = (sal_uInt16)InStream->readShort();
- aValue <<= aSeq;
- }
- else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) )
- {
- long nEntries = InStream->readLong();
- ::com::sun::star::uno::Sequence<sal_Int16> aSeq( nEntries );
- for ( long n = 0; n < nEntries; n++ )
- aSeq.getArray()[n] = (sal_Int16)InStream->readShort();
- aValue <<= aSeq;
- }
- else if ( pType->getTypeClass() == TypeClass_ENUM )
- {
- sal_Int32 nAsInt = InStream->readLong();
- aValue = ::cppu::int2enum( nAsInt, *pType );
- }
- else
- {
- ::rtl::OString sMessage( "UnoControlModel::read: don't know how to handle a property of type '" );
- ::rtl::OUString sTypeName( pType->getTypeName() );
- sMessage += ::rtl::OString( sTypeName.getStr(), sTypeName.getLength(), RTL_TEXTENCODING_ASCII_US );
- sMessage += "'.\n(Currently handling property '";
- ::rtl::OUString sPropertyName( GetPropertyName( nPropId ) );
- sMessage += ::rtl::OString( sPropertyName.getStr(), sPropertyName.getLength(), osl_getThreadTextEncoding() );
- sMessage += "'.)";
- OSL_FAIL( sMessage.getStr() );
- }
- }
- else
- {
- // Altes Geraffel aus 5.0
- if ( nPropId == BASEPROPERTY_FONT_TYPE )
- {
- // Sonst ist es nur die redundante Info fuer alte Versionen
- // Daten werden durch MarkableStream geskippt.
- if ( nVersion < 2 )
- {
- if ( !pFD )
- {
- pFD = new ::com::sun::star::awt::FontDescriptor;
- ImplControlProperty* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
- if ( pProp ) // wegen den Defaults...
- pProp->GetValue() >>= *pFD;
- }
- pFD->Name = InStream->readUTF();
- pFD->StyleName = InStream->readUTF();
- pFD->Family = InStream->readShort();
- pFD->CharSet = InStream->readShort();
- pFD->Pitch = InStream->readShort();
- }
- }
- else if ( nPropId == BASEPROPERTY_FONT_SIZE )
- {
- if ( nVersion < 2 )
- {
- if ( !pFD )
- {
- pFD = new ::com::sun::star::awt::FontDescriptor;
- ImplControlProperty* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
- if ( pProp ) // wegen den Defaults...
- pProp->GetValue() >>= *pFD;
- }
- pFD->Width = (sal_Int16)InStream->readLong();
- pFD->Height = (sal_Int16)InStream->readLong();
- InStream->readShort(); // ::com::sun::star::awt::FontWidth ignorieren - wurde mal falsch geschrieben und wird nicht gebraucht.
- pFD->CharacterWidth = ::com::sun::star::awt::FontWidth::DONTKNOW;
- }
- }
- else if ( nPropId == BASEPROPERTY_FONT_ATTRIBS )
- {
- if ( nVersion < 2 )
- {
- if ( !pFD )
- {
- pFD = new ::com::sun::star::awt::FontDescriptor;
- ImplControlProperty* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
- if ( pProp ) // wegen den Defaults...
- pProp->GetValue() >>= *pFD;
- }
- pFD->Weight = VCLUnoHelper::ConvertFontWeight( (FontWeight) InStream->readShort() );
- pFD->Slant = (::com::sun::star::awt::FontSlant)InStream->readShort();
- pFD->Underline = InStream->readShort();
- pFD->Strikeout = InStream->readShort();
- pFD->Orientation = ( (float)(double)InStream->readShort() ) / 10;
- pFD->Kerning = InStream->readBoolean();
- pFD->WordLineMode = InStream->readBoolean();
- }
- }
- else
- {
- OSL_FAIL( "read: unknown Property!" );
- }
- }
- }
- else // bVoid
- {
- if ( nPropId == BASEPROPERTY_FONTDESCRIPTOR )
- {
- EmptyFontDescriptor aFD;
- aValue <<= aFD;
- }
- }
-
- if ( mpData->Get( nPropId ) )
- {
- aProps.getArray()[i] = GetPropertyName( nPropId );
- aValues.getArray()[i] = aValue;
- }
- else
- {
- bInvalidEntries = sal_True;
- }
-
- // Falls bereits mehr drinsteht als diese Version kennt:
- xMark->jumpToMark( nPropDataBeginMark );
- InStream->skipBytes( nPropDataLen );
- xMark->deleteMark(nPropDataBeginMark);
- }
- if ( bInvalidEntries )
- {
- for ( i = 0; i < (sal_uInt32)aProps.getLength(); i++ )
- {
- if ( !aProps.getConstArray()[i].getLength() )
- {
- ::comphelper::removeElementAt( aProps, i );
- ::comphelper::removeElementAt( aValues, i );
- i--;
- }
- }
- }
-
- try
- {
- setPropertyValues( aProps, aValues );
- }
- catch ( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- if ( pFD )
- {
- ::com::sun::star::uno::Any aValue;
- aValue <<= *pFD;
- setPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ), aValue );
- delete pFD;
- }
-}
-
-
-// ::com::sun::star::lang::XServiceInfo
-::rtl::OUString UnoControlModel::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
-{
- OSL_FAIL( "This method should be overloaded!" );
- return ::rtl::OUString();
-
-}
-
-sal_Bool UnoControlModel::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
- const ::rtl::OUString * pArray = aSNL.getConstArray();
- for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
- if( pArray[i] == rServiceName )
- return sal_True;
- return sal_False;
-}
-
-::com::sun::star::uno::Sequence< ::rtl::OUString > UnoControlModel::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlModel" ) );
- return Sequence< ::rtl::OUString >( &sName, 1 );
-}
-
-// ::cppu::OPropertySetHelper
-::cppu::IPropertyArrayHelper& UnoControlModel::getInfoHelper()
-{
- OSL_FAIL( "UnoControlModel::getInfoHelper() not possible!" );
- return *(::cppu::IPropertyArrayHelper*) NULL;
-}
-
-// ------------------------------------------------------------------
-template <class TYPE>
-sal_Bool convertType(Any& _rConvertedValue, const Any& _rNewValueTest, const TYPE* /* _pTypeDisambiguation */)
-{
- TYPE tValue;
- if (_rNewValueTest >>= tValue)
- {
- _rConvertedValue <<= tValue;
- return sal_True;
- }
-}
-
-// ..................................................................
-sal_Bool UnoControlModel::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nPropId, const Any& rValue ) throw (IllegalArgumentException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_Bool bVoid = rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
- if ( bVoid )
- {
- rConvertedValue.clear();
- }
- else
- {
- const ::com::sun::star::uno::Type* pDestType = GetPropertyType( (sal_uInt16)nPropId );
- if ( pDestType->getTypeClass() == TypeClass_ANY )
- {
- rConvertedValue = rValue;
- }
- else
- {
- if ( pDestType->equals( rValue.getValueType() ) )
- {
- rConvertedValue = rValue;
- }
- else
- {
- sal_Bool bConverted = sal_False;
- // 13.03.2001 - 84923 - frank.schoenheit@germany.sun.com
-
- switch (pDestType->getTypeClass())
- {
- case TypeClass_DOUBLE:
- {
- // try as double
- double nAsDouble = 0;
- bConverted = ( rValue >>= nAsDouble );
- if ( bConverted )
- rConvertedValue <<= nAsDouble;
- else
- { // try as integer
- sal_Int32 nAsInteger = 0;
- bConverted = ( rValue >>= nAsInteger );
- if ( bConverted )
- rConvertedValue <<= (double)nAsInteger;
- }
- }
- break;
- case TypeClass_SHORT:
- {
- sal_Int16 n;
- bConverted = ( rValue >>= n );
- if ( bConverted )
- rConvertedValue <<= n;
- }
- break;
- case TypeClass_UNSIGNED_SHORT:
- {
- sal_uInt16 n;
- bConverted = ( rValue >>= n );
- if ( bConverted )
- rConvertedValue <<= n;
- }
- break;
- case TypeClass_LONG:
- {
- sal_Int32 n;
- bConverted = ( rValue >>= n );
- if ( bConverted )
- rConvertedValue <<= n;
- }
- break;
- case TypeClass_UNSIGNED_LONG:
- {
- sal_uInt32 n;
- bConverted = ( rValue >>= n );
- if ( bConverted )
- rConvertedValue <<= n;
- }
- break;
- case TypeClass_INTERFACE:
- {
- if ( rValue.getValueType().getTypeClass() == TypeClass_INTERFACE )
- {
- Reference< XInterface > xPure( rValue, UNO_QUERY );
- if ( xPure.is() )
- rConvertedValue = xPure->queryInterface( *pDestType );
- else
- rConvertedValue.setValue( NULL, *pDestType );
- bConverted = sal_True;
- }
- }
- break;
- case TypeClass_ENUM:
- {
- sal_Int32 nValue = 0;
- bConverted = ( rValue >>= nValue );
- if ( bConverted )
- rConvertedValue = ::cppu::int2enum( nValue, *pDestType );
- }
- break;
- default: ; // avoid compiler warning
- }
-
- if (!bConverted)
- {
- ::rtl::OUStringBuffer aErrorMessage;
- aErrorMessage.appendAscii( "Unable to convert the given value for the property " );
- aErrorMessage.append ( GetPropertyName( (sal_uInt16)nPropId ) );
- aErrorMessage.appendAscii( ".\n" );
- aErrorMessage.appendAscii( "Expected type: " );
- aErrorMessage.append ( pDestType->getTypeName() );
- aErrorMessage.appendAscii( "\n" );
- aErrorMessage.appendAscii( "Found type: " );
- aErrorMessage.append ( rValue.getValueType().getTypeName() );
- throw ::com::sun::star::lang::IllegalArgumentException(
- aErrorMessage.makeStringAndClear(),
- static_cast< ::com::sun::star::beans::XPropertySet* >(this),
- 1);
- }
- }
- }
- }
-
- // the current value
- getFastPropertyValue( rOldValue, nPropId );
- return !CompareProperties( rConvertedValue, rOldValue );
-}
-
-void UnoControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
-{
- // Fehlt: Die gefakten Einzelproperties des FontDescriptors...
-
- ImplControlProperty* pProp = mpData->Get( nPropId );
- ENSURE_OR_RETURN_VOID( pProp, "UnoControlModel::setFastPropertyValue_NoBroadcast: invalid property id!" );
-
- DBG_ASSERT( ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID ) || ( GetPropertyAttribs( (sal_uInt16)nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" );
- pProp->SetValue( rValue );
-}
-
-void UnoControlModel::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nPropId ) const
-{
- ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlModel*)this)->GetMutex() );
-
- ImplControlProperty* pProp = mpData->Get( nPropId );
-
- if ( pProp )
- rValue = pProp->GetValue();
- else if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
- {
- pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
- ::com::sun::star::awt::FontDescriptor aFD;
- pProp->GetValue() >>= aFD;
- switch ( nPropId )
- {
- case BASEPROPERTY_FONTDESCRIPTORPART_NAME: rValue <<= aFD.Name;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: rValue <<= aFD.StyleName;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: rValue <<= aFD.Family;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: rValue <<= aFD.CharSet;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: rValue <<= (float)aFD.Height;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue <<= aFD.Weight;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: rValue <<= (sal_Int16)aFD.Slant;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue <<= aFD.Underline;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: rValue <<= aFD.Strikeout;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: rValue <<= aFD.Width;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: rValue <<= aFD.Pitch;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: rValue <<= aFD.CharacterWidth;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: rValue <<= aFD.Orientation;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: rValue <<= aFD.Kerning;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: rValue <<= aFD.WordLineMode;
- break;
- case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: rValue <<= aFD.Type;
- break;
- default: OSL_FAIL( "FontProperty?!" );
- }
- }
- else
- {
- OSL_FAIL( "getFastPropertyValue - invalid Property!" );
- }
-}
-
-// ::com::sun::star::beans::XPropertySet
-void UnoControlModel::setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-{
- sal_Int32 nPropId = 0;
- {
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- nPropId = (sal_Int32) GetPropertyId( rPropertyName );
- DBG_ASSERT( nPropId, "Invalid ID in UnoControlModel::setPropertyValue" );
- }
- if( nPropId )
- setFastPropertyValue( nPropId, rValue );
- else
- throw ::com::sun::star::beans::UnknownPropertyException();
-}
-
-// ::com::sun::star::beans::XFastPropertySet
-void UnoControlModel::setFastPropertyValue( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-{
- if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
- {
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
-
- Any aOldSingleValue;
- getFastPropertyValue( aOldSingleValue, BASEPROPERTY_FONTDESCRIPTORPART_START );
-
- ImplControlProperty* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
- FontDescriptor aOldFontDescriptor;
- pProp->GetValue() >>= aOldFontDescriptor;
-
- FontDescriptor aNewFontDescriptor( aOldFontDescriptor );
- lcl_ImplMergeFontProperty( aNewFontDescriptor, (sal_uInt16)nPropId, rValue );
-
- Any aNewValue;
- aNewValue <<= aNewFontDescriptor;
- sal_Int32 nDescriptorId( BASEPROPERTY_FONTDESCRIPTOR );
- nDescriptorId = BASEPROPERTY_FONTDESCRIPTOR;
-
- // also, we need fire a propertyChange event for the single property, since with
- // the above line, only an event for the FontDescriptor property will be fired
- Any aNewSingleValue;
- getFastPropertyValue( aNewSingleValue, BASEPROPERTY_FONTDESCRIPTORPART_START );
-
- aGuard.clear();
- setFastPropertyValues( 1, &nDescriptorId, &aNewValue, 1 );
- fire( &nPropId, &aNewSingleValue, &aOldSingleValue, 1, sal_False );
- }
- else
- setFastPropertyValues( 1, &nPropId, &rValue, 1 );
-}
-
-// ::com::sun::star::beans::XMultiPropertySet
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- OSL_FAIL( "UnoControlModel::getPropertySetInfo() not possible!" );
- return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >();
-}
-
-void UnoControlModel::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
-
- sal_Int32 nProps = rPropertyNames.getLength();
-
-// sal_Int32* pHandles = new sal_Int32[nProps];
- // don't do this - it leaks in case of an exception
- Sequence< sal_Int32 > aHandles( nProps );
- sal_Int32* pHandles = aHandles.getArray();
-
- // may need to change the order in the sequence, for this we need a non-const value sequence
- uno::Sequence< uno::Any > aValues( Values );
- uno::Any* pValues = aValues.getArray();
-
- sal_Int32 nValidHandles = getInfoHelper().fillHandles( pHandles, rPropertyNames );
-
- if ( nValidHandles )
- {
- // if somebody sets properties which are single aspects of a font descriptor,
- // remove them, and build a font descriptor instead
- ::std::auto_ptr< awt::FontDescriptor > pFD;
- for ( sal_uInt16 n = 0; n < nProps; ++n )
- {
- if ( ( pHandles[n] >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( pHandles[n] <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
- {
- if ( !pFD.get() )
- {
- ImplControlProperty* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
- pFD.reset( new awt::FontDescriptor );
- pProp->GetValue() >>= *pFD;
- }
- lcl_ImplMergeFontProperty( *pFD, (sal_uInt16)pHandles[n], pValues[n] );
- pHandles[n] = -1;
- nValidHandles--;
- }
- }
-
- if ( nValidHandles )
- {
- ImplNormalizePropertySequence( nProps, pHandles, pValues, &nValidHandles );
- aGuard.clear();
- // clear our guard before calling into setFastPropertyValues - this method
- // will implicitly call property listeners, and this should not happen with
- // our mutex locked
- // #i23451#
- setFastPropertyValues( nProps, pHandles, pValues, nValidHandles );
- }
- else
- aGuard.clear();
- // same as a few lines above
-
- // FD-Propertie nicht in das Array mergen, weil sortiert...
- if ( pFD.get() )
- {
- ::com::sun::star::uno::Any aValue;
- aValue <<= *pFD;
- sal_Int32 nHandle = BASEPROPERTY_FONTDESCRIPTOR;
- setFastPropertyValues( 1, &nHandle, &aValue, 1 );
- }
- }
-}
-
-
-
-void UnoControlModel::ImplNormalizePropertySequence( const sal_Int32, sal_Int32*,
- uno::Any*, sal_Int32* ) const SAL_THROW(())
-{
- // nothing to do here
-}
-
-void UnoControlModel::ImplEnsureHandleOrder( const sal_Int32 _nCount, sal_Int32* _pHandles,
- uno::Any* _pValues, sal_Int32 _nFirstHandle, sal_Int32 _nSecondHandle ) const
-{
- for ( sal_Int32 i=0; i < _nCount; ++_pHandles, ++_pValues, ++i )
- {
- if ( _nSecondHandle == *_pHandles )
- {
- sal_Int32* pLaterHandles = _pHandles + 1;
- uno::Any* pLaterValues = _pValues + 1;
- for ( sal_Int32 j = i + 1; j < _nCount; ++j, ++pLaterHandles, ++pLaterValues )
- {
- if ( _nFirstHandle == *pLaterHandles )
- {
- // indeed it is -> exchange the both places in the sequences
- sal_Int32 nHandle( *_pHandles );
- *_pHandles = *pLaterHandles;
- *pLaterHandles = nHandle;
-
- uno::Any aValue( *_pValues );
- *_pValues = *pLaterValues;
- *pLaterValues = aValue;
-
- break;
- // this will leave the inner loop, and continue with the outer loop.
- // Note that this means we will encounter the _nSecondHandle handle, again, once we reached
- // (in the outer loop) the place where we just put it.
- }
- }
- }
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
deleted file mode 100644
index 3fb2d1841c..0000000000
--- a/toolkit/source/controls/unocontrols.cxx
+++ /dev/null
@@ -1,4397 +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/XTextArea.hpp>
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <com/sun/star/awt/VisualEffect.hpp>
-#include <com/sun/star/awt/LineEndFormat.hpp>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <com/sun/star/graphic/GraphicObject.hpp>
-#include <com/sun/star/util/Date.hpp>
-#include <com/sun/star/awt/ImageScaleMode.hpp>
-
-
-#include <toolkit/controls/formattedcontrol.hxx>
-#include <toolkit/controls/roadmapcontrol.hxx>
-#include <toolkit/controls/unocontrols.hxx>
-#include <toolkit/controls/stdtabcontroller.hxx>
-#include <toolkit/helper/property.hxx>
-#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/helper/unomemorystream.hxx>
-#include <toolkit/helper/servicenames.hxx>
-#include <toolkit/helper/macros.hxx>
-#include <toolkit/helper/imagealign.hxx>
-
-// for introspection
-#include <toolkit/awt/vclxwindows.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/componentcontext.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/extract.hxx>
-#include <vcl/wrkwin.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/button.hxx>
-#include <vcl/group.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/combobox.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <tools/date.hxx>
-#include <tools/time.hxx>
-
-#include <algorithm>
-#include <functional>
-
-using namespace ::com::sun::star;
-using ::com::sun::star::graphic::XGraphic;
-using ::com::sun::star::uno::Reference;
-using namespace ::toolkit;
-
-#define IMPL_SERVICEINFO_DERIVED( ImplName, BaseClass, ServiceName ) \
- ::rtl::OUString SAL_CALL ImplName::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "stardiv.Toolkit." #ImplName )); } \
- ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ImplName::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \
- { \
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames = BaseClass::getSupportedServiceNames( ); \
- aNames.realloc( aNames.getLength() + 1 ); \
- aNames[ aNames.getLength() - 1 ] = ::rtl::OUString::createFromAscii( ServiceName ); \
- return aNames; \
- } \
-
-
-
-// ----------------------------------------------------
-// class UnoControlEditModel
-// ----------------------------------------------------
-UnoControlEditModel::UnoControlEditModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXEdit );
-}
-
-::rtl::OUString UnoControlEditModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlEditModel );
-}
-
-uno::Any UnoControlEditModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- uno::Any aReturn;
-
- switch ( nPropId )
- {
- case BASEPROPERTY_LINE_END_FORMAT:
- aReturn <<= (sal_Int16)awt::LineEndFormat::LINE_FEED; // LF
- break;
- case BASEPROPERTY_DEFAULTCONTROL:
- aReturn <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlEdit );
- break;
- default:
- aReturn = UnoControlModel::ImplGetDefaultValue( nPropId );
- break;
- }
- return aReturn;
-}
-
-::cppu::IPropertyArrayHelper& UnoControlEditModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlEditModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-// ----------------------------------------------------
-// class UnoEditControl
-// ----------------------------------------------------
-UnoEditControl::UnoEditControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlBase( i_factory )
- ,maTextListeners( *this )
- ,mnMaxTextLen( 0 )
- ,mbSetTextInPeer( sal_False )
- ,mbSetMaxTextLenInPeer( sal_False )
- ,mbHasTextProperty( sal_False )
-{
- maComponentInfos.nWidth = 100;
- maComponentInfos.nHeight = 12;
- mnMaxTextLen = 0;
- mbSetMaxTextLenInPeer = sal_False;
-}
-
-uno::Any SAL_CALL UnoEditControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aReturn = UnoControlBase::queryAggregation( rType );
- if ( !aReturn.hasValue() )
- aReturn = UnoEditControl_Base::queryInterface( rType );
- return aReturn;
-}
-
-uno::Any SAL_CALL UnoEditControl::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- return UnoControlBase::queryInterface( rType );
-}
-
-void SAL_CALL UnoEditControl::acquire( ) throw ()
-{
- UnoControlBase::acquire();
-}
-
-void SAL_CALL UnoEditControl::release( ) throw ()
-{
- UnoControlBase::release();
-}
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoEditControl, UnoControlBase, UnoEditControl_Base )
-
-::rtl::OUString UnoEditControl::GetComponentServiceName()
-{
- // by default, we want a simple edit field
- ::rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Edit") );
-
- // but maybe we are to display multi-line text?
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_MULTILINE ) );
- sal_Bool b = sal_Bool();
- if ( ( aVal >>= b ) && b )
- sName= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MultiLineEdit"));
-
- return sName;
-}
-
-sal_Bool SAL_CALL UnoEditControl::setModel(const uno::Reference< awt::XControlModel >& _rModel) throw ( uno::RuntimeException )
-{
- sal_Bool bReturn = UnoControlBase::setModel( _rModel );
- mbHasTextProperty = ImplHasProperty( BASEPROPERTY_TEXT );
- return bReturn;
-}
-
-void UnoEditControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
-{
- sal_Bool bDone = sal_False;
- if ( GetPropertyId( rPropName ) == BASEPROPERTY_TEXT )
- {
- // #96986# use setText(), or text listener will not be called.
- uno::Reference < awt::XTextComponent > xTextComponent( getPeer(), uno::UNO_QUERY );
- if ( xTextComponent.is() )
- {
- ::rtl::OUString sText;
- rVal >>= sText;
- ImplCheckLocalize( sText );
- xTextComponent->setText( sText );
- bDone = sal_True;
- }
- }
-
- if ( !bDone )
- UnoControlBase::ImplSetPeerProperty( rPropName, rVal );
-}
-
-void UnoEditControl::dispose() throw(uno::RuntimeException)
-{
- lang::EventObject aEvt( *this );
- maTextListeners.disposeAndClear( aEvt );
- UnoControl::dispose();
-}
-
-void UnoEditControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoControl::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
- if ( xText.is() )
- {
- xText->addTextListener( this );
-
- if ( mbSetMaxTextLenInPeer )
- xText->setMaxTextLen( mnMaxTextLen );
- if ( mbSetTextInPeer )
- xText->setText( maText );
- }
-}
-
-void UnoEditControl::textChanged(const awt::TextEvent& e) throw(uno::RuntimeException)
-{
- uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
-
- if ( mbHasTextProperty )
- {
- uno::Any aAny;
- aAny <<= xText->getText();
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_False );
- }
- else
- {
- maText = xText->getText();
- }
-
- if ( maTextListeners.getLength() )
- maTextListeners.textChanged( e );
-}
-
-void UnoEditControl::addTextListener(const uno::Reference< awt::XTextListener > & l) throw(uno::RuntimeException)
-{
- maTextListeners.addInterface( l );
-}
-
-void UnoEditControl::removeTextListener(const uno::Reference< awt::XTextListener > & l) throw(uno::RuntimeException)
-{
- maTextListeners.removeInterface( l );
-}
-
-void UnoEditControl::setText( const ::rtl::OUString& aText ) throw(uno::RuntimeException)
-{
- if ( mbHasTextProperty )
- {
- uno::Any aAny;
- aAny <<= aText;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_True );
- }
- else
- {
- maText = aText;
- mbSetTextInPeer = sal_True;
- uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
- if ( xText.is() )
- xText->setText( maText );
- }
-
- // Setting the property to the VCLXWindow doesn't call textChanged
- if ( maTextListeners.getLength() )
- {
- awt::TextEvent aEvent;
- aEvent.Source = *this;
- maTextListeners.textChanged( aEvent );
- }
-}
-
-namespace
-{
- static void lcl_normalize( awt::Selection& _rSel )
- {
- if ( _rSel.Min > _rSel.Max )
- ::std::swap( _rSel.Min, _rSel.Max );
- }
-
-/*
- static bool lcl_intersect( const awt::Selection& _rLHS, const awt::Selection& _rRHS )
- {
- OSL_PRECOND( _rLHS.Min <= _rLHS.Max, "lcl_intersect: LHS to be normalized!" );
- OSL_PRECOND( _rRHS.Min <= _rRHS.Max, "lcl_intersect: RHS to be normalized!" );
- return !( ( _rLHS.Max < _rRHS.Min ) || ( _rLHS.Min > _rRHS.Max ) );
- }
-*/
-}
-
-void UnoEditControl::insertText( const awt::Selection& rSel, const ::rtl::OUString& rNewText ) throw(uno::RuntimeException)
-{
- // normalize the selection - OUString::replaceAt has a strange behaviour if the min is greater than the max
- awt::Selection aSelection( rSel );
- lcl_normalize( aSelection );
-
- // preserve the selection resp. cursor position
- awt::Selection aNewSelection( getSelection() );
-#ifdef ALSO_PRESERVE_COMPLETE_SELECTION
- // (not sure - looks uglier ...)
- sal_Int32 nDeletedCharacters = ( aSelection.Max - aSelection.Min ) - rNewText.getLength();
- if ( aNewSelection.Min > aSelection.Min )
- aNewSelection.Min -= nDeletedCharacters;
- if ( aNewSelection.Max > aSelection.Max )
- aNewSelection.Max -= nDeletedCharacters;
-#else
- aNewSelection.Max = ::std::min( aNewSelection.Min, aNewSelection.Max ) + rNewText.getLength();
- aNewSelection.Min = aNewSelection.Max;
-#endif
-
- ::rtl::OUString aOldText = getText();
- ::rtl::OUString aNewText = aOldText.replaceAt( aSelection.Min, aSelection.Max - aSelection.Min, rNewText );
- setText( aNewText );
-
- setSelection( aNewSelection );
-}
-
-::rtl::OUString UnoEditControl::getText() throw(uno::RuntimeException)
-{
- ::rtl::OUString aText = maText;
-
- if ( mbHasTextProperty )
- aText = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT );
- else
- {
- uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
- if ( xText.is() )
- aText = xText->getText();
- }
-
- return aText;
-}
-
-::rtl::OUString UnoEditControl::getSelectedText( void ) throw(uno::RuntimeException)
-{
- ::rtl::OUString sSelected;
- uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
- if ( xText.is() )
- sSelected = xText->getSelectedText();
-
- return sSelected;
-}
-
-void UnoEditControl::setSelection( const awt::Selection& aSelection ) throw(uno::RuntimeException)
-{
- uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
- if ( xText.is() )
- xText->setSelection( aSelection );
-}
-
-awt::Selection UnoEditControl::getSelection( void ) throw(uno::RuntimeException)
-{
- awt::Selection aSel;
- uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
- if ( xText.is() )
- aSel = xText->getSelection();
- return aSel;
-}
-
-sal_Bool UnoEditControl::isEditable( void ) throw(uno::RuntimeException)
-{
- return !ImplGetPropertyValue_BOOL( BASEPROPERTY_READONLY );
-}
-
-void UnoEditControl::setEditable( sal_Bool bEditable ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= (sal_Bool)!bEditable;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_READONLY ), aAny, sal_True );
-}
-
-sal_Int16 UnoEditControl::getMaxTextLen() throw(uno::RuntimeException)
-{
- sal_Int16 nMaxLen = mnMaxTextLen;
-
- if ( ImplHasProperty( BASEPROPERTY_MAXTEXTLEN ) )
- nMaxLen = ImplGetPropertyValue_INT16( BASEPROPERTY_MAXTEXTLEN );
-
- return nMaxLen;
-}
-
-void UnoEditControl::setMaxTextLen( sal_Int16 nLen ) throw(uno::RuntimeException)
-{
- if ( ImplHasProperty( BASEPROPERTY_MAXTEXTLEN) )
- {
- uno::Any aAny;
- aAny <<= (sal_Int16)nLen;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MAXTEXTLEN ), aAny, sal_True );
- }
- else
- {
- mnMaxTextLen = nLen;
- mbSetMaxTextLenInPeer = sal_True;
- uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
- if ( xText.is() )
- xText->setMaxTextLen( mnMaxTextLen );
- }
-}
-
-awt::Size UnoEditControl::getMinimumSize( ) throw(uno::RuntimeException)
-{
- return Impl_getMinimumSize();
-}
-
-awt::Size UnoEditControl::getPreferredSize( ) throw(uno::RuntimeException)
-{
- return Impl_getPreferredSize();
-}
-
-awt::Size UnoEditControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
-{
- return Impl_calcAdjustedSize( rNewSize );
-}
-
-awt::Size UnoEditControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(uno::RuntimeException)
-{
- return Impl_getMinimumSize( nCols, nLines );
-}
-
-void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(uno::RuntimeException)
-{
- Impl_getColumnsAndLines( nCols, nLines );
-}
-
-
-// ----------------------------------------------------
-// class UnoControlFileControlModel
-// ----------------------------------------------------
-UnoControlFileControlModel::UnoControlFileControlModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_ALIGN );
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_READONLY );
- ImplRegisterProperty( BASEPROPERTY_TABSTOP );
- ImplRegisterProperty( BASEPROPERTY_TEXT );
- ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
- ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
- ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
- ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
-}
-
-::rtl::OUString UnoControlFileControlModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControlModel );
-}
-
-uno::Any UnoControlFileControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControl );
- return aAny;
- }
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlFileControlModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlFileControlModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ----------------------------------------------------
-// class UnoFileControl
-// ----------------------------------------------------
-UnoFileControl::UnoFileControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoEditControl( i_factory )
-{
-}
-
-::rtl::OUString UnoFileControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("filecontrol"));
-}
-
-// ----------------------------------------------------
-// class GraphicControlModel
-// ----------------------------------------------------
-uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_GRAPHIC )
- return uno::makeAny( uno::Reference< graphic::XGraphic >() );
-
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
- uno::Reference< graphic::XGraphic > GraphicControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
-
- if( ( _rURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) )
- {
- // graphic manager uniqueid
- rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
- // get the DefaultContext
- mxGrfObj = graphic::GraphicObject::createWithId( maContext.getUNOContext(), sID );
- }
- else // linked
- mxGrfObj = NULL; // release the GraphicObject
-
- if ( !_rURL.getLength() )
- return xGraphic;
-
- try
- {
- uno::Reference< graphic::XGraphicProvider > xProvider;
- if ( maContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
- {
- uno::Sequence< beans::PropertyValue > aMediaProperties(1);
- aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- aMediaProperties[0].Value <<= _rURL;
- xGraphic = xProvider->queryGraphic( aMediaProperties );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return xGraphic;
- }
-
-void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
-{
- UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-
- // - ImageAlign and ImagePosition need to correspond to each other
- // - Graphic and ImageURL need to correspond to each other
- try
- {
- switch ( nHandle )
- {
- case BASEPROPERTY_IMAGEURL:
- if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
- {
- mbAdjustingGraphic = true;
- ::rtl::OUString sImageURL;
- OSL_VERIFY( rValue >>= sImageURL );
- setDependentFastPropertyValue( BASEPROPERTY_GRAPHIC, uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
- mbAdjustingGraphic = false;
- }
- break;
-
- case BASEPROPERTY_GRAPHIC:
- if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
- {
- mbAdjustingGraphic = true;
- setDependentFastPropertyValue( BASEPROPERTY_IMAGEURL, uno::makeAny( ::rtl::OUString() ) );
- mbAdjustingGraphic = false;
- }
- break;
-
- case BASEPROPERTY_IMAGEALIGN:
- if ( !mbAdjustingImagePosition && ImplHasProperty( BASEPROPERTY_IMAGEPOSITION ) )
- {
- mbAdjustingImagePosition = true;
- sal_Int16 nUNOValue = 0;
- OSL_VERIFY( rValue >>= nUNOValue );
- setDependentFastPropertyValue( BASEPROPERTY_IMAGEPOSITION, uno::makeAny( getExtendedImagePosition( nUNOValue ) ) );
- mbAdjustingImagePosition = false;
- }
- break;
- case BASEPROPERTY_IMAGEPOSITION:
- if ( !mbAdjustingImagePosition && ImplHasProperty( BASEPROPERTY_IMAGEALIGN ) )
- {
- mbAdjustingImagePosition = true;
- sal_Int16 nUNOValue = 0;
- OSL_VERIFY( rValue >>= nUNOValue );
- setDependentFastPropertyValue( BASEPROPERTY_IMAGEALIGN, uno::makeAny( getCompatibleImageAlign( translateImagePosition( nUNOValue ) ) ) );
- mbAdjustingImagePosition = false;
- }
- break;
- }
- }
- catch( const ::com::sun::star::uno::Exception& )
- {
- OSL_FAIL( "GraphicControlModel::setFastPropertyValue_NoBroadcast: caught an exception while aligning the ImagePosition/ImageAlign properties!" );
- mbAdjustingImagePosition = sal_False;
- }
-}
-
-// ----------------------------------------------------
-// class UnoControlButtonModel
-// ----------------------------------------------------
-UnoControlButtonModel::UnoControlButtonModel( const Reference< XMultiServiceFactory >& i_factory )
- :GraphicControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXButton );
-
- osl_incrementInterlockedCount( &m_refCount );
- {
- setFastPropertyValue_NoBroadcast( BASEPROPERTY_IMAGEPOSITION, ImplGetDefaultValue( BASEPROPERTY_IMAGEPOSITION ) );
- // this ensures that our ImagePosition is consistent with our ImageAlign property (since both
- // defaults are not per se consistent), since both are coupled in setFastPropertyValue_NoBroadcast
- }
- osl_decrementInterlockedCount( &m_refCount );
-}
-
-::rtl::OUString UnoControlButtonModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlButtonModel );
-}
-
-uno::Any UnoControlButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- switch ( nPropId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlButton ) );
- case BASEPROPERTY_TOGGLE:
- return uno::makeAny( (sal_Bool)sal_False );
- case BASEPROPERTY_ALIGN:
- return uno::makeAny( (sal_Int16)PROPERTY_ALIGN_CENTER );
- case BASEPROPERTY_FOCUSONCLICK:
- return uno::makeAny( (sal_Bool)sal_True );
- }
-
- return GraphicControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlButtonModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlButtonModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ----------------------------------------------------
-// class UnoButtonControl
-// ----------------------------------------------------
-UnoButtonControl::UnoButtonControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
- :UnoButtonControl_Base( i_factory )
- ,maActionListeners( *this )
- ,maItemListeners( *this )
-{
- maComponentInfos.nWidth = 50;
- maComponentInfos.nHeight = 14;
-}
-
-::rtl::OUString UnoButtonControl::GetComponentServiceName()
-{
- ::rtl::OUString aName( RTL_CONSTASCII_USTRINGPARAM("pushbutton") );
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_PUSHBUTTONTYPE ) );
- sal_Int16 n = sal_Int16();
- if ( ( aVal >>= n ) && n )
- {
- // Use PushButtonType later when available...
- switch ( n )
- {
- case 1 /*PushButtonType::OK*/: aName= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("okbutton"));
- break;
- case 2 /*PushButtonType::CANCEL*/: aName= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cancelbutton"));
- break;
- case 3 /*PushButtonType::HELP*/: aName= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("helpbutton"));
- break;
- default:
- {
- OSL_FAIL( "Unknown Button Type!" );
- }
- }
- }
- return aName;
-}
-
-void UnoButtonControl::dispose() throw(uno::RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- maActionListeners.disposeAndClear( aEvt );
- maItemListeners.disposeAndClear( aEvt );
- UnoControlBase::dispose();
-}
-
-void UnoButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoControlBase::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->setActionCommand( maActionCommand );
- if ( maActionListeners.getLength() )
- xButton->addActionListener( &maActionListeners );
-
- uno::Reference< XToggleButton > xPushButton( getPeer(), uno::UNO_QUERY );
- if ( xPushButton.is() )
- xPushButton->addItemListener( this );
-}
-
-void UnoButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- maActionListeners.addInterface( l );
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->addActionListener( &maActionListeners );
- }
-}
-
-void UnoButtonControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->removeActionListener( &maActionListeners );
- }
- maActionListeners.removeInterface( l );
-}
-
-void UnoButtonControl::addItemListener(const uno::Reference< awt::XItemListener > & l) throw(uno::RuntimeException)
-{
- maItemListeners.addInterface( l );
-}
-
-void UnoButtonControl::removeItemListener(const uno::Reference< awt::XItemListener > & l) throw(uno::RuntimeException)
-{
- maItemListeners.removeInterface( l );
-}
-
-void SAL_CALL UnoButtonControl::disposing( const lang::EventObject& Source ) throw (uno::RuntimeException)
-{
- UnoControlBase::disposing( Source );
-}
-
-void SAL_CALL UnoButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw (uno::RuntimeException)
-{
- // forward to model
- uno::Any aAny;
- aAny <<= (sal_Int16)rEvent.Selected;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
-
- // multiplex
- ItemEvent aEvent( rEvent );
- aEvent.Source = *this;
- maItemListeners.itemStateChanged( aEvent );
-}
-
-void UnoButtonControl::setLabel( const ::rtl::OUString& rLabel ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= rLabel;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
-}
-
-void UnoButtonControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
-{
- maActionCommand = rCommand;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->setActionCommand( rCommand );
- }
-}
-
-awt::Size UnoButtonControl::getMinimumSize( ) throw(uno::RuntimeException)
-{
- return Impl_getMinimumSize();
-}
-
-awt::Size UnoButtonControl::getPreferredSize( ) throw(uno::RuntimeException)
-{
- return Impl_getPreferredSize();
-}
-
-awt::Size UnoButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
-{
- return Impl_calcAdjustedSize( rNewSize );
-}
-
-// ----------------------------------------------------
-// class UnoControlImageControlModel
-// ----------------------------------------------------
-UnoControlImageControlModel::UnoControlImageControlModel( const Reference< XMultiServiceFactory >& i_factory )
- :GraphicControlModel( i_factory )
- ,mbAdjustingImageScaleMode( false )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXImageControl );
-}
-
-::rtl::OUString UnoControlImageControlModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControlModel );
-}
-
-uno::Any UnoControlImageControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControl ) );
-
- if ( nPropId == BASEPROPERTY_IMAGE_SCALE_MODE )
- return makeAny( awt::ImageScaleMode::Anisotropic );
-
- return GraphicControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlImageControlModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlImageControlModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-void SAL_CALL UnoControlImageControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::Exception)
-{
- GraphicControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
-
- // ScaleImage is an older (and less powerful) version of ScaleMode, but keep both in sync as far as possible
- try
- {
- switch ( _nHandle )
- {
- case BASEPROPERTY_IMAGE_SCALE_MODE:
- if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_SCALEIMAGE ) )
- {
- mbAdjustingImageScaleMode = true;
- sal_Int16 nScaleMode( awt::ImageScaleMode::Anisotropic );
- OSL_VERIFY( _rValue >>= nScaleMode );
- setDependentFastPropertyValue( BASEPROPERTY_SCALEIMAGE, uno::makeAny( sal_Bool( nScaleMode != awt::ImageScaleMode::None ) ) );
- mbAdjustingImageScaleMode = false;
- }
- break;
- case BASEPROPERTY_SCALEIMAGE:
- if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_IMAGE_SCALE_MODE ) )
- {
- mbAdjustingImageScaleMode = true;
- sal_Bool bScale = sal_True;
- OSL_VERIFY( _rValue >>= bScale );
- setDependentFastPropertyValue( BASEPROPERTY_IMAGE_SCALE_MODE, uno::makeAny( bScale ? awt::ImageScaleMode::Anisotropic : awt::ImageScaleMode::None ) );
- mbAdjustingImageScaleMode = false;
- }
- break;
- }
- }
- catch( const Exception& )
- {
- mbAdjustingImageScaleMode = false;
- throw;
- }
-}
-
-// ----------------------------------------------------
-// class UnoImageControlControl
-// ----------------------------------------------------
-UnoImageControlControl::UnoImageControlControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoImageControlControl_Base( i_factory )
- ,maActionListeners( *this )
-{
- // Woher die Defaults nehmen?
- maComponentInfos.nWidth = 100;
- maComponentInfos.nHeight = 100;
-}
-
-::rtl::OUString UnoImageControlControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fixedimage"));
-}
-
-void UnoImageControlControl::dispose() throw(uno::RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- maActionListeners.disposeAndClear( aEvt );
- UnoControl::dispose();
-}
-
-sal_Bool UnoImageControlControl::isTransparent() throw(uno::RuntimeException)
-{
- return sal_True;
-}
-
-awt::Size UnoImageControlControl::getMinimumSize( ) throw(uno::RuntimeException)
-{
- return Impl_getMinimumSize();
-}
-
-awt::Size UnoImageControlControl::getPreferredSize( ) throw(uno::RuntimeException)
-{
- return Impl_getPreferredSize();
-}
-
-awt::Size UnoImageControlControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
-{
- return Impl_calcAdjustedSize( rNewSize );
-}
-
-// ----------------------------------------------------
-// class UnoControlRadioButtonModel
-// ----------------------------------------------------
-UnoControlRadioButtonModel::UnoControlRadioButtonModel( const Reference< XMultiServiceFactory >& i_factory )
- :GraphicControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXRadioButton );
-}
-
-::rtl::OUString UnoControlRadioButtonModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButtonModel );
-}
-
-uno::Any UnoControlRadioButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- switch ( nPropId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButton ) );
-
- case BASEPROPERTY_VISUALEFFECT:
- return uno::makeAny( (sal_Int16)awt::VisualEffect::LOOK3D );
- }
-
- return GraphicControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlRadioButtonModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlRadioButtonModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-
-// ----------------------------------------------------
-// class UnoRadioButtonControl
-// ----------------------------------------------------
-UnoRadioButtonControl::UnoRadioButtonControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoRadioButtonControl_Base( i_factory )
- ,maItemListeners( *this )
- ,maActionListeners( *this )
-{
- maComponentInfos.nWidth = 100;
- maComponentInfos.nHeight = 12;
-}
-
-::rtl::OUString UnoRadioButtonControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("radiobutton"));
-}
-
-void UnoRadioButtonControl::dispose() throw(uno::RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- maItemListeners.disposeAndClear( aEvt );
- UnoControlBase::dispose();
-}
-
-
-sal_Bool UnoRadioButtonControl::isTransparent() throw(uno::RuntimeException)
-{
- return sal_True;
-}
-
-void UnoRadioButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoControlBase::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XRadioButton > xRadioButton( getPeer(), uno::UNO_QUERY );
- xRadioButton->addItemListener( this );
-
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->setActionCommand( maActionCommand );
- if ( maActionListeners.getLength() )
- xButton->addActionListener( &maActionListeners );
-
- // as default, set the "AutoToggle" to true
- // (it is set to false in VCLXToolkit::ImplCreateWindow because of #87254#, but we want to
- // have it enabled by default because of 85071)
- uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( getPeer(), uno::UNO_QUERY );
- if ( xVclWindowPeer.is() )
- xVclWindowPeer->setProperty( GetPropertyName( BASEPROPERTY_AUTOTOGGLE ), ::cppu::bool2any( sal_True ) );
-}
-
-void UnoRadioButtonControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
-{
- maItemListeners.addInterface( l );
-}
-
-void UnoRadioButtonControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
-{
- maItemListeners.removeInterface( l );
-}
-
-void UnoRadioButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- maActionListeners.addInterface( l );
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->addActionListener( &maActionListeners );
- }
-}
-
-void UnoRadioButtonControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->removeActionListener( &maActionListeners );
- }
- maActionListeners.removeInterface( l );
-}
-
-void UnoRadioButtonControl::setLabel( const ::rtl::OUString& rLabel ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= rLabel;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
-}
-
-void UnoRadioButtonControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
-{
- maActionCommand = rCommand;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->setActionCommand( rCommand );
- }
-}
-
-void UnoRadioButtonControl::setState( sal_Bool bOn ) throw(uno::RuntimeException)
-{
- sal_Int16 nState = bOn ? 1 : 0;
- uno::Any aAny;
- aAny <<= nState;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_True );
-}
-
-sal_Bool UnoRadioButtonControl::getState() throw(uno::RuntimeException)
-{
- sal_Int16 nState = 0;
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) );
- aVal >>= nState;
- return nState ? sal_True : sal_False;
-}
-
-void UnoRadioButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= (sal_Int16)rEvent.Selected;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
-
- // compatibility:
- // in OOo 1.0.x, when the user clicked a radio button in a group of buttons, this resulted
- // in _one_ itemStateChanged call for exactly the radio button which's state changed from
- // "0" to "1".
- // Nowadays, since the listener handling changed a lot towards 1.1 (the VCLXWindow reacts on more
- // basic events from the VCL-windows, not anymore on the Link-based events like in 1.0.x), this
- // isn't the case anymore: For instance, this method here gets called for the radio button
- // which is being implicitily _de_selected, too. This is pretty bad for compatibility.
- // Thus, we suppress all events with a new state other than "1". This is unlogical, and weird, when looking
- // from a pure API perspective, but it's _compatible_ with older product versions, and this is
- // all which matters here.
- // #i14703#
- if ( 1 == rEvent.Selected )
- {
- if ( maItemListeners.getLength() )
- maItemListeners.itemStateChanged( rEvent );
- }
- // note that speaking stricly, this is wrong: When in 1.0.x, the user would have de-selected
- // a radio button _without_ selecing another one, this would have caused a notification.
- // With the change done here, this today won't cause a notification anymore.
- //
- // Fortunately, it's not possible for the user to de-select a radio button without selecting another on,
- // at least not via the regular UI. It _would_ be possible via the Accessibility API, which
- // counts as "user input", too. But in 1.0.x, there was no Accessibility API, so there is nothing
- // to be inconsistent with.
-}
-
-awt::Size UnoRadioButtonControl::getMinimumSize( ) throw(uno::RuntimeException)
-{
- return Impl_getMinimumSize();
-}
-
-awt::Size UnoRadioButtonControl::getPreferredSize( ) throw(uno::RuntimeException)
-{
- return Impl_getPreferredSize();
-}
-
-awt::Size UnoRadioButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
-{
- return Impl_calcAdjustedSize( rNewSize );
-}
-
-// ----------------------------------------------------
-// class UnoControlCheckBoxModel
-// ----------------------------------------------------
-UnoControlCheckBoxModel::UnoControlCheckBoxModel( const Reference< XMultiServiceFactory >& i_factory )
- :GraphicControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXCheckBox );
-}
-
-::rtl::OUString UnoControlCheckBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBoxModel );
-}
-
-uno::Any UnoControlCheckBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- switch ( nPropId )
- {
- case BASEPROPERTY_DEFAULTCONTROL:
- return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBox ) );
-
- case BASEPROPERTY_VISUALEFFECT:
- return uno::makeAny( (sal_Int16)awt::VisualEffect::LOOK3D );
- }
-
- return GraphicControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlCheckBoxModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlCheckBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-
-// ----------------------------------------------------
-// class UnoCheckBoxControl
-// ----------------------------------------------------
-UnoCheckBoxControl::UnoCheckBoxControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
- :UnoCheckBoxControl_Base( i_factory )
- ,maItemListeners( *this ), maActionListeners( *this )
-{
- maComponentInfos.nWidth = 100;
- maComponentInfos.nHeight = 12;
-}
-
-::rtl::OUString UnoCheckBoxControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("checkbox"));
-}
-
-void UnoCheckBoxControl::dispose() throw(uno::RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- maItemListeners.disposeAndClear( aEvt );
- UnoControlBase::dispose();
-}
-
-sal_Bool UnoCheckBoxControl::isTransparent() throw(uno::RuntimeException)
-{
- return sal_True;
-}
-
-void UnoCheckBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoControlBase::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XCheckBox > xCheckBox( getPeer(), uno::UNO_QUERY );
- xCheckBox->addItemListener( this );
-
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->setActionCommand( maActionCommand );
- if ( maActionListeners.getLength() )
- xButton->addActionListener( &maActionListeners );
-}
-
-void UnoCheckBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
-{
- maItemListeners.addInterface( l );
-}
-
-void UnoCheckBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
-{
- maItemListeners.removeInterface( l );
-}
-
-void UnoCheckBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- maActionListeners.addInterface( l );
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->addActionListener( &maActionListeners );
- }
-}
-
-void UnoCheckBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->removeActionListener( &maActionListeners );
- }
- maActionListeners.removeInterface( l );
-}
-
-void UnoCheckBoxControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
-{
- maActionCommand = rCommand;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
- xButton->setActionCommand( rCommand );
- }
-}
-
-
-void UnoCheckBoxControl::setLabel( const ::rtl::OUString& rLabel ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= rLabel;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
-}
-
-void UnoCheckBoxControl::setState( short n ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= (sal_Int16)n;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_True );
-}
-
-short UnoCheckBoxControl::getState() throw(uno::RuntimeException)
-{
- short nState = 0;
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) );
- aVal >>= nState;
- return nState;
-}
-
-void UnoCheckBoxControl::enableTriState( sal_Bool b ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= b;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TRISTATE ), aAny, sal_True );
-}
-
-void UnoCheckBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= (sal_Int16)rEvent.Selected;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
-
- if ( maItemListeners.getLength() )
- maItemListeners.itemStateChanged( rEvent );
-}
-
-awt::Size UnoCheckBoxControl::getMinimumSize( ) throw(uno::RuntimeException)
-{
- return Impl_getMinimumSize();
-}
-
-awt::Size UnoCheckBoxControl::getPreferredSize( ) throw(uno::RuntimeException)
-{
- return Impl_getPreferredSize();
-}
-
-awt::Size UnoCheckBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
-{
- return Impl_calcAdjustedSize( rNewSize );
-}
-
-// ----------------------------------------------------
-// class UnoControlFixedHyperlinkModel
-// ----------------------------------------------------
-UnoControlFixedHyperlinkModel::UnoControlFixedHyperlinkModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedHyperlink );
-}
-
-::rtl::OUString UnoControlFixedHyperlinkModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedHyperlinkModel );
-}
-
-uno::Any UnoControlFixedHyperlinkModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedHyperlink );
- return aAny;
- }
- else if ( nPropId == BASEPROPERTY_BORDER )
- {
- uno::Any aAny;
- aAny <<= (sal_Int16)0;
- return aAny;
- }
- else if ( nPropId == BASEPROPERTY_URL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString();
- return aAny;
- }
-
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlFixedHyperlinkModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlFixedHyperlinkModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ----------------------------------------------------
-// class UnoFixedHyperlinkControl
-// ----------------------------------------------------
-UnoFixedHyperlinkControl::UnoFixedHyperlinkControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlBase( i_factory )
- ,maActionListeners( *this )
-{
- maComponentInfos.nWidth = 100;
- maComponentInfos.nHeight = 12;
-}
-
-::rtl::OUString UnoFixedHyperlinkControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fixedhyperlink"));
-}
-
-// uno::XInterface
-uno::Any UnoFixedHyperlinkControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XFixedHyperlink*, this ),
- SAL_STATIC_CAST( awt::XLayoutConstrains*, this ) );
- return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoFixedHyperlinkControl )
- getCppuType( ( uno::Reference< awt::XFixedHyperlink>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
- UnoControlBase::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-sal_Bool UnoFixedHyperlinkControl::isTransparent() throw(uno::RuntimeException)
-{
- return sal_True;
-}
-
-void UnoFixedHyperlinkControl::setText( const ::rtl::OUString& Text ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Text;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
-}
-
-::rtl::OUString UnoFixedHyperlinkControl::getText() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL );
-}
-
-void UnoFixedHyperlinkControl::setURL( const ::rtl::OUString& URL ) throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= URL;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_URL ), aAny, sal_True );
-}
-
-::rtl::OUString UnoFixedHyperlinkControl::getURL( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ImplGetPropertyValue_UString( BASEPROPERTY_URL );
-}
-
-void UnoFixedHyperlinkControl::setAlignment( short nAlign ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= (sal_Int16)nAlign;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ), aAny, sal_True );
-}
-
-short UnoFixedHyperlinkControl::getAlignment() throw(uno::RuntimeException)
-{
- short nAlign = 0;
- if ( mxModel.is() )
- {
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) );
- aVal >>= nAlign;
- }
- return nAlign;
-}
-
-awt::Size UnoFixedHyperlinkControl::getMinimumSize( ) throw(uno::RuntimeException)
-{
- return Impl_getMinimumSize();
-}
-
-awt::Size UnoFixedHyperlinkControl::getPreferredSize( ) throw(uno::RuntimeException)
-{
- return Impl_getPreferredSize();
-}
-
-awt::Size UnoFixedHyperlinkControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
-{
- return Impl_calcAdjustedSize( rNewSize );
-}
-
-void UnoFixedHyperlinkControl::dispose() throw(uno::RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- maActionListeners.disposeAndClear( aEvt );
- UnoControlBase::dispose();
-}
-
-void UnoFixedHyperlinkControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoControlBase::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY );
- if ( maActionListeners.getLength() )
- xFixedHyperlink->addActionListener( &maActionListeners );
-}
-
-void UnoFixedHyperlinkControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- maActionListeners.addInterface( l );
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY );
- xFixedHyperlink->addActionListener( &maActionListeners );
- }
-}
-
-void UnoFixedHyperlinkControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY );
- xFixedHyperlink->removeActionListener( &maActionListeners );
- }
- maActionListeners.removeInterface( l );
-}
-
-// ----------------------------------------------------
-// class UnoControlFixedTextModel
-// ----------------------------------------------------
-UnoControlFixedTextModel::UnoControlFixedTextModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedText );
-}
-
-::rtl::OUString UnoControlFixedTextModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedTextModel );
-}
-
-uno::Any UnoControlFixedTextModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedText );
- return aAny;
- }
- else if ( nPropId == BASEPROPERTY_BORDER )
- {
- uno::Any aAny;
- aAny <<= (sal_Int16)0;
- return aAny;
- }
-
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlFixedTextModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlFixedTextModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-// ----------------------------------------------------
-// class UnoFixedTextControl
-// ----------------------------------------------------
-UnoFixedTextControl::UnoFixedTextControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlBase( i_factory )
-{
- maComponentInfos.nWidth = 100;
- maComponentInfos.nHeight = 12;
-}
-
-::rtl::OUString UnoFixedTextControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fixedtext"));
-}
-
-// uno::XInterface
-uno::Any UnoFixedTextControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XFixedText*, this ),
- SAL_STATIC_CAST( awt::XLayoutConstrains*, this ) );
- return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoFixedTextControl )
- getCppuType( ( uno::Reference< awt::XFixedText>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
- UnoControlBase::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-sal_Bool UnoFixedTextControl::isTransparent() throw(uno::RuntimeException)
-{
- return sal_True;
-}
-
-void UnoFixedTextControl::setText( const ::rtl::OUString& Text ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Text;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
-}
-
-::rtl::OUString UnoFixedTextControl::getText() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL );
-}
-
-void UnoFixedTextControl::setAlignment( short nAlign ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= (sal_Int16)nAlign;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ), aAny, sal_True );
-}
-
-short UnoFixedTextControl::getAlignment() throw(uno::RuntimeException)
-{
- short nAlign = 0;
- if ( mxModel.is() )
- {
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) );
- aVal >>= nAlign;
- }
- return nAlign;
-}
-
-awt::Size UnoFixedTextControl::getMinimumSize( ) throw(uno::RuntimeException)
-{
- return Impl_getMinimumSize();
-}
-
-awt::Size UnoFixedTextControl::getPreferredSize( ) throw(uno::RuntimeException)
-{
- return Impl_getPreferredSize();
-}
-
-awt::Size UnoFixedTextControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
-{
- return Impl_calcAdjustedSize( rNewSize );
-}
-
-// ----------------------------------------------------
-// class UnoControlGroupBoxModel
-// ----------------------------------------------------
-UnoControlGroupBoxModel::UnoControlGroupBoxModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_LABEL );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
- ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
-}
-
-::rtl::OUString UnoControlGroupBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBoxModel );
-}
-
-uno::Any UnoControlGroupBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox );
- return aAny;
- }
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlGroupBoxModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlGroupBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ----------------------------------------------------
-// class UnoGroupBoxControl
-// ----------------------------------------------------
-UnoGroupBoxControl::UnoGroupBoxControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlBase( i_factory )
-{
- maComponentInfos.nWidth = 100;
- maComponentInfos.nHeight = 100;
-}
-
-::rtl::OUString UnoGroupBoxControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("groupbox"));
-}
-
-sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException)
-{
- return sal_True;
-}
-
-// =====================================================================================================================
-// = UnoControlListBoxModel_Data
-// =====================================================================================================================
-struct ListItem
-{
- ::rtl::OUString ItemText;
- ::rtl::OUString ItemImageURL;
- Any ItemData;
-
- ListItem()
- :ItemText()
- ,ItemImageURL()
- ,ItemData()
- {
- }
-
- ListItem( const ::rtl::OUString& i_rItemText )
- :ItemText( i_rItemText )
- ,ItemImageURL()
- ,ItemData()
- {
- }
-};
-
-typedef beans::Pair< ::rtl::OUString, ::rtl::OUString > UnoListItem;
-
-struct StripItemData : public ::std::unary_function< ListItem, UnoListItem >
-{
- UnoListItem operator()( const ListItem& i_rItem )
- {
- return UnoListItem( i_rItem.ItemText, i_rItem.ItemImageURL );
- }
-};
-
-struct UnoControlListBoxModel_Data
-{
- UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl )
- :m_bSettingLegacyProperty( false )
- ,m_rAntiImpl( i_rAntiImpl )
- ,m_aListItems()
- {
- }
-
- sal_Int32 getItemCount() const { return sal_Int32( m_aListItems.size() ); }
-
- const ListItem& getItem( const sal_Int32 i_nIndex ) const
- {
- if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
- return m_aListItems[ i_nIndex ];
- }
-
- ListItem& getItem( const sal_Int32 i_nIndex )
- {
- return const_cast< ListItem& >( static_cast< const UnoControlListBoxModel_Data* >( this )->getItem( i_nIndex ) );
- }
-
- ListItem& insertItem( const sal_Int32 i_nIndex )
- {
- if ( ( i_nIndex < 0 ) || ( i_nIndex > sal_Int32( m_aListItems.size() ) ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
- return *m_aListItems.insert( m_aListItems.begin() + i_nIndex, ListItem() );
- }
-
- Sequence< UnoListItem > getAllItems() const
- {
- Sequence< UnoListItem > aItems( sal_Int32( m_aListItems.size() ) );
- ::std::transform( m_aListItems.begin(), m_aListItems.end(), aItems.getArray(), StripItemData() );
- return aItems;
- }
-
- void copyItems( const UnoControlListBoxModel_Data& i_copySource )
- {
- m_aListItems = i_copySource.m_aListItems;
- }
-
- void setAllItems( const ::std::vector< ListItem >& i_rItems )
- {
- m_aListItems = i_rItems;
- }
-
- void removeItem( const sal_Int32 i_nIndex )
- {
- if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
- throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
- m_aListItems.erase( m_aListItems.begin() + i_nIndex );
- }
-
- void removeAllItems()
- {
- ::std::vector< ListItem > aEmpty;
- m_aListItems.swap( aEmpty );
- }
-
-public:
- bool m_bSettingLegacyProperty;
-
-private:
- UnoControlListBoxModel& m_rAntiImpl;
- ::std::vector< ListItem > m_aListItems;
-};
-
-// =====================================================================================================================
-// = UnoControlListBoxModel
-// =====================================================================================================================
-// ---------------------------------------------------------------------------------------------------------------------
-UnoControlListBoxModel::UnoControlListBoxModel( const Reference< XMultiServiceFactory >& i_factory, ConstructorMode const i_mode )
- :UnoControlListBoxModel_Base( i_factory )
- ,m_pData( new UnoControlListBoxModel_Data( *this ) )
- ,m_aItemListListeners( GetMutex() )
-{
- if ( i_mode == ConstructDefault )
- {
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox );
- }
-}
-// ---------------------------------------------------------------------------------------------------------------------
-UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource )
- :UnoControlListBoxModel_Base( i_rSource )
- ,m_pData( new UnoControlListBoxModel_Data( *this ) )
- ,m_aItemListListeners( GetMutex() )
-{
- m_pData->copyItems( *i_rSource.m_pData );
-}
-UnoControlListBoxModel::~UnoControlListBoxModel()
-{
-}
-IMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel )
-// ---------------------------------------------------------------------------------------------------------------------
-::rtl::OUString UnoControlListBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBox );
- return aAny;
- }
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& UnoControlListBoxModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-namespace
-{
- struct CreateListItem : public ::std::unary_function< ::rtl::OUString, ListItem >
- {
- ListItem operator()( const ::rtl::OUString& i_rItemText )
- {
- return ListItem( i_rItemText );
- }
- };
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception)
-{
- UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-
- if ( nHandle == BASEPROPERTY_STRINGITEMLIST )
- {
- // reset selection
- uno::Sequence<sal_Int16> aSeq;
- uno::Any aAny;
- aAny <<= aSeq;
- setDependentFastPropertyValue( BASEPROPERTY_SELECTEDITEMS, aAny );
-
- if ( !m_pData->m_bSettingLegacyProperty )
- {
- // synchronize the legacy StringItemList property with our list items
- Sequence< ::rtl::OUString > aStringItemList;
- Any aPropValue;
- getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
- OSL_VERIFY( aPropValue >>= aStringItemList );
-
- ::std::vector< ListItem > aItems( aStringItemList.getLength() );
- ::std::transform(
- aStringItemList.getConstArray(),
- aStringItemList.getConstArray() + aStringItemList.getLength(),
- aItems.begin(),
- CreateListItem()
- );
- m_pData->setAllItems( aItems );
-
- // since an XItemListListener does not have a "all items modified" or some such method,
- // we simulate this by notifying removal of all items, followed by insertion of all new
- // items
- lang::EventObject aEvent;
- aEvent.Source = *this;
- m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
- // TODO: OPropertySetHelper calls into this method with the mutex locked ...
- // which is wrong for the above notifications ...
- }
- }
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCount, sal_Int32* _pHandles,
- uno::Any* _pValues, sal_Int32* _pValidHandles ) const SAL_THROW(())
-{
- // dependencies we know:
- // BASEPROPERTY_STRINGITEMLIST->BASEPROPERTY_SELECTEDITEMS
- ImplEnsureHandleOrder( _nCount, _pHandles, _pValues, BASEPROPERTY_STRINGITEMLIST, BASEPROPERTY_SELECTEDITEMS );
-
- UnoControlModel::ImplNormalizePropertySequence( _nCount, _pHandles, _pValues, _pValidHandles );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-::sal_Int32 SAL_CALL UnoControlListBoxModel::getItemCount() throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- return m_pData->getItemCount();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::insertItem( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // SYNCHRONIZED ----->
- ListItem& rItem( m_pData->insertItem( i_nPosition ) );
- rItem.ItemText = i_rItemText;
- rItem.ItemImageURL = i_rItemImageURL;
-
- impl_handleInsert( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
- // <----- SYNCHRONIZED
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::insertItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // SYNCHRONIZED ----->
- ListItem& rItem( m_pData->insertItem( i_nPosition ) );
- rItem.ItemText = i_rItemText;
-
- impl_handleInsert( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard );
- // <----- SYNCHRONIZED
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::insertItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // SYNCHRONIZED ----->
- ListItem& rItem( m_pData->insertItem( i_nPosition ) );
- rItem.ItemImageURL = i_rItemImageURL;
-
- impl_handleInsert( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard );
- // <----- SYNCHRONIZED
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::removeItem( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // SYNCHRONIZED ----->
- m_pData->removeItem( i_nPosition );
-
- impl_handleRemove( i_nPosition, aGuard );
- // <----- SYNCHRONIZED
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::removeAllItems( ) throw (::com::sun::star::uno::RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // SYNCHRONIZED ----->
- m_pData->removeAllItems();
-
- impl_handleRemove( -1, aGuard );
- // <----- SYNCHRONIZED
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::setItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // SYNCHRONIZED ----->
- ListItem& rItem( m_pData->getItem( i_nPosition ) );
- rItem.ItemText = i_rItemText;
-
- impl_handleModify( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard );
- // <----- SYNCHRONIZED
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::setItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // SYNCHRONIZED ----->
- ListItem& rItem( m_pData->getItem( i_nPosition ) );
- rItem.ItemImageURL = i_rItemImageURL;
-
- impl_handleModify( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard );
- // <----- SYNCHRONIZED
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::setItemTextAndImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- // SYNCHRONIZED ----->
- ListItem& rItem( m_pData->getItem( i_nPosition ) );
- rItem.ItemText = i_rItemText;
- rItem.ItemImageURL = i_rItemImageURL;
-
- impl_handleModify( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
- // <----- SYNCHRONIZED
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::setItemData( ::sal_Int32 i_nPosition, const Any& i_rDataValue ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- ListItem& rItem( m_pData->getItem( i_nPosition ) );
- rItem.ItemData = i_rDataValue;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemText( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- const ListItem& rItem( m_pData->getItem( i_nPosition ) );
- return rItem.ItemText;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- const ListItem& rItem( m_pData->getItem( i_nPosition ) );
- return rItem.ItemImageURL;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL UnoControlListBoxModel::getItemTextAndImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- const ListItem& rItem( m_pData->getItem( i_nPosition ) );
- return beans::Pair< ::rtl::OUString, ::rtl::OUString >( rItem.ItemText, rItem.ItemImageURL );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-Any SAL_CALL UnoControlListBoxModel::getItemData( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
- const ListItem& rItem( m_pData->getItem( i_nPosition ) );
- return rItem.ItemData;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL UnoControlListBoxModel::getAllItems( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- return m_pData->getAllItems();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::addItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException)
-{
- if ( i_Listener.is() )
- m_aItemListListeners.addInterface( i_Listener );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoControlListBoxModel::removeItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException)
-{
- if ( i_Listener.is() )
- m_aItemListListeners.removeInterface( i_Listener );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void UnoControlListBoxModel::impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const
-{
- Sequence< ::rtl::OUString > aStringItemList;
- Any aPropValue;
- getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
- OSL_VERIFY( aPropValue >>= aStringItemList );
-
- o_rStringItems.resize( size_t( aStringItemList.getLength() ) );
- ::std::copy(
- aStringItemList.getConstArray(),
- aStringItemList.getConstArray() + aStringItemList.getLength(),
- o_rStringItems.begin()
- );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void UnoControlListBoxModel::impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems )
-{
- Sequence< ::rtl::OUString > aStringItems( i_rStringItems.size() );
- ::std::copy(
- i_rStringItems.begin(),
- i_rStringItems.end(),
- aStringItems.getArray()
- );
- m_pData->m_bSettingLegacyProperty = true;
- try
- {
- setFastPropertyValue( BASEPROPERTY_STRINGITEMLIST, uno::makeAny( aStringItems ) );
- }
- catch( const Exception& )
- {
- m_pData->m_bSettingLegacyProperty = false;
- throw;
- }
- m_pData->m_bSettingLegacyProperty = false;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void UnoControlListBoxModel::impl_handleInsert( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
- const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
-{
- // SYNCHRONIZED ----->
- // sync with legacy StringItemList property
- ::std::vector< ::rtl::OUString > aStringItems;
- impl_getStringItemList( aStringItems );
- OSL_ENSURE( size_t( i_nItemPosition ) <= aStringItems.size(), "UnoControlListBoxModel::impl_handleInsert" );
- if ( size_t( i_nItemPosition ) <= aStringItems.size() )
- {
- const ::rtl::OUString sItemText( !!i_rItemText ? *i_rItemText : ::rtl::OUString() );
- aStringItems.insert( aStringItems.begin() + i_nItemPosition, sItemText );
- }
-
- i_rClearBeforeNotify.clear();
- // <----- SYNCHRONIZED
- impl_setStringItemList_nolck( aStringItems );
-
- // notify ItemListListeners
- impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemInserted );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void UnoControlListBoxModel::impl_handleRemove( const sal_Int32 i_nItemPosition, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
-{
- // SYNCHRONIZED ----->
- const bool bAllItems = ( i_nItemPosition < 0 );
- // sync with legacy StringItemList property
- ::std::vector< ::rtl::OUString > aStringItems;
- impl_getStringItemList( aStringItems );
- if ( !bAllItems )
- {
- OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleRemove" );
- if ( size_t( i_nItemPosition ) < aStringItems.size() )
- {
- aStringItems.erase( aStringItems.begin() + i_nItemPosition );
- }
- }
- else
- {
- aStringItems.resize(0);
- }
-
- i_rClearBeforeNotify.clear();
- // <----- SYNCHRONIZED
- impl_setStringItemList_nolck( aStringItems );
-
- // notify ItemListListeners
- if ( bAllItems )
- {
- EventObject aEvent( *this );
- m_aItemListListeners.notifyEach( &XItemListListener::allItemsRemoved, aEvent );
- }
- else
- {
- impl_notifyItemListEvent_nolck( i_nItemPosition, ::boost::optional< ::rtl::OUString >(), ::boost::optional< ::rtl::OUString >(),
- &XItemListListener::listItemRemoved );
- }
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void UnoControlListBoxModel::impl_handleModify( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
- const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
-{
- // SYNCHRONIZED ----->
- if ( !!i_rItemText )
- {
- // sync with legacy StringItemList property
- ::std::vector< ::rtl::OUString > aStringItems;
- impl_getStringItemList( aStringItems );
- OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleModify" );
- if ( size_t( i_nItemPosition ) < aStringItems.size() )
- {
- aStringItems[ i_nItemPosition] = *i_rItemText;
- }
-
- i_rClearBeforeNotify.clear();
- // <----- SYNCHRONIZED
- impl_setStringItemList_nolck( aStringItems );
- }
- else
- {
- i_rClearBeforeNotify.clear();
- // <----- SYNCHRONIZED
- }
-
- // notify ItemListListeners
- impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemModified );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void UnoControlListBoxModel::impl_notifyItemListEvent_nolck( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
- const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
- void ( SAL_CALL XItemListListener::*NotificationMethod )( const ItemListEvent& ) )
-{
- ItemListEvent aEvent;
- aEvent.Source = *this;
- aEvent.ItemPosition = i_nItemPosition;
- if ( !!i_rItemText )
- {
- aEvent.ItemText.IsPresent = sal_True;
- aEvent.ItemText.Value = *i_rItemText;
- }
- if ( !!i_rItemImageURL )
- {
- aEvent.ItemImageURL.IsPresent = sal_True;
- aEvent.ItemImageURL.Value = *i_rItemImageURL;
- }
-
- m_aItemListListeners.notifyEach( NotificationMethod, aEvent );
-}
-
-// ----------------------------------------------------
-// class UnoListBoxControl
-// ----------------------------------------------------
-UnoListBoxControl::UnoListBoxControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoListBoxControl_Base( i_factory )
- ,maActionListeners( *this )
- ,maItemListeners( *this )
-{
- maComponentInfos.nWidth = 100;
- maComponentInfos.nHeight = 12;
-}
-
-::rtl::OUString UnoListBoxControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("listbox"));
-}
-IMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox )
-
-void UnoListBoxControl::dispose() throw(uno::RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- maActionListeners.disposeAndClear( aEvt );
- maItemListeners.disposeAndClear( aEvt );
- UnoControl::dispose();
-}
-
-void UnoListBoxControl::ImplUpdateSelectedItemsProperty()
-{
- if ( getPeer().is() )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- DBG_ASSERT( xListBox.is(), "XListBox?" );
-
- uno::Sequence<sal_Int16> aSeq = xListBox->getSelectedItemsPos();
- uno::Any aAny;
- aAny <<= aSeq;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny, sal_False );
- }
-}
-
-void UnoListBoxControl::updateFromModel()
-{
- UnoControlBase::updateFromModel();
-
- Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY );
- ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
-
- EventObject aEvent( getModel() );
- xItemListListener->itemListChanged( aEvent );
-
- // notify the change of the SelectedItems property, again. While our base class, in updateFromModel,
- // already did this, our peer(s) can only legitimately set the selection after they have the string
- // item list, which we just notified with the itemListChanged call.
- const ::rtl::OUString sSelectedItemsPropName( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ) );
- ImplSetPeerProperty( sSelectedItemsPropName, ImplGetPropertyValue( sSelectedItemsPropName ) );
-}
-
-void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
-{
- if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
- // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item
- // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes
- // will be forwarded to the peer, which will update itself accordingly.
- return;
-
- UnoControl::ImplSetPeerProperty( rPropName, rVal );
-}
-
-void UnoListBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoControl::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- xListBox->addItemListener( this );
-
- if ( maActionListeners.getLength() )
- xListBox->addActionListener( &maActionListeners );
-}
-
-void UnoListBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- maActionListeners.addInterface( l );
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- xListBox->addActionListener( &maActionListeners );
- }
-}
-
-void UnoListBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- xListBox->removeActionListener( &maActionListeners );
- }
- maActionListeners.removeInterface( l );
-}
-
-void UnoListBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
-{
- maItemListeners.addInterface( l );
-}
-
-void UnoListBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
-{
- maItemListeners.removeInterface( l );
-}
-
-void UnoListBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(uno::RuntimeException)
-{
- uno::Sequence< ::rtl::OUString> aSeq( 1 );
- aSeq.getArray()[0] = aItem;
- addItems( aSeq, nPos );
-}
-
-void UnoListBoxControl::addItems( const uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(uno::RuntimeException)
-{
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
- uno::Sequence< ::rtl::OUString> aSeq;
- aVal >>= aSeq;
- sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength();
- sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
- sal_uInt16 nNewLen = nOldLen + nNewItems;
-
- uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
- ::rtl::OUString* pNewData = aNewSeq.getArray();
- ::rtl::OUString* pOldData = aSeq.getArray();
-
- if ( ( nPos < 0 ) || ( nPos > nOldLen ) )
- nPos = (sal_uInt16) nOldLen;
-
- sal_uInt16 n;
- // Items vor der Einfuege-Position
- for ( n = 0; n < nPos; n++ )
- pNewData[n] = pOldData[n];
-
- // Neue Items
- for ( n = 0; n < nNewItems; n++ )
- pNewData[nPos+n] = aItems.getConstArray()[n];
-
- // Rest der alten Items
- for ( n = nPos; n < nOldLen; n++ )
- pNewData[nNewItems+n] = pOldData[n];
-
- uno::Any aAny;
- aAny <<= aNewSeq;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
-}
-
-void UnoListBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(uno::RuntimeException)
-{
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
- uno::Sequence< ::rtl::OUString> aSeq;
- aVal >>= aSeq;
- sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
- if ( nOldLen && ( nPos < nOldLen ) )
- {
- if ( nCount > ( nOldLen-nPos ) )
- nCount = nOldLen-nPos;
-
- sal_uInt16 nNewLen = nOldLen - nCount;
-
- uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
- ::rtl::OUString* pNewData = aNewSeq.getArray();
- ::rtl::OUString* pOldData = aSeq.getArray();
-
- sal_uInt16 n;
- // Items vor der Entfern-Position
- for ( n = 0; n < nPos; n++ )
- pNewData[n] = pOldData[n];
-
- // Rest der Items
- for ( n = nPos; n < (nOldLen-nCount); n++ )
- pNewData[n] = pOldData[n+nCount];
-
- uno::Any aAny;
- aAny <<= aNewSeq;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
- }
-}
-
-sal_Int16 UnoListBoxControl::getItemCount() throw(uno::RuntimeException)
-{
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
- uno::Sequence< ::rtl::OUString> aSeq;
- aVal >>= aSeq;
- return (sal_Int16)aSeq.getLength();
-}
-
-::rtl::OUString UnoListBoxControl::getItem( sal_Int16 nPos ) throw(uno::RuntimeException)
-{
- ::rtl::OUString aItem;
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
- uno::Sequence< ::rtl::OUString> aSeq;
- aVal >>= aSeq;
- if ( nPos < aSeq.getLength() )
- aItem = aSeq.getConstArray()[nPos];
- return aItem;
-}
-
-uno::Sequence< ::rtl::OUString> UnoListBoxControl::getItems() throw(uno::RuntimeException)
-{
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
- uno::Sequence< ::rtl::OUString> aSeq;
- aVal >>= aSeq;
- return aSeq;
-}
-
-sal_Int16 UnoListBoxControl::getSelectedItemPos() throw(uno::RuntimeException)
-{
- sal_Int16 n = -1;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- n = xListBox->getSelectedItemPos();
- }
- return n;
-}
-
-uno::Sequence<sal_Int16> UnoListBoxControl::getSelectedItemsPos() throw(uno::RuntimeException)
-{
- uno::Sequence<sal_Int16> aSeq;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- aSeq = xListBox->getSelectedItemsPos();
- }
- return aSeq;
-}
-
-::rtl::OUString UnoListBoxControl::getSelectedItem() throw(uno::RuntimeException)
-{
- ::rtl::OUString aItem;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- aItem = xListBox->getSelectedItem();
- }
- return aItem;
-}
-
-uno::Sequence< ::rtl::OUString> UnoListBoxControl::getSelectedItems() throw(uno::RuntimeException)
-{
- uno::Sequence< ::rtl::OUString> aSeq;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- aSeq = xListBox->getSelectedItems();
- }
- return aSeq;
-}
-
-void UnoListBoxControl::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(uno::RuntimeException)
-{
- if ( getPeer().is() )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- xListBox->selectItemPos( nPos, bSelect );
- }
- ImplUpdateSelectedItemsProperty();
-}
-
-void UnoListBoxControl::selectItemsPos( const uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(uno::RuntimeException)
-{
- if ( getPeer().is() )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- xListBox->selectItemsPos( aPositions, bSelect );
- }
- ImplUpdateSelectedItemsProperty();
-}
-
-void UnoListBoxControl::selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(uno::RuntimeException)
-{
- if ( getPeer().is() )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- xListBox->selectItem( aItem, bSelect );
- }
- ImplUpdateSelectedItemsProperty();
-}
-
-void UnoListBoxControl::makeVisible( sal_Int16 nEntry ) throw(uno::RuntimeException)
-{
- if ( getPeer().is() )
- {
- uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
- xListBox->makeVisible( nEntry );
- }
-}
-
-void UnoListBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= (sal_Int16)nLines;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, sal_True );
-}
-
-sal_Int16 UnoListBoxControl::getDropDownLineCount() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT );
-}
-
-sal_Bool UnoListBoxControl::isMutipleMode() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_BOOL( BASEPROPERTY_MULTISELECTION );
-}
-
-void UnoListBoxControl::setMultipleMode( sal_Bool bMulti ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= bMulti;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTISELECTION ), aAny, sal_True );
-}
-
-void UnoListBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
-{
- ImplUpdateSelectedItemsProperty();
- if ( maItemListeners.getLength() )
- {
- try
- {
- maItemListeners.itemStateChanged( rEvent );
- }
- catch( const Exception& e )
- {
-#if OSL_DEBUG_LEVEL == 0
- (void) e; // suppress warning
-#else
- ::rtl::OString sMessage( "UnoListBoxControl::itemStateChanged: caught an exception:\n" );
- sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US );
- OSL_FAIL( sMessage.getStr() );
-#endif
- }
- }
-}
-
-awt::Size UnoListBoxControl::getMinimumSize( ) throw(uno::RuntimeException)
-{
- return Impl_getMinimumSize();
-}
-
-awt::Size UnoListBoxControl::getPreferredSize( ) throw(uno::RuntimeException)
-{
- return Impl_getPreferredSize();
-}
-
-awt::Size UnoListBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
-{
- return Impl_calcAdjustedSize( rNewSize );
-}
-
-awt::Size UnoListBoxControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(uno::RuntimeException)
-{
- return Impl_getMinimumSize( nCols, nLines );
-}
-
-void UnoListBoxControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(uno::RuntimeException)
-{
- Impl_getColumnsAndLines( nCols, nLines );
-}
-
-sal_Bool SAL_CALL UnoListBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- const Reference< XItemList > xOldItems( getModel(), UNO_QUERY );
- OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoListBoxControl::setModel: illegal old model!" );
- const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY );
- OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoListBoxControl::setModel: illegal new model!" );
-
- if ( !UnoListBoxControl_Base::setModel( i_rModel ) )
- return sal_False;
-
- if ( xOldItems.is() )
- xOldItems->removeItemListListener( this );
- if ( xNewItems.is() )
- xNewItems->addItemListListener( this );
-
- return sal_True;
-}
-
-void SAL_CALL UnoListBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
-{
- const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
- OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemInserted: invalid peer!" );
- if ( xPeerListener.is() )
- xPeerListener->listItemInserted( i_rEvent );
-}
-
-void SAL_CALL UnoListBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
-{
- const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
- OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemRemoved: invalid peer!" );
- if ( xPeerListener.is() )
- xPeerListener->listItemRemoved( i_rEvent );
-}
-
-void SAL_CALL UnoListBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
-{
- const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
- OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemModified: invalid peer!" );
- if ( xPeerListener.is() )
- xPeerListener->listItemModified( i_rEvent );
-}
-
-void SAL_CALL UnoListBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
-{
- const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
- OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::allItemsRemoved: invalid peer!" );
- if ( xPeerListener.is() )
- xPeerListener->allItemsRemoved( i_rEvent );
-}
-
-void SAL_CALL UnoListBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
-{
- const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
- OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::itemListChanged: invalid peer!" );
- if ( xPeerListener.is() )
- xPeerListener->itemListChanged( i_rEvent );
-}
-ActionListenerMultiplexer& UnoListBoxControl::getActionListeners()
-{
- return maActionListeners;
-}
-ItemListenerMultiplexer& UnoListBoxControl::getItemListeners()
-{
- return maItemListeners;
-}
-// ----------------------------------------------------
-// class UnoControlComboBoxModel
-// ----------------------------------------------------
-UnoControlComboBoxModel::UnoControlComboBoxModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlListBoxModel( i_factory, ConstructWithoutProperties )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXComboBox );
-}
-
-IMPL_SERVICEINFO_DERIVED( UnoControlComboBoxModel, UnoControlModel, szServiceName2_UnoControlComboBoxModel )
-
-uno::Reference< beans::XPropertySetInfo > UnoControlComboBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-// ---------------------------------------------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& UnoControlComboBoxModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-
-::rtl::OUString UnoControlComboBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel );
-}
-void SAL_CALL UnoControlComboBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception)
-{
- UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-
- if ( nHandle == BASEPROPERTY_STRINGITEMLIST && !m_pData->m_bSettingLegacyProperty)
- {
- // synchronize the legacy StringItemList property with our list items
- Sequence< ::rtl::OUString > aStringItemList;
- Any aPropValue;
- getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
- OSL_VERIFY( aPropValue >>= aStringItemList );
-
- ::std::vector< ListItem > aItems( aStringItemList.getLength() );
- ::std::transform(
- aStringItemList.getConstArray(),
- aStringItemList.getConstArray() + aStringItemList.getLength(),
- aItems.begin(),
- CreateListItem()
- );
- m_pData->setAllItems( aItems );
-
- // since an XItemListListener does not have a "all items modified" or some such method,
- // we simulate this by notifying removal of all items, followed by insertion of all new
- // items
- lang::EventObject aEvent;
- aEvent.Source = *this;
- m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
- // TODO: OPropertySetHelper calls into this method with the mutex locked ...
- // which is wrong for the above notifications ...
- }
-}
-
-uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox );
- return aAny;
- }
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-// ----------------------------------------------------
-// class UnoComboBoxControl
-// ----------------------------------------------------
-UnoComboBoxControl::UnoComboBoxControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoEditControl( i_factory )
- ,maActionListeners( *this )
- ,maItemListeners( *this )
-{
- maComponentInfos.nWidth = 100;
- maComponentInfos.nHeight = 12;
-}
-IMPL_SERVICEINFO_DERIVED( UnoComboBoxControl, UnoEditControl, szServiceName2_UnoControlComboBox )
-
-::rtl::OUString UnoComboBoxControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("combobox"));
-}
-
-void UnoComboBoxControl::dispose() throw(uno::RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = (::cppu::OWeakObject*)this;
- maActionListeners.disposeAndClear( aEvt );
- maItemListeners.disposeAndClear( aEvt );
- UnoControl::dispose();
-}
-uno::Any UnoComboBoxControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XComboBox*, this ) );
- if ( !aRet.hasValue() )
- {
- aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XItemListener*, this ) );
- if ( !aRet.hasValue() )
- {
- aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XItemListListener*, this ) );
- }
- }
- return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
-}
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoComboBoxControl )
- getCppuType( ( uno::Reference< awt::XComboBox>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XItemListener>* ) NULL ),
- getCppuType( ( uno::Reference< awt::XItemListListener>* ) NULL ),
- UnoEditControl::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-void UnoComboBoxControl::updateFromModel()
-{
- UnoEditControl::updateFromModel();
-
- Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY );
- ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoComboBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
-
- EventObject aEvent( getModel() );
- xItemListListener->itemListChanged( aEvent );
-}
-void UnoComboBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
-{
- if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
- // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item
- // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes
- // will be forwarded to the peer, which will update itself accordingly.
- return;
-
- UnoEditControl::ImplSetPeerProperty( rPropName, rVal );
-}
-void UnoComboBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoEditControl::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY );
- if ( maActionListeners.getLength() )
- xComboBox->addActionListener( &maActionListeners );
- if ( maItemListeners.getLength() )
- xComboBox->addItemListener( &maItemListeners );
-}
-
-void UnoComboBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- maActionListeners.addInterface( l );
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY );
- xComboBox->addActionListener( &maActionListeners );
- }
-}
-
-void UnoComboBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
-{
- if( getPeer().is() && maActionListeners.getLength() == 1 )
- {
- uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY );
- xComboBox->removeActionListener( &maActionListeners );
- }
- maActionListeners.removeInterface( l );
-}
-
-void UnoComboBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
-{
- maItemListeners.addInterface( l );
- if( getPeer().is() && maItemListeners.getLength() == 1 )
- {
- uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY );
- xComboBox->addItemListener( &maItemListeners );
- }
-}
-
-void UnoComboBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
-{
- if( getPeer().is() && maItemListeners.getLength() == 1 )
- {
- uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY ); // MT: Mal alles so umstellen, schoener als Ref anlegen und query rufen
- xComboBox->removeItemListener( &maItemListeners );
- }
- maItemListeners.removeInterface( l );
-}
-void UnoComboBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
-{
- if ( maItemListeners.getLength() )
- {
- try
- {
- maItemListeners.itemStateChanged( rEvent );
- }
- catch( const Exception& e )
- {
-#if OSL_DEBUG_LEVEL == 0
- (void) e; // suppress warning
-#else
- ::rtl::OString sMessage( "UnoComboBoxControl::itemStateChanged: caught an exception:\n" );
- sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US );
- OSL_FAIL( sMessage.getStr() );
-#endif
- }
- }
-}
-sal_Bool SAL_CALL UnoComboBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- const Reference< XItemList > xOldItems( getModel(), UNO_QUERY );
- OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoComboBoxControl::setModel: illegal old model!" );
- const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY );
- OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoComboBoxControl::setModel: illegal new model!" );
-
- if ( !UnoEditControl::setModel( i_rModel ) )
- return sal_False;
-
- if ( xOldItems.is() )
- xOldItems->removeItemListListener( this );
- if ( xNewItems.is() )
- xNewItems->addItemListListener( this );
-
- return sal_True;
-}
-
-void SAL_CALL UnoComboBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
-{
- const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
- OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemInserted: invalid peer!" );
- if ( xPeerListener.is() )
- xPeerListener->listItemInserted( i_rEvent );
-}
-
-void SAL_CALL UnoComboBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
-{
- const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
- OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemRemoved: invalid peer!" );
- if ( xPeerListener.is() )
- xPeerListener->listItemRemoved( i_rEvent );
-}
-
-void SAL_CALL UnoComboBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
-{
- const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
- OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemModified: invalid peer!" );
- if ( xPeerListener.is() )
- xPeerListener->listItemModified( i_rEvent );
-}
-
-void SAL_CALL UnoComboBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
-{
- const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
- OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::allItemsRemoved: invalid peer!" );
- if ( xPeerListener.is() )
- xPeerListener->allItemsRemoved( i_rEvent );
-}
-
-void SAL_CALL UnoComboBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
-{
- const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
- OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::itemListChanged: invalid peer!" );
- if ( xPeerListener.is() )
- xPeerListener->itemListChanged( i_rEvent );
-}
-ActionListenerMultiplexer& UnoComboBoxControl::getActionListeners()
-{
- return maActionListeners;
-}
-ItemListenerMultiplexer& UnoComboBoxControl::getItemListeners()
-{
- return maItemListeners;
-}
-
-void UnoComboBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(uno::RuntimeException)
-{
- uno::Sequence< ::rtl::OUString> aSeq( 1 );
- aSeq.getArray()[0] = aItem;
- addItems( aSeq, nPos );
-}
-
-void UnoComboBoxControl::addItems( const uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(uno::RuntimeException)
-{
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
- uno::Sequence< ::rtl::OUString> aSeq;
- aVal >>= aSeq;
- sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength();
- sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
- sal_uInt16 nNewLen = nOldLen + nNewItems;
-
- uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
- ::rtl::OUString* pNewData = aNewSeq.getArray();
- const ::rtl::OUString* pOldData = aSeq.getConstArray();
-
- if ( ( nPos < 0 ) || ( nPos > nOldLen ) )
- nPos = (sal_uInt16) nOldLen;
-
- sal_uInt16 n;
- // Items vor der Einfuege-Position
- for ( n = 0; n < nPos; n++ )
- pNewData[n] = pOldData[n];
-
- // Neue Items
- for ( n = 0; n < nNewItems; n++ )
- pNewData[nPos+n] = aItems.getConstArray()[n];
-
- // Rest der alten Items
- for ( n = nPos; n < nOldLen; n++ )
- pNewData[nNewItems+n] = pOldData[n];
-
- uno::Any aAny;
- aAny <<= aNewSeq;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
-}
-
-void UnoComboBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(uno::RuntimeException)
-{
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
- uno::Sequence< ::rtl::OUString> aSeq;
- aVal >>= aSeq;
- sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
- if ( nOldLen && ( nPos < nOldLen ) )
- {
- if ( nCount > ( nOldLen-nPos ) )
- nCount = nOldLen-nPos;
-
- sal_uInt16 nNewLen = nOldLen - nCount;
-
- uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
- ::rtl::OUString* pNewData = aNewSeq.getArray();
- ::rtl::OUString* pOldData = aSeq.getArray();
-
- sal_uInt16 n;
- // Items vor der Entfern-Position
- for ( n = 0; n < nPos; n++ )
- pNewData[n] = pOldData[n];
-
- // Rest der Items
- for ( n = nPos; n < (nOldLen-nCount); n++ )
- pNewData[n] = pOldData[n+nCount];
-
- uno::Any aAny;
- aAny <<= aNewSeq;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
- }
-}
-
-sal_Int16 UnoComboBoxControl::getItemCount() throw(uno::RuntimeException)
-{
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
- uno::Sequence< ::rtl::OUString> aSeq;
- aVal >>= aSeq;
- return (sal_Int16)aSeq.getLength();
-}
-
-::rtl::OUString UnoComboBoxControl::getItem( sal_Int16 nPos ) throw(uno::RuntimeException)
-{
- ::rtl::OUString aItem;
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
- uno::Sequence< ::rtl::OUString> aSeq;
- aVal >>= aSeq;
- if ( nPos < aSeq.getLength() )
- aItem = aSeq.getConstArray()[nPos];
- return aItem;
-}
-
-uno::Sequence< ::rtl::OUString> UnoComboBoxControl::getItems() throw(uno::RuntimeException)
-{
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
- uno::Sequence< ::rtl::OUString> aSeq;
- aVal >>= aSeq;
- return aSeq;
-}
-
-void UnoComboBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= nLines;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, sal_True );
-}
-
-sal_Int16 UnoComboBoxControl::getDropDownLineCount() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT );
-}
-
-
-// ----------------------------------------------------
-// UnoSpinFieldControl
-// ----------------------------------------------------
-UnoSpinFieldControl::UnoSpinFieldControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoEditControl( i_factory )
- ,maSpinListeners( *this )
-{
- mbRepeat = sal_False;
-}
-
-// uno::XInterface
-uno::Any UnoSpinFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XSpinField*, this ) );
- return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoSpinFieldControl )
- getCppuType( ( uno::Reference< awt::XSpinField>* ) NULL ),
- UnoEditControl::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-void UnoSpinFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoEditControl::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
- xField->enableRepeat( mbRepeat );
- if ( maSpinListeners.getLength() )
- xField->addSpinListener( &maSpinListeners );
-}
-
- // ::com::sun::star::awt::XSpinField
-void UnoSpinFieldControl::addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException)
-{
- maSpinListeners.addInterface( l );
- if( getPeer().is() && maSpinListeners.getLength() == 1 )
- {
- uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
- xField->addSpinListener( &maSpinListeners );
- }
-}
-
-void UnoSpinFieldControl::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException)
-{
- if( getPeer().is() && maSpinListeners.getLength() == 1 )
- {
- uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
- xField->removeSpinListener( &maSpinListeners );
- }
- maSpinListeners.removeInterface( l );
-}
-
-void UnoSpinFieldControl::up() throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
- if ( xField.is() )
- xField->up();
-}
-
-void UnoSpinFieldControl::down() throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
- if ( xField.is() )
- xField->down();
-}
-
-void UnoSpinFieldControl::first() throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
- if ( xField.is() )
- xField->first();
-}
-
-void UnoSpinFieldControl::last() throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
- if ( xField.is() )
- xField->last();
-}
-
-void UnoSpinFieldControl::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException)
-{
- mbRepeat = bRepeat;
-
- uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
- if ( xField.is() )
- xField->enableRepeat( bRepeat );
-}
-
-// ----------------------------------------------------
-// class UnoControlDateFieldModel
-// ----------------------------------------------------
-UnoControlDateFieldModel::UnoControlDateFieldModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXDateField );
-}
-
-::rtl::OUString UnoControlDateFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateFieldModel );
-}
-
-uno::Any UnoControlDateFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateField );
- return aAny;
- }
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-
-::cppu::IPropertyArrayHelper& UnoControlDateFieldModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlDateFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-
-// ----------------------------------------------------
-// class UnoDateFieldControl
-// ----------------------------------------------------
-UnoDateFieldControl::UnoDateFieldControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoSpinFieldControl( i_factory )
-{
- mnFirst = Date( 1, 1, 1900 ).GetDate();
- mnLast = Date( 31, 12, 2200 ).GetDate();
- mbLongFormat = 2;
-}
-
-::rtl::OUString UnoDateFieldControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("datefield"));
-}
-
-// uno::XInterface
-uno::Any UnoDateFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XDateField*, this ) );
- return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoDateFieldControl )
- getCppuType( ( uno::Reference< awt::XDateField>* ) NULL ),
- UnoSpinFieldControl::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-void UnoDateFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
- xField->setFirst( mnFirst );
- xField->setLast( mnLast );
- if ( mbLongFormat != 2 ) // not set
- xField->setLongFormat( mbLongFormat );
-}
-
-
-void UnoDateFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
-{
- uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY );
-
- // also change the text property (#i25106#)
- if ( xPeer.is() )
- {
- ::rtl::OUString sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
- ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), sal_False );
- }
-
- // re-calc the Date property
- uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
- uno::Any aValue;
- if ( xField->isEmpty() )
- {
- // the field says it's empty
- sal_Bool bEnforceFormat = sal_True;
- if ( xPeer.is() )
- xPeer->getProperty( GetPropertyName( BASEPROPERTY_ENFORCE_FORMAT ) ) >>= bEnforceFormat;
- if ( !bEnforceFormat )
- {
- // and it also says that it is currently accepting invalid inputs, without
- // forcing it to a valid date
- uno::Reference< awt::XTextComponent > xText( xPeer, uno::UNO_QUERY );
- if ( xText.is() && xText->getText().getLength() )
- // and in real, the text of the peer is *not* empty
- // -> simulate an invalid date, which is different from "no date"
- aValue <<= util::Date( 0, 0, 0 );
- }
- }
- else
- aValue <<= xField->getDate();
-
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aValue, sal_False );
-
- // multiplex the event
- if ( GetTextListeners().getLength() )
- GetTextListeners().textChanged( e );
-}
-
-void UnoDateFieldControl::setDate( sal_Int32 Date ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Date;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aAny, sal_True );
-}
-
-sal_Int32 UnoDateFieldControl::getDate() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_DATE );
-}
-
-void UnoDateFieldControl::setMin( sal_Int32 Date ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Date;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMIN ), aAny, sal_True );
-}
-
-sal_Int32 UnoDateFieldControl::getMin() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMIN );
-}
-
-void UnoDateFieldControl::setMax( sal_Int32 Date ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Date;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMAX ), aAny, sal_True );
-}
-
-sal_Int32 UnoDateFieldControl::getMax() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMAX );
-}
-
-void UnoDateFieldControl::setFirst( sal_Int32 Date ) throw(uno::RuntimeException)
-{
- mnFirst = Date;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
- xField->setFirst( Date );
- }
-}
-
-sal_Int32 UnoDateFieldControl::getFirst() throw(uno::RuntimeException)
-{
- return mnFirst;
-}
-
-void UnoDateFieldControl::setLast( sal_Int32 Date ) throw(uno::RuntimeException)
-{
- mnLast = Date;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
- xField->setLast( Date );
- }
-}
-
-sal_Int32 UnoDateFieldControl::getLast() throw(uno::RuntimeException)
-{
- return mnLast;
-}
-
-void UnoDateFieldControl::setLongFormat( sal_Bool bLong ) throw(uno::RuntimeException)
-{
- mbLongFormat = bLong;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
- xField->setLongFormat( bLong );
- }
-}
-
-sal_Bool UnoDateFieldControl::isLongFormat() throw(uno::RuntimeException)
-{
- return ( mbLongFormat != 2 ) ? mbLongFormat : sal_False;
-}
-
-void UnoDateFieldControl::setEmpty() throw(uno::RuntimeException)
-{
- if ( getPeer().is() )
- {
- uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
- xField->setEmpty();
- }
-}
-
-sal_Bool UnoDateFieldControl::isEmpty() throw(uno::RuntimeException)
-{
- sal_Bool bEmpty = sal_False;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
- bEmpty = xField->isEmpty();
- }
- return bEmpty;
-}
-
-void UnoDateFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= bStrict;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
-}
-
-sal_Bool UnoDateFieldControl::isStrictFormat() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
-}
-
-// ----------------------------------------------------
-// class UnoControlTimeFieldModel
-// ----------------------------------------------------
-UnoControlTimeFieldModel::UnoControlTimeFieldModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXTimeField );
-}
-
-::rtl::OUString UnoControlTimeFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeFieldModel );
-}
-
-uno::Any UnoControlTimeFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeField );
- return aAny;
- }
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-
-::cppu::IPropertyArrayHelper& UnoControlTimeFieldModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlTimeFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-
-// ----------------------------------------------------
-// class UnoTimeFieldControl
-// ----------------------------------------------------
-UnoTimeFieldControl::UnoTimeFieldControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoSpinFieldControl( i_factory )
-{
- mnFirst = Time( 0, 0 ).GetTime();
- mnLast = Time( 23, 59, 59, 99 ).GetTime();
-}
-
-::rtl::OUString UnoTimeFieldControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("timefield"));
-}
-
-// uno::XInterface
-uno::Any UnoTimeFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XTimeField*, this ) );
- return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoTimeFieldControl )
- getCppuType( ( uno::Reference< awt::XTimeField>* ) NULL ),
- UnoSpinFieldControl::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-void UnoTimeFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
- xField->setFirst( mnFirst );
- xField->setLast( mnLast );
-}
-
-void UnoTimeFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
-{
- // also change the text property (#i25106#)
- uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY );
- ::rtl::OUString sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
- ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), sal_False );
-
- // re-calc the Time property
- uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
- uno::Any aValue;
- if ( !xField->isEmpty() )
- aValue <<= xField->getTime();
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aValue, sal_False );
-
- // multiplex the event
- if ( GetTextListeners().getLength() )
- GetTextListeners().textChanged( e );
-}
-
-void UnoTimeFieldControl::setTime( sal_Int32 Time ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Time;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aAny, sal_True );
-}
-
-sal_Int32 UnoTimeFieldControl::getTime() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_TIME );
-}
-
-void UnoTimeFieldControl::setMin( sal_Int32 Time ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Time;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMIN ), aAny, sal_True );
-}
-
-sal_Int32 UnoTimeFieldControl::getMin() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMIN );
-}
-
-void UnoTimeFieldControl::setMax( sal_Int32 Time ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Time;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMAX ), aAny, sal_True );
-}
-
-sal_Int32 UnoTimeFieldControl::getMax() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMAX );
-}
-
-void UnoTimeFieldControl::setFirst( sal_Int32 Time ) throw(uno::RuntimeException)
-{
- mnFirst = Time;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
- xField->setFirst( mnFirst );
- }
-}
-
-sal_Int32 UnoTimeFieldControl::getFirst() throw(uno::RuntimeException)
-{
- return mnFirst;
-}
-
-void UnoTimeFieldControl::setLast( sal_Int32 Time ) throw(uno::RuntimeException)
-{
- mnLast = Time;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
- xField->setFirst( mnLast );
- }
-}
-
-sal_Int32 UnoTimeFieldControl::getLast() throw(uno::RuntimeException)
-{
- return mnLast;
-}
-
-void UnoTimeFieldControl::setEmpty() throw(uno::RuntimeException)
-{
- if ( getPeer().is() )
- {
- uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
- xField->setEmpty();
- }
-}
-
-sal_Bool UnoTimeFieldControl::isEmpty() throw(uno::RuntimeException)
-{
- sal_Bool bEmpty = sal_False;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
- bEmpty = xField->isEmpty();
- }
- return bEmpty;
-}
-
-void UnoTimeFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= bStrict;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
-}
-
-sal_Bool UnoTimeFieldControl::isStrictFormat() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
-}
-
-// ----------------------------------------------------
-// class UnoControlNumericFieldModel
-// ----------------------------------------------------
-UnoControlNumericFieldModel::UnoControlNumericFieldModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXNumericField );
-}
-
-::rtl::OUString UnoControlNumericFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericFieldModel );
-}
-
-uno::Any UnoControlNumericFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericField );
- return aAny;
- }
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-
-::cppu::IPropertyArrayHelper& UnoControlNumericFieldModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlNumericFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-
-// ----------------------------------------------------
-// class UnoNumericFieldControl
-// ----------------------------------------------------
-UnoNumericFieldControl::UnoNumericFieldControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoSpinFieldControl( i_factory )
-{
- mnFirst = 0;
- mnLast = 0x7FFFFFFF;
-}
-
-::rtl::OUString UnoNumericFieldControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("numericfield"));
-}
-
-// uno::XInterface
-uno::Any UnoNumericFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XNumericField*, this ) );
- return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoNumericFieldControl )
- getCppuType( ( uno::Reference< awt::XNumericField>* ) NULL ),
- UnoSpinFieldControl::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-void UnoNumericFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
- xField->setFirst( mnFirst );
- xField->setLast( mnLast );
-}
-
-
-void UnoNumericFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
-{
- uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
- uno::Any aAny;
- aAny <<= xField->getValue();
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False );
-
- if ( GetTextListeners().getLength() )
- GetTextListeners().textChanged( e );
-}
-
-void UnoNumericFieldControl::setValue( double Value ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Value;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_True );
-}
-
-double UnoNumericFieldControl::getValue() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE );
-}
-
-void UnoNumericFieldControl::setMin( double Value ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Value;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, sal_True );
-}
-
-double UnoNumericFieldControl::getMin() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE );
-}
-
-void UnoNumericFieldControl::setMax( double Value ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Value;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, sal_True );
-}
-
-double UnoNumericFieldControl::getMax() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE );
-}
-
-void UnoNumericFieldControl::setFirst( double Value ) throw(uno::RuntimeException)
-{
- mnFirst = Value;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
- xField->setFirst( mnFirst );
- }
-}
-
-double UnoNumericFieldControl::getFirst() throw(uno::RuntimeException)
-{
- return mnFirst;
-}
-
-void UnoNumericFieldControl::setLast( double Value ) throw(uno::RuntimeException)
-{
- mnLast = Value;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
- xField->setLast( mnLast );
- }
-}
-
-double UnoNumericFieldControl::getLast() throw(uno::RuntimeException)
-{
- return mnLast;
-}
-
-void UnoNumericFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= bStrict;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
-}
-
-sal_Bool UnoNumericFieldControl::isStrictFormat() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
-}
-
-void UnoNumericFieldControl::setSpinSize( double Digits ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Digits;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, sal_True );
-}
-
-double UnoNumericFieldControl::getSpinSize() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE );
-}
-
-void UnoNumericFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Digits;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DECIMALACCURACY ), aAny, sal_True );
-}
-
-sal_Int16 UnoNumericFieldControl::getDecimalDigits() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT16( BASEPROPERTY_DECIMALACCURACY );
-}
-
-// ----------------------------------------------------
-// class UnoControlCurrencyFieldModel
-// ----------------------------------------------------
-UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXCurrencyField );
-}
-
-::rtl::OUString UnoControlCurrencyFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyFieldModel );
-}
-
-uno::Any UnoControlCurrencyFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyField );
- return aAny;
- }
- if ( nPropId == BASEPROPERTY_CURSYM_POSITION )
- {
- uno::Any aAny;
- aAny <<= (sal_Bool)sal_False;
- return aAny;
- }
-
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlCurrencyFieldModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlCurrencyFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ----------------------------------------------------
-// class UnoCurrencyFieldControl
-// ----------------------------------------------------
-UnoCurrencyFieldControl::UnoCurrencyFieldControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoSpinFieldControl( i_factory )
-{
- mnFirst = 0;
- mnLast = 0x7FFFFFFF;
-}
-
-::rtl::OUString UnoCurrencyFieldControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("longcurrencyfield"));
-}
-
-// uno::XInterface
-uno::Any UnoCurrencyFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XCurrencyField*, this ) );
- return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoCurrencyFieldControl )
- getCppuType( ( uno::Reference< awt::XCurrencyField>* ) NULL ),
- UnoSpinFieldControl::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-void UnoCurrencyFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
- xField->setFirst( mnFirst );
- xField->setLast( mnLast );
-}
-
-void UnoCurrencyFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
-{
- uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
- uno::Any aAny;
- aAny <<= xField->getValue();
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False );
-
- if ( GetTextListeners().getLength() )
- GetTextListeners().textChanged( e );
-}
-
-void UnoCurrencyFieldControl::setValue( double Value ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Value;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_True );
-}
-
-double UnoCurrencyFieldControl::getValue() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE );
-}
-
-void UnoCurrencyFieldControl::setMin( double Value ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Value;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, sal_True );
-}
-
-double UnoCurrencyFieldControl::getMin() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE );
-}
-
-void UnoCurrencyFieldControl::setMax( double Value ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Value;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, sal_True );
-}
-
-double UnoCurrencyFieldControl::getMax() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE );
-}
-
-void UnoCurrencyFieldControl::setFirst( double Value ) throw(uno::RuntimeException)
-{
- mnFirst = Value;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
- xField->setFirst( mnFirst );
- }
-}
-
-double UnoCurrencyFieldControl::getFirst() throw(uno::RuntimeException)
-{
- return mnFirst;
-}
-
-void UnoCurrencyFieldControl::setLast( double Value ) throw(uno::RuntimeException)
-{
- mnLast = Value;
- if ( getPeer().is() )
- {
- uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
- xField->setLast( mnLast );
- }
-}
-
-double UnoCurrencyFieldControl::getLast() throw(uno::RuntimeException)
-{
- return mnLast;
-}
-
-void UnoCurrencyFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= bStrict;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
-}
-
-sal_Bool UnoCurrencyFieldControl::isStrictFormat() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
-}
-
-void UnoCurrencyFieldControl::setSpinSize( double Digits ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Digits;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, sal_True );
-}
-
-double UnoCurrencyFieldControl::getSpinSize() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE );
-}
-
-void UnoCurrencyFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Digits;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DECIMALACCURACY ), aAny, sal_True );
-}
-
-sal_Int16 UnoCurrencyFieldControl::getDecimalDigits() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT16( BASEPROPERTY_DECIMALACCURACY );
-}
-
-// ----------------------------------------------------
-// class UnoControlPatternFieldModel
-// ----------------------------------------------------
-UnoControlPatternFieldModel::UnoControlPatternFieldModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXPatternField );
-}
-
-::rtl::OUString UnoControlPatternFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternFieldModel );
-}
-
-uno::Any UnoControlPatternFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternField );
- return aAny;
- }
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlPatternFieldModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlPatternFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-// ----------------------------------------------------
-// class UnoPatternFieldControl
-// ----------------------------------------------------
-UnoPatternFieldControl::UnoPatternFieldControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoSpinFieldControl( i_factory )
-{
-}
-
-::rtl::OUString UnoPatternFieldControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("patternfield"));
-}
-
-void UnoPatternFieldControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
-{
- sal_uInt16 nType = GetPropertyId( rPropName );
- if ( ( nType == BASEPROPERTY_TEXT ) || ( nType == BASEPROPERTY_EDITMASK ) || ( nType == BASEPROPERTY_LITERALMASK ) )
- {
- // Die Masken koennen nicht nacheinander gesetzt werden.
- ::rtl::OUString Text = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT );
- ::rtl::OUString EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
- ::rtl::OUString LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
-
- uno::Reference < awt::XPatternField > xPF( getPeer(), uno::UNO_QUERY );
- if (xPF.is())
- {
- // same comment as in UnoControl::ImplSetPeerProperty - see there
- ::rtl::OUString sText( Text );
- ImplCheckLocalize( sText );
- xPF->setString( sText );
- xPF->setMasks( EditMask, LiteralMask );
- }
- }
- else
- UnoSpinFieldControl::ImplSetPeerProperty( rPropName, rVal );
-}
-
-
-// uno::XInterface
-uno::Any UnoPatternFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XPatternField*, this ) );
- return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoPatternFieldControl )
- getCppuType( ( uno::Reference< awt::XPatternField>* ) NULL ),
- UnoSpinFieldControl::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-void UnoPatternFieldControl::setString( const ::rtl::OUString& rString ) throw(uno::RuntimeException)
-{
- setText( rString );
-}
-
-::rtl::OUString UnoPatternFieldControl::getString() throw(uno::RuntimeException)
-{
- return getText();
-}
-
-void UnoPatternFieldControl::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= EditMask;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_EDITMASK ), aAny, sal_True );
- aAny <<= LiteralMask;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LITERALMASK ), aAny, sal_True );
-}
-
-void UnoPatternFieldControl::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(uno::RuntimeException)
-{
- EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
- LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
-}
-
-void UnoPatternFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= bStrict;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
-}
-
-sal_Bool UnoPatternFieldControl::isStrictFormat() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
-}
-
-
-// ----------------------------------------------------
-// class UnoControlProgressBarModel
-// ----------------------------------------------------
-UnoControlProgressBarModel::UnoControlProgressBarModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE );
- ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX );
- ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MIN );
-}
-
-::rtl::OUString UnoControlProgressBarModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlProgressBarModel );
-}
-
-uno::Any UnoControlProgressBarModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlProgressBar );
- return aAny;
- }
-
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlProgressBarModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlProgressBarModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-
-// ----------------------------------------------------
-// class UnoProgressBarControl
-// ----------------------------------------------------
-UnoProgressBarControl::UnoProgressBarControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlBase( i_factory )
-{
-}
-
-::rtl::OUString UnoProgressBarControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressBar"));
-}
-
-// uno::XInterface
-uno::Any UnoProgressBarControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XProgressBar*, this ) );
- return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoProgressBarControl )
- getCppuType( ( uno::Reference< awt::XProgressBar>* ) NULL ),
- UnoControlBase::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-// ::com::sun::star::awt::XProgressBar
-void UnoProgressBarControl::setForegroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= nColor;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_FILLCOLOR ), aAny, sal_True );
-}
-
-void UnoProgressBarControl::setBackgroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= nColor;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_BACKGROUNDCOLOR ), aAny, sal_True );
-}
-
-void UnoProgressBarControl::setValue( sal_Int32 nValue ) throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= nValue;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE ), aAny, sal_True );
-}
-
-void UnoProgressBarControl::setRange( sal_Int32 nMin, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException )
-{
- uno::Any aMin;
- uno::Any aMax;
-
- if ( nMin < nMax )
- {
- // take correct min and max
- aMin <<= nMin;
- aMax <<= nMax;
- }
- else
- {
- // change min and max
- aMin <<= nMax;
- aMax <<= nMin;
- }
-
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE_MIN ), aMin, sal_True );
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE_MAX ), aMax, sal_True );
-}
-
-sal_Int32 UnoProgressBarControl::getValue() throw(::com::sun::star::uno::RuntimeException)
-{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_PROGRESSVALUE );
-}
-
-
-// ----------------------------------------------------
-// class UnoControlFixedLineModel
-// ----------------------------------------------------
-UnoControlFixedLineModel::UnoControlFixedLineModel( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlModel( i_factory )
-{
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_LABEL );
- ImplRegisterProperty( BASEPROPERTY_ORIENTATION );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-}
-
-::rtl::OUString UnoControlFixedLineModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedLineModel );
-}
-
-uno::Any UnoControlFixedLineModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedLine );
- return aAny;
- }
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlFixedLineModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlFixedLineModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ----------------------------------------------------
-// class UnoFixedLineControl
-// ----------------------------------------------------
-UnoFixedLineControl::UnoFixedLineControl( const Reference< XMultiServiceFactory >& i_factory )
- :UnoControlBase( i_factory )
-{
- maComponentInfos.nWidth = 100; // ??
- maComponentInfos.nHeight = 100; // ??
-}
-
-::rtl::OUString UnoFixedLineControl::GetComponentServiceName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FixedLine"));
-}
-
-sal_Bool UnoFixedLineControl::isTransparent() throw(uno::RuntimeException)
-{
- return sal_True;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/accessibilityclient.cxx b/toolkit/source/helper/accessibilityclient.cxx
deleted file mode 100644
index c926ec25d8..0000000000
--- a/toolkit/source/helper/accessibilityclient.cxx
+++ /dev/null
@@ -1,280 +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/helper/accessibilityclient.hxx>
-#include <toolkit/helper/accessiblefactory.hxx>
-#include <osl/module.h>
-#include <osl/diagnose.h>
-#include <tools/solar.h>
-
-// #define UNLOAD_ON_LAST_CLIENT_DYING
- // this is not recommended currently. If enabled, the implementation will log
- // the number of active clients, and unload the acc library when the last client
- // goes away.
- // Sounds like a good idea, unfortunately, there's no guarantee that all objects
- // implemented in this library are already dead.
- // Iow, just because an object implementing an XAccessible (implemented in this lib
- // here) died, it's not said that everybody released all references to the
- // XAccessibleContext used by this component, and implemented in the acc lib.
- // So we cannot really unload the lib.
- //
- // Alternatively, if the lib would us own "usage counting", i.e. every component
- // implemented therein would affect a static ref count, the acc lib could care
- // for unloading itself.
-
-//........................................................................
-namespace toolkit
-{
-//........................................................................
-
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::accessibility;
-
- namespace
- {
-#ifdef UNLOAD_ON_LAST_CLIENT_DYING
- static oslInterlockedCount s_nAccessibilityClients = 0;
-#endif // UNLOAD_ON_LAST_CLIENT_DYING
- static oslModule s_hAccessibleImplementationModule = NULL;
- static GetStandardAccComponentFactory s_pAccessibleFactoryFunc = NULL;
- static ::rtl::Reference< IAccessibleFactory > s_pFactory;
- }
-
- //====================================================================
- //= AccessibleDummyFactory
- //====================================================================
- class AccessibleDummyFactory : public IAccessibleFactory
- {
- public:
- AccessibleDummyFactory();
-
- protected:
- virtual ~AccessibleDummyFactory();
-
- private:
- AccessibleDummyFactory( const AccessibleDummyFactory& ); // never implemented
- AccessibleDummyFactory& operator=( const AccessibleDummyFactory& ); // never implemented
-
- oslInterlockedCount m_refCount;
-
- public:
- // IReference
- virtual oslInterlockedCount SAL_CALL acquire();
- virtual oslInterlockedCount SAL_CALL release();
-
- // IAccessibleFactory
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXButton* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXCheckBox* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXRadioButton* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXListBox* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXFixedHyperlink* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXFixedText* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXScrollBar* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXEdit* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXComboBox* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXToolBox* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
- createAccessibleContext( VCLXWindow* /*_pXWindow*/ )
- {
- return NULL;
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- createAccessible( Menu* /*_pMenu*/, sal_Bool /*_bIsMenuBar*/ )
- {
- return NULL;
- }
- };
-
- //--------------------------------------------------------------------
- AccessibleDummyFactory::AccessibleDummyFactory()
- {
- }
-
- //--------------------------------------------------------------------
- AccessibleDummyFactory::~AccessibleDummyFactory()
- {
- }
-
- //--------------------------------------------------------------------
- oslInterlockedCount SAL_CALL AccessibleDummyFactory::acquire()
- {
- return osl_incrementInterlockedCount( &m_refCount );
- }
-
- //--------------------------------------------------------------------
- oslInterlockedCount SAL_CALL AccessibleDummyFactory::release()
- {
- if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
- {
- delete this;
- return 0;
- }
- return m_refCount;
- }
-
- //====================================================================
- //= AccessibilityClient
- //====================================================================
- //--------------------------------------------------------------------
- AccessibilityClient::AccessibilityClient()
- :m_bInitialized( false )
- {
- }
-
- //--------------------------------------------------------------------
- extern "C" { static void SAL_CALL thisModule() {} }
-
- void AccessibilityClient::ensureInitialized()
- {
- if ( m_bInitialized )
- return;
-
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-
-#ifdef UNLOAD_ON_LAST_CLIENT_DYING
- if ( 1 == osl_incrementInterlockedCount( &s_nAccessibilityClients ) )
- { // the first client
-#endif // UNLOAD_ON_LAST_CLIENT_DYING
- // load the library implementing the factory
- if ( !s_pFactory.get() )
- {
- const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM(
- SVLIBRARY( "acc" ))
- );
- s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
- if ( s_hAccessibleImplementationModule != NULL )
- {
- const ::rtl::OUString sFactoryCreationFunc =
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getStandardAccessibleFactory"));
- s_pAccessibleFactoryFunc = (GetStandardAccComponentFactory)
- osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData );
-
- }
- OSL_ENSURE( s_pAccessibleFactoryFunc, "AccessibilityClient::ensureInitialized: could not load the library, or not retrieve the needed symbol!" );
-
- // get a factory instance
- if ( s_pAccessibleFactoryFunc )
- {
- IAccessibleFactory* pFactory = static_cast< IAccessibleFactory* >( (*s_pAccessibleFactoryFunc)() );
- OSL_ENSURE( pFactory, "AccessibilityClient::ensureInitialized: no factory provided by the A11Y lib!" );
- if ( pFactory )
- {
- s_pFactory = pFactory;
- pFactory->release();
- }
- }
- }
-
- if ( !s_pFactory.get() )
- // the attempt to load the lib, or to create the factory, failed
- // -> fall back to a dummy factory
- s_pFactory = new AccessibleDummyFactory;
-#ifdef UNLOAD_ON_LAST_CLIENT_DYING
- }
-#endif
-
- m_bInitialized = true;
- }
-
- //--------------------------------------------------------------------
- AccessibilityClient::~AccessibilityClient()
- {
- if ( m_bInitialized )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-
-#ifdef UNLOAD_ON_LAST_CLIENT_DYING
- if( 0 == osl_decrementInterlockedCount( &s_nAccessibilityClients ) )
- {
- s_pFactory = NULL;
- s_pAccessibleFactoryFunc = NULL;
- if ( s_hAccessibleImplementationModule )
- {
- osl_unloadModule( s_hAccessibleImplementationModule );
- s_hAccessibleImplementationModule = NULL;
- }
- }
-#endif // UNLOAD_ON_LAST_CLIENT_DYING
- }
- }
-
- //--------------------------------------------------------------------
- IAccessibleFactory& AccessibilityClient::getFactory()
- {
- ensureInitialized();
- OSL_ENSURE( s_pFactory.is(), "AccessibilityClient::getFactory: at least a dummy factory should have been created!" );
- return *s_pFactory;
- }
-
-//........................................................................
-} // namespace toolkit
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/externallock.cxx b/toolkit/source/helper/externallock.cxx
deleted file mode 100644
index 33be3e7e5c..0000000000
--- a/toolkit/source/helper/externallock.cxx
+++ /dev/null
@@ -1,48 +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/helper/externallock.hxx>
-#include <osl/mutex.hxx>
-#include <vcl/svapp.hxx>
-
-// -----------------------------------------------------------------------------
-// class VCLExternalSolarLock
-// -----------------------------------------------------------------------------
-void VCLExternalSolarLock::acquire()
-{
- Application::GetSolarMutex().acquire();
-}
-// -----------------------------------------------------------------------------
-void VCLExternalSolarLock::release()
-{
- Application::GetSolarMutex().release();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/fixedhyperbase.cxx b/toolkit/source/helper/fixedhyperbase.cxx
deleted file mode 100644
index b9ce25f40f..0000000000
--- a/toolkit/source/helper/fixedhyperbase.cxx
+++ /dev/null
@@ -1,74 +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/helper/fixedhyperbase.hxx>
-
-//........................................................................
-namespace toolkit
-{
-//........................................................................
-
-// ----------------------------------------------------
-// class FixedHyperlinkBase
-// ----------------------------------------------------
-
-FixedHyperlinkBase::FixedHyperlinkBase( Window* pParent, const ResId& rId ) :
- FixedText( pParent, rId )
-{
-}
-
-FixedHyperlinkBase::FixedHyperlinkBase( Window* pParent, WinBits nWinStyle ) :
- FixedText( pParent, nWinStyle )
-{
-}
-
-FixedHyperlinkBase::~FixedHyperlinkBase()
-{
-}
-
-void FixedHyperlinkBase::SetURL( const String& )
-{
-}
-
-String FixedHyperlinkBase::GetURL() const
-{
- return String::EmptyString();
-}
-
-void FixedHyperlinkBase::SetDescription( const String& )
-{
-}
-
-//........................................................................
-} // namespace toolkit
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx
deleted file mode 100644
index 5cd82c0985..0000000000
--- a/toolkit/source/helper/formpdfexport.cxx
+++ /dev/null
@@ -1,628 +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/helper/formpdfexport.hxx>
-
-/** === begin UNO includes === **/
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/form/XForm.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/form/FormComponentType.hpp>
-#include <com/sun/star/awt/TextAlign.hpp>
-#include <com/sun/star/style/VerticalAlignment.hpp>
-#include <com/sun/star/form/FormButtonType.hpp>
-#include <com/sun/star/form/FormSubmitMethod.hpp>
-/** === end UNO includes === **/
-
-#include <toolkit/helper/vclunohelper.hxx>
-#include <vcl/pdfextoutdevdata.hxx>
-#include <vcl/outdev.hxx>
-
-#include <functional>
-#include <algorithm>
-
-//........................................................................
-namespace toolkitform
-{
-//........................................................................
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::awt;
- using namespace ::com::sun::star::style;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::form;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
-
- static const ::rtl::OUString FM_PROP_NAME(RTL_CONSTASCII_USTRINGPARAM("Name"));
-
- namespace
- {
- //--------------------------------------------------------------------
- /** determines the FormComponentType of a form control
- */
- sal_Int16 classifyFormControl( const Reference< XPropertySet >& _rxModel ) SAL_THROW(( Exception ))
- {
- static const ::rtl::OUString FM_PROP_CLASSID(RTL_CONSTASCII_USTRINGPARAM("ClassId"));
- sal_Int16 nControlType = FormComponentType::CONTROL;
-
- Reference< XPropertySetInfo > xPSI;
- if ( _rxModel.is() )
- xPSI = _rxModel->getPropertySetInfo();
- if ( xPSI.is() && xPSI->hasPropertyByName( FM_PROP_CLASSID ) )
- {
- OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_CLASSID ) >>= nControlType );
- }
-
- return nControlType;
- }
-
- //--------------------------------------------------------------------
- /** (default-)creates a PDF widget according to a given FormComponentType
- */
- ::vcl::PDFWriter::AnyWidget* createDefaultWidget( sal_Int16 _nFormComponentType )
- {
- switch ( _nFormComponentType )
- {
- case FormComponentType::COMMANDBUTTON:
- return new ::vcl::PDFWriter::PushButtonWidget;
- case FormComponentType::CHECKBOX:
- return new ::vcl::PDFWriter::CheckBoxWidget;
- case FormComponentType::RADIOBUTTON:
- return new ::vcl::PDFWriter::RadioButtonWidget;
- case FormComponentType::LISTBOX:
- return new ::vcl::PDFWriter::ListBoxWidget;
- case FormComponentType::COMBOBOX:
- return new ::vcl::PDFWriter::ComboBoxWidget;
-
- case FormComponentType::TEXTFIELD:
- case FormComponentType::FILECONTROL:
- case FormComponentType::DATEFIELD:
- case FormComponentType::TIMEFIELD:
- case FormComponentType::NUMERICFIELD:
- case FormComponentType::CURRENCYFIELD:
- case FormComponentType::PATTERNFIELD:
- return new ::vcl::PDFWriter::EditWidget;
- }
- return NULL;
- }
-
- //--------------------------------------------------------------------
- /** determines a unique number for the radio group which the given radio
- button model belongs to
-
- The number is guaranteed to be
- <ul><li>unique within the document in which the button lives</li>
- <li>the same for subsequent calls with other radio button models,
- which live in the same document, and belong to the same group</li>
- </ul>
-
- @precond
- the model must be part of the form component hierarchy in a document
- */
- sal_Int32 determineRadioGroupId( const Reference< XPropertySet >& _rxRadioModel ) SAL_THROW((Exception))
- {
- OSL_ENSURE( classifyFormControl( _rxRadioModel ) == FormComponentType::RADIOBUTTON,
- "determineRadioGroupId: this *is* no radio button model!" );
- // The fact that radio button groups need to be unique within the complete
- // host document makes it somewhat difficult ...
- // Problem is that two form radio buttons belong to the same group if
- // - they have the same parent
- // - AND they have the same name
- // This implies that we need some knowledge about (potentially) *all* radio button
- // groups in the document.
-
- // get the root-level container
- Reference< XChild > xChild( _rxRadioModel, UNO_QUERY );
- Reference< XForm > xParentForm( xChild.is() ? xChild->getParent() : Reference< XInterface >(), UNO_QUERY );
- OSL_ENSURE( xParentForm.is(), "determineRadioGroupId: no parent form -> group id!" );
- if ( !xParentForm.is() )
- return -1;
-
- while ( xParentForm.is() )
- {
- xChild = xParentForm.get();
- xParentForm = xParentForm.query( xChild->getParent() );
- }
- Reference< XIndexAccess > xRoot( xChild->getParent(), UNO_QUERY );
- OSL_ENSURE( xRoot.is(), "determineRadioGroupId: unable to determine the root of the form component hierarchy!" );
- if ( !xRoot.is() )
- return -1;
-
- // count the leafs in the hierarchy, until we encounter radio button
- ::std::vector< Reference< XIndexAccess > > aAncestors;
- ::std::vector< sal_Int32 > aPath;
-
- Reference< XInterface > xNormalizedLookup( _rxRadioModel, UNO_QUERY );
- ::rtl::OUString sRadioGroupName;
- OSL_VERIFY( _rxRadioModel->getPropertyValue( FM_PROP_NAME ) >>= sRadioGroupName );
-
- Reference< XIndexAccess > xCurrentContainer( xRoot );
- sal_Int32 nStartWithChild = 0;
- sal_Int32 nGroupsEncountered = 0;
- do
- {
- Reference< XNameAccess > xElementNameAccess( xCurrentContainer, UNO_QUERY );
- OSL_ENSURE( xElementNameAccess.is(), "determineRadioGroupId: no name container?" );
- if ( !xElementNameAccess.is() )
- return -1;
-
- if ( nStartWithChild == 0 )
- { // we encounter this container the first time. In particular, we did not
- // just step up
- nGroupsEncountered += xElementNameAccess->getElementNames().getLength();
- // this is way too much: Not all of the elements in the current container
- // may form groups, especially if they're forms. But anyway, this number is
- // sufficient for our purpose. Finally, the container contains *at most*
- // that much groups
- }
-
- sal_Int32 nCount = xCurrentContainer->getCount();
- sal_Int32 i;
- for ( i = nStartWithChild; i < nCount; ++i )
- {
- Reference< XInterface > xElement( xCurrentContainer->getByIndex( i ), UNO_QUERY );
- if ( !xElement.is() )
- {
- OSL_FAIL( "determineRadioGroupId: very suspicious!" );
- continue;
- }
-
- Reference< XIndexAccess > xNewContainer( xElement, UNO_QUERY );
- if ( xNewContainer.is() )
- {
- // step down the hierarchy
- aAncestors.push_back( xCurrentContainer );
- xCurrentContainer = xNewContainer;
- aPath.push_back( i );
- nStartWithChild = 0;
- break;
- // out of the inner loop, but continue with the outer loop
- }
-
- if ( xElement.get() == xNormalizedLookup.get() )
- {
- // look up the name of the radio group in the list of all element names
- Sequence< ::rtl::OUString > aElementNames( xElementNameAccess->getElementNames() );
- const ::rtl::OUString* pElementNames = aElementNames.getConstArray();
- const ::rtl::OUString* pElementNamesEnd = pElementNames + aElementNames.getLength();
- while ( pElementNames != pElementNamesEnd )
- {
- if ( *pElementNames == sRadioGroupName )
- {
- sal_Int32 nLocalGroupIndex = pElementNames - aElementNames.getConstArray();
- OSL_ENSURE( nLocalGroupIndex < xElementNameAccess->getElementNames().getLength(),
- "determineRadioGroupId: inconsistency!" );
-
- sal_Int32 nGlobalGroupId = nGroupsEncountered - xElementNameAccess->getElementNames().getLength() + nLocalGroupIndex;
- return nGlobalGroupId;
- }
- ++pElementNames;
- }
- OSL_FAIL( "determineRadioGroupId: did not find the radios element name!" );
- }
- }
-
- if ( !( i < nCount ) )
- {
- // the loop terminated because there were no more elements
- // -> step up, if possible
- if ( aAncestors.empty() )
- break;
-
- xCurrentContainer = aAncestors.back(); aAncestors.pop_back();
- nStartWithChild = aPath.back() + 1; aPath.pop_back();
- }
- }
- while ( true );
- return -1;
- }
-
- //--------------------------------------------------------------------
- /** copies a StringItemList to a PDF widget's list
- */
- void getStringItemVector( const Reference< XPropertySet >& _rxModel, ::std::vector< ::rtl::OUString >& _rVector )
- {
- static const ::rtl::OUString FM_PROP_STRINGITEMLIST(RTL_CONSTASCII_USTRINGPARAM("StringItemList"));
- Sequence< ::rtl::OUString > aListEntries;
- OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_STRINGITEMLIST ) >>= aListEntries );
- ::std::copy( aListEntries.getConstArray(), aListEntries.getConstArray() + aListEntries.getLength(),
- ::std::back_insert_iterator< ::std::vector< ::rtl::OUString > >( _rVector ) );
- }
- }
-
- //--------------------------------------------------------------------
- /** creates a PDF compatible control descriptor for the given control
- */
- void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl,
- ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor, ::vcl::PDFExtOutDevData& i_pdfExportData ) SAL_THROW(())
- {
- _rpDescriptor.reset( NULL );
- OSL_ENSURE( _rxControl.is(), "describePDFControl: invalid (NULL) control!" );
- if ( !_rxControl.is() )
- return;
-
- try
- {
- Reference< XPropertySet > xModelProps( _rxControl->getModel(), UNO_QUERY );
- sal_Int16 nControlType = classifyFormControl( xModelProps );
- _rpDescriptor.reset( createDefaultWidget( nControlType ) );
- if ( !_rpDescriptor.get() )
- // no PDF widget available for this
- return;
-
- Reference< XPropertySetInfo > xPSI( xModelProps->getPropertySetInfo() );
- Reference< XServiceInfo > xSI( xModelProps, UNO_QUERY );
- OSL_ENSURE( xSI.is(), "describePDFControl: no service info!" );
- // if we survived classifyFormControl, then it's a real form control, and they all have
- // service infos
-
- // ================================
- // set the common widget properties
-
- // --------------------------------
- // Name, Description, Text
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_NAME ) >>= _rpDescriptor->Name );
- static const ::rtl::OUString FM_PROP_HELPTEXT(RTL_CONSTASCII_USTRINGPARAM("HelpText"));
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_HELPTEXT ) >>= _rpDescriptor->Description );
- Any aText;
- static const ::rtl::OUString FM_PROP_TEXT(RTL_CONSTASCII_USTRINGPARAM("Text"));
- static const ::rtl::OUString FM_PROP_LABEL(RTL_CONSTASCII_USTRINGPARAM("Label"));
- if ( xPSI->hasPropertyByName( FM_PROP_TEXT ) )
- aText = xModelProps->getPropertyValue( FM_PROP_TEXT );
- else if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) )
- aText = xModelProps->getPropertyValue( FM_PROP_LABEL );
- if ( aText.hasValue() )
- OSL_VERIFY( aText >>= _rpDescriptor->Text );
-
- // --------------------------------
- // readonly
- static const ::rtl::OUString FM_PROP_READONLY(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
- if ( xPSI->hasPropertyByName( FM_PROP_READONLY ) )
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_READONLY ) >>= _rpDescriptor->ReadOnly );
-
- // --------------------------------
- // border
- {
- static const ::rtl::OUString FM_PROP_BORDER(RTL_CONSTASCII_USTRINGPARAM("Border"));
- if ( xPSI->hasPropertyByName( FM_PROP_BORDER ) )
- {
- sal_Int16 nBorderType = 0;
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_BORDER ) >>= nBorderType );
- _rpDescriptor->Border = ( nBorderType != 0 );
-
- ::rtl::OUString sBorderColorPropertyName( RTL_CONSTASCII_USTRINGPARAM( "BorderColor" ) );
- if ( xPSI->hasPropertyByName( sBorderColorPropertyName ) )
- {
- sal_Int32 nBoderColor = COL_TRANSPARENT;
- if ( xModelProps->getPropertyValue( sBorderColorPropertyName ) >>= nBoderColor )
- _rpDescriptor->BorderColor = Color( nBoderColor );
- else
- _rpDescriptor->BorderColor = Color( COL_BLACK );
- }
- }
- }
-
- // --------------------------------
- // background color
- static const ::rtl::OUString FM_PROP_BACKGROUNDCOLOR(RTL_CONSTASCII_USTRINGPARAM("BackgroundColor"));
- if ( xPSI->hasPropertyByName( FM_PROP_BACKGROUNDCOLOR ) )
- {
- sal_Int32 nBackColor = COL_TRANSPARENT;
- xModelProps->getPropertyValue( FM_PROP_BACKGROUNDCOLOR ) >>= nBackColor;
- _rpDescriptor->Background = true;
- _rpDescriptor->BackgroundColor = Color( nBackColor );
- }
-
- // --------------------------------
- // text color
- static const ::rtl::OUString FM_PROP_TEXTCOLOR(RTL_CONSTASCII_USTRINGPARAM("TextColor"));
- if ( xPSI->hasPropertyByName( FM_PROP_TEXTCOLOR ) )
- {
- sal_Int32 nTextColor = COL_TRANSPARENT;
- xModelProps->getPropertyValue( FM_PROP_TEXTCOLOR ) >>= nTextColor;
- _rpDescriptor->TextColor = Color( nTextColor );
- }
-
- // --------------------------------
- // text style
- _rpDescriptor->TextStyle = 0;
- // ............................
- // multi line and word break
- // The MultiLine property of the control is mapped to both the "MULTILINE" and
- // "WORDBREAK" style flags
- static const ::rtl::OUString FM_PROP_MULTILINE(RTL_CONSTASCII_USTRINGPARAM("MultiLine"));
- if ( xPSI->hasPropertyByName( FM_PROP_MULTILINE ) )
- {
- sal_Bool bMultiLine = sal_False;
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_MULTILINE ) >>= bMultiLine );
- if ( bMultiLine )
- _rpDescriptor->TextStyle |= TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK;
- }
- // ............................
- // horizontal alignment
- static const ::rtl::OUString FM_PROP_ALIGN(RTL_CONSTASCII_USTRINGPARAM("Align"));
- if ( xPSI->hasPropertyByName( FM_PROP_ALIGN ) )
- {
- sal_Int16 nAlign = awt::TextAlign::LEFT;
- xModelProps->getPropertyValue( FM_PROP_ALIGN ) >>= nAlign;
- // TODO: when the property is VOID - are there situations/UIs where this
- // means something else than LEFT?
- switch ( nAlign )
- {
- case awt::TextAlign::LEFT: _rpDescriptor->TextStyle |= TEXT_DRAW_LEFT; break;
- case awt::TextAlign::CENTER: _rpDescriptor->TextStyle |= TEXT_DRAW_CENTER; break;
- case awt::TextAlign::RIGHT: _rpDescriptor->TextStyle |= TEXT_DRAW_RIGHT; break;
- default:
- OSL_FAIL( "describePDFControl: invalid text align!" );
- }
- }
- // ............................
- // vertical alignment
- {
- ::rtl::OUString sVertAlignPropertyName( RTL_CONSTASCII_USTRINGPARAM( "VerticalAlign" ) );
- if ( xPSI->hasPropertyByName( sVertAlignPropertyName ) )
- {
- sal_Int16 nAlign = VerticalAlignment_MIDDLE;
- xModelProps->getPropertyValue( sVertAlignPropertyName ) >>= nAlign;
- switch ( nAlign )
- {
- case VerticalAlignment_TOP: _rpDescriptor->TextStyle |= TEXT_DRAW_TOP; break;
- case VerticalAlignment_MIDDLE: _rpDescriptor->TextStyle |= TEXT_DRAW_VCENTER; break;
- case VerticalAlignment_BOTTOM: _rpDescriptor->TextStyle |= TEXT_DRAW_BOTTOM; break;
- default:
- OSL_FAIL( "describePDFControl: invalid vertical text align!" );
- }
- }
- }
-
- // font
- static const ::rtl::OUString FM_PROP_FONT(RTL_CONSTASCII_USTRINGPARAM("FontDescriptor"));
- if ( xPSI->hasPropertyByName( FM_PROP_FONT ) )
- {
- FontDescriptor aUNOFont;
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_FONT ) >>= aUNOFont );
- _rpDescriptor->TextFont = VCLUnoHelper::CreateFont( aUNOFont, Font() );
- }
-
- // tab order
- rtl::OUString aTabIndexString( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) );
- if ( xPSI->hasPropertyByName( aTabIndexString ) )
- {
- sal_Int16 nIndex = -1;
- OSL_VERIFY( xModelProps->getPropertyValue( aTabIndexString ) >>= nIndex );
- _rpDescriptor->TabOrder = nIndex;
- }
-
- // ================================
- // special widget properties
- // --------------------------------
- // edits
- if ( _rpDescriptor->getType() == ::vcl::PDFWriter::Edit )
- {
- ::vcl::PDFWriter::EditWidget* pEditWidget = static_cast< ::vcl::PDFWriter::EditWidget* >( _rpDescriptor.get() );
- // ............................
- // multiline (already flagged in the TextStyle)
- pEditWidget->MultiLine = ( _rpDescriptor->TextStyle & TEXT_DRAW_MULTILINE ) != 0;
- // ............................
- // password input
- ::rtl::OUString sEchoCharPropName( RTL_CONSTASCII_USTRINGPARAM( "EchoChar" ) );
- if ( xPSI->hasPropertyByName( sEchoCharPropName ) )
- {
- sal_Int16 nEchoChar = 0;
- if ( ( xModelProps->getPropertyValue( sEchoCharPropName ) >>= nEchoChar ) && ( nEchoChar != 0 ) )
- pEditWidget->Password = true;
- }
- // ............................
- // file select
- static const ::rtl::OUString FM_SUN_COMPONENT_FILECONTROL(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FileControl"));
- if ( xSI->supportsService( FM_SUN_COMPONENT_FILECONTROL ) )
- pEditWidget->FileSelect = true;
- // ............................
- // maximum text length
- static const ::rtl::OUString FM_PROP_MAXTEXTLEN(RTL_CONSTASCII_USTRINGPARAM("MaxTextLen"));
- if ( xPSI->hasPropertyByName( FM_PROP_MAXTEXTLEN ) )
- {
- sal_Int16 nMaxTextLength = 0;
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_MAXTEXTLEN ) >>= nMaxTextLength );
- if ( nMaxTextLength <= 0 )
- // "-1" has a special meaning for database-bound controls
- nMaxTextLength = 0;
- pEditWidget->MaxLen = nMaxTextLength;
- }
- }
-
- // --------------------------------
- // buttons
- if ( _rpDescriptor->getType() == ::vcl::PDFWriter::PushButton )
- {
- ::vcl::PDFWriter::PushButtonWidget* pButtonWidget = static_cast< ::vcl::PDFWriter::PushButtonWidget* >( _rpDescriptor.get() );
- FormButtonType eButtonType = FormButtonType_PUSH;
- OSL_VERIFY( xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) ) ) >>= eButtonType );
- static const ::rtl::OUString FM_PROP_TARGET_URL(RTL_CONSTASCII_USTRINGPARAM("TargetURL"));
- if ( eButtonType == FormButtonType_SUBMIT )
- {
- // if a button is a submit button, then it uses the URL at it's parent form
- Reference< XChild > xChild( xModelProps, UNO_QUERY );
- Reference < XPropertySet > xParentProps;
- if ( xChild.is() )
- xParentProps = xParentProps.query( xChild->getParent() );
- if ( xParentProps.is() )
- {
- Reference< XServiceInfo > xParentSI( xParentProps, UNO_QUERY );
- if ( xParentSI.is() && xParentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.HTMLForm" ) ) ) )
- {
- OSL_VERIFY( xParentProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= pButtonWidget->URL );
- pButtonWidget->Submit = true;
- FormSubmitMethod eMethod = FormSubmitMethod_POST;
- OSL_VERIFY( xParentProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SubmitMethod" ) ) ) >>= eMethod );
- pButtonWidget->SubmitGet = (eMethod == FormSubmitMethod_GET);
- }
- }
- }
- else if ( eButtonType == FormButtonType_URL )
- {
- ::rtl::OUString sURL;
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= sURL );
- const bool bDocumentLocalTarget = ( sURL.getLength() > 0 ) && ( sURL.getStr()[0] == '#' );
- if ( bDocumentLocalTarget )
- {
- const ::rtl::OUString sDestinationName( sURL.copy(1) );
- // Register the destination for for future handling ...
- pButtonWidget->Dest = i_pdfExportData.RegisterDest();
-
- // and put it into the bookmarks, to ensure the future handling really happens
- ::std::vector< ::vcl::PDFExtOutDevBookmarkEntry >& rBookmarks( i_pdfExportData.GetBookmarks() );
- ::vcl::PDFExtOutDevBookmarkEntry aBookmark;
- aBookmark.nDestId = pButtonWidget->Dest;
- aBookmark.aBookmark = sURL;
- rBookmarks.push_back( aBookmark );
- }
- else
- pButtonWidget->URL = sURL;
-
- pButtonWidget->Submit = false;
- }
-
- // TODO:
- // In PDF files, buttons are either reset, url or submit buttons. So if we have a simple PUSH button
- // in a document, then this means that we do not export a SubmitToURL, which means that in PDF,
- // the button is used as reset button.
- // Is this desired? If no, we would have to reset _rpDescriptor to NULL here, in case eButtonType
- // != FormButtonType_SUBMIT && != FormButtonType_RESET
-
- // the PDF exporter defaults the text style, if 0. To prevent this, we have to transfer the UNO
- // defaults to the PDF widget
- if ( !pButtonWidget->TextStyle )
- pButtonWidget->TextStyle = TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER;
- }
-
- // --------------------------------
- // check boxes
- static const ::rtl::OUString FM_PROP_STATE(RTL_CONSTASCII_USTRINGPARAM("State"));
- if ( _rpDescriptor->getType() == ::vcl::PDFWriter::CheckBox )
- {
- ::vcl::PDFWriter::CheckBoxWidget* pCheckBoxWidget = static_cast< ::vcl::PDFWriter::CheckBoxWidget* >( _rpDescriptor.get() );
- sal_Int16 nState = 0;
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_STATE ) >>= nState );
- pCheckBoxWidget->Checked = ( nState != 0 );
- }
-
- // --------------------------------
- // radio buttons
- if ( _rpDescriptor->getType() == ::vcl::PDFWriter::RadioButton )
- {
- ::vcl::PDFWriter::RadioButtonWidget* pRadioWidget = static_cast< ::vcl::PDFWriter::RadioButtonWidget* >( _rpDescriptor.get() );
- sal_Int16 nState = 0;
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_STATE ) >>= nState );
- pRadioWidget->Selected = ( nState != 0 );
- pRadioWidget->RadioGroup = determineRadioGroupId( xModelProps );
- try
- {
- static const ::rtl::OUString FM_PROP_REFVALUE(RTL_CONSTASCII_USTRINGPARAM("RefValue"));
- xModelProps->getPropertyValue( FM_PROP_REFVALUE ) >>= pRadioWidget->OnValue;
- }
- catch(...)
- {
- pRadioWidget->OnValue = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "On" ) );
- }
- }
-
- // --------------------------------
- // list boxes
- if ( _rpDescriptor->getType() == ::vcl::PDFWriter::ListBox )
- {
- ::vcl::PDFWriter::ListBoxWidget* pListWidget = static_cast< ::vcl::PDFWriter::ListBoxWidget* >( _rpDescriptor.get() );
- // ............................
- // drop down
- static const ::rtl::OUString FM_PROP_DROPDOWN(RTL_CONSTASCII_USTRINGPARAM("Dropdown"));
- OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_DROPDOWN ) >>= pListWidget->DropDown );
- // ............................
- // multi selection
- OSL_VERIFY( xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= pListWidget->MultiSelect );
- // ............................
- // entries
- getStringItemVector( xModelProps, pListWidget->Entries );
- // since we explicitly list the entries in the order in which they appear, they should not be
- // resorted by the PDF viewer
- pListWidget->Sort = false;
-
- // get selected items
- Sequence< sal_Int16 > aSelectIndices;
- OSL_VERIFY( xModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= aSelectIndices );
- if( aSelectIndices.getLength() > 0 )
- {
- pListWidget->SelectedEntries.resize( 0 );
- for( sal_Int32 i = 0; i < aSelectIndices.getLength(); i++ )
- {
- sal_Int16 nIndex = aSelectIndices.getConstArray()[i];
- if( nIndex >= 0 && nIndex < (sal_Int16)pListWidget->Entries.size() )
- pListWidget->SelectedEntries.push_back( nIndex );
- }
- }
- }
-
- // --------------------------------
- // combo boxes
- if ( _rpDescriptor->getType() == ::vcl::PDFWriter::ComboBox )
- {
- ::vcl::PDFWriter::ComboBoxWidget* pComboWidget = static_cast< ::vcl::PDFWriter::ComboBoxWidget* >( _rpDescriptor.get() );
- // ............................
- // entries
- getStringItemVector( xModelProps, pComboWidget->Entries );
- // same reasoning as above
- pComboWidget->Sort = false;
- }
-
- // ================================
- // some post-processing
- // --------------------------------
- // text line ends
- // some controls may (always or dependent on other settings) return UNIX line ends
- String aConverter( _rpDescriptor->Text );
- _rpDescriptor->Text = aConverter.ConvertLineEnd( LINEEND_CRLF );
- }
- catch( const Exception& )
- {
- OSL_FAIL( "describePDFControl: caught an exception!" );
- }
- }
-
-//........................................................................
-} // namespace toolkitform
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/imagealign.cxx b/toolkit/source/helper/imagealign.cxx
deleted file mode 100644
index e95d104561..0000000000
--- a/toolkit/source/helper/imagealign.cxx
+++ /dev/null
@@ -1,138 +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/helper/imagealign.hxx>
-#include <com/sun/star/awt/ImagePosition.hpp>
-#include <com/sun/star/awt/ImageAlign.hpp>
-
-//........................................................................
-namespace toolkit
-{
-//........................................................................
-
- using namespace ::com::sun::star::awt::ImagePosition;
- using namespace ::com::sun::star::awt::ImageAlign;
-
- sal_Int16 translateImagePosition( ImageAlign _eVCLAlign )
- {
- sal_Int16 nReturn = AboveCenter;
- switch ( _eVCLAlign )
- {
- case IMAGEALIGN_LEFT: nReturn = LeftCenter; break;
- case IMAGEALIGN_TOP: nReturn = AboveCenter; break;
- case IMAGEALIGN_RIGHT: nReturn = RightCenter; break;
- case IMAGEALIGN_BOTTOM: nReturn = BelowCenter; break;
- case IMAGEALIGN_LEFT_TOP: nReturn = LeftTop; break;
- case IMAGEALIGN_LEFT_BOTTOM: nReturn = LeftBottom; break;
- case IMAGEALIGN_TOP_LEFT: nReturn = AboveLeft; break;
- case IMAGEALIGN_TOP_RIGHT: nReturn = AboveRight; break;
- case IMAGEALIGN_RIGHT_TOP: nReturn = RightTop; break;
- case IMAGEALIGN_RIGHT_BOTTOM: nReturn = RightBottom; break;
- case IMAGEALIGN_BOTTOM_LEFT: nReturn = BelowLeft; break;
- case IMAGEALIGN_BOTTOM_RIGHT: nReturn = BelowRight; break;
- case IMAGEALIGN_CENTER: nReturn = Centered; break;
- default:
- OSL_FAIL( "translateImagePosition: unknown IMAGEALIGN value!" );
- }
- return nReturn;
- }
-
- ImageAlign translateImagePosition( sal_Int16 _eUNOAlign )
- {
- ImageAlign nReturn = IMAGEALIGN_TOP;
- switch ( _eUNOAlign )
- {
- case LeftCenter: nReturn = IMAGEALIGN_LEFT; break;
- case AboveCenter: nReturn = IMAGEALIGN_TOP; break;
- case RightCenter: nReturn = IMAGEALIGN_RIGHT; break;
- case BelowCenter: nReturn = IMAGEALIGN_BOTTOM; break;
- case LeftTop: nReturn = IMAGEALIGN_LEFT_TOP; break;
- case LeftBottom: nReturn = IMAGEALIGN_LEFT_BOTTOM; break;
- case AboveLeft: nReturn = IMAGEALIGN_TOP_LEFT; break;
- case AboveRight: nReturn = IMAGEALIGN_TOP_RIGHT; break;
- case RightTop: nReturn = IMAGEALIGN_RIGHT_TOP; break;
- case RightBottom: nReturn = IMAGEALIGN_RIGHT_BOTTOM; break;
- case BelowLeft: nReturn = IMAGEALIGN_BOTTOM_LEFT; break;
- case BelowRight: nReturn = IMAGEALIGN_BOTTOM_RIGHT; break;
- case Centered: nReturn = IMAGEALIGN_CENTER; break;
- default:
- OSL_FAIL( "translateImagePosition: unknown css.awt.ImagePosition value!" );
- }
- return nReturn;
- }
-
- sal_Int16 getCompatibleImageAlign( ImageAlign _eAlign )
- {
- sal_Int16 nReturn = TOP;
- switch ( _eAlign )
- {
- case IMAGEALIGN_LEFT_TOP:
- case IMAGEALIGN_LEFT:
- case IMAGEALIGN_LEFT_BOTTOM: nReturn = LEFT; break;
-
- case IMAGEALIGN_TOP_LEFT:
- case IMAGEALIGN_TOP:
- case IMAGEALIGN_TOP_RIGHT: nReturn = TOP; break;
-
- case IMAGEALIGN_RIGHT_TOP:
- case IMAGEALIGN_RIGHT:
- case IMAGEALIGN_RIGHT_BOTTOM: nReturn = RIGHT; break;
-
- case IMAGEALIGN_BOTTOM_LEFT:
- case IMAGEALIGN_BOTTOM:
- case IMAGEALIGN_BOTTOM_RIGHT: nReturn = BOTTOM; break;
-
- case IMAGEALIGN_CENTER: nReturn = TOP; break;
- default:
- OSL_FAIL( "getCompatibleImageAlign: unknown IMAGEALIGN value!" );
- }
- return nReturn;
- }
-
- sal_Int16 getExtendedImagePosition( sal_Int16 _nImageAlign )
- {
- sal_Int16 nReturn = AboveCenter;
- switch ( _nImageAlign )
- {
- case LEFT: nReturn = LeftCenter; break;
- case TOP: nReturn = AboveCenter; break;
- case RIGHT: nReturn = RightCenter; break;
- case BOTTOM: nReturn = BelowCenter; break;
- default:
- OSL_FAIL( "getExtendedImagePosition: unknown ImageAlign value!" );
- }
- return nReturn;
- }
-
-//........................................................................
-} // namespace toolkit
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
deleted file mode 100644
index 4ca367b79e..0000000000
--- a/toolkit/source/helper/listenermultiplexer.cxx
+++ /dev/null
@@ -1,235 +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/helper/listenermultiplexer.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-
-// ----------------------------------------------------
-// class ListenerMultiplexerBase
-// ----------------------------------------------------
-ListenerMultiplexerBase::ListenerMultiplexerBase( ::cppu::OWeakObject& rSource )
- : ::cppu::OInterfaceContainerHelper( GetMutex() ), mrContext( rSource )
-{
-}
-
-ListenerMultiplexerBase::~ListenerMultiplexerBase()
-{
-}
-
-// ::com::sun::star::uno::XInterface
-::com::sun::star::uno::Any ListenerMultiplexerBase::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, this ) );
-}
-
-
-// ----------------------------------------------------
-// class EventListenerMultiplexer
-// ----------------------------------------------------
-EventListenerMultiplexer::EventListenerMultiplexer( ::cppu::OWeakObject& rSource )
- : ListenerMultiplexerBase( rSource )
-{
-}
-
-// ::com::sun::star::uno::XInterface
-::com::sun::star::uno::Any EventListenerMultiplexer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ) );
- return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType ));
-}
-
-// ::com::sun::star::lang::XEventListener
-void EventListenerMultiplexer::disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException)
-{
-}
-
-// ----------------------------------------------------
-// class FocusListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener, focusGained, ::com::sun::star::awt::FocusEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener, focusLost, ::com::sun::star::awt::FocusEvent )
-
-// ----------------------------------------------------
-// class WindowListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowResized, ::com::sun::star::awt::WindowEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowMoved, ::com::sun::star::awt::WindowEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowShown, ::com::sun::star::lang::EventObject )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowHidden, ::com::sun::star::lang::EventObject )
-
-// ----------------------------------------------------
-// class VclContainerListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener, windowAdded, ::com::sun::star::awt::VclContainerEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener, windowRemoved, ::com::sun::star::awt::VclContainerEvent )
-
-// ----------------------------------------------------
-// class KeyListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener, keyPressed, ::com::sun::star::awt::KeyEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener, keyReleased, ::com::sun::star::awt::KeyEvent )
-
-// ----------------------------------------------------
-// class MouseListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mousePressed, ::com::sun::star::awt::MouseEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseReleased, ::com::sun::star::awt::MouseEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseEntered, ::com::sun::star::awt::MouseEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseExited, ::com::sun::star::awt::MouseEvent )
-
-// ----------------------------------------------------
-// class MouseMotionListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener, mouseDragged, ::com::sun::star::awt::MouseEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener, mouseMoved, ::com::sun::star::awt::MouseEvent )
-
-// ----------------------------------------------------
-// class PaintListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener, windowPaint, ::com::sun::star::awt::PaintEvent )
-
-// ----------------------------------------------------
-// class TopWindowListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowOpened, ::com::sun::star::lang::EventObject )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowClosing, ::com::sun::star::lang::EventObject )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowClosed, ::com::sun::star::lang::EventObject )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowMinimized, ::com::sun::star::lang::EventObject )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowNormalized, ::com::sun::star::lang::EventObject )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowActivated, ::com::sun::star::lang::EventObject )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowDeactivated, ::com::sun::star::lang::EventObject )
-
-// ----------------------------------------------------
-// class TextListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener, textChanged, ::com::sun::star::awt::TextEvent )
-
-// ----------------------------------------------------
-// class ActionListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener, actionPerformed, ::com::sun::star::awt::ActionEvent )
-
-// ----------------------------------------------------
-// class ItemListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener, itemStateChanged, ::com::sun::star::awt::ItemEvent )
-
-// ----------------------------------------------------
-// class TabListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener )
-void TabListenerMultiplexer::inserted( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
-IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, inserted, ::sal_Int32 )
-void TabListenerMultiplexer::removed( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
-IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, removed, ::sal_Int32 )
-void TabListenerMultiplexer::changed( sal_Int32 evt, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& evt2 ) throw(::com::sun::star::uno::RuntimeException)
-IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_2PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, changed, ::sal_Int32, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > )
-void TabListenerMultiplexer::activated( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
-IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, activated, ::sal_Int32 )
-void TabListenerMultiplexer::deactivated( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
-IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, deactivated, ::sal_Int32 )
-
-// ----------------------------------------------------
-// class ContainerListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementInserted, ::com::sun::star::container::ContainerEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementRemoved, ::com::sun::star::container::ContainerEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementReplaced, ::com::sun::star::container::ContainerEvent )
-
-// ----------------------------------------------------
-// class SpinListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, up, ::com::sun::star::awt::SpinEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, down, ::com::sun::star::awt::SpinEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, first, ::com::sun::star::awt::SpinEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, last, ::com::sun::star::awt::SpinEvent )
-
-// ----------------------------------------------------
-// class AdjustmentListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener, adjustmentValueChanged, ::com::sun::star::awt::AdjustmentEvent )
-
-// ----------------------------------------------------
-// class MenuListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, highlight, ::com::sun::star::awt::MenuEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, select, ::com::sun::star::awt::MenuEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, activate, ::com::sun::star::awt::MenuEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, deactivate, ::com::sun::star::awt::MenuEvent )
-
-// ----------------------------------------------------
-// class TreeSelectionListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeSelectionListenerMultiplexer, ::com::sun::star::view::XSelectionChangeListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeSelectionListenerMultiplexer, ::com::sun::star::view::XSelectionChangeListener, selectionChanged, ::com::sun::star::lang::EventObject )
-
-// ----------------------------------------------------
-// class TreeSelectionListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, requestChildNodes, ::com::sun::star::awt::tree::TreeExpansionEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeExpanding, ::com::sun::star::awt::tree::TreeExpansionEvent, ::com::sun::star::awt::tree::ExpandVetoException )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeCollapsing, ::com::sun::star::awt::tree::TreeExpansionEvent, ::com::sun::star::awt::tree::ExpandVetoException )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeExpanded, ::com::sun::star::awt::tree::TreeExpansionEvent )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeCollapsed, ::com::sun::star::awt::tree::TreeExpansionEvent )
-
-// ----------------------------------------------------
-// class TreeEditListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer, ::com::sun::star::awt::tree::XTreeEditListener )
-
-// ----------------------------------------------------
-// class SelectionListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent )
-
-// ----------------------------------------------------
-// class SelectionListenerMultiplexer
-// ----------------------------------------------------
-IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener )
-IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener, tabPageActivated, ::com::sun::star::awt::tab::TabPageActivatedEvent )
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
deleted file mode 100644
index a7ff7832d7..0000000000
--- a/toolkit/source/helper/property.cxx
+++ /dev/null
@@ -1,415 +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/helper/property.hxx>
-#include <toolkit/helper/macros.hxx>
-#include <osl/mutex.hxx>
-
-#include <stdlib.h> // qsort/bsearch
-#include <tools/debug.hxx>
-#include <com/sun/star/awt/FontWeight.hpp>
-#include <com/sun/star/awt/FontSlant.hpp>
-#include <com/sun/star/awt/CharSet.hpp>
-#include <com/sun/star/awt/FontDescriptor.hpp>
-#include <com/sun/star/awt/FontWidth.hpp>
-#include <com/sun/star/awt/FontType.hpp>
-#include <com/sun/star/awt/FontUnderline.hpp>
-#include <com/sun/star/awt/FontStrikeout.hpp>
-#include <com/sun/star/awt/FontPitch.hpp>
-#include <com/sun/star/awt/XDevice.hpp>
-#include <com/sun/star/awt/tree/XTreeDataModel.hpp>
-#include <com/sun/star/awt/grid/XGridDataModel.hpp>
-#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
-#include <com/sun/star/view/SelectionType.hpp>
-#include <com/sun/star/style/VerticalAlignment.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <com/sun/star/resource/XStringResourceResolver.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <comphelper/types.hxx>
-#include <functional>
-#include <algorithm>
-#include <toolkit/helper/property.hxx>
-
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::awt::XDevice;
-using ::com::sun::star::awt::FontDescriptor;
-using ::com::sun::star::style::VerticalAlignment;
-using ::com::sun::star::graphic::XGraphic;
-
-struct ImplPropertyInfo
-{
- ::rtl::OUString aName;
- sal_uInt16 nPropId;
- ::com::sun::star::uno::Type aType;
- sal_Int16 nAttribs;
- sal_Bool bDependsOnOthers; // eg. VALUE depends on MIN/MAX and must be set after MIN/MAX.
-
- ImplPropertyInfo()
- {
- nPropId = 0;
- nAttribs = 0;
- bDependsOnOthers = sal_False;
- }
-
- ImplPropertyInfo( const sal_Unicode* pName, sal_uInt16 nId, const ::com::sun::star::uno::Type& rType,
- sal_Int16 nAttrs, sal_Bool bDepends = sal_False )
- : aName( pName )
- {
- nPropId = nId;
- aType = rType;
- nAttribs = nAttrs;
- bDependsOnOthers = bDepends;
- }
-
-};
-
-#define DECL_PROP_1( asciiname, id, type, attrib1 ) \
- ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 )
-#define DECL_PROP_2( asciiname, id, type, attrib1, attrib2 ) \
- ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 )
-#define DECL_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \
- ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 )
-#define DECL_PROP_4( asciiname, id, type, attrib1, attrib2, attrib3, attrib4 ) \
- ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 | ::com::sun::star::beans::PropertyAttribute::attrib4 )
-
-#define DECL_DEP_PROP_1( asciiname, id, type, attrib1 ) \
- ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1, sal_True )
-#define DECL_DEP_PROP_2( asciiname, id, type, attrib1, attrib2 ) \
- ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2, sal_True )
-#define DECL_DEP_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \
- ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3, sal_True )
-
-ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
-{
- static ImplPropertyInfo* pPropertyInfos = NULL;
- static sal_uInt16 nElements = 0;
- if( !pPropertyInfos )
- {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pPropertyInfos )
- {
- static ImplPropertyInfo aImplPropertyInfos [] =
- {
- DECL_PROP_2 ( "AccessibleName", ACCESSIBLENAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "Align", ALIGN, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "Autocomplete", AUTOCOMPLETE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "AutoHScroll", AUTOHSCROLL, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_1 ( "AutoMnemonics", AUTOMNEMONICS, bool, BOUND ),
- DECL_PROP_2 ( "AutoToggle", AUTOTOGGLE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "AutoVScroll", AUTOVSCROLL, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "BackgroundColor", BACKGROUNDCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_DEP_PROP_2 ( "BlockIncrement", BLOCKINCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "Border", BORDER, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_DEP_PROP_3 ( "BorderColor", BORDERCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "Closeable", CLOSEABLE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "CurrencySymbol", CURRENCYSYMBOL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "CustomUnitText", CUSTOMUNITTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_DEP_PROP_3 ( "Date", DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "DateFormat", EXTDATEFORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DateMax", DATEMAX, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DateMin", DATEMIN, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "DateShowCentury", DATESHOWCENTURY, bool, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "DecimalAccuracy", DECIMALACCURACY, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DefaultButton", DEFAULTBUTTON, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DefaultControl", DEFAULTCONTROL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DesktopAsParent", DESKTOP_AS_PARENT, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DisplayBackgroundColor", DISPLAYBACKGROUNDCOLOR, sal_Int32, BOUND, MAYBEVOID ),
- DECL_PROP_2 ( "Dropdown", DROPDOWN, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "EchoChar", ECHOCHAR, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "EditMask", EDITMASK, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "EffectiveDefault", EFFECTIVE_DEFAULT, Any, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "EffectiveMax", EFFECTIVE_MAX, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "EffectiveMin", EFFECTIVE_MIN, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_DEP_PROP_3 ( "EffectiveValue", EFFECTIVE_VALUE, Any, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "Enabled", ENABLED, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "EnforceFormat", ENFORCE_FORMAT, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "FillColor", FILLCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "FocusOnClick", FOCUSONCLICK, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontRelief", FONTRELIEF, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontEmphasisMark", FONTEMPHASISMARK, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontDescriptor", FONTDESCRIPTOR, FontDescriptor, BOUND, MAYBEDEFAULT ),
-
- // Teile des ::com::sun::star::awt::FontDescriptor
- DECL_PROP_2 ( "FontName", FONTDESCRIPTORPART_NAME, ::rtl::OUString,BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontStyleName", FONTDESCRIPTORPART_STYLENAME, ::rtl::OUString,BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontFamily", FONTDESCRIPTORPART_FAMILY, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontCharset", FONTDESCRIPTORPART_CHARSET, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontHeight", FONTDESCRIPTORPART_HEIGHT, float, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontWidth", FONTDESCRIPTORPART_WIDTH, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontPitch", FONTDESCRIPTORPART_PITCH, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontWeight", FONTDESCRIPTORPART_WEIGHT, float, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontCharWidth", FONTDESCRIPTORPART_CHARWIDTH, float, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontOrientation", FONTDESCRIPTORPART_ORIENTATION, float, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontSlant", FONTDESCRIPTORPART_SLANT, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontUnderline", FONTDESCRIPTORPART_UNDERLINE, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontStrikeout", FONTDESCRIPTORPART_STRIKEOUT, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontKerning", FONTDESCRIPTORPART_KERNING, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontWordLineMode", FONTDESCRIPTORPART_WORDLINEMODE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "FontType", FONTDESCRIPTORPART_TYPE, sal_Int16, BOUND, MAYBEDEFAULT ),
-
- DECL_PROP_3 ( "FormatKey", FORMATKEY, sal_Int32, BOUND, MAYBEVOID, TRANSIENT ),
- DECL_PROP_3 ( "FormatsSupplier", FORMATSSUPPLIER, Reference< ::com::sun::star::util::XNumberFormatsSupplier >, BOUND, MAYBEVOID, TRANSIENT ),
-
- DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< XGraphic >, BOUND, TRANSIENT ),
- DECL_PROP_2 ( "GroupName", GROUPNAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HighContrastMode", HIGHCONTRASTMODE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HScroll", HSCROLL, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HardLineBreaks", HARDLINEBREAKS, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ImageAlign", IMAGEALIGN, sal_Int16, BOUND, MAYBEDEFAULT),
- DECL_PROP_2 ( "ImagePosition", IMAGEPOSITION, sal_Int16, BOUND, MAYBEDEFAULT),
- DECL_PROP_2 ( "ImageURL", IMAGEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "ItemSeparatorPos", ITEM_SEPARATOR_POS, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "Label", LABEL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "LineColor", LINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "LineCount", LINECOUNT, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "LineEndFormat", LINE_END_FORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_DEP_PROP_2 ( "LineIncrement", LINEINCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "LiteralMask", LITERALMASK, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "LiveScroll", LIVE_SCROLL, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "MaxTextLen", MAXTEXTLEN, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Moveable", MOVEABLE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_1 ( "MouseTransparent", MOUSETRANSPARENT, bool, BOUND ),
- DECL_PROP_2 ( "MultiLine", MULTILINE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "MultiSelection", MULTISELECTION, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "MultiSelectionSimpleMode", MULTISELECTION_SIMPLEMODE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "NativeWidgetLook", NATIVE_WIDGET_LOOK, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Orientation", ORIENTATION, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "PaintTransparent", PAINTTRANSPARENT, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "PluginParent", PLUGINPARENT, sal_Int64, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "PrependCurrencySymbol", CURSYM_POSITION, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Printable", PRINTABLE, bool, BOUND, MAYBEDEFAULT ),
- DECL_DEP_PROP_3 ( "ProgressValue", PROGRESSVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "ProgressValueMax", PROGRESSVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ProgressValueMin", PROGRESSVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "PushButtonType", PUSHBUTTONTYPE, sal_Int16, BOUND, MAYBEDEFAULT),
- DECL_PROP_2 ( "ReadOnly", READONLY, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Repeat", REPEAT, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "AutoRepeat", AUTO_REPEAT, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "RepeatDelay", REPEAT_DELAY, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ScaleImage", SCALEIMAGE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ScaleMode", IMAGE_SCALE_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_DEP_PROP_3 ( "ScrollValue", SCROLLVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "ScrollValueMax", SCROLLVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ScrollValueMin", SCROLLVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_DEP_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence<sal_Int16>, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ShowThousandsSeparator", NUMSHOWTHOUSANDSEP, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Sizeable", SIZEABLE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Spin", SPIN, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "SpinIncrement", SPININCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_DEP_PROP_2 ( "SpinValue", SPINVALUE, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "SpinValueMax", SPINVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "SpinValueMin", SPINVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_DEP_PROP_2 ( "State", STATE, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "StrictFormat", STRICTFORMAT, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "StringItemList", STRINGITEMLIST, Sequence< ::rtl::OUString >, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "VisualEffect", VISUALEFFECT, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "SymbolColor", SYMBOL_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "Tabstop", TABSTOP, bool, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "Text", TEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "TextColor", TEXTCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "TextLineColor", TEXTLINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_DEP_PROP_3 ( "Time", TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "TimeFormat", EXTTIMEFORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "TimeMax", TIMEMAX, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "TimeMin", TIMEMIN, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Title", TITLE, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Toggle", TOGGLE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "TreatAsNumber", TREATASNUMBER, bool, BOUND, MAYBEDEFAULT,TRANSIENT ),
- DECL_PROP_2 ( "TriState", TRISTATE, bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Unit", UNIT, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "VScroll", VSCROLL, bool, BOUND, MAYBEDEFAULT ),
- DECL_DEP_PROP_3 ( "Value", VALUE_DOUBLE, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "ValueMax", VALUEMAX_DOUBLE, double, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ValueMin", VALUEMIN_DOUBLE, double, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ValueStep", VALUESTEP_DOUBLE, double, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "VerticalAlign", VERTICALALIGN, VerticalAlignment, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_DEP_PROP_3 ( "VisibleSize", VISIBLESIZE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "Activated", ACTIVATED, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Complete", COMPLETE, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "CurrentItemID", CURRENTITEMID, sal_Int16, BOUND, MAYBEDEFAULT ),
-
- DECL_PROP_2 ( "MouseWheelBehavior", MOUSE_WHEEL_BEHAVIOUR, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "StepTime", STEP_TIME, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Decoration", DECORATION, sal_Bool, BOUND, MAYBEDEFAULT ),
-
- DECL_PROP_2 ( "SelectionType", TREE_SELECTIONTYPE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "Editable", TREE_EDITABLE, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "DataModel", TREE_DATAMODEL, Reference< ::com::sun::star::awt::tree::XTreeDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "RootDisplayed", TREE_ROOTDISPLAYED, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ShowsHandles", TREE_SHOWSHANDLES, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ShowsRootHandles", TREE_SHOWSROOTHANDLES, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "RowHeight", ROW_HEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "InvokesStopNodeEditing", TREE_INVOKESSTOPNODEEDITING, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "WritingMode", WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ),
- DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "RowHeaderWidth", ROW_HEADER_WIDTH, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "ColumnHeaderHeight", COLUMN_HEADER_HEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_1 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND ),
- DECL_PROP_1 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND ),
- DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ),
- DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "HeaderTextColor", GRID_HEADER_TEXT_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "RowBackgroundColors", GRID_ROW_BACKGROUND_COLORS, Sequence< sal_Int32 >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "UseGridLines", USE_GRID_LINES, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_DEP_PROP_3 ( "MultiPageValue", MULTIPAGEVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "AllDialogChildren", USERFORMCONTAINEES, Reference< ::com::sun::star::container::XNameContainer >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- };
- pPropertyInfos = aImplPropertyInfos;
- nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
- }
- }
- rElementCount = nElements;
- return pPropertyInfos;
-}
-
-
-struct ImplPropertyInfoCompareFunctor : ::std::binary_function<ImplPropertyInfo,::rtl::OUString,bool>
-{
- inline bool operator()(const ImplPropertyInfo& lhs,const ImplPropertyInfo& rhs) const
- {
- return lhs.aName.compareTo(rhs.aName) < 0;
- }
- inline bool operator()(const ImplPropertyInfo& lhs,const ::rtl::OUString& rhs) const
- {
- return lhs.aName.compareTo(rhs) < 0;
- }
- inline bool operator()(const ::rtl::OUString& lhs,const ImplPropertyInfo& rhs) const
- {
- return lhs.compareTo(rhs.aName) < 0;
- }
-};
-
-void ImplAssertValidPropertyArray()
-{
- static sal_Bool bSorted = sal_False;
- if( !bSorted )
- {
- sal_uInt16 nElements;
- ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
- ::std::sort(pInfos, pInfos+nElements,ImplPropertyInfoCompareFunctor());
- bSorted = sal_True;
- }
-}
-
-sal_uInt16 GetPropertyId( const ::rtl::OUString& rPropertyName )
-{
- ImplAssertValidPropertyArray();
-
- sal_uInt16 nElements;
- ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
- ImplPropertyInfo* pInf = ::std::lower_bound(pInfos,pInfos+nElements,rPropertyName,ImplPropertyInfoCompareFunctor());
-/*
- (ImplPropertyInfo*)
- bsearch( &aSearch, pInfos, nElements, sizeof( ImplPropertyInfo ), ImplPropertyInfoCompare );
-*/
-
- return ( pInf && pInf != (pInfos+nElements) && pInf->aName == rPropertyName) ? pInf->nPropId: 0;
-}
-
-const ImplPropertyInfo* ImplGetImplPropertyInfo( sal_uInt16 nPropertyId )
-{
- ImplAssertValidPropertyArray();
-
- sal_uInt16 nElements;
- ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
- sal_uInt16 n;
- for ( n = 0; n < nElements && pInfos[n].nPropId != nPropertyId; ++n)
- ;
-
- return (n < nElements) ? &pInfos[n] : NULL;
-}
-
-sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId )
-{
- ImplAssertValidPropertyArray();
-
- sal_uInt16 nElements;
- ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
- for ( sal_uInt16 n = nElements; n; )
- {
- if ( pInfos[--n].nPropId == nPropertyId )
- return n;
- }
- return 0xFFFF;
-}
-
-const ::rtl::OUString& GetPropertyName( sal_uInt16 nPropertyId )
-{
- const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
- DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
- return pImplPropertyInfo->aName;
-}
-
-const ::com::sun::star::uno::Type* GetPropertyType( sal_uInt16 nPropertyId )
-{
- const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
- DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
- return pImplPropertyInfo ? &pImplPropertyInfo->aType : NULL;
-}
-
-sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId )
-{
- const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
- DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
- return pImplPropertyInfo ? pImplPropertyInfo->nAttribs : 0;
-}
-
-sal_Bool DoesDependOnOthers( sal_uInt16 nPropertyId )
-{
- const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
- DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
- return pImplPropertyInfo ? pImplPropertyInfo->bDependsOnOthers : sal_False;
-}
-
-sal_Bool CompareProperties( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 )
-{
- return ::comphelper::compare( r1, r2 );
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
deleted file mode 100644
index 2e5b3eb390..0000000000
--- a/toolkit/source/helper/registerservices.cxx
+++ /dev/null
@@ -1,342 +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/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <toolkit/controls/geometrycontrolmodel.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/weak.hxx>
-#include <osl/mutex.hxx>
-#include <toolkit/helper/servicenames.hxx>
-#include <toolkit/helper/macros.hxx>
-#include <toolkit/awt/vclxtoolkit.hxx>
-#include <toolkit/awt/vclxmenu.hxx>
-#include <toolkit/awt/vclxpointer.hxx>
-#include <toolkit/awt/vclxprinter.hxx>
-#include <toolkit/controls/unocontrols.hxx>
-#include <toolkit/controls/dialogcontrol.hxx>
-#include <toolkit/controls/unocontrolcontainer.hxx>
-#include <toolkit/controls/unocontrolcontainermodel.hxx>
-#include <toolkit/controls/stdtabcontroller.hxx>
-#include <toolkit/controls/stdtabcontrollermodel.hxx>
-#include <toolkit/controls/formattedcontrol.hxx>
-#include <toolkit/controls/roadmapcontrol.hxx>
-#include <toolkit/controls/tkscrollbar.hxx>
-#include "toolkit/controls/tkspinbutton.hxx"
-#include <toolkit/controls/tksimpleanimation.hxx>
-#include <toolkit/controls/tkthrobber.hxx>
-#include <toolkit/controls/animatedimages.hxx>
-#include <toolkit/controls/spinningprogress.hxx>
-#include <toolkit/controls/dialogcontrol.hxx>
-#include <toolkit/controls/tabpagemodel.hxx>
-#include <toolkit/controls/tabpagecontainer.hxx>
-#include "toolkit/dllapi.h"
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-namespace toolkit
-{
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::registry;
-
- //.........................................................................
- Reference< XRegistryKey > registerServices( const Reference< XRegistryKey >& _rxParentKey,
- const sal_Char* _pAsciiImplName, const sal_Char* _pAsciiServiceName )
- {
- ::rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM( "/stardiv.Toolkit." ) );
- sImplName += ::rtl::OUString::createFromAscii( _pAsciiImplName );
- sImplName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES" ) );
-
- Reference< XRegistryKey > xNewKey = _rxParentKey->createKey( sImplName );
- xNewKey->createKey( ::rtl::OUString::createFromAscii( _pAsciiServiceName ) );
-
- return xNewKey;
- }
-
- //.........................................................................
- Reference< XRegistryKey > registerServices( const Reference< XRegistryKey >& _rxParentKey,
- const sal_Char* _pAsciiImplName, const sal_Char* _pAsciiServiceName1, const sal_Char* _pAsciiServiceName2 )
- {
- Reference< XRegistryKey > xComponentServicesKey = registerServices( _rxParentKey, _pAsciiImplName, _pAsciiServiceName1 );
- xComponentServicesKey->createKey( ::rtl::OUString::createFromAscii( _pAsciiServiceName2 ) );
- return xComponentServicesKey;
- }
-
- //.........................................................................
- void* tryCreateFactory( const sal_Char* _pRequiredImplName, const sal_Char* _pComponentImplName,
- const sal_Char* _pAsciiServiceName1, const sal_Char* _pAsciiServiceName2,
- ::cppu::ComponentInstantiation _pInstantiation, const Reference< XMultiServiceFactory >& _rxServiceFactory )
- {
- void* pReturn = NULL;
-
- if ( rtl_str_compare( _pRequiredImplName, _pComponentImplName ) == 0 )
- {
- Sequence< ::rtl::OUString > aServiceNames( _pAsciiServiceName2 ? 2 : 1 );
- aServiceNames.getArray()[ 0 ] = ::rtl::OUString::createFromAscii( _pAsciiServiceName1 );
- if ( _pAsciiServiceName2 )
- aServiceNames.getArray()[ 1 ] = ::rtl::OUString::createFromAscii( _pAsciiServiceName2 );
- Reference< XSingleServiceFactory > xFactory( ::cppu::createSingleFactory(
- _rxServiceFactory, ::rtl::OUString::createFromAscii( _pComponentImplName ),
- _pInstantiation, aServiceNames
- ) );
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pReturn = xFactory.get();
- }
- }
-
- return pReturn;
- }
-
-
-}
-
-#define IMPL_CREATEINSTANCE( ImplName ) \
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) \
- { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName ); }
-
-#define IMPL_CREATEINSTANCE2( ImplName ) \
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ) \
- { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName( i_factory ) ); }
-
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlDialogModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
-{
- return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlDialogModel>( i_factory ) );
-}
-
-#define GET_FACTORY_WITH_IMPL_PREFIX( ClassName, ImplNamePrefix, ServiceName1, ServiceName2 ) \
- pRet = tryCreateFactory( sImplementationName, ImplNamePrefix "." #ClassName, \
- ServiceName1, ServiceName2, \
- ClassName##_CreateInstance, xServiceFactory \
- ); \
- if ( pRet ) \
- return pRet; \
-
-#define GET_FACTORY( ImplName, ServiceName1, ServiceName2 ) \
- GET_FACTORY_WITH_IMPL_PREFIX( ImplName, "stardiv.Toolkit", ServiceName1, ServiceName2 )
-
-using namespace toolkit;
-
-IMPL_CREATEINSTANCE2( VCLXToolkit )
-IMPL_CREATEINSTANCE( StdTabController )
-IMPL_CREATEINSTANCE( StdTabControllerModel )
-IMPL_CREATEINSTANCE2( UnoButtonControl )
-IMPL_CREATEINSTANCE2( UnoCheckBoxControl )
-IMPL_CREATEINSTANCE2( UnoComboBoxControl )
-IMPL_CREATEINSTANCE2( UnoControlButtonModel )
-IMPL_CREATEINSTANCE2( UnoControlCheckBoxModel )
-IMPL_CREATEINSTANCE2( UnoControlComboBoxModel )
-IMPL_CREATEINSTANCE2( UnoControlContainer )
-IMPL_CREATEINSTANCE2( UnoControlContainerModel )
-IMPL_CREATEINSTANCE2( UnoControlCurrencyFieldModel )
-IMPL_CREATEINSTANCE2( UnoControlDateFieldModel )
-IMPL_CREATEINSTANCE2( UnoControlEditModel )
-IMPL_CREATEINSTANCE2( UnoControlFileControlModel )
-IMPL_CREATEINSTANCE2( UnoControlFixedHyperlinkModel )
-IMPL_CREATEINSTANCE2( UnoControlFixedTextModel )
-IMPL_CREATEINSTANCE2( UnoControlFormattedFieldModel )
-IMPL_CREATEINSTANCE2( UnoControlGroupBoxModel )
-IMPL_CREATEINSTANCE2( UnoControlImageControlModel )
-IMPL_CREATEINSTANCE2( UnoControlListBoxModel )
-IMPL_CREATEINSTANCE2( UnoControlNumericFieldModel )
-IMPL_CREATEINSTANCE2( UnoControlPatternFieldModel )
-IMPL_CREATEINSTANCE2( UnoControlRadioButtonModel )
-IMPL_CREATEINSTANCE2( UnoControlTimeFieldModel )
-IMPL_CREATEINSTANCE2( UnoControlProgressBarModel )
-IMPL_CREATEINSTANCE2( UnoControlScrollBarModel )
-IMPL_CREATEINSTANCE2( UnoSpinButtonModel )
-IMPL_CREATEINSTANCE2( UnoMultiPageModel )
-IMPL_CREATEINSTANCE2( UnoPageModel )
-IMPL_CREATEINSTANCE2( UnoFrameModel )
-IMPL_CREATEINSTANCE2( UnoControlFixedLineModel )
-IMPL_CREATEINSTANCE2( UnoCurrencyFieldControl )
-IMPL_CREATEINSTANCE2( UnoDateFieldControl )
-IMPL_CREATEINSTANCE2( UnoDialogControl )
-IMPL_CREATEINSTANCE2( UnoEditControl )
-IMPL_CREATEINSTANCE2( UnoFileControl )
-IMPL_CREATEINSTANCE2( UnoFixedHyperlinkControl )
-IMPL_CREATEINSTANCE2( UnoFixedTextControl )
-IMPL_CREATEINSTANCE2( UnoFormattedFieldControl )
-IMPL_CREATEINSTANCE2( UnoGroupBoxControl )
-IMPL_CREATEINSTANCE2( UnoImageControlControl )
-IMPL_CREATEINSTANCE2( UnoListBoxControl )
-IMPL_CREATEINSTANCE2( UnoNumericFieldControl )
-IMPL_CREATEINSTANCE2( UnoPatternFieldControl )
-IMPL_CREATEINSTANCE2( UnoRadioButtonControl )
-IMPL_CREATEINSTANCE2( UnoTimeFieldControl )
-IMPL_CREATEINSTANCE2( UnoProgressBarControl )
-IMPL_CREATEINSTANCE2( UnoScrollBarControl )
-IMPL_CREATEINSTANCE2( UnoSpinButtonControl )
-IMPL_CREATEINSTANCE2( UnoFixedLineControl )
-IMPL_CREATEINSTANCE2( UnoMultiPageControl )
-IMPL_CREATEINSTANCE2( UnoPageControl )
-IMPL_CREATEINSTANCE2( UnoFrameControl )
-IMPL_CREATEINSTANCE( VCLXMenuBar )
-IMPL_CREATEINSTANCE( VCLXPointer )
-IMPL_CREATEINSTANCE( VCLXPopupMenu )
-IMPL_CREATEINSTANCE( VCLXPrinterServer )
-IMPL_CREATEINSTANCE2( UnoRoadmapControl )
-IMPL_CREATEINSTANCE2( UnoControlRoadmapModel )
-IMPL_CREATEINSTANCE2( UnoSimpleAnimationControl )
-IMPL_CREATEINSTANCE2( UnoSimpleAnimationControlModel )
-IMPL_CREATEINSTANCE2( UnoThrobberControl )
-IMPL_CREATEINSTANCE2( UnoThrobberControlModel )
-IMPL_CREATEINSTANCE2( UnoControlTabPage )
-IMPL_CREATEINSTANCE2( UnoControlTabPageModel )
-IMPL_CREATEINSTANCE2( UnoControlTabPageContainer )
-IMPL_CREATEINSTANCE2( UnoControlTabPageContainerModel )
-IMPL_CREATEINSTANCE2( AnimatedImagesControl )
-IMPL_CREATEINSTANCE2( AnimatedImagesControlModel )
-IMPL_CREATEINSTANCE2( SpinningProgressControlModel )
-
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MutableTreeDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridColumn_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SortableGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-
-extern void * SAL_CALL comp_AsyncCallback_component_getFactory( const char * implName, void * serviceManager, void * registryKey );
-
-extern void * SAL_CALL comp_Layout_component_getFactory( const char * implName, void * serviceManager, void * registryKey );
-
-extern "C"
-{
-
-TOOLKIT_DLLPUBLIC void* SAL_CALL tk_component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey )
-{
- void* pRet = NULL;
-
- if ( _pServiceManager )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory =
- static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( _pServiceManager );
- GET_FACTORY( VCLXToolkit, szServiceName_Toolkit, szServiceName2_Toolkit )
- GET_FACTORY( VCLXPopupMenu, szServiceName_PopupMenu, szServiceName2_PopupMenu )
- GET_FACTORY( VCLXMenuBar, szServiceName_MenuBar, szServiceName2_MenuBar )
- GET_FACTORY( VCLXPointer, szServiceName_Pointer, szServiceName2_Pointer )
- GET_FACTORY( UnoControlContainer, szServiceName_UnoControlContainer, szServiceName2_UnoControlContainer )
- GET_FACTORY( UnoControlContainerModel, szServiceName_UnoControlContainerModel, szServiceName2_UnoControlContainerModel )
- GET_FACTORY( StdTabController, szServiceName_TabController, szServiceName2_TabController )
- GET_FACTORY( StdTabControllerModel, szServiceName_TabControllerModel, szServiceName2_TabControllerModel )
- GET_FACTORY( UnoDialogControl, szServiceName_UnoControlDialog, szServiceName2_UnoControlDialog )
- GET_FACTORY( UnoControlDialogModel, szServiceName_UnoControlDialogModel, szServiceName2_UnoControlDialogModel )
- GET_FACTORY( UnoEditControl, szServiceName_UnoControlEdit, szServiceName2_UnoControlEdit )
- GET_FACTORY( UnoControlEditModel, szServiceName_UnoControlEditModel, szServiceName2_UnoControlEditModel )
- GET_FACTORY( UnoDateFieldControl, szServiceName_UnoControlDateField, szServiceName2_UnoControlDateField )
- GET_FACTORY( UnoControlDateFieldModel, szServiceName_UnoControlDateFieldModel, szServiceName2_UnoControlDateFieldModel )
- GET_FACTORY( UnoTimeFieldControl, szServiceName_UnoControlTimeField, szServiceName2_UnoControlTimeField )
- GET_FACTORY( UnoControlTimeFieldModel, szServiceName_UnoControlTimeFieldModel, szServiceName2_UnoControlTimeFieldModel )
- GET_FACTORY( UnoNumericFieldControl, szServiceName_UnoControlNumericField, szServiceName2_UnoControlNumericField )
- GET_FACTORY( UnoControlNumericFieldModel, szServiceName_UnoControlNumericFieldModel, szServiceName2_UnoControlNumericFieldModel )
- GET_FACTORY( UnoCurrencyFieldControl, szServiceName_UnoControlCurrencyField, szServiceName2_UnoControlCurrencyField )
- GET_FACTORY( UnoControlCurrencyFieldModel, szServiceName_UnoControlCurrencyFieldModel, szServiceName2_UnoControlCurrencyFieldModel )
- GET_FACTORY( UnoPatternFieldControl, szServiceName_UnoControlPatternField, szServiceName2_UnoControlPatternField )
- GET_FACTORY( UnoControlPatternFieldModel, szServiceName_UnoControlPatternFieldModel, szServiceName2_UnoControlPatternFieldModel )
- GET_FACTORY( UnoFormattedFieldControl, szServiceName_UnoControlFormattedField, szServiceName2_UnoControlFormattedField )
- GET_FACTORY( UnoControlFormattedFieldModel, szServiceName_UnoControlFormattedFieldModel, szServiceName2_UnoControlFormattedFieldModel )
- GET_FACTORY( UnoFileControl, szServiceName_UnoControlFileControl, szServiceName2_UnoControlFileControl )
- GET_FACTORY( UnoControlFileControlModel, szServiceName_UnoControlFileControlModel, szServiceName2_UnoControlFileControlModel )
- GET_FACTORY( UnoButtonControl, szServiceName_UnoControlButton, szServiceName2_UnoControlButton )
- GET_FACTORY( UnoControlButtonModel, szServiceName_UnoControlButtonModel, szServiceName2_UnoControlButtonModel )
- GET_FACTORY( UnoImageControlControl, szServiceName_UnoControlImageButton, szServiceName2_UnoControlImageButton )
- GET_FACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageButtonModel, szServiceName2_UnoControlImageButtonModel )
- GET_FACTORY( UnoImageControlControl, szServiceName_UnoControlImageControl, szServiceName2_UnoControlImageControl )
- GET_FACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageControlModel, szServiceName2_UnoControlImageControlModel )
- GET_FACTORY( UnoRadioButtonControl, szServiceName_UnoControlRadioButton, szServiceName2_UnoControlRadioButton )
- GET_FACTORY( UnoControlRadioButtonModel, szServiceName_UnoControlRadioButtonModel, szServiceName2_UnoControlRadioButtonModel )
- GET_FACTORY( UnoCheckBoxControl, szServiceName_UnoControlCheckBox, szServiceName2_UnoControlCheckBox )
- GET_FACTORY( UnoControlCheckBoxModel, szServiceName_UnoControlCheckBoxModel, szServiceName2_UnoControlCheckBoxModel )
- GET_FACTORY( UnoListBoxControl, szServiceName_UnoControlListBox, szServiceName2_UnoControlListBox )
- GET_FACTORY( UnoControlListBoxModel, szServiceName_UnoControlListBoxModel, szServiceName2_UnoControlListBoxModel )
- GET_FACTORY( UnoComboBoxControl, szServiceName_UnoControlComboBox, szServiceName2_UnoControlComboBox )
- GET_FACTORY( UnoControlComboBoxModel, szServiceName_UnoControlComboBoxModel, szServiceName2_UnoControlComboBoxModel )
- GET_FACTORY( UnoFixedTextControl, szServiceName_UnoControlFixedText, szServiceName2_UnoControlFixedText )
- GET_FACTORY( UnoControlFixedTextModel, szServiceName_UnoControlFixedTextModel, szServiceName2_UnoControlFixedTextModel )
- GET_FACTORY( UnoGroupBoxControl, szServiceName_UnoControlGroupBox, szServiceName2_UnoControlGroupBox )
- GET_FACTORY( UnoControlGroupBoxModel, szServiceName_UnoControlGroupBoxModel, szServiceName2_UnoControlGroupBoxModel )
- GET_FACTORY( UnoProgressBarControl, szServiceName_UnoControlProgressBar, szServiceName2_UnoControlProgressBar )
- GET_FACTORY( UnoControlProgressBarModel, szServiceName_UnoControlProgressBarModel, szServiceName2_UnoControlProgressBarModel )
- GET_FACTORY( UnoScrollBarControl, szServiceName_UnoControlScrollBar, szServiceName2_UnoControlScrollBar )
- GET_FACTORY( UnoControlScrollBarModel, szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel )
- GET_FACTORY( UnoFixedLineControl, szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine )
- GET_FACTORY( UnoControlFixedLineModel, szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel )
- GET_FACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer )
- GET_FACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap )
- GET_FACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
- GET_FACTORY( UnoMultiPageModel, szServiceName_UnoMultiPageModel, NULL )
- GET_FACTORY( UnoMultiPageControl, szServiceName_UnoMultiPageControl, NULL )
- GET_FACTORY( UnoPageModel, szServiceName_UnoPageModel, NULL )
- GET_FACTORY( UnoPageControl, szServiceName_UnoPageControl, NULL )
- GET_FACTORY( UnoFrameModel, szServiceName_UnoFrameModel, NULL )
- GET_FACTORY( UnoFrameControl, szServiceName_UnoFrameControl, NULL )
- GET_FACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
- GET_FACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
- GET_FACTORY( TreeControl, szServiceName_TreeControl, NULL )
- GET_FACTORY( TreeControlModel, szServiceName_TreeControlModel, NULL )
- GET_FACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL )
- GET_FACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel )
- GET_FACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl )
- GET_FACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel )
- GET_FACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl )
- GET_FACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
- GET_FACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
- GET_FACTORY( GridControl, szServiceName_GridControl, NULL );
- GET_FACTORY( GridControlModel, szServiceName_GridControlModel, NULL );
- GET_FACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL );
- GET_FACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL );
- GET_FACTORY_WITH_IMPL_PREFIX( GridColumn, "org.openoffice.comp.toolkit", szServiceName_GridColumn, NULL );
- GET_FACTORY_WITH_IMPL_PREFIX( SortableGridDataModel, "org.openoffice.comp.toolkit", szServiceName_SortableGridDataModel, NULL );
- GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControl, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControl, NULL )
- GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControlModel, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControlModel, NULL )
- GET_FACTORY_WITH_IMPL_PREFIX( SpinningProgressControlModel, "org.openoffice.comp.toolkit", szServiceName_SpinningProgressControlModel, NULL )
- GET_FACTORY( UnoControlTabPageModel, szServiceName_UnoControlTabPageModel, NULL )
- GET_FACTORY( UnoControlTabPage, szServiceName_UnoControlTabPage, NULL )
- GET_FACTORY( UnoControlTabPageContainerModel, szServiceName_UnoControlTabPageContainerModel, NULL )
- GET_FACTORY( UnoControlTabPageContainer, szServiceName_UnoControlTabPageContainer, NULL )
-
- if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 )
- return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
- if( pRet == 0 )
- pRet = comp_Layout_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
- }
- return pRet;
-}
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
deleted file mode 100644
index 0fb3a29dd2..0000000000
--- a/toolkit/source/helper/servicenames.cxx
+++ /dev/null
@@ -1,123 +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 <sal/types.h>
-#include <tools/solar.h>
-
-#include <toolkit/helper/servicenames.hxx>
-
-const sal_Char szServiceName_Toolkit[] = "stardiv.vcl.VclToolkit", szServiceName2_Toolkit[] = "com.sun.star.awt.Toolkit";
-const sal_Char szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", szServiceName2_PopupMenu[] = "com.sun.star.awt.PopupMenu";
-const sal_Char szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar";
-const sal_Char szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer";
-const sal_Char szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer";
-
-
-const sal_Char szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel";
-const sal_Char szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController";
-const sal_Char szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel";
-const sal_Char szServiceName_UnoControlDialog[] = "stardiv.vcl.control.Dialog", szServiceName2_UnoControlDialog[] = "com.sun.star.awt.UnoControlDialog";
-const sal_Char szServiceName_UnoControlDialogModel[] = "stardiv.vcl.controlmodel.Dialog", szServiceName2_UnoControlDialogModel[] = "com.sun.star.awt.UnoControlDialogModel";
-const sal_Char szServiceName_UnoControlEdit[] = "stardiv.vcl.control.Edit", szServiceName2_UnoControlEdit[] = "com.sun.star.awt.UnoControlEdit";
-const sal_Char szServiceName_UnoControlEditModel[] = "stardiv.vcl.controlmodel.Edit", szServiceName2_UnoControlEditModel[] = "com.sun.star.awt.UnoControlEditModel";
-const sal_Char szServiceName_UnoControlFileControl[] = "stardiv.vcl.control.FileControl", szServiceName2_UnoControlFileControl[] = "com.sun.star.awt.UnoControlFileControl";
-const sal_Char szServiceName_UnoControlFileControlModel[] = "stardiv.vcl.controlmodel.FileControl", szServiceName2_UnoControlFileControlModel[] = "com.sun.star.awt.UnoControlFileControlModel";
-const sal_Char szServiceName_UnoControlButton[] = "stardiv.vcl.control.Button", szServiceName2_UnoControlButton[] = "com.sun.star.awt.UnoControlButton";
-const sal_Char szServiceName_UnoControlButtonModel[] = "stardiv.vcl.controlmodel.Button", szServiceName2_UnoControlButtonModel[] = "com.sun.star.awt.UnoControlButtonModel";
-const sal_Char szServiceName_UnoControlImageButton[] = "stardiv.vcl.control.ImageButton", szServiceName2_UnoControlImageButton[] = "com.sun.star.awt.UnoControlImageButton";
-const sal_Char szServiceName_UnoControlImageButtonModel[] = "stardiv.vcl.controlmodel.ImageButton", szServiceName2_UnoControlImageButtonModel[] = "com.sun.star.awt.UnoControlImageButtonModel";
-const sal_Char szServiceName_UnoControlImageControl[] = "stardiv.vcl.control.ImageControl", szServiceName2_UnoControlImageControl[] = "com.sun.star.awt.UnoControlImageControl";
-const sal_Char szServiceName_UnoControlImageControlModel[] = "stardiv.vcl.controlmodel.ImageControl", szServiceName2_UnoControlImageControlModel[] = "com.sun.star.awt.UnoControlImageControlModel";
-const sal_Char szServiceName_UnoControlRadioButton[] = "stardiv.vcl.control.RadioButton", szServiceName2_UnoControlRadioButton[] = "com.sun.star.awt.UnoControlRadioButton";
-const sal_Char szServiceName_UnoControlRadioButtonModel[] = "stardiv.vcl.controlmodel.RadioButton", szServiceName2_UnoControlRadioButtonModel[] = "com.sun.star.awt.UnoControlRadioButtonModel";
-const sal_Char szServiceName_UnoControlCheckBox[] = "stardiv.vcl.control.CheckBox", szServiceName2_UnoControlCheckBox[] = "com.sun.star.awt.UnoControlCheckBox";
-const sal_Char szServiceName_UnoControlCheckBoxModel[] = "stardiv.vcl.controlmodel.CheckBox", szServiceName2_UnoControlCheckBoxModel[] = "com.sun.star.awt.UnoControlCheckBoxModel";
-const sal_Char szServiceName_UnoControlListBox[] = "stardiv.vcl.control.ListBox", szServiceName2_UnoControlListBox[] = "com.sun.star.awt.UnoControlListBox";
-const sal_Char szServiceName_UnoControlListBoxModel[] = "stardiv.vcl.controlmodel.ListBox", szServiceName2_UnoControlListBoxModel[] = "com.sun.star.awt.UnoControlListBoxModel";
-const sal_Char szServiceName_UnoControlComboBox[] = "stardiv.vcl.control.ComboBox", szServiceName2_UnoControlComboBox[] = "com.sun.star.awt.UnoControlComboBox";
-const sal_Char szServiceName_UnoControlComboBoxModel[] = "stardiv.vcl.controlmodel.ComboBox", szServiceName2_UnoControlComboBoxModel[] = "com.sun.star.awt.UnoControlComboBoxModel";
-const sal_Char szServiceName_UnoControlFixedText[] = "stardiv.vcl.control.FixedText", szServiceName2_UnoControlFixedText[] = "com.sun.star.awt.UnoControlFixedText";
-const sal_Char szServiceName_UnoControlFixedTextModel[] = "stardiv.vcl.controlmodel.FixedText", szServiceName2_UnoControlFixedTextModel[] = "com.sun.star.awt.UnoControlFixedTextModel";
-const sal_Char szServiceName_UnoControlGroupBox[] = "stardiv.vcl.control.GroupBox", szServiceName2_UnoControlGroupBox[] = "com.sun.star.awt.UnoControlGroupBox";
-const sal_Char szServiceName_UnoControlGroupBoxModel[] = "stardiv.vcl.controlmodel.GroupBox", szServiceName2_UnoControlGroupBoxModel[] = "com.sun.star.awt.UnoControlGroupBoxModel";
-const sal_Char szServiceName_UnoControlDateField[] = "stardiv.vcl.control.DateField", szServiceName2_UnoControlDateField[] = "com.sun.star.awt.UnoControlDateField";
-const sal_Char szServiceName_UnoControlDateFieldModel[] = "stardiv.vcl.controlmodel.DateField", szServiceName2_UnoControlDateFieldModel[] = "com.sun.star.awt.UnoControlDateFieldModel";
-const sal_Char szServiceName_UnoControlTimeField[] = "stardiv.vcl.control.TimeField", szServiceName2_UnoControlTimeField[] = "com.sun.star.awt.UnoControlTimeField";
-const sal_Char szServiceName_UnoControlTimeFieldModel[] = "stardiv.vcl.controlmodel.TimeField", szServiceName2_UnoControlTimeFieldModel[] = "com.sun.star.awt.UnoControlTimeFieldModel";
-const sal_Char szServiceName_UnoControlNumericField[] = "stardiv.vcl.control.NumericField", szServiceName2_UnoControlNumericField[] = "com.sun.star.awt.UnoControlNumericField";
-const sal_Char szServiceName_UnoControlNumericFieldModel[] = "stardiv.vcl.controlmodel.NumericField", szServiceName2_UnoControlNumericFieldModel[] = "com.sun.star.awt.UnoControlNumericFieldModel";
-const sal_Char szServiceName_UnoControlCurrencyField[] = "stardiv.vcl.control.CurrencyField", szServiceName2_UnoControlCurrencyField[] = "com.sun.star.awt.UnoControlCurrencyField";
-const sal_Char szServiceName_UnoControlCurrencyFieldModel[] = "stardiv.vcl.controlmodel.CurrencyField", szServiceName2_UnoControlCurrencyFieldModel[] = "com.sun.star.awt.UnoControlCurrencyFieldModel";
-const sal_Char szServiceName_UnoControlPatternField[] = "stardiv.vcl.control.PatternField", szServiceName2_UnoControlPatternField[] = "com.sun.star.awt.UnoControlPatternField";
-const sal_Char szServiceName_UnoControlPatternFieldModel[] = "stardiv.vcl.controlmodel.PatternField", szServiceName2_UnoControlPatternFieldModel[] = "com.sun.star.awt.UnoControlPatternFieldModel";
-const sal_Char szServiceName_UnoControlFormattedField[] = "stardiv.vcl.control.FormattedField", szServiceName2_UnoControlFormattedField[] = "com.sun.star.awt.UnoControlFormattedField";
-const sal_Char szServiceName_UnoControlFormattedFieldModel[] = "stardiv.vcl.controlmodel.FormattedField", szServiceName2_UnoControlFormattedFieldModel[] = "com.sun.star.awt.UnoControlFormattedFieldModel";
-const sal_Char szServiceName_MVCIntrospection[] = "stardiv.vcl.MVCIntrospection", szServiceName2_MVCIntrospection[] = "com.sun.star.awt.MVCIntrospection";
-const sal_Char szServiceName_PrinterServer[] = "stardiv.vcl.PrinterServer", szServiceName2_PrinterServer[] = "com.sun.star.awt.PrinterServer";
-const sal_Char szServiceName_UnoControlProgressBar[] = "stardiv.vcl.control.ProgressBar", szServiceName2_UnoControlProgressBar[] = "com.sun.star.awt.UnoControlProgressBar";
-const sal_Char szServiceName_UnoControlProgressBarModel[] = "stardiv.vcl.controlmodel.ProgressBar", szServiceName2_UnoControlProgressBarModel[] = "com.sun.star.awt.UnoControlProgressBarModel";
-const sal_Char szServiceName_UnoControlScrollBar[] = "stardiv.vcl.control.ScrollBar", szServiceName2_UnoControlScrollBar[] = "com.sun.star.awt.UnoControlScrollBar";
-const sal_Char szServiceName_UnoControlScrollBarModel[] = "stardiv.vcl.controlmodel.ScrollBar", szServiceName2_UnoControlScrollBarModel[] = "com.sun.star.awt.UnoControlScrollBarModel";
-const sal_Char szServiceName_UnoControlFixedLine[] = "stardiv.vcl.control.FixedLine", szServiceName2_UnoControlFixedLine[] = "com.sun.star.awt.UnoControlFixedLine";
-const sal_Char szServiceName_UnoControlFixedLineModel[] = "stardiv.vcl.controlmodel.FixedLine", szServiceName2_UnoControlFixedLineModel[] = "com.sun.star.awt.UnoControlFixedLineModel";
-const sal_Char szServiceName_UnoControlRoadmap[] = "stardiv.vcl.control.Roadmap", szServiceName2_UnoControlRoadmap[] = "com.sun.star.awt.UnoControlRoadmap";
-const sal_Char szServiceName_UnoControlRoadmapModel[] = "stardiv.vcl.controlmodel.Roadmap", szServiceName2_UnoControlRoadmapModel[] = "com.sun.star.awt.UnoControlRoadmapModel";
-const sal_Char szServiceName_UnoSpinButtonControl[] = "com.sun.star.awt.UnoControlSpinButton";
-const sal_Char szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel";
-const sal_Char szServiceName_UnoMultiPageControl[] = "com.sun.star.awt.UnoControlMultiPage";
-const sal_Char szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPageModel";
-const sal_Char szServiceName_UnoPageControl[] = "com.sun.star.awt.UnoControlPage";
-const sal_Char szServiceName_UnoPageModel[] = "com.sun.star.awt.UnoPageModel";
-const sal_Char szServiceName_UnoFrameControl[] = "com.sun.star.awt.UnoControlFrame";
-const sal_Char szServiceName_AnimatedImagesControl[] = "com.sun.star.awt.AnimatedImagesControl";
-const sal_Char szServiceName_AnimatedImagesControlModel[] = "com.sun.star.awt.AnimatedImagesControlModel";
-const sal_Char szServiceName_SpinningProgressControlModel[] = "com.sun.star.awt.SpinningProgressControlModel";
-const sal_Char szServiceName_UnoFrameModel[] = "com.sun.star.awt.UnoFrameModel";
-const sal_Char szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
-const sal_Char szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
-const sal_Char szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
-const sal_Char szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel", szServiceName2_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoControlSimpleAnimationModel";
-const sal_Char szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl", szServiceName2_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoControlSimpleAnimation";
-const sal_Char szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel", szServiceName2_UnoThrobberControlModel[] = "com.sun.star.awt.UnoControlThrobberModel";
-const sal_Char szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl", szServiceName2_UnoThrobberControl[] = "com.sun.star.awt.UnoControlThrobber";
-const sal_Char szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink";
-const sal_Char szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel";
-const sal_Char szServiceName_GridControl[] = "com.sun.star.awt.grid.UnoControlGrid";
-const sal_Char szServiceName_GridControlModel[] = "com.sun.star.awt.grid.UnoControlGridModel";
-const sal_Char szServiceName_DefaultGridDataModel[] = "com.sun.star.awt.grid.DefaultGridDataModel";
-const sal_Char szServiceName_DefaultGridColumnModel[] = "com.sun.star.awt.grid.DefaultGridColumnModel";
-const sal_Char szServiceName_GridColumn[] = "com.sun.star.awt.grid.GridColumn";
-const sal_Char szServiceName_UnoControlTabPage[] = "com.sun.star.awt.tab.UnoControlTabPage";
-const sal_Char szServiceName_UnoControlTabPageModel[] = "com.sun.star.awt.tab.UnoControlTabPageModel";
-const sal_Char szServiceName_UnoControlTabPageContainerModel[] = "com.sun.star.awt.tab.UnoControlTabPageContainerModel";
-const sal_Char szServiceName_UnoControlTabPageContainer[] = "com.sun.star.awt.tab.UnoControlTabPageContainer";
-const sal_Char szServiceName_SortableGridDataModel[] = "com.sun.star.awt.grid.SortableGridDataModel";
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx
deleted file mode 100644
index a0a99128b6..0000000000
--- a/toolkit/source/helper/tkresmgr.cxx
+++ /dev/null
@@ -1,131 +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/helper/tkresmgr.hxx>
-#include <tools/simplerm.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/componentcontext.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <tools/resmgr.hxx>
-#include <tools/diagnose_ex.h>
-
-#include <vcl/svapp.hxx>
-
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::graphic::XGraphic;
-using ::com::sun::star::graphic::XGraphicProvider;
-using namespace ::com::sun::star;
-// -----------------------------------------------------------------------------
-// TkResMgr
-// -----------------------------------------------------------------------------
-
-SimpleResMgr* TkResMgr::m_pSimpleResMgr = NULL;
-ResMgr* TkResMgr::m_pResMgr = NULL;
-
-// -----------------------------------------------------------------------------
-
-TkResMgr::EnsureDelete::~EnsureDelete()
-{
- delete TkResMgr::m_pSimpleResMgr;
-// delete TkResMgr::m_pResMgr;
-}
-
-// -----------------------------------------------------------------------------
-
-void TkResMgr::ensureImplExists()
-{
- if (m_pSimpleResMgr)
- return;
-
- ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
-
- ByteString sResMgrName( "tk" );
-
- m_pSimpleResMgr = SimpleResMgr::Create( sResMgrName.GetBuffer(), aLocale );
- m_pResMgr = ResMgr::CreateResMgr( sResMgrName.GetBuffer() );
-
- if (m_pSimpleResMgr)
- {
- // now that we have a impl class, make sure it's deleted on unloading the library
- static TkResMgr::EnsureDelete s_aDeleteTheImplClass;
- }
-}
-
-// -----------------------------------------------------------------------------
-::rtl::OUString TkResMgr::loadString( sal_uInt16 nResId )
-{
- ::rtl::OUString sReturn;
-
- ensureImplExists();
- if ( m_pSimpleResMgr )
- sReturn = m_pSimpleResMgr->ReadString( nResId );
-
- return sReturn;
-}
-
-// -----------------------------------------------------------------------------
-Image TkResMgr::loadImage( sal_uInt16 nResId )
-{
- Image aReturn;
-
- ensureImplExists();
- if ( m_pResMgr )
- aReturn = Image( ResId( nResId, *m_pResMgr ) );
-
- return aReturn;
-}
-
-// -----------------------------------------------------------------------------
-Image TkResMgr::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();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/unomemorystream.cxx b/toolkit/source/helper/unomemorystream.cxx
deleted file mode 100644
index 3105da5414..0000000000
--- a/toolkit/source/helper/unomemorystream.cxx
+++ /dev/null
@@ -1,110 +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/helper/unomemorystream.hxx>
-#include <algorithm>
-
-// ----------------------------------------------------
-// class UnoMemoryStream
-// ----------------------------------------------------
-UnoMemoryStream::UnoMemoryStream( sal_uInt32 nInitSize, sal_uInt32 nInitResize )
- : SvMemoryStream( nInitSize, nInitResize )
-{
-}
-
-// ::com::sun::star::uno::XInterface
-::com::sun::star::uno::Any UnoMemoryStream::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::io::XInputStream*, this ) );
- return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
-}
-
-
-// ::com::sun::star::io::XInputStream
-sal_Int32 UnoMemoryStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_Int32 nRead = available();
- if ( nRead > nBytesToRead )
- nRead = nBytesToRead;
-
- rData = ::com::sun::star::uno::Sequence< sal_Int8 >( nRead );
- Read( rData.getArray(), nRead );
-
- return nRead;
-}
-
-sal_Int32 UnoMemoryStream::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_Int32 nAvailable = available();
- if( nAvailable )
- {
- return readBytes( rData, std::min( nMaxBytesToRead , nAvailable ) );
- }
- else
- {
- // Not the most effective method, but it sticks to the specification
- return readBytes( rData, 1 );
- }
-}
-
-void UnoMemoryStream::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- SeekRel( nBytesToSkip );
-}
-
-sal_Int32 UnoMemoryStream::available() throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- sal_uInt32 nStreamPos = Tell();
- sal_uInt32 nEnd = Seek( STREAM_SEEK_TO_END );
- Seek( nStreamPos );
- return nEnd - nStreamPos;
-}
-
-void UnoMemoryStream::closeInput() throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- // nothing to do
-}
-
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/unopropertyarrayhelper.cxx b/toolkit/source/helper/unopropertyarrayhelper.cxx
deleted file mode 100644
index 0893413a7f..0000000000
--- a/toolkit/source/helper/unopropertyarrayhelper.cxx
+++ /dev/null
@@ -1,162 +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/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/helper/property.hxx>
-
-// ----------------------------------------------------
-// class UnoPropertyArrayHelper
-// ----------------------------------------------------
-
-UnoPropertyArrayHelper::UnoPropertyArrayHelper( const ::com::sun::star::uno::Sequence<sal_Int32>& rIDs )
-{
- sal_Int32 nIDs = rIDs.getLength();
- const sal_Int32* pIDs = rIDs.getConstArray();
- for ( sal_Int32 n = 0; n < nIDs; n++ )
- maIDs.Insert( pIDs[n], (void*)1L );
-}
-
-UnoPropertyArrayHelper::UnoPropertyArrayHelper( const std::list< sal_uInt16 > &rIDs )
-{
- std::list< sal_uInt16 >::const_iterator iter;
- for( iter = rIDs.begin(); iter != rIDs.end(); ++iter)
- maIDs.Insert( *iter, (void*)1L);
-}
-
-sal_Bool UnoPropertyArrayHelper::ImplHasProperty( sal_uInt16 nPropId ) const
-{
- if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
- nPropId = BASEPROPERTY_FONTDESCRIPTOR;
-
- return maIDs.Get( nPropId ) ? sal_True : sal_False;
-}
-
-// ::cppu::IPropertyArrayHelper
-sal_Bool UnoPropertyArrayHelper::fillPropertyMembersByHandle( ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nPropId )
-{
- sal_uInt16 id = sal::static_int_cast< sal_uInt16 >(nPropId);
- sal_Bool bValid = ImplHasProperty( id );
- if ( bValid )
- {
- if ( pPropName )
- *pPropName = GetPropertyName( id );
- if ( pAttributes )
- *pAttributes = GetPropertyAttribs( id );
- }
- return bValid;
-}
-
-::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > UnoPropertyArrayHelper::getProperties()
-{
- // Sortiert nach Namen...
-
- Table aSortedPropsIds;
- sal_uInt32 nProps = maIDs.Count();
- for ( sal_uInt32 s = 0; s < nProps; s++ )
- {
- sal_uInt16 nId = sal::static_int_cast< sal_uInt16 >(
- maIDs.GetObjectKey( s ));
- aSortedPropsIds.Insert( 1+GetPropertyOrderNr( nId ), (void*)(sal_uIntPtr)nId );
-
- if ( nId == BASEPROPERTY_FONTDESCRIPTOR )
- {
- // Einzelproperties...
- for ( sal_uInt16 i = BASEPROPERTY_FONTDESCRIPTORPART_START; i <= BASEPROPERTY_FONTDESCRIPTORPART_END; i++ )
- aSortedPropsIds.Insert( 1+GetPropertyOrderNr( i ), (void*)(sal_uIntPtr)i );
- }
- }
-
- nProps = aSortedPropsIds.Count(); // koennen jetzt mehr sein
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aProps( nProps );
- ::com::sun::star::beans::Property* pProps = aProps.getArray();
-
- for ( sal_uInt32 n = 0; n < nProps; n++ )
- {
- sal_uInt16 nId = (sal_uInt16)(sal_uLong)aSortedPropsIds.GetObject( n );
- pProps[n].Name = GetPropertyName( nId );
- pProps[n].Handle = nId;
- pProps[n].Type = *GetPropertyType( nId );
- pProps[n].Attributes = GetPropertyAttribs( nId );
- }
-
- return aProps;
-}
-
-::com::sun::star::beans::Property UnoPropertyArrayHelper::getPropertyByName(const ::rtl::OUString& rPropertyName) throw (::com::sun::star::beans::UnknownPropertyException)
-{
- ::com::sun::star::beans::Property aProp;
- sal_uInt16 nId = GetPropertyId( rPropertyName );
- if ( ImplHasProperty( nId ) )
- {
- aProp.Name = rPropertyName;
- aProp.Handle = -1;
- aProp.Type = *GetPropertyType( nId );
- aProp.Attributes = GetPropertyAttribs( nId );
- }
-
- return aProp;
-}
-
-sal_Bool UnoPropertyArrayHelper::hasPropertyByName(const ::rtl::OUString& rPropertyName)
-{
- return ImplHasProperty( GetPropertyId( rPropertyName ) );
-}
-
-sal_Int32 UnoPropertyArrayHelper::getHandleByName( const ::rtl::OUString & rPropertyName )
-{
- sal_Int32 nId = (sal_Int32 ) GetPropertyId( rPropertyName );
- return nId ? nId : (-1);
-}
-
-sal_Int32 UnoPropertyArrayHelper::fillHandles( sal_Int32* pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames )
-{
- const ::rtl::OUString* pNames = rPropNames.getConstArray();
- sal_Int32 nValues = rPropNames.getLength();
- sal_Int32 nValidHandles = 0;
-
- for ( sal_Int32 n = 0; n < nValues; n++ )
- {
- sal_uInt16 nPropId = GetPropertyId( pNames[n] );
- if ( nPropId && ImplHasProperty( nPropId ) )
- {
- pHandles[n] = nPropId;
- nValidHandles++;
- }
- else
- {
- pHandles[n] = -1;
- }
- }
- return nValidHandles;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
deleted file mode 100644
index e613cfaa83..0000000000
--- a/toolkit/source/helper/unowrapper.cxx
+++ /dev/null
@@ -1,346 +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 <comphelper/processfactory.hxx>
-
-#include <toolkit/helper/unowrapper.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <toolkit/helper/convert.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <toolkit/awt/vclxwindows.hxx>
-#include <toolkit/awt/vclxcontainer.hxx>
-#include <toolkit/awt/vclxtopwindow.hxx>
-#include <toolkit/awt/vclxgraphics.hxx>
-#include <awt/vclxtabcontrol.hxx>
-
-#include "toolkit/dllapi.h"
-#include <vcl/svapp.hxx>
-#include <vcl/syswin.hxx>
-#include <vcl/menu.hxx>
-
-#include <tools/debug.hxx>
-
-using namespace ::com::sun::star;
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > CreateXWindow( Window* pWindow )
-{
- switch ( pWindow->GetType() )
- {
- case WINDOW_IMAGERADIOBUTTON:
- case WINDOW_IMAGEBUTTON:
- case WINDOW_SPINBUTTON:
- case WINDOW_MENUBUTTON:
- case WINDOW_MOREBUTTON:
- case WINDOW_PUSHBUTTON:
- case WINDOW_HELPBUTTON:
- case WINDOW_OKBUTTON:
- case WINDOW_CANCELBUTTON: return new VCLXButton;
- case WINDOW_CHECKBOX: return new VCLXCheckBox;
- // #i95042#
- // A Window of type <MetricBox> is inherited from type <ComboBox>.
- // Thus, it does make more sense to return a <VCLXComboBox> instance
- // instead of only a <VCLXWindow> instance, especially regarding its
- // corresponding accessibility API.
- case WINDOW_METRICBOX:
- case WINDOW_COMBOBOX: return new VCLXComboBox;
- case WINDOW_SPINFIELD:
- case WINDOW_NUMERICFIELD:
- case WINDOW_CURRENCYFIELD: return new VCLXNumericField;
- case WINDOW_DATEFIELD: return new VCLXDateField;
- case WINDOW_MULTILINEEDIT:
- case WINDOW_EDIT: return new VCLXEdit;
- case WINDOW_METRICFIELD: return new VCLXSpinField;
- case WINDOW_MESSBOX:
- case WINDOW_INFOBOX:
- case WINDOW_WARNINGBOX:
- case WINDOW_QUERYBOX:
- case WINDOW_ERRORBOX: return new VCLXMessageBox;
- case WINDOW_FIXEDIMAGE: return new VCLXImageControl;
- case WINDOW_FIXEDTEXT: return new VCLXFixedText;
- case WINDOW_MULTILISTBOX:
- case WINDOW_LISTBOX: return new VCLXListBox;
- case WINDOW_LONGCURRENCYFIELD: return new VCLXCurrencyField;
- case WINDOW_DIALOG:
- case WINDOW_MODALDIALOG:
- case WINDOW_TABDIALOG:
- case WINDOW_BUTTONDIALOG:
- case WINDOW_MODELESSDIALOG: return new VCLXDialog;
- case WINDOW_PATTERNFIELD: return new VCLXPatternField;
- case WINDOW_RADIOBUTTON: return new VCLXRadioButton;
- case WINDOW_SCROLLBAR: return new VCLXScrollBar;
- case WINDOW_TIMEFIELD: return new VCLXTimeField;
-
- case WINDOW_SYSWINDOW:
- case WINDOW_WORKWINDOW:
- case WINDOW_DOCKINGWINDOW:
- case WINDOW_FLOATINGWINDOW:
- case WINDOW_HELPTEXTWINDOW: return new VCLXTopWindow;
-
- case WINDOW_WINDOW:
- case WINDOW_TABPAGE: return new VCLXContainer;
-
- case WINDOW_TOOLBOX: return new VCLXToolBox;
- case WINDOW_TABCONTROL: return new VCLXMultiPage;
-
- // case WINDOW_FIXEDLINE:
- // case WINDOW_FIXEDBITMAP:
- // case WINDOW_DATEBOX:
- // case WINDOW_GROUPBOX:
- // case WINDOW_LONGCURRENCYBOX:
- // case WINDOW_SPLITTER:
- // case WINDOW_STATUSBAR:
- // case WINDOW_TABCONTROL:
- // case WINDOW_NUMERICBOX:
- // case WINDOW_TRISTATEBOX:
- // case WINDOW_TIMEBOX:
- // case WINDOW_SPLITWINDOW:
- // case WINDOW_SCROLLBARBOX:
- // case WINDOW_PATTERNBOX:
- // case WINDOW_CURRENCYBOX:
- default: return new VCLXWindow( true );
- }
-}
-
-// ----------------------------------------------------
-// class UnoWrapper
-// ----------------------------------------------------
-
-extern "C" {
-
-TOOLKIT_DLLPUBLIC UnoWrapperBase* CreateUnoWrapper()
-{
- return new UnoWrapper( NULL );
-}
-
-} // extern "C"
-
-
-UnoWrapper::UnoWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>& rxToolkit )
-{
- mxToolkit = rxToolkit;
-}
-
-void UnoWrapper::Destroy()
-{
- delete this;
-}
-
-UnoWrapper::~UnoWrapper()
-{
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> UnoWrapper::GetVCLToolkit()
-{
- if ( !mxToolkit.is() )
- mxToolkit = VCLUnoHelper::CreateToolkit();
- return mxToolkit.get();
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> UnoWrapper::GetWindowInterface( Window* pWindow, sal_Bool bCreate )
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
- if ( !xPeer.is() && bCreate )
- {
- xPeer = CreateXWindow( pWindow );
- SetWindowInterface( pWindow, xPeer );
- }
- return xPeer;
-}
-
-void UnoWrapper::SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xIFace )
-{
- VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( xIFace );
-
- DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" );
- if ( pVCLXWindow )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
- if( xPeer.is() )
- {
- bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() ));
- DBG_ASSERT( bSameInstance, "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" );
- if ( bSameInstance )
- return;
- }
- pVCLXWindow->SetWindow( pWindow );
- pWindow->SetWindowPeer( xIFace, pVCLXWindow );
- }
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> UnoWrapper::CreateGraphics( OutputDevice* pOutDev )
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> xGrf;
- VCLXGraphics* pGrf = new VCLXGraphics;
- xGrf = pGrf;
- pGrf->Init( pOutDev );
- return xGrf;
-}
-
-void UnoWrapper::ReleaseAllGraphics( OutputDevice* pOutDev )
-{
- VCLXGraphicsList_impl* pLst = pOutDev->GetUnoGraphicsList();
- if ( pLst )
- {
- for ( size_t n = 0; n < pLst->size(); n++ )
- {
- VCLXGraphics* pGrf = (*pLst)[ n ];
- pGrf->SetOutputDevice( NULL );
- }
- }
-
-}
-
-// MT: Wurde im Window-CTOR gerufen, damit Container-Listener
-// vom Parent reagieren, aber hat sowieso nicht richtig funktioniert,
-// weil im Window-CTOR das Interface noch nicht da ist!
-// => Nur Listener rufen, wenn ueber das ::com::sun::star::awt::Toolkit erzeugt
-
-/*
-void ImplSmartWindowCreated( Window* pNewWindow )
-{
- UNOWindowData* pParentUNOData = pNewWindow->GetParent() ?
- pNewWindow->GetParent()->GetUNOData() : NULL;
-
- if ( pParentUNOData && pParentUNOData->GetListeners( EL_CONTAINER ) )
- {
- UNOWindowData* pUNOData = pNewWindow->GetUNOData();
- if ( !pUNOData )
- pUNOData = ImplSmartCreateUNOData( pNewWindow );
-
- ::com::sun::star::awt::VclContainerEvent aEvent;
- aEvent.Source = (UsrObject*)pParentUNOData->GetWindowPeer();
- aEvent.Id = VCLCOMPONENT_ADDED;
- aEvent.Child = (UsrObject*)pUNOData->GetWindowPeer();
-
- EventList* pLst = pParentUNOData->GetListeners( EL_CONTAINER );
- for ( sal_uInt32 n = 0; n < pLst->Count(); n++ )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > * pRef = pLst->GetObject( n );
- ((::com::sun::star::awt::XVclContainerListener*)(::com::sun::star::lang::XEventListener*)*pRef)->windowAdded( aEvent );
- }
- }
-}
-*/
-
-sal_Bool lcl_ImplIsParent( Window* pParentWindow, Window* pPossibleChild )
-{
- Window* pWindow = ( pPossibleChild != pParentWindow ) ? pPossibleChild : NULL;
- while ( pWindow && ( pWindow != pParentWindow ) )
- pWindow = pWindow->GetParent();
-
- return pWindow ? sal_True : sal_False;
-}
-
-void UnoWrapper::WindowDestroyed( Window* pWindow )
-{
- // ggf. existieren noch von ::com::sun::star::loader::Java erzeugte Childs, die sonst erst
- // im Garbage-Collector zerstoert werden...
- Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
- while ( pChild )
- {
- Window* pNextChild = pChild->GetWindow( WINDOW_NEXT );
-
- Window* pClient = pChild->GetWindow( WINDOW_CLIENT );
- if ( pClient->GetWindowPeer() )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( sal_False ), ::com::sun::star::uno::UNO_QUERY );
- xComp->dispose();
- }
-
- pChild = pNextChild;
- }
-
- // ::com::sun::star::chaos::System-Windows suchen...
- Window* pOverlap = pWindow->GetWindow( WINDOW_OVERLAP );
- pOverlap = pOverlap->GetWindow( WINDOW_FIRSTOVERLAP );
- while ( pOverlap )
- {
- Window* pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT );
- Window* pClient = pOverlap->GetWindow( WINDOW_CLIENT );
-
- if ( pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( sal_False ), ::com::sun::star::uno::UNO_QUERY );
- xComp->dispose();
- }
-
- pOverlap = pNextOverlap;
- }
-
- Window* pParent = pWindow->GetParent();
- if ( pParent && pParent->GetWindowPeer() )
- pParent->GetWindowPeer()->notifyWindowRemoved( *pWindow );
-
- VCLXWindow* pWindowPeer = pWindow->GetWindowPeer();
- uno::Reference< lang::XComponent > xWindowPeerComp( pWindow->GetComponentInterface( sal_False ), uno::UNO_QUERY );
- OSL_ENSURE( ( pWindowPeer != NULL ) == ( xWindowPeerComp.is() == sal_True ),
- "UnoWrapper::WindowDestroyed: inconsistency in the window's peers!" );
- if ( pWindowPeer )
- {
- pWindowPeer->SetWindow( NULL );
- pWindow->SetWindowPeer( NULL, NULL );
- }
- if ( xWindowPeerComp.is() )
- xWindowPeerComp->dispose();
-
- // #102132# Iterate over frames after setting Window peer to NULL,
- // because while destroying other frames, we get get into the method again and try
- // to destroy this window again...
- // #i42462#/#116855# no, don't loop: Instead, just ensure that all our top-window-children
- // are disposed, too (which should also be a valid fix for #102132#, but doesn't have the extreme
- // performance penalties)
- if ( pWindow )
- {
- Window* pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD );
- while ( pTopWindowChild )
- {
- OSL_ENSURE( pTopWindowChild->GetParent() == pWindow,
- "UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" );
-
- Window* pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
-
- //the window still could be on the stack, so we have to
- // use lazy delete ( it will automatically
- // disconnect from the currently destroyed parent window )
- pTopWindowChild->doLazyDelete();
-
- pTopWindowChild = pNextTopChild;
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > UnoWrapper::CreateAccessible( Menu* pMenu, sal_Bool bIsMenuBar )
-{
- return maAccessibleFactoryAccess.getFactory().createAccessible( pMenu, bIsMenuBar );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
deleted file mode 100644
index e0ea77c74c..0000000000
--- a/toolkit/source/helper/vclunohelper.cxx
+++ /dev/null
@@ -1,804 +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 <tools/debug.hxx>
-#include <tools/stream.hxx>
-#include <vcl/bitmap.hxx>
-#include <vcl/window.hxx>
-#include <sal/macros.h>
-#include <com/sun/star/util/MeasureUnit.hpp>
-#include <com/sun/star/awt/XBitmap.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/awt/XDevice.hpp>
-#include <com/sun/star/awt/XPointer.hpp>
-#include <com/sun/star/awt/SimpleFontMetric.hpp>
-#include <com/sun/star/awt/FontDescriptor.hpp>
-#include <com/sun/star/awt/XControlContainer.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
-#include <com/sun/star/awt/FontWidth.hpp>
-#include <com/sun/star/awt/KeyModifier.hpp>
-#include <com/sun/star/awt/MouseButton.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/embed/EmbedMapUnits.hpp>
-
-#include <com/sun/star/graphic/XGraphic.hpp>
-
-#include <toolkit/helper/vclunohelper.hxx>
-#include <toolkit/helper/convert.hxx>
-#include <toolkit/awt/vclxbitmap.hxx>
-#include <toolkit/awt/vclxregion.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <toolkit/awt/vclxgraphics.hxx>
-#include <toolkit/awt/vclxpointer.hxx>
-#include <toolkit/awt/vclxfont.hxx>
-#include <toolkit/controls/unocontrolcontainer.hxx>
-#include <toolkit/controls/unocontrolcontainermodel.hxx>
-
-#include <vcl/graph.hxx>
-#include <comphelper/processfactory.hxx>
-
-#include <com/sun/star/awt/Size.hpp>
-#include <com/sun/star/awt/Point.hpp>
-
-using namespace ::com::sun::star;
-
-// ----------------------------------------------------
-// class VCLUnoHelper
-// ----------------------------------------------------
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> VCLUnoHelper::CreateToolkit()
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> xToolkit;
- if ( xI.is() )
- xToolkit = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>( xI, ::com::sun::star::uno::UNO_QUERY );
-
- return xToolkit;
-}
-
-BitmapEx VCLUnoHelper::GetBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>& rxBitmap )
-{
- BitmapEx aBmp;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > xGraphic( rxBitmap, ::com::sun::star::uno::UNO_QUERY );
- if( xGraphic.is() )
- {
- Graphic aGraphic( xGraphic );
- aBmp = aGraphic.GetBitmapEx();
- }
- else if ( rxBitmap.is() )
- {
- VCLXBitmap* pVCLBitmap = VCLXBitmap::GetImplementation( rxBitmap );
- if ( pVCLBitmap )
- aBmp = pVCLBitmap->GetBitmap();
- else
- {
- Bitmap aDIB, aMask;
- {
- ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getDIB();
- SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
- aMem >> aDIB;
- }
- {
- ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getMaskDIB();
- SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
- aMem >> aMask;
- }
- aBmp = BitmapEx( aDIB, aMask );
- }
- }
- return aBmp;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> VCLUnoHelper::CreateBitmap( const BitmapEx& rBitmap )
-{
- Graphic aGraphic( rBitmap );
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> xBmp( aGraphic.GetXGraphic(), ::com::sun::star::uno::UNO_QUERY );
- return xBmp;
-}
-
-Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
-{
- VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
- return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
-}
-
-Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow )
-{
- VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
- return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
-}
-
-Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
-{
- VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
- return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
-}
-
-Region VCLUnoHelper::GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion )
-{
- Region aRegion;
- VCLXRegion* pVCLRegion = VCLXRegion::GetImplementation( rxRegion );
- if ( pVCLRegion )
- aRegion = pVCLRegion->GetRegion();
- else
- {
- ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > aRects = rxRegion->getRectangles();
- sal_Int32 nRects = aRects.getLength();
- for ( sal_Int32 n = 0; n < nRects; n++ )
- aRegion.Union( VCLRectangle( aRects.getArray()[n] ) );
- }
- return aRegion;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> VCLUnoHelper::GetInterface( Window* pWindow )
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWin;
- if ( pWindow )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetComponentInterface();
- xWin = xWin.query( xPeer );
- }
- return xWin;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> VCLUnoHelper::CreatePointer()
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> xPointer = new VCLXPointer;
- return xPointer;
-}
-
-OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>& rxDevice )
-{
- OutputDevice* pOutDev = NULL;
- VCLXDevice* pDev = VCLXDevice::GetImplementation( rxDevice );
- if ( pDev )
- pOutDev = pDev->GetOutputDevice();
- return pOutDev;
-}
-
-OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>& rxGraphics )
-{
- OutputDevice* pOutDev = NULL;
- VCLXGraphics* pGrf = VCLXGraphics::GetImplementation( rxGraphics );
- if ( pGrf )
- pOutDev = pGrf->GetOutputDevice();
- return pOutDev;
-}
-
-Polygon VCLUnoHelper::CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY )
-{
- sal_uInt32 nLen = DataX.getLength();
- const sal_Int32* pDataX = DataX.getConstArray();
- const sal_Int32* pDataY = DataY.getConstArray();
- Polygon aPoly( (sal_uInt16) nLen );
- for ( sal_uInt16 n = 0; n < nLen; n++ )
- {
- Point aPnt;
- aPnt.X() = pDataX[n];
- aPnt.Y() = pDataY[n];
- aPoly[n] = aPnt;
- }
- return aPoly;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> VCLUnoHelper::CreateControlContainer( Window* pWindow )
-{
- const uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
- UnoControlContainer* pContainer = new UnoControlContainer( xFactory, pWindow->GetComponentInterface( sal_True ) );
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > x = pContainer;
-
- UnoControlModel* pContainerModel = new UnoControlContainerModel( xFactory );
- pContainer->setModel( (::com::sun::star::awt::XControlModel*)pContainerModel );
-
- return x;
-}
-
-float VCLUnoHelper::ConvertFontWidth( FontWidth eWidth )
-{
- if( eWidth == WIDTH_DONTKNOW )
- return ::com::sun::star::awt::FontWidth::DONTKNOW;
- else if( eWidth == WIDTH_ULTRA_CONDENSED )
- return ::com::sun::star::awt::FontWidth::ULTRACONDENSED;
- else if( eWidth == WIDTH_EXTRA_CONDENSED )
- return ::com::sun::star::awt::FontWidth::EXTRACONDENSED;
- else if( eWidth == WIDTH_CONDENSED )
- return ::com::sun::star::awt::FontWidth::CONDENSED;
- else if( eWidth == WIDTH_SEMI_CONDENSED )
- return ::com::sun::star::awt::FontWidth::SEMICONDENSED;
- else if( eWidth == WIDTH_NORMAL )
- return ::com::sun::star::awt::FontWidth::NORMAL;
- else if( eWidth == WIDTH_SEMI_EXPANDED )
- return ::com::sun::star::awt::FontWidth::SEMIEXPANDED;
- else if( eWidth == WIDTH_EXPANDED )
- return ::com::sun::star::awt::FontWidth::EXPANDED;
- else if( eWidth == WIDTH_EXTRA_EXPANDED )
- return ::com::sun::star::awt::FontWidth::EXTRAEXPANDED;
- else if( eWidth == WIDTH_ULTRA_EXPANDED )
- return ::com::sun::star::awt::FontWidth::ULTRAEXPANDED;
-
- OSL_FAIL( "Unknown FontWidth" );
- return ::com::sun::star::awt::FontWidth::DONTKNOW;
-}
-
-FontWidth VCLUnoHelper::ConvertFontWidth( float f )
-{
- if( f <= ::com::sun::star::awt::FontWidth::DONTKNOW )
- return WIDTH_DONTKNOW;
- else if( f <= ::com::sun::star::awt::FontWidth::ULTRACONDENSED )
- return WIDTH_ULTRA_CONDENSED;
- else if( f <= ::com::sun::star::awt::FontWidth::EXTRACONDENSED )
- return WIDTH_EXTRA_CONDENSED;
- else if( f <= ::com::sun::star::awt::FontWidth::CONDENSED )
- return WIDTH_CONDENSED;
- else if( f <= ::com::sun::star::awt::FontWidth::SEMICONDENSED )
- return WIDTH_SEMI_CONDENSED;
- else if( f <= ::com::sun::star::awt::FontWidth::NORMAL )
- return WIDTH_NORMAL;
- else if( f <= ::com::sun::star::awt::FontWidth::SEMIEXPANDED )
- return WIDTH_SEMI_EXPANDED;
- else if( f <= ::com::sun::star::awt::FontWidth::EXPANDED )
- return WIDTH_EXPANDED;
- else if( f <= ::com::sun::star::awt::FontWidth::EXTRAEXPANDED )
- return WIDTH_EXTRA_EXPANDED;
- else if( f <= ::com::sun::star::awt::FontWidth::ULTRAEXPANDED )
- return WIDTH_ULTRA_EXPANDED;
-
- OSL_FAIL( "Unknown FontWidth" );
- return WIDTH_DONTKNOW;
-}
-
-float VCLUnoHelper::ConvertFontWeight( FontWeight eWeight )
-{
- if( eWeight == WEIGHT_DONTKNOW )
- return ::com::sun::star::awt::FontWeight::DONTKNOW;
- else if( eWeight == WEIGHT_THIN )
- return ::com::sun::star::awt::FontWeight::THIN;
- else if( eWeight == WEIGHT_ULTRALIGHT )
- return ::com::sun::star::awt::FontWeight::ULTRALIGHT;
- else if( eWeight == WEIGHT_LIGHT )
- return ::com::sun::star::awt::FontWeight::LIGHT;
- else if( eWeight == WEIGHT_SEMILIGHT )
- return ::com::sun::star::awt::FontWeight::SEMILIGHT;
- else if( ( eWeight == WEIGHT_NORMAL ) || ( eWeight == WEIGHT_MEDIUM ) )
- return ::com::sun::star::awt::FontWeight::NORMAL;
- else if( eWeight == WEIGHT_SEMIBOLD )
- return ::com::sun::star::awt::FontWeight::SEMIBOLD;
- else if( eWeight == WEIGHT_BOLD )
- return ::com::sun::star::awt::FontWeight::BOLD;
- else if( eWeight == WEIGHT_ULTRABOLD )
- return ::com::sun::star::awt::FontWeight::ULTRABOLD;
- else if( eWeight == WEIGHT_BLACK )
- return ::com::sun::star::awt::FontWeight::BLACK;
-
- OSL_FAIL( "Unknown FontWeigth" );
- return ::com::sun::star::awt::FontWeight::DONTKNOW;
-}
-
-FontWeight VCLUnoHelper::ConvertFontWeight( float f )
-{
- if( f <= ::com::sun::star::awt::FontWeight::DONTKNOW )
- return WEIGHT_DONTKNOW;
- else if( f <= ::com::sun::star::awt::FontWeight::THIN )
- return WEIGHT_THIN;
- else if( f <= ::com::sun::star::awt::FontWeight::ULTRALIGHT )
- return WEIGHT_ULTRALIGHT;
- else if( f <= ::com::sun::star::awt::FontWeight::LIGHT )
- return WEIGHT_LIGHT;
- else if( f <= ::com::sun::star::awt::FontWeight::SEMILIGHT )
- return WEIGHT_SEMILIGHT;
- else if( f <= ::com::sun::star::awt::FontWeight::NORMAL )
- return WEIGHT_NORMAL;
- else if( f <= ::com::sun::star::awt::FontWeight::SEMIBOLD )
- return WEIGHT_SEMIBOLD;
- else if( f <= ::com::sun::star::awt::FontWeight::BOLD )
- return WEIGHT_BOLD;
- else if( f <= ::com::sun::star::awt::FontWeight::ULTRABOLD )
- return WEIGHT_ULTRABOLD;
- else if( f <= ::com::sun::star::awt::FontWeight::BLACK )
- return WEIGHT_BLACK;
-
- OSL_FAIL( "Unknown FontWeigth" );
- return WEIGHT_DONTKNOW;
-}
-
-
-::com::sun::star::awt::FontDescriptor VCLUnoHelper::CreateFontDescriptor( const Font& rFont )
-{
- ::com::sun::star::awt::FontDescriptor aFD;
- aFD.Name = rFont.GetName();
- aFD.StyleName = rFont.GetStyleName();
- aFD.Height = (sal_Int16)rFont.GetSize().Height();
- aFD.Width = (sal_Int16)rFont.GetSize().Width();
- aFD.Family = sal::static_int_cast< sal_Int16 >(rFont.GetFamily());
- aFD.CharSet = rFont.GetCharSet();
- aFD.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch());
- aFD.CharacterWidth = VCLUnoHelper::ConvertFontWidth( rFont.GetWidthType() );
- aFD.Weight= VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() );
- aFD.Slant = (::com::sun::star::awt::FontSlant)rFont.GetItalic();
- aFD.Underline = sal::static_int_cast< sal_Int16 >(rFont.GetUnderline());
- aFD.Strikeout = sal::static_int_cast< sal_Int16 >(rFont.GetStrikeout());
- aFD.Orientation = rFont.GetOrientation();
- aFD.Kerning = rFont.IsKerning();
- aFD.WordLineMode = rFont.IsWordLineMode();
- aFD.Type = 0; // ??? => Nur an Metric...
- return aFD;
-}
-
-Font VCLUnoHelper::CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont )
-{
- Font aFont( rInitFont );
- if ( rDescr.Name.getLength() )
- aFont.SetName( rDescr.Name );
- if ( rDescr.StyleName.getLength() )
- aFont.SetStyleName( rDescr.StyleName );
- if ( rDescr.Height )
- aFont.SetSize( Size( rDescr.Width, rDescr.Height ) );
- if ( (FontFamily)rDescr.Family != FAMILY_DONTKNOW )
- aFont.SetFamily( (FontFamily)rDescr.Family );
- if ( (CharSet)rDescr.CharSet != RTL_TEXTENCODING_DONTKNOW )
- aFont.SetCharSet( (CharSet)rDescr.CharSet );
- if ( (FontPitch)rDescr.Pitch != PITCH_DONTKNOW )
- aFont.SetPitch( (FontPitch)rDescr.Pitch );
- if ( rDescr.CharacterWidth )
- aFont.SetWidthType( VCLUnoHelper::ConvertFontWidth( rDescr.CharacterWidth ) );
- if ( rDescr.Weight )
- aFont.SetWeight( VCLUnoHelper::ConvertFontWeight( rDescr.Weight ) );
- if ( (FontItalic)rDescr.Slant != ITALIC_DONTKNOW )
- aFont.SetItalic( (FontItalic)rDescr.Slant );
- if ( (FontUnderline)rDescr.Underline != UNDERLINE_DONTKNOW )
- aFont.SetUnderline( (FontUnderline)rDescr.Underline );
- if ( (FontStrikeout)rDescr.Strikeout != STRIKEOUT_DONTKNOW )
- aFont.SetStrikeout( (FontStrikeout)rDescr.Strikeout );
-
- // Kein DONTKNOW
- aFont.SetOrientation( (short)rDescr.Orientation );
- aFont.SetKerning( rDescr.Kerning );
- aFont.SetWordLineMode( rDescr.WordLineMode );
-
- return aFont;
-}
-
-Font VCLUnoHelper::CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont )
-{
- Font aFont;
- VCLXFont* pVCLXFont = VCLXFont::GetImplementation( rxFont );
- if ( pVCLXFont )
- aFont = pVCLXFont->GetFont();
- return aFont;
-}
-
-
-::com::sun::star::awt::SimpleFontMetric VCLUnoHelper::CreateFontMetric( const FontMetric& rFontMetric )
-{
- ::com::sun::star::awt::SimpleFontMetric aFM;
- aFM.Ascent = (sal_Int16)rFontMetric.GetAscent();
- aFM.Descent = (sal_Int16)rFontMetric.GetDescent();
- aFM.Leading = (sal_Int16)rFontMetric.GetIntLeading();
- aFM.Slant = (sal_Int16)rFontMetric.GetSlant();
- aFM.FirstChar = 0x0020;
- aFM.LastChar = 0xFFFD;
- return aFM;
-}
-
-sal_Bool VCLUnoHelper::IsZero( ::com::sun::star::awt::Rectangle rRect )
-{
- return ( !rRect.X && !rRect.Y && !rRect.Width && !rRect.Height );
-}
-
-MapUnit VCLUnoHelper::UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit )
-{
- switch( nUnoEmbedMapUnit )
- {
- case ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_MM:
- return MAP_100TH_MM;
- case ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_MM:
- return MAP_10TH_MM;
- case ::com::sun::star::embed::EmbedMapUnits::ONE_MM:
- return MAP_MM;
- case ::com::sun::star::embed::EmbedMapUnits::ONE_CM:
- return MAP_CM;
- case ::com::sun::star::embed::EmbedMapUnits::ONE_1000TH_INCH:
- return MAP_1000TH_INCH;
- case ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_INCH:
- return MAP_100TH_INCH;
- case ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_INCH:
- return MAP_10TH_INCH;
- case ::com::sun::star::embed::EmbedMapUnits::ONE_INCH:
- return MAP_INCH;
- case ::com::sun::star::embed::EmbedMapUnits::POINT:
- return MAP_POINT;
- case ::com::sun::star::embed::EmbedMapUnits::TWIP:
- return MAP_TWIP;
- case ::com::sun::star::embed::EmbedMapUnits::PIXEL:
- return MAP_PIXEL;
- }
-
- OSL_FAIL( "Unexpected UNO map mode is provided!\n" );
- return MAP_LASTENUMDUMMY;
-}
-
-sal_Int32 VCLUnoHelper::VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit )
-{
- switch( nVCLMapUnit )
- {
- case MAP_100TH_MM:
- return ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_MM;
- case MAP_10TH_MM:
- return ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_MM;
- case MAP_MM:
- return ::com::sun::star::embed::EmbedMapUnits::ONE_MM;
- case MAP_CM:
- return ::com::sun::star::embed::EmbedMapUnits::ONE_CM;
- case MAP_1000TH_INCH:
- return ::com::sun::star::embed::EmbedMapUnits::ONE_1000TH_INCH;
- case MAP_100TH_INCH:
- return ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_INCH;
- case MAP_10TH_INCH:
- return ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_INCH;
- case MAP_INCH:
- return ::com::sun::star::embed::EmbedMapUnits::ONE_INCH;
- case MAP_POINT:
- return ::com::sun::star::embed::EmbedMapUnits::POINT;
- case MAP_TWIP:
- return ::com::sun::star::embed::EmbedMapUnits::TWIP;
- case MAP_PIXEL:
- return ::com::sun::star::embed::EmbedMapUnits::PIXEL;
- default: ; // avoid compiler warning
- }
-
- OSL_FAIL( "Unexpected VCL map mode is provided!\n" );
- return -1;
-}
-
-using namespace ::com::sun::star::util;
-
-//====================================================================
-//= file-local helpers
-//====================================================================
-namespace
-{
- enum UnitConversionDirection
- {
- FieldUnitToMeasurementUnit,
- MeasurementUnitToFieldUnit
- };
-
- sal_Int16 convertMeasurementUnit( sal_Int16 _nUnit, UnitConversionDirection eDirection, sal_Int16& _rFieldToUNOValueFactor )
- {
- static struct _unit_table
- {
- FieldUnit eFieldUnit;
- sal_Int16 nMeasurementUnit;
- sal_Int16 nFieldToMeasureFactor;
- } aUnits[] = {
- { FUNIT_NONE, -1 , -1},
- { FUNIT_MM, MeasureUnit::MM, 1 }, // must precede MM_10TH
- { FUNIT_MM, MeasureUnit::MM_10TH, 10 },
- { FUNIT_100TH_MM, MeasureUnit::MM_100TH, 1 },
- { FUNIT_CM, MeasureUnit::CM, 1 },
- { FUNIT_M, MeasureUnit::M, 1 },
- { FUNIT_KM, MeasureUnit::KM, 1 },
- { FUNIT_TWIP, MeasureUnit::TWIP, 1 },
- { FUNIT_POINT, MeasureUnit::POINT, 1 },
- { FUNIT_PICA, MeasureUnit::PICA, 1 },
- { FUNIT_INCH, MeasureUnit::INCH, 1 }, // must precede INCH_*TH
- { FUNIT_INCH, MeasureUnit::INCH_10TH, 10 },
- { FUNIT_INCH, MeasureUnit::INCH_100TH, 100 },
- { FUNIT_INCH, MeasureUnit::INCH_1000TH, 1000 },
- { FUNIT_FOOT, MeasureUnit::FOOT, 1 },
- { FUNIT_MILE, MeasureUnit::MILE, 1 },
- };
- for ( size_t i = 0; i < SAL_N_ELEMENTS( aUnits ); ++i )
- {
- if ( eDirection == FieldUnitToMeasurementUnit )
- {
- if ( ( aUnits[ i ].eFieldUnit == (FieldUnit)_nUnit ) && ( aUnits[ i ].nFieldToMeasureFactor == _rFieldToUNOValueFactor ) )
- return aUnits[ i ].nMeasurementUnit;
- }
- else
- {
- if ( aUnits[ i ].nMeasurementUnit == _nUnit )
- {
- _rFieldToUNOValueFactor = aUnits[ i ].nFieldToMeasureFactor;
- return (sal_Int16)aUnits[ i ].eFieldUnit;
- }
- }
- }
- if ( eDirection == FieldUnitToMeasurementUnit )
- return -1;
-
- _rFieldToUNOValueFactor = 1;
- return (sal_Int16)FUNIT_NONE;
- }
-}
-//========================================================================
-//= MeasurementUnitConversion
-//========================================================================
-//------------------------------------------------------------------------
-sal_Int16 VCLUnoHelper::ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _nUNOToFieldValueFactor )
-{
- return convertMeasurementUnit( (sal_Int16)_nFieldUnit, FieldUnitToMeasurementUnit, _nUNOToFieldValueFactor );
-}
-
-//------------------------------------------------------------------------
-FieldUnit VCLUnoHelper::ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor )
-{
- return (FieldUnit)convertMeasurementUnit( _nMeasurementUnit, MeasurementUnitToFieldUnit, _rFieldToUNOValueFactor );
-}
-
-
-MapUnit /* MapModeUnit */ VCLUnoHelper::ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit) throw (::com::sun::star::lang::IllegalArgumentException)
-{
- MapUnit eMode;
- switch(_nMeasureUnit)
- {
- case com::sun::star::util::MeasureUnit::MM_100TH:
- eMode = MAP_100TH_MM;
- break;
-
-
- case com::sun::star::util::MeasureUnit::MM_10TH:
- eMode = MAP_10TH_MM;
- break;
-
- case com::sun::star::util::MeasureUnit::MM:
- eMode = MAP_MM;
- break;
-
- case com::sun::star::util::MeasureUnit::CM:
- eMode = MAP_CM;
- break;
-
- case com::sun::star::util::MeasureUnit::INCH_1000TH:
- eMode = MAP_1000TH_INCH;
- break;
-
- case com::sun::star::util::MeasureUnit::INCH_100TH:
- eMode = MAP_100TH_INCH;
- break;
-
- case com::sun::star::util::MeasureUnit::INCH_10TH:
- eMode = MAP_10TH_INCH;
- break;
-
- case com::sun::star::util::MeasureUnit::INCH:
- eMode = MAP_INCH;
- break;
-
- case com::sun::star::util::MeasureUnit::POINT:
- eMode = MAP_POINT;
- break;
-
- case com::sun::star::util::MeasureUnit::TWIP:
- eMode = MAP_TWIP;
- break;
-
- case com::sun::star::util::MeasureUnit::PIXEL:
- eMode = MAP_PIXEL;
- break;
-
-/*
- case com::sun::star::util::MeasureUnit::M:
- break;
- case com::sun::star::util::MeasureUnit::KM:
- break;
- case com::sun::star::util::MeasureUnit::PICA:
- break;
- case com::sun::star::util::MeasureUnit::FOOT:
- break;
- case com::sun::star::util::MeasureUnit::MILE:
- break;
- case com::sun::star::util::MeasureUnit::PERCENT:
- break;
-*/
- case com::sun::star::util::MeasureUnit::APPFONT:
- eMode = MAP_APPFONT;
- break;
-
- case com::sun::star::util::MeasureUnit::SYSFONT:
- eMode = MAP_SYSFONT;
- break;
-
-/*
- case com::sun::star::util::MeasureUnit::RELATIVE:
- eMode = MAP_RELATIVE;
- break;
- case com::sun::star::util::MeasureUnit::REALAPPFONT:
- eMode = MAP_REALAPPFONT;
- break;
-*/
-
- default:
- throw ::com::sun::star::lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unsupported measure unit.")), NULL, 1 );
- }
- return eMode;
-}
-
-sal_Int16 /* com.sun.star.util.MeasureUnit.* */ VCLUnoHelper::ConvertToMeasurementUnit(MapUnit /* MapModeUnit */ _eMapModeUnit) throw (::com::sun::star::lang::IllegalArgumentException)
-{
- sal_Int16 nMeasureUnit = 0;
- switch (_eMapModeUnit)
- {
- case MAP_100TH_MM:
- nMeasureUnit = com::sun::star::util::MeasureUnit::MM_100TH;
- break;
-
- case MAP_10TH_MM:
- nMeasureUnit = com::sun::star::util::MeasureUnit::MM_10TH;
- break;
-
- case MAP_MM:
- nMeasureUnit = com::sun::star::util::MeasureUnit::MM;
- break;
-
- case MAP_CM:
- nMeasureUnit = com::sun::star::util::MeasureUnit::CM;
- break;
-
- case MAP_1000TH_INCH:
- nMeasureUnit = com::sun::star::util::MeasureUnit::INCH_1000TH;
- break;
-
- case MAP_100TH_INCH:
- nMeasureUnit = com::sun::star::util::MeasureUnit::INCH_100TH;
- break;
-
- case MAP_10TH_INCH:
- nMeasureUnit = com::sun::star::util::MeasureUnit::INCH_10TH;
- break;
-
- case MAP_INCH:
- nMeasureUnit = com::sun::star::util::MeasureUnit::INCH;
- break;
-
- case MAP_POINT:
- nMeasureUnit = com::sun::star::util::MeasureUnit::POINT;
- break;
-
- case MAP_TWIP:
- nMeasureUnit = com::sun::star::util::MeasureUnit::TWIP;
- break;
-
- case MAP_PIXEL:
- nMeasureUnit = com::sun::star::util::MeasureUnit::PIXEL;
- break;
-
- case MAP_APPFONT:
- nMeasureUnit = com::sun::star::util::MeasureUnit::APPFONT;
- break;
-
- case MAP_SYSFONT:
- nMeasureUnit = com::sun::star::util::MeasureUnit::SYSFONT;
- break;
-
-/*
- case MAP_RELATIVE:
- break;
-
- case MAP_REALAPPFONT:
- break;
-*/
- default:
- throw ::com::sun::star::lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unsupported MapMode unit.")), NULL, 1 );
- }
- return nMeasureUnit;
-}
-
-::Size VCLUnoHelper::ConvertToVCLSize(com::sun::star::awt::Size const& _aSize)
-{
- ::Size aVCLSize(_aSize.Width, _aSize.Height);
- return aVCLSize;
-}
-
-com::sun::star::awt::Size VCLUnoHelper::ConvertToAWTSize(::Size /* VCLSize */ const& _aSize)
-{
- com::sun::star::awt::Size aAWTSize(_aSize.Width(), _aSize.Height());
- return aAWTSize;
-}
-
-
-::Point VCLUnoHelper::ConvertToVCLPoint(com::sun::star::awt::Point const& _aPoint)
-{
- ::Point aVCLPoint(_aPoint.X, _aPoint.Y);
- return aVCLPoint;
-}
-
-com::sun::star::awt::Point VCLUnoHelper::ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint)
-{
- com::sun::star::awt::Point aAWTPoint(_aPoint.X(), _aPoint.Y());
- return aAWTPoint;
-}
-
-::Rectangle VCLUnoHelper::ConvertToVCLRect( ::com::sun::star::awt::Rectangle const & _rRect )
-{
- return ::Rectangle( _rRect.X, _rRect.Y, _rRect.X + _rRect.Width - 1, _rRect.Y + _rRect.Height - 1 );
-}
-
-::com::sun::star::awt::Rectangle VCLUnoHelper::ConvertToAWTRect( ::Rectangle const & _rRect )
-{
- return ::com::sun::star::awt::Rectangle( _rRect.Left(), _rRect.Top(), _rRect.GetWidth(), _rRect.GetHeight() );
-}
-
-awt::MouseEvent VCLUnoHelper::createMouseEvent( const ::MouseEvent& _rVclEvent, const uno::Reference< uno::XInterface >& _rxContext )
-{
- awt::MouseEvent aMouseEvent;
- aMouseEvent.Source = _rxContext;
-
- aMouseEvent.Modifiers = 0;
- if ( _rVclEvent.IsShift() )
- aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT;
- if ( _rVclEvent.IsMod1() )
- aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
- if ( _rVclEvent.IsMod2() )
- aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
-
- aMouseEvent.Buttons = 0;
- if ( _rVclEvent.IsLeft() )
- aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::LEFT;
- if ( _rVclEvent.IsRight() )
- aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::RIGHT;
- if ( _rVclEvent.IsMiddle() )
- aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::MIDDLE;
-
- aMouseEvent.X = _rVclEvent.GetPosPixel().X();
- aMouseEvent.Y = _rVclEvent.GetPosPixel().Y();
- aMouseEvent.ClickCount = _rVclEvent.GetClicks();
- aMouseEvent.PopupTrigger = sal_False;
-
- return aMouseEvent;
-}
-
-awt::KeyEvent VCLUnoHelper::createKeyEvent( const ::KeyEvent& _rVclEvent, const uno::Reference< uno::XInterface >& _rxContext )
-{
- awt::KeyEvent aKeyEvent;
- aKeyEvent.Source = _rxContext;
-
- aKeyEvent.Modifiers = 0;
- if ( _rVclEvent.GetKeyCode().IsShift() )
- aKeyEvent.Modifiers |= awt::KeyModifier::SHIFT;
- if ( _rVclEvent.GetKeyCode().IsMod1() )
- aKeyEvent.Modifiers |= awt::KeyModifier::MOD1;
- if ( _rVclEvent.GetKeyCode().IsMod2() )
- aKeyEvent.Modifiers |= awt::KeyModifier::MOD2;
- if ( _rVclEvent.GetKeyCode().IsMod3() )
- aKeyEvent.Modifiers |= awt::KeyModifier::MOD3;
-
- aKeyEvent.KeyCode = _rVclEvent.GetKeyCode().GetCode();
- aKeyEvent.KeyChar = _rVclEvent.GetCharCode();
- aKeyEvent.KeyFunc = ::sal::static_int_cast< sal_Int16 >( _rVclEvent.GetKeyCode().GetFunction());
-
- return aKeyEvent;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/bin.cxx b/toolkit/source/layout/core/bin.cxx
deleted file mode 100644
index 8a72d88cf2..0000000000
--- a/toolkit/source/layout/core/bin.cxx
+++ /dev/null
@@ -1,201 +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 "bin.hxx"
-
-#include <sal/macros.h>
-
-namespace layoutimpl
-{
-
-using namespace css;
-
-/* Bin */
-
-Bin::Bin() : Container()
-{
-}
-
-void SAL_CALL
-Bin::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
- throw (uno::RuntimeException, awt::MaxChildrenException)
-{
- if ( mxChild.is() )
- throw awt::MaxChildrenException();
- if ( xChild.is() )
- {
- mxChild = xChild;
- setChildParent( xChild );
- queueResize();
- }
-}
-
-void SAL_CALL
-Bin::removeChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
- throw (uno::RuntimeException)
-{
- if ( xChild == mxChild )
- {
- mxChild = uno::Reference< awt::XLayoutConstrains >();
- unsetChildParent( xChild );
- queueResize();
- }
-}
-
-uno::Sequence< uno::Reference< awt::XLayoutConstrains > > SAL_CALL
-Bin::getChildren()
- throw (uno::RuntimeException)
-{
- return getSingleChild (mxChild);
-}
-
-void SAL_CALL
-Bin::allocateArea( const awt::Rectangle &rArea )
- throw (uno::RuntimeException)
-{
- maAllocation = rArea;
- if ( mxChild.is() )
- allocateChildAt( mxChild, rArea );
-}
-
-awt::Size SAL_CALL
-Bin::getMinimumSize()
- throw(uno::RuntimeException)
-{
- if ( mxChild.is() )
- return maRequisition = maChildRequisition = mxChild->getMinimumSize();
- return maRequisition = awt::Size( 0, 0 );
-}
-
-uno::Reference< beans::XPropertySet > SAL_CALL
-Bin::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& )
- throw (uno::RuntimeException)
-{
- return uno::Reference< beans::XPropertySet >();
-}
-
-sal_Bool SAL_CALL
-Bin::hasHeightForWidth()
- throw(uno::RuntimeException)
-{
- uno::Reference< awt::XLayoutContainer > xChildCont( mxChild, uno::UNO_QUERY );
- if ( xChildCont.is() )
- return xChildCont->hasHeightForWidth();
- return false;
-}
-
-sal_Int32 SAL_CALL
-Bin::getHeightForWidth( sal_Int32 nWidth )
- throw(uno::RuntimeException)
-{
- uno::Reference< awt::XLayoutContainer > xChildCont( mxChild, uno::UNO_QUERY );
- if ( xChildCont.is() )
- return xChildCont->getHeightForWidth( nWidth );
- return maRequisition.Height;
-}
-
-/* Align */
-
-Align::Align() : Bin()
-{
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Halign" ),
- ::getCppuType( static_cast< const float* >( NULL ) ),
- &fHorAlign );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Valign" ),
- ::getCppuType( static_cast< const float* >( NULL ) ),
- &fVerAlign );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Hfill" ),
- ::getCppuType( static_cast< const float* >( NULL ) ),
- &fHorFill );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Vfill" ),
- ::getCppuType( static_cast< const float* >( NULL ) ),
- &fVerFill );
-
- fHorAlign = fVerAlign = 0.5;
- fHorFill = fVerFill = 0;
-}
-
-void SAL_CALL
-Align::allocateArea( const awt::Rectangle &rArea )
- throw (uno::RuntimeException)
-{
- maAllocation = rArea;
- if ( !mxChild.is() )
- return;
-
- awt::Rectangle aChildArea;
- aChildArea.Width = SAL_MIN( rArea.Width, maChildRequisition.Width );
- aChildArea.Width += (sal_Int32) SAL_MAX(
- 0, (rArea.Width - maChildRequisition.Width) * fHorFill );
- aChildArea.Height = SAL_MIN( rArea.Height, maChildRequisition.Height );
- aChildArea.Height += (sal_Int32) SAL_MAX(
- 0, (rArea.Height - maChildRequisition.Height) * fVerFill );
-
- aChildArea.X = rArea.X + (sal_Int32)( (rArea.Width - aChildArea.Width) * fHorAlign );
- aChildArea.Y = rArea.Y + (sal_Int32)( (rArea.Height - aChildArea.Height) * fVerAlign );
-
- allocateChildAt( mxChild, aChildArea );
-}
-
-bool
-Align::emptyVisible ()
-{
- return true;
-}
-
-/* MinSize */
-
-MinSize::MinSize() : Bin()
-{
- mnMinWidth = mnMinHeight = 0;
- addProp( RTL_CONSTASCII_USTRINGPARAM( "MinWidth" ),
- ::getCppuType( static_cast< const long* >( NULL ) ),
- &mnMinWidth );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "MinHeight" ),
- ::getCppuType( static_cast< const long* >( NULL ) ),
- &mnMinHeight );
-}
-
-bool
-MinSize::emptyVisible ()
-{
- return true;
-}
-
-awt::Size SAL_CALL MinSize::getMinimumSize()
- throw(uno::RuntimeException)
-{
- Bin::getMinimumSize();
- maRequisition.Width = SAL_MAX( maRequisition.Width, mnMinWidth );
- maRequisition.Height = SAL_MAX( maRequisition.Height, mnMinHeight );
- return maRequisition;
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/bin.hxx b/toolkit/source/layout/core/bin.hxx
deleted file mode 100644
index 4e03d56949..0000000000
--- a/toolkit/source/layout/core/bin.hxx
+++ /dev/null
@@ -1,116 +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.
- *
- ************************************************************************/
-
-/* A few simple binary containers */
-
-#ifndef LAYOUT_CORE_BIN_HXX
-#define LAYOUT_CORE_BIN_HXX
-
-#include <layout/core/container.hxx>
-
-namespace layoutimpl
-{
-
-class Bin : public Container
-{
-protected:
- // Child
- css::awt::Size maChildRequisition;
- css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
-
-public:
- Bin();
- virtual ~Bin() {}
-
- // css::awt::XLayoutContainer
- virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
- virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException);
-
- virtual css::uno::Sequence< css::uno::Reference
- < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
- throw (css::uno::RuntimeException);
-
- virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
- throw (css::uno::RuntimeException);
-
- virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
- const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL hasHeightForWidth()
- throw(css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
- throw(css::uno::RuntimeException);
-
- // css::awt::XLayoutConstrains
- virtual css::awt::Size SAL_CALL getMinimumSize()
- throw(css::uno::RuntimeException);
-};
-
-// Align gives control over child position on the allocated space.
-class Align : public Bin
-{
- friend class AlignChildProps;
-protected:
- // properties
- float fHorAlign, fVerAlign;
- float fHorFill, fVerFill;
-
-public:
- Align();
-
- bool emptyVisible ();
-
- // css::awt::XLayoutContainer
- virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
- throw (css::uno::RuntimeException);
-};
-
-// Makes child request its or a specified size, whatever is larger.
-class MinSize : public Bin
-{
-protected:
- // properties
- long mnMinWidth, mnMinHeight;
-
-public:
- MinSize();
-
- bool emptyVisible ();
- // css::awt::XLayoutContainer
- virtual css::awt::Size SAL_CALL getMinimumSize()
- throw(css::uno::RuntimeException);
-};
-
-} // namespace layoutimpl
-
-#endif /* LAYOUT_CORE_BIN_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/box-base.cxx b/toolkit/source/layout/core/box-base.cxx
deleted file mode 100644
index 7bb136082e..0000000000
--- a/toolkit/source/layout/core/box-base.cxx
+++ /dev/null
@@ -1,176 +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 "box.hxx"
-
-#include <tools/debug.hxx>
-#include <sal/macros.h>
-
-#include <com/sun/star/awt/XWindow2.hpp>
-
-// fixed point precision for distributing error
-#define FIXED_PT 16
-
-namespace layoutimpl
-{
-
-using namespace css;
-
-Box_Base::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
- : mxChild( xChild )
- , mxProps()
- , maRequisition()
-{
-}
-
-static bool isVisible( uno::Reference< awt::XLayoutConstrains > xWidget )
-{
- if ( !xWidget.is() )
- {
- OSL_FAIL( "FIXME: invalid child !" );
- return true;
- }
-
- uno::Reference< awt::XWindow2 > xWindow( xWidget, uno::UNO_QUERY );
- if ( xWindow.is() && !xWindow->isVisible() )
- return false;
-
- uno::Reference< awt::XLayoutContainer > xContainer( xWidget, uno::UNO_QUERY );
- if ( xContainer.is() )
- {
- uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aChildren
- = xContainer->getChildren();
-
- if (!aChildren.getLength ())
- if (Container *c = dynamic_cast <Container*> (xWidget.get ()))
- return c->emptyVisible ();
-
- for ( int i = 0; i < aChildren.getLength(); i++ )
- if ( isVisible( aChildren[i] ) )
- return true;
- return false; // this would kill flow without workaround above
- }
-
- return true;
-}
-
-bool Box_Base::ChildData::isVisible()
-{
- // FIXME: call the 'isVisible' method on it ?
- return layoutimpl::isVisible( mxChild );
-}
-
-void
-Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> const& xChild)
-{
- ChildData *pData = createChild (xChild);
- maChildren.push_back (pData);
- queueResize ();
-}
-
-void SAL_CALL
-Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> const& xChild)
- throw (uno::RuntimeException, awt::MaxChildrenException)
-{
- if (xChild.is ())
- {
- AddChild (xChild);
- setChildParent (xChild);
- }
-}
-
-Box_Base::ChildData*
-Box_Base::removeChildData( std::list< ChildData* >& lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild )
-{
- for ( std::list< ChildData* >::iterator it = lst.begin();
- it != lst.end(); ++it )
- {
- if ( (*it)->mxChild == xChild )
- {
- ChildData* pRet = *it;
- lst.erase( it );
- return pRet;
- }
- }
- return 0;
-}
-
-void SAL_CALL
-Box_Base::removeChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
- throw (uno::RuntimeException)
-{
- if ( ChildData* p = removeChildData( maChildren, xChild ) )
- {
- delete p;
- unsetChildParent( xChild );
- queueResize();
- }
- else
- {
- OSL_FAIL( "Box_Base: removeChild: no such child" );
- }
-}
-
-uno::Sequence< uno::Reference < awt::XLayoutConstrains > > SAL_CALL
-Box_Base::getChildren()
- throw (uno::RuntimeException)
-{
- uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() );
- unsigned int index = 0;
- for ( std::list< ChildData* >::iterator it = maChildren.begin();
- it != maChildren.end(); ++it, ++index )
- children[index] = ( *it )->mxChild;
-
- return children;
-}
-
-uno::Reference< beans::XPropertySet > SAL_CALL
-Box_Base::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& xChild )
- throw (uno::RuntimeException)
-{
-
- for ( std::list< ChildData * >::iterator it = maChildren.begin();
- it != maChildren.end(); ++it)
- {
- if ( ( *it )->mxChild == xChild )
- {
- if ( !( *it )->mxProps.is() )
- {
- PropHelper *pProps = createChildProps( *it );
- pProps->setChangeListener( this );
- ( *it )->mxProps = pProps;
- }
- return (*it)->mxProps;
- }
- }
- return uno::Reference< beans::XPropertySet >();
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/box-base.hxx b/toolkit/source/layout/core/box-base.hxx
deleted file mode 100644
index faeddf91f8..0000000000
--- a/toolkit/source/layout/core/box-base.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_CORE_BOX_BASE_HXX
-#define LAYOUT_CORE_BOX_BASE_HXX
-
-#include <layout/core/container.hxx>
-
-#include <list>
-
-namespace layoutimpl
-{
-
-class Box_Base : public Container
-{
-public:
- // Children properties
- struct ChildData
- {
- css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
- css::uno::Reference< css::beans::XPropertySet > mxProps;
- css::awt::Size maRequisition;
- virtual bool isVisible();
-
- ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
- virtual ~ChildData() { };
- };
-
- struct ChildProps: public PropHelper
- {
- //ChildProps( ChildProps* );
- };
-
-protected:
- std::list< ChildData* > maChildren;
-
-
- virtual ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) = 0;
- virtual ChildProps *createChildProps( ChildData* pData ) = 0;
-
- ChildData *removeChildData( std::list< ChildData *>&, css::uno::Reference< css::awt::XLayoutConstrains > const& Child );
-
-public:
- void AddChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child);
-
- // css::awt::XLayoutContainer
- virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child)
- throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
- virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException);
-
- virtual css::uno::Sequence< css::uno::Reference
- < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
- throw (css::uno::RuntimeException);
-
- virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
- const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException);
-};
-
-} // namespace layoutimpl
-
-#endif /* LAYOUT_CORE_BOX_BASE HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/box.cxx b/toolkit/source/layout/core/box.cxx
deleted file mode 100644
index 27fab86fa0..0000000000
--- a/toolkit/source/layout/core/box.cxx
+++ /dev/null
@@ -1,284 +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 "box.hxx"
-
-#include <tools/debug.hxx>
-#include <sal/macros.h>
-
-// fixed point precision for distributing error
-#define FIXED_PT 16
-
-namespace layoutimpl
-{
-
-using namespace css;
-
-Box::ChildProps::ChildProps( Box::ChildData *pData )
-{
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Expand" ),
- ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
- &(pData->mbExpand) );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Fill" ),
- ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
- &(pData->mbFill) );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Padding" ),
- ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
- &(pData->mnPadding) );
-}
-
-Box::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
- : Box_Base::ChildData( xChild )
- , mnPadding( 0 )
- , mbExpand( true )
- , mbFill( true )
-{
-}
-
-Box::ChildData*
-Box::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
- {
- return new ChildData( xChild );
- }
-
-Box::ChildProps*
-Box::createChildProps( Box_Base::ChildData *pData )
-{
- return new ChildProps( static_cast<Box::ChildData*> ( pData ) );
-}
-
-Box::Box( bool horizontal )
- : Box_Base()
- , mnSpacing( 0 )
- , mbHomogeneous( false )
- , mbHorizontal( horizontal )
-{
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ),
- ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
- &mbHomogeneous );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Spacing" ),
- ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
- &mnSpacing );
- mbHasFlowChildren = false;
-}
-
-awt::Size
-Box::calculateSize( long nWidth )
-{
- int nVisibleChildren = 0;
- // primary vs secundary axis (instead of a X and Y)
- int nPrimSize = 0;
- int nSecSize = 0;
- int nFlowMinWidth = 0; // in case the box only has flow children
-
- mbHasFlowChildren = false;
-
- for ( std::list<Box_Base::ChildData *>::const_iterator it
- = maChildren.begin(); it != maChildren.end(); ++it )
- {
- ChildData *child = static_cast<Box::ChildData*> ( *it );
- if ( !child->isVisible() )
- continue;
-
- uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
- bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
-
- awt::Size aChildSize = child->maRequisition = child->mxChild->getMinimumSize();
-
- if ( !mbHorizontal /*vertical*/ && bFlow )
- {
- if ( nFlowMinWidth == 0 || nFlowMinWidth > aChildSize.Width )
- nFlowMinWidth = aChildSize.Width;
- mbHasFlowChildren = true;
- }
- else
- {
- int size = primDim( aChildSize ) + child->mnPadding * 2;
- if ( mbHomogeneous )
- nPrimSize = SAL_MAX( nPrimSize, size );
- else
- nPrimSize += size;
-
- nSecSize = SAL_MAX( nSecSize, secDim( aChildSize ) );
- }
- nVisibleChildren++;
- }
-
- if ( nVisibleChildren )
- {
- if ( mbHomogeneous )
- nPrimSize *= nVisibleChildren;
- nPrimSize += (nVisibleChildren - 1) * mnSpacing;
- }
-
- if ( mbHasFlowChildren )
- {
- if ( nWidth == 0 )
- nWidth = nSecSize ? nSecSize : nFlowMinWidth;
- for ( std::list<Box_Base::ChildData *>::const_iterator it
- = maChildren.begin(); it != maChildren.end(); ++it )
- {
- ChildData *child = static_cast<Box::ChildData*> ( *it );
- if ( !child->isVisible() )
- continue;
-
- uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
- bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
-
- if ( bFlow )
- nPrimSize += xChildCont->getHeightForWidth( nWidth );
- }
- }
-
- nPrimSize += mnBorderWidth * 2;
- nSecSize += mnBorderWidth * 2;
- return awt::Size( mbHorizontal ? nPrimSize : nSecSize,
- mbHorizontal ? nSecSize : nPrimSize );
-}
-
-awt::Size SAL_CALL
-Box::getMinimumSize() throw(uno::RuntimeException)
-{
- maRequisition = calculateSize();
- return maRequisition;
-}
-
-sal_Bool SAL_CALL
-Box::hasHeightForWidth()
- throw(uno::RuntimeException)
-{
- return mbHasFlowChildren;
-}
-
-sal_Int32 SAL_CALL
-Box::getHeightForWidth( sal_Int32 nWidth )
- throw(uno::RuntimeException)
-{
- if ( hasHeightForWidth() )
- return calculateSize( nWidth ).Height;
- return maRequisition.Height;
-}
-
-void SAL_CALL
-Box::allocateArea( const awt::Rectangle &newArea )
- throw (uno::RuntimeException)
-{
- maAllocation = newArea;
- int nVisibleChildren = 0, nExpandChildren = 0;
-
- for ( std::list<Box_Base::ChildData *>::const_iterator it
- = maChildren.begin(); it != maChildren.end(); ++it )
- {
- ChildData *child = static_cast<Box::ChildData*> ( *it );
- if ( child->isVisible() )
- {
- nVisibleChildren++;
- if ( child->mbExpand )
- nExpandChildren++;
- }
- }
- if ( !nVisibleChildren )
- return;
-
- // split rectangle for dimension helpers
- awt::Point newPoint( newArea.X, newArea.Y );
- awt::Size newSize( newArea.Width, newArea.Height );
-
- int nExtraSpace;
- if ( mbHomogeneous )
- nExtraSpace = ( ( primDim( newSize ) - mnBorderWidth * 2 -
- ( nVisibleChildren - 1 ) * mnSpacing )) / nVisibleChildren;
- else if ( nExpandChildren )
- {
- int reqSize = primDim( maRequisition );
- if ( !mbHorizontal && hasHeightForWidth() )
- reqSize = getHeightForWidth( newArea.Width );
- nExtraSpace = ( primDim( newSize ) - reqSize ) / nExpandChildren;
- }
- else
- nExtraSpace = 0;
-
- int nChildPrimPoint, nChildSecPoint, nChildPrimSize, nChildSecSize;
-
- int nStartPoint = primDim( newPoint ) + mnBorderWidth;
- int nBoxSecSize = SAL_MAX( 1, secDim( newSize ) - mnBorderWidth * 2 );
-
- for ( std::list<Box_Base::ChildData *>::const_iterator it
- = maChildren.begin(); it != maChildren.end(); ++it )
- {
- ChildData *child = static_cast<Box::ChildData*> ( *it );
- if ( !child->isVisible() )
- continue;
-
- awt::Point aChildPos;
- int nBoxPrimSize; // of the available box space
-
- if ( mbHomogeneous )
- nBoxPrimSize = nExtraSpace;
- else
- {
- uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
- bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
- if ( !mbHorizontal && bFlow )
- nBoxPrimSize = xChildCont->getHeightForWidth( newArea.Width );
- else
- nBoxPrimSize = primDim( child->maRequisition );
- nBoxPrimSize += child->mnPadding;
- if ( child->mbExpand )
- nBoxPrimSize += nExtraSpace;
- }
-
- nChildPrimPoint = nStartPoint + child->mnPadding;
- nChildSecPoint = secDim( newPoint ) + mnBorderWidth;
-
- nChildSecSize = nBoxSecSize;
- if ( child->mbFill )
- nChildPrimSize = SAL_MAX( 1, nBoxPrimSize - child->mnPadding);
- else
- {
- nChildPrimSize = primDim( child->maRequisition );
- nChildPrimPoint += (nBoxPrimSize - nChildPrimSize) / 2;
-
- nChildSecPoint += (nBoxSecSize - nChildSecSize) / 2;
- }
-
- awt::Rectangle area;
- area.X = mbHorizontal ? nChildPrimPoint : nChildSecPoint;
- area.Y = mbHorizontal ? nChildSecPoint : nChildPrimPoint;
- area.Width = mbHorizontal ? nChildPrimSize : nChildSecSize;
- area.Height = mbHorizontal ? nChildSecSize : nChildPrimSize;
-
- allocateChildAt( child->mxChild, area );
-
- nStartPoint += nBoxPrimSize + mnSpacing + child->mnPadding;
- }
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/box.hxx b/toolkit/source/layout/core/box.hxx
deleted file mode 100644
index 936b99ea77..0000000000
--- a/toolkit/source/layout/core/box.hxx
+++ /dev/null
@@ -1,105 +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_CORE_BOX_HXX
-#define LAYOUT_CORE_BOX_HXX
-
-#include <layout/core/box-base.hxx>
-
-#include <com/sun/star/awt/Point.hpp>
-
-namespace layoutimpl
-{
-
-class Box : public Box_Base
-{
-protected:
- // Box properties (i.e. affect all children)
- sal_Int32 mnSpacing;
- sal_Bool mbHomogeneous;
- sal_Bool mbHorizontal; // false for Vertical
- bool mbHasFlowChildren;
-
-public:
- // Children properties
- struct ChildData : public Box_Base::ChildData
- {
- sal_Int32 mnPadding;
- sal_Bool mbExpand;
- sal_Bool mbFill;
- ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
- };
-
- struct ChildProps : public Box_Base::ChildProps
- {
- ChildProps( ChildData *pData );
- };
-
-protected:
- ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
- ChildProps *createChildProps( Box_Base::ChildData* pData );
-
-public:
- Box( bool horizontal );
-
- virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
- throw (css::uno::RuntimeException);
-
- virtual css::awt::Size SAL_CALL getMinimumSize()
- throw(css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasHeightForWidth()
- throw(css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
- throw(css::uno::RuntimeException);
-
- // helper: mix of getMinimumSize() and getHeightForWidth()
- css::awt::Size calculateSize( long nWidth = 0 );
-
-private:
- /* Helpers to deal with the joint Box directions. */
- inline int primDim (const css::awt::Size &size)
- { if (mbHorizontal) return size.Width; else return size.Height; }
- inline int secDim (const css::awt::Size &size)
- { if (mbHorizontal) return size.Height; else return size.Width; }
- inline int primDim (const css::awt::Point &point)
- { if (mbHorizontal) return point.X; else return point.Y; }
- inline int secDim (const css::awt::Point &point)
- { if (mbHorizontal) return point.Y; else return point.X; }
-};
-
-struct VBox : public Box
-{ VBox() : Box (false) {} };
-
-struct HBox : public Box
-{ HBox() : Box (true) {} };
-
-} // namespace layoutimpl
-
-#endif /* LAYOUT_CORE_BOX_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/byteseq.cxx b/toolkit/source/layout/core/byteseq.cxx
deleted file mode 100644
index 29894be31a..0000000000
--- a/toolkit/source/layout/core/byteseq.cxx
+++ /dev/null
@@ -1,79 +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 <com/sun/star/io/XInputStream.hpp>
-#include <osl/file.hxx>
-#include <comphelper/oslfile2streamwrap.hxx>
-
-using osl::File;
-using osl::FileBase;
-using namespace ::com::sun::star;
-
-namespace layoutimpl
-{
-
-uno::Reference< io::XInputStream > getFileAsStream( const rtl::OUString &rName )
-{
- rtl::OUString sFileURL;
- if( FileBase::E_None != FileBase::getFileURLFromSystemPath( rName, sFileURL ) )
- sFileURL = rName; // maybe it already was a file url
-
- File * blobFile = new File(sFileURL);
- File::RC errorCode = blobFile->open(osl_File_OpenFlag_Read);
-
- uno::Reference<io::XInputStream> xResult;
- switch (errorCode)
- {
- case osl::File::E_None: // got it
- xResult.set( new comphelper::OSLInputStreamWrapper(blobFile,true) );
- break;
-
- case osl::File::E_NOENT: // no file => no stream
- delete blobFile;
- break;
-
- default:
- delete blobFile;
-/* {
- rtl::OUStringBuffer sMsg;
- sMsg.appendAscii("Cannot open output file \"");
- sMsg.append(aURL);
- sMsg.appendAscii("\" : ");
- sMsg.append(configmgr::FileHelper::createOSLErrorString(errorCode));
-
- throw io::IOException(sMsg.makeStringAndClear(),NULL);
- }
-*/
- }
-
- return xResult;
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/container.cxx b/toolkit/source/layout/core/container.cxx
deleted file mode 100644
index 9e844e16c8..0000000000
--- a/toolkit/source/layout/core/container.cxx
+++ /dev/null
@@ -1,131 +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 "container.hxx"
-
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <tools/debug.hxx>
-
-namespace layoutimpl {
-
-using namespace css;
-
-Container::Container()
- : Container_Base()
- , PropHelper()
- , mnBorderWidth( 0 )
-{
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Border" ),
- ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
- &mnBorderWidth );
- setChangeListener( this );
-}
-
-bool
-Container::emptyVisible ()
-{
- return false;
-}
-
-uno::Any
-Container::queryInterface( const uno::Type & rType ) throw (uno::RuntimeException)
-{
- uno::Any aRet = Container_Base::queryInterface( rType );
- return aRet.hasValue() ? aRet : PropHelper::queryInterface( rType );
-}
-
-void
-Container::allocateChildAt( const uno::Reference< awt::XLayoutConstrains > &xChild,
- const awt::Rectangle &rArea )
- throw( uno::RuntimeException )
-{
- uno::Reference< awt::XLayoutContainer > xCont( xChild, uno::UNO_QUERY );
- if ( xCont.is() )
- xCont->allocateArea( rArea );
- else
- {
- uno::Reference< awt::XWindow > xWindow( xChild, uno::UNO_QUERY );
- if ( xWindow.is() )
- xWindow->setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height,
- awt::PosSize::POSSIZE );
- else
- {
- OSL_FAIL( "Error: non-sizeable child" );
- }
- }
-}
-
-uno::Sequence< uno::Reference< awt::XLayoutConstrains > >
-Container::getSingleChild ( uno::Reference< awt::XLayoutConstrains >const &xChildOrNil )
-{
- uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aSeq( ( xChildOrNil.is() ? 1 : 0 ) );
- if ( xChildOrNil.is() )
- aSeq[0] = xChildOrNil;
- return aSeq;
-}
-
-void
-Container::queueResize()
-{
- if ( mxLayoutUnit.is() )
- mxLayoutUnit->queueResize( uno::Reference< awt::XLayoutContainer >( this ) );
-}
-
-void
-Container::setChildParent( const uno::Reference< awt::XLayoutConstrains >& xChild )
-{
- uno::Reference< awt::XLayoutContainer > xContChild( xChild, uno::UNO_QUERY );
- if ( xContChild.is() )
- {
- xContChild->setParent( uno::Reference< awt::XLayoutContainer >( this ) );
- }
-}
-
-void
-Container::unsetChildParent( const uno::Reference< awt::XLayoutConstrains >& xChild )
-{
- uno::Reference< awt::XLayoutContainer > xContChild( xChild, uno::UNO_QUERY );
- if ( xContChild.is() )
- {
- xContChild->setParent( uno::Reference< awt::XLayoutContainer >() );
- }
-}
-
-void Container::propertiesChanged()
-{
- // cl: why this assertion? This is also called to set properties at the top level widget which has no parent!?
- // DBG_ASSERT( mxParent.is(), "Properties listener: error container doesn't have parent" );
-
- if ( mxLayoutUnit.is() && mxParent.is() )
- mxLayoutUnit->queueResize( mxParent );
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/container.hxx b/toolkit/source/layout/core/container.hxx
deleted file mode 100644
index 3c15efaaae..0000000000
--- a/toolkit/source/layout/core/container.hxx
+++ /dev/null
@@ -1,139 +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_CORE_CONTAINER_HXX
-#define LAYOUT_CORE_CONTAINER_HXX
-
-#include <layout/core/helper.hxx>
-
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/awt/MaxChildrenException.hpp>
-
-namespace layoutimpl
-{
-namespace css = ::com::sun::star;
-
-typedef ::cppu::WeakImplHelper2< css::awt::XLayoutContainer,
- css::awt::XLayoutConstrains > Container_Base;
-
-class TOOLKIT_DLLPUBLIC Container : public Container_Base, public PropHelper, public PropHelper::Listener
-{
- friend class ChildProps;
-protected:
- // Widget properties
- css::uno::Reference< css::awt::XLayoutContainer > mxParent;
- css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit;
- css::awt::Size maRequisition;
- css::awt::Rectangle maAllocation;
-
- // Container properties
- sal_Int32 mnBorderWidth;
-
- // Utilities
- void allocateChildAt( const css::uno::Reference< css::awt::XLayoutConstrains > &xChild,
- const css::awt::Rectangle &rArea )
- throw (css::uno::RuntimeException);
- static css::uno::Sequence< css::uno::Reference< css::awt::XLayoutConstrains > >
- getSingleChild (const css::uno::Reference< css::awt::XLayoutConstrains > &xChildOrNil);
- void setChildParent( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild );
- void unsetChildParent( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild );
-
- void queueResize();
- void forceRecalc() { allocateArea( maAllocation ); }
-
-public:
- Container();
- virtual ~Container() {}
-
- virtual bool emptyVisible ();
-
- // XInterface
- virtual void SAL_CALL acquire() throw() { PropHelper::acquire(); }
- virtual void SAL_CALL release() throw() { PropHelper::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-
- // css::awt::XLayoutContainer
- virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException, css::awt::MaxChildrenException) = 0;
- virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException) = 0;
-
- virtual css::uno::Sequence< css::uno::Reference
- < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
- throw (css::uno::RuntimeException) = 0;
-
- virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
- const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException) = 0;
-
- virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
- throw (css::uno::RuntimeException) = 0;
-
- void SAL_CALL setLayoutUnit( const css::uno::Reference< css::awt::XLayoutUnit > &xUnit )
- throw(css::uno::RuntimeException)
- { mxLayoutUnit = xUnit; }
- css::uno::Reference< css::awt::XLayoutUnit > SAL_CALL getLayoutUnit()
- throw(css::uno::RuntimeException)
- { return mxLayoutUnit; }
-
- css::awt::Size SAL_CALL getRequestedSize() throw(css::uno::RuntimeException)
- { return maRequisition; }
- com::sun::star::awt::Rectangle SAL_CALL getAllocatedArea() throw(css::uno::RuntimeException)
- { return maAllocation; }
-
- virtual sal_Bool SAL_CALL hasHeightForWidth()
- throw(css::uno::RuntimeException) = 0;
- virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
- throw(css::uno::RuntimeException) = 0;
-
- // css::awt::XLayoutContainer: css::container::XChild
- css::uno::Reference< css::uno::XInterface > SAL_CALL getParent()
- throw (css::uno::RuntimeException)
- { return mxParent; }
- void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface > &xParent )
- throw (css::uno::RuntimeException)
- { mxParent = css::uno::Reference< css::awt::XLayoutContainer >( xParent, css::uno::UNO_QUERY ); }
-
- // css::awt::XLayoutConstrains
- virtual css::awt::Size SAL_CALL getMinimumSize()
- throw(css::uno::RuntimeException) = 0;
- // (not properly implemented in toolkit, ignore it.)
- css::awt::Size SAL_CALL getPreferredSize()
- throw(css::uno::RuntimeException) { return getMinimumSize(); } // TODO: use this for flow?
- css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize )
- throw(css::uno::RuntimeException) { return rNewSize; }
-
-protected:
- void propertiesChanged();
-};
-
-} // namespace layoutimpl
-
-#endif /* LAYOUT_CORE_CONTAINER_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/dialogbuttonhbox.cxx b/toolkit/source/layout/core/dialogbuttonhbox.cxx
deleted file mode 100644
index 23d9e5ca34..0000000000
--- a/toolkit/source/layout/core/dialogbuttonhbox.cxx
+++ /dev/null
@@ -1,283 +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 <awt/vclxbutton.hxx>
-#include <tools/debug.hxx>
-#include <toolkit/awt/vclxwindows.hxx>
-#include <vcl/button.hxx>
-
-#include "dialogbuttonhbox.hxx"
-#include "flow.hxx"
-#include "proplist.hxx"
-
-namespace layoutimpl
-{
-
-using namespace css;
-
-//FIXME: how to set platform-dependant variables?
-DialogButtonHBox::Ordering const DialogButtonHBox::DEFAULT_ORDERING =
-#if defined( MACOSX )
- DialogButtonHBox::MACOS;
-#elif defined( SAL_W32 )
-DialogButtonHBox::WINDOWS;
-#elif defined( ENABLE_KDE )
-DialogButtonHBox::KDE;
-#else /* !MACOSX && !SAL_W32 && !ENABLE_KDE */
-DialogButtonHBox::GNOME;
-#endif /* !MACOSX && !SAL_W32 && !ENABLE_KDE */
-
-DialogButtonHBox::DialogButtonHBox()
- : HBox()
- , mnOrdering( DEFAULT_ORDERING )
- , mFlow()
- , mpAction( 0 )
- , mpAffirmative( 0 )
- , mpAlternate( 0 )
- , mpApply( 0 )
- , mpCancel( 0 )
- , mpFlow( createChild( uno::Reference< awt::XLayoutConstrains > ( &mFlow ) ) )
- , mpHelp( 0 )
- , mpReset( 0 )
-{
- mbHomogeneous = true;
-}
-
-void
-DialogButtonHBox::setOrdering( rtl::OUString const& ordering )
-{
- if ( ordering.equalsIgnoreAsciiCaseAscii( "GNOME" ) )
- mnOrdering = GNOME;
- else if ( ordering.equalsIgnoreAsciiCaseAscii( "KDE" ) )
- mnOrdering = KDE;
- else if ( ordering.equalsIgnoreAsciiCaseAscii( "MacOS" ) )
- mnOrdering = MACOS;
- else if ( ordering.equalsIgnoreAsciiCaseAscii( "Windows" ) )
- mnOrdering = WINDOWS;
- else
- {
- OSL_TRACE( "DialogButtonHBox: no such ordering: %s", OUSTRING_CSTR( ordering ) );
- }
-}
-
-void
-DialogButtonHBox::addChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
- throw ( uno::RuntimeException, awt::MaxChildrenException )
-{
- if ( !xChild.is() )
- return;
-
- ChildData *p = createChild( xChild );
-
-#define IS_BUTTON(t) dynamic_cast<VCLX##t##Button *>( xChild.get () )
-
- /* Sort Retry as Action */
- if ( !mpAction && IS_BUTTON( Retry ) )
- mpAction = p;
- else if ( !mpAffirmative && IS_BUTTON( OK ) )
- mpAffirmative = p;
- else if ( !mpAffirmative && IS_BUTTON( Yes ) )
- mpAffirmative = p;
- else if ( !mpAlternate && IS_BUTTON( No ) )
- mpAlternate = p;
- /* Sort Ignore as Alternate */
- else if ( !mpAlternate && IS_BUTTON( Ignore ) )
- mpAlternate = p;
- else if ( !mpApply && IS_BUTTON( Apply ) )
- mpApply = p;
- else if ( !mpCancel && IS_BUTTON( Cancel ) )
- mpCancel = p;
- /* Let the user overwrite Flow */
- else if ( /* !mpFlow && */ dynamic_cast<Flow *>( xChild.get () ) )
- mpFlow = p;
- else if ( !mpHelp && IS_BUTTON( Help ) )
- mpHelp = p;
- else if ( !mpReset && IS_BUTTON( Reset ) )
- mpReset = p;
- else
- maOther.push_back( p );
- orderChildren();
- setChildParent( xChild );
- queueResize();
-}
-
-void
-DialogButtonHBox::orderChildren()
-{
- if ( mnOrdering == WINDOWS )
- windowsOrdering();
- else if ( mnOrdering == MACOS )
- macosOrdering();
- else if ( mnOrdering == KDE )
- kdeOrdering();
- else if ( 1 || mnOrdering == GNOME )
- gnomeOrdering();
-}
-
-void SAL_CALL
-DialogButtonHBox::removeChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
- throw ( uno::RuntimeException)
-{
- if ( !xChild.is ())
- return;
-
- Box_Base::ChildData *p = 0;
-
- if ( mpAction && mpAction->mxChild == xChild )
- p = mpAction;
- else if ( mpAffirmative && mpAffirmative->mxChild == xChild )
- p = mpAffirmative;
- else if ( mpAlternate && mpAlternate->mxChild == xChild )
- p = mpAlternate;
- else if ( mpApply && mpApply->mxChild == xChild )
- p = mpApply;
- else if ( mpCancel && mpCancel->mxChild == xChild )
- p = mpCancel;
- else if ( mpFlow && mpFlow->mxChild == xChild )
- p = mpFlow;
- else if ( mpReset && mpReset->mxChild == xChild )
- p = mpReset;
- else if ( mpHelp && mpHelp->mxChild == xChild )
- p = mpHelp;
- else
- p = removeChildData( maOther, xChild );
-
- if ( p )
- {
- delete p;
- unsetChildParent( xChild );
- orderChildren();
- queueResize();
- }
- else
- {
- OSL_FAIL( "DialogButtonHBox: removeChild: no such child" );
- }
-}
-
-void
-DialogButtonHBox::gnomeOrdering()
-{
- std::list< Box_Base::ChildData * > ordered;
- if ( mpHelp )
- ordered.push_back( mpHelp );
- if ( mpReset )
- ordered.push_back( mpReset );
- if ( mpFlow && ( mpHelp || mpReset ) )
- ordered.push_back( mpFlow );
- ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
- if ( mpAction )
- ordered.push_back( mpAction );
- if ( mpApply )
- ordered.push_back( mpApply );
- if ( mpAlternate )
- ordered.push_back( mpAlternate );
- if ( mpCancel )
- ordered.push_back( mpCancel );
- if ( mpAffirmative )
- ordered.push_back( mpAffirmative );
- maChildren = ordered;
-}
-
-void
-DialogButtonHBox::kdeOrdering()
-{
- std::list< Box_Base::ChildData * > ordered;
- if ( mpHelp )
- ordered.push_back( mpHelp );
- if ( mpReset )
- ordered.push_back( mpReset );
- if ( mpFlow && ( mpHelp || mpReset ) )
- ordered.push_back( mpFlow );
- ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
- if ( mpAction )
- ordered.push_back( mpAction );
- if ( mpAffirmative )
- ordered.push_back( mpAffirmative );
- if ( mpApply )
- ordered.push_back( mpApply );
- if ( mpAlternate )
- ordered.push_back( mpAlternate );
- if ( mpCancel )
- ordered.push_back( mpCancel );
- maChildren = ordered;
-}
-
-void
-DialogButtonHBox::macosOrdering()
-{
- std::list< Box_Base::ChildData * > ordered;
- if ( mpHelp )
- ordered.push_back( mpHelp );
- if ( mpReset )
- ordered.push_back( mpReset );
- if ( mpApply )
- ordered.push_back( mpApply );
- if ( mpAction )
- ordered.push_back( mpAction );
- ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
- if ( mpFlow ) // Always flow? && ( maOther.size () || mpHelp || mpReset || mpAction ) )
- ordered.push_back( mpFlow );
- if ( mpAlternate )
- ordered.push_back( mpAlternate );
- if ( mpFlow && mpAlternate )
- ordered.push_back( mpFlow );
- if ( mpCancel )
- ordered.push_back( mpCancel );
- if ( mpAffirmative )
- ordered.push_back( mpAffirmative );
- maChildren = ordered;
-}
-
-void
-DialogButtonHBox::windowsOrdering()
-{
- std::list< Box_Base::ChildData * > ordered;
- if ( mpReset )
- ordered.push_back( mpReset );
- if ( mpReset && mpFlow )
- ordered.push_back( mpFlow );
- if ( mpAffirmative )
- ordered.push_back( mpAffirmative );
- if ( mpAlternate )
- ordered.push_back( mpAlternate );
- if ( mpAction )
- ordered.push_back( mpAction );
- if ( mpCancel )
- ordered.push_back( mpCancel );
- if ( mpApply )
- ordered.push_back( mpApply );
- ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
- if ( mpHelp )
- ordered.push_back( mpHelp );
- maChildren = ordered;
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/dialogbuttonhbox.hxx b/toolkit/source/layout/core/dialogbuttonhbox.hxx
deleted file mode 100644
index fbeca8691b..0000000000
--- a/toolkit/source/layout/core/dialogbuttonhbox.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_CORE_DIALOGBUTTONHBOX_HXX
-#define LAYOUT_CORE_DIALOGBUTTONHBOX_HXX
-
-#include <layout/core/box.hxx>
-#include <layout/core/flow.hxx>
-
-namespace layoutimpl
-{
-
-class DialogButtonHBox : public HBox
-{
-public:
- DialogButtonHBox();
-
- void setOrdering( rtl::OUString const& ordering );
- void SAL_CALL addChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) throw ( css::uno::RuntimeException, css::awt::MaxChildrenException );
- void SAL_CALL removeChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) throw ( css::uno::RuntimeException );
-
-private:
- enum Ordering { PLATFORM, GNOME, KDE, MACOS, WINDOWS };
-
- void orderChildren();
- void gnomeOrdering();
- void kdeOrdering();
- void macosOrdering();
- void windowsOrdering();
-
- static Ordering const DEFAULT_ORDERING;
- Ordering mnOrdering;
- Flow mFlow;
-
- ChildData *mpAction; /* [..]?, [Retry?] */
- ChildData *mpAffirmative; /* OK, Yes, Save */
- ChildData *mpAlternate; /* NO, [Ignore?], Don't save, Quit without saving */
- ChildData *mpApply; /* Deprecated? */
- ChildData *mpCancel; /* Cancel, Close */
- ChildData *mpFlow;
- ChildData *mpHelp;
- ChildData *mpReset;
-
- std::list< Box_Base::ChildData *> maOther;
-};
-
-} // namespace layoutimpl
-
-#endif /* LAYOUT_CORE_DIALOGBUTTONHBOX_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/factory.cxx b/toolkit/source/layout/core/factory.cxx
deleted file mode 100644
index be73b11359..0000000000
--- a/toolkit/source/layout/core/factory.cxx
+++ /dev/null
@@ -1,126 +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 "factory.hxx"
-
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/registry/InvalidRegistryException.hpp>
-#include <cppuhelper/factory.hxx>
-
-#include "root.hxx"
-
-using namespace ::com::sun::star;
-using namespace layoutimpl;
-
-void * SAL_CALL comp_Layout_component_getFactory( const char * pImplName, void * pServiceManager, void * /*registryKey*/ )
- {
- void * pRet = 0;
-
- ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) );
- uno::Reference< lang::XSingleServiceFactory > xFactory;
-
- if ( pServiceManager && aImplName.equals( LayoutFactory::impl_staticGetImplementationName() ) )
- xFactory = ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
- LayoutFactory::impl_staticGetImplementationName(),
- LayoutFactory::impl_staticCreateSelfInstance,
- LayoutFactory::impl_staticGetSupportedServiceNames() );
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
- }
-
-// Component registration
-::rtl::OUString SAL_CALL LayoutFactory::impl_staticGetImplementationName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.awt.Layout"));
-}
-
-uno::Sequence< ::rtl::OUString > SAL_CALL LayoutFactory::impl_staticGetSupportedServiceNames()
-{
- uno::Sequence< ::rtl::OUString > aRet(2);
- aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Layout"));
- aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.awt.Layout"));
- return aRet;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::impl_staticCreateSelfInstance(
- const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
-{
- return uno::Reference< uno::XInterface >( *new LayoutFactory( xServiceManager ) );
-}
-
-// XServiceInfo
-::rtl::OUString SAL_CALL LayoutFactory::getImplementationName()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetImplementationName();
-}
-
-uno::Sequence< ::rtl::OUString > SAL_CALL LayoutFactory::getSupportedServiceNames()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetSupportedServiceNames();
-}
-
-sal_Bool SAL_CALL LayoutFactory::supportsService( const ::rtl::OUString& ServiceName )
- throw ( uno::RuntimeException )
-{
- uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
- if ( ServiceName.compareTo( aSeq[i] ) == 0 )
- return sal_True;
-
- return sal_False;
-}
-
-// XSingleServiceFactory
-uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::createInstance()
- throw ( uno::Exception,
- uno::RuntimeException )
-{
- return uno::Reference< uno::XInterface >(
- static_cast< OWeakObject* >( new LayoutRoot( m_xFactory ) ),
- uno::UNO_QUERY );
-}
-
-uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::createInstanceWithArguments(
- const uno::Sequence< uno::Any >& aArguments )
- throw ( uno::Exception,
- uno::RuntimeException )
-{
- uno::Reference< uno::XInterface > layout = createInstance();
- uno::Reference< lang::XInitialization > xInit( layout, uno::UNO_QUERY );
- xInit->initialize( aArguments );
- return layout;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/factory.hxx b/toolkit/source/layout/core/factory.hxx
deleted file mode 100644
index 7d1f77a9a2..0000000000
--- a/toolkit/source/layout/core/factory.hxx
+++ /dev/null
@@ -1,77 +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_CORE_FACTORY_HXX
-#define LAYOUT_CORE_FACTORY_HXX
-
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <toolkit/dllapi.h>
-
-namespace layoutimpl
-{
-class Layout;
-}
-
-class TOOLKIT_DLLPUBLIC LayoutFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory,
- ::com::sun::star::lang::XServiceInfo >
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
-public:
- LayoutFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
- : m_xFactory( xFactory )
- {
- OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
- }
-
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- impl_staticGetSupportedServiceNames();
-
- static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- impl_staticCreateSelfInstance(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
-
-
- // XSingleServiceFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-#endif /* LAYOUT_CORE_FACTORY_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/flow.cxx b/toolkit/source/layout/core/flow.cxx
deleted file mode 100644
index 06c0d0f13e..0000000000
--- a/toolkit/source/layout/core/flow.cxx
+++ /dev/null
@@ -1,213 +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 "flow.hxx"
-
-#include <sal/macros.h>
-
-namespace layoutimpl
-{
-
-using namespace css;
-
-bool Flow::ChildData::isVisible()
-{
- return xChild.is();
-}
-
-Flow::Flow()
- : Container()
- , mnSpacing( 0 )
- , mbHomogeneous( false )
- , mnEachWidth( 0 )
-{
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ),
- ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
- &mbHomogeneous );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Spacing" ),
- ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
- &mnSpacing );
-}
-
-bool
-Flow::emptyVisible ()
-{
- return true;
-}
-
-void SAL_CALL
-Flow::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
- throw (uno::RuntimeException, css::awt::MaxChildrenException)
-{
- if ( xChild.is() )
- {
- ChildData *pData = new ChildData();
- pData->xChild = xChild;
- maChildren.push_back( pData );
-
- setChildParent( xChild );
- queueResize();
- }
-}
-
-void SAL_CALL
-Flow::removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild )
- throw (css::uno::RuntimeException)
-{
- for ( std::list< ChildData * >::iterator it = maChildren.begin();
- it != maChildren.end(); ++it )
- {
- if ( (*it)->xChild == xChild )
- {
- delete *it;
- maChildren.erase( it );
-
- unsetChildParent( xChild );
- queueResize();
- break;
- }
- }
-}
-
-css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > SAL_CALL
-Flow::getChildren()
- throw (css::uno::RuntimeException)
-{
- uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() );
- unsigned int i = 0;
- for ( std::list< ChildData * >::iterator it = maChildren.begin();
- it != maChildren.end(); ++it, ++i )
- children[i] = (*it)->xChild;
-
- return children;
-}
-
-uno::Reference< beans::XPropertySet > SAL_CALL
-Flow::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& /*xChild*/ )
- throw (uno::RuntimeException)
-{
- return uno::Reference< beans::XPropertySet >();
-}
-
-css::awt::Size
-Flow::calculateSize( long nMaxWidth )
-{
- long nNeedHeight = 0;
-
- std::list<ChildData *>::const_iterator it;
- mnEachWidth = 0;
- // first pass, for homogeneous property
- for (it = maChildren.begin(); it != maChildren.end(); ++it)
- {
- if ( !(*it)->isVisible() )
- continue;
- (*it)->aRequisition = (*it)->xChild->getMinimumSize();
- if ( mbHomogeneous )
- mnEachWidth = SAL_MAX( mnEachWidth, (*it)->aRequisition.Width );
- }
-
- long nRowWidth = 0, nRowHeight = 0;
- for (it = maChildren.begin(); it != maChildren.end(); ++it)
- {
- if ( !(*it)->isVisible() )
- continue;
-
- awt::Size aChildSize = (*it)->aRequisition;
- if ( mbHomogeneous )
- aChildSize.Width = mnEachWidth;
-
- if ( nMaxWidth && nRowWidth > 0 && nRowWidth + aChildSize.Width > nMaxWidth )
- {
- nRowWidth = 0;
- nNeedHeight += nRowHeight;
- nRowHeight = 0;
- }
- nRowHeight = SAL_MAX( nRowHeight, aChildSize.Height );
- nRowWidth += aChildSize.Width;
- }
- nNeedHeight += nRowHeight;
-
- return awt::Size( nRowWidth, nNeedHeight );
-}
-
-awt::Size SAL_CALL
-Flow::getMinimumSize() throw(uno::RuntimeException)
-{
- return maRequisition = calculateSize( 0 );
-}
-
-sal_Bool SAL_CALL
-Flow::hasHeightForWidth()
- throw(css::uno::RuntimeException)
-{
- return true;
-}
-
-sal_Int32 SAL_CALL
-Flow::getHeightForWidth( sal_Int32 nWidth )
- throw(css::uno::RuntimeException)
-{
- return calculateSize( nWidth ).Height;
-}
-
-void SAL_CALL
-Flow::allocateArea( const css::awt::Rectangle &rArea )
- throw (css::uno::RuntimeException)
-{
- maAllocation = rArea;
-
- std::list<ChildData *>::const_iterator it;
- long nX = 0, nY = 0, nRowHeight = 0;
- for (it = maChildren.begin(); it != maChildren.end(); ++it)
- {
- ChildData *child = *it;
- if ( !child->isVisible() )
- continue;
-
- awt::Size aChildSize( child->aRequisition );
- if ( mbHomogeneous )
- aChildSize.Width = mnEachWidth;
-
- if ( nX > 0 && nX + aChildSize.Width > rArea.Width )
- {
- nX = 0;
- nY += nRowHeight;
- nRowHeight = 0;
- }
- nRowHeight = SAL_MAX( nRowHeight, aChildSize.Height );
-
- allocateChildAt( child->xChild,
- awt::Rectangle( rArea.X + nX, rArea.Y + nY, aChildSize.Width, aChildSize.Height ) );
-
- nX += aChildSize.Width;
- }
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/flow.hxx b/toolkit/source/layout/core/flow.hxx
deleted file mode 100644
index e6d9677db1..0000000000
--- a/toolkit/source/layout/core/flow.hxx
+++ /dev/null
@@ -1,98 +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_CORE_FLOW_HXX
-#define LAYOUT_CORE_FLOW_HXX
-
-#include <layout/core/container.hxx>
-
-#include <list>
-
-namespace layoutimpl
-{
-
-class Flow : public Container
-{
-protected:
- // Box properties (i.e. affect all children)
- sal_Int32 mnSpacing;
- sal_Bool mbHomogeneous;
-
-public:
- // Children properties
- struct ChildData
- {
- css::awt::Size aRequisition;
- css::uno::Reference< css::awt::XLayoutConstrains > xChild;
- css::uno::Reference< css::beans::XPropertySet > xProps;
- bool isVisible();
- };
-
-protected:
- std::list< ChildData * > maChildren;
- long mnEachWidth; // on homogeneous, the width of every child
-
-public:
- Flow();
-
- bool emptyVisible ();
-
- // css::awt::XLayoutContainer
- virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
- virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException);
-
- virtual css::uno::Sequence< css::uno::Reference
- < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
- throw (css::uno::RuntimeException);
-
- virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
- const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException);
-
- virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
- throw (css::uno::RuntimeException);
-
- virtual css::awt::Size SAL_CALL getMinimumSize()
- throw(css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasHeightForWidth()
- throw(css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
- throw(css::uno::RuntimeException);
-
-private:
- // shared between getMinimumSize() and getHeightForWidth()
- css::awt::Size calculateSize( long nMaxWidth );
-};
-
-} // namespace layoutimpl
-
-#endif /* LAYOUT_FLOW_CORE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/helper.cxx b/toolkit/source/layout/core/helper.cxx
deleted file mode 100644
index 362f766a28..0000000000
--- a/toolkit/source/layout/core/helper.cxx
+++ /dev/null
@@ -1,597 +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 "helper.hxx"
-
-#include <assert.h>
-#include <list>
-#include <com/sun/star/awt/WindowAttribute.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <tools/debug.hxx>
-
-#include "proplist.hxx"
-
-namespace layoutimpl
-{
-using namespace com::sun::star;
-using rtl::OUString;
-
-uno::Reference< awt::XWindowPeer >
-getParent( uno::Reference< uno::XInterface > xRef )
-{
- do
- {
- uno::Reference< awt::XWindowPeer > xPeer( xRef, uno::UNO_QUERY );
- if ( xPeer.is() )
- return xPeer;
-
- uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY );
- if ( xCont.is() )
- xRef = xCont->getParent();
- }
- while ( xRef.is() );
-
- return uno::Reference< awt::XWindowPeer >();
-}
-
-}
-
-#include "bin.hxx"
-#include "box.hxx"
-#include "dialogbuttonhbox.hxx"
-#include "flow.hxx"
-#include "localized-string.hxx"
-#include "table.hxx"
-
-namespace layoutimpl
-{
-
-oslModule WidgetFactory::mSfx2Library = 0;
-WindowCreator WidgetFactory::mSfx2CreateWidget = 0;
-
-uno::Reference <awt::XLayoutContainer> WidgetFactory::createContainer (OUString const& name)
-{
- uno::Reference< awt::XLayoutContainer > xPeer;
-
- if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hbox" ) ) )
- xPeer = uno::Reference< awt::XLayoutContainer >( new HBox() );
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "vbox" ) ) )
- xPeer = uno::Reference< awt::XLayoutContainer >( new VBox() );
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "table" ) ) )
- xPeer = uno::Reference< awt::XLayoutContainer >( new Table() );
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "flow" ) ) )
- xPeer = uno::Reference< awt::XLayoutContainer >( new Flow() );
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "bin" ) ) )
- xPeer = uno::Reference< awt::XLayoutContainer >( new Bin() );
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "min-size" ) ) )
- xPeer = uno::Reference< awt::XLayoutContainer >( new MinSize() );
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "align" ) ) )
- xPeer = uno::Reference< awt::XLayoutContainer >( new Align() );
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "dialogbuttonhbox" ) ) )
- xPeer = uno::Reference< awt::XLayoutContainer >( new DialogButtonHBox() );
-
- return xPeer;
-}
-
-uno::Reference <awt::XLayoutConstrains> WidgetFactory::toolkitCreateWidget (uno::Reference <awt::XToolkit> xToolkit, uno::Reference <uno::XInterface> xParent, OUString const& name, long properties)
-{
- uno::Reference< awt::XLayoutConstrains > xPeer;
- bool bToplevel = !xParent.is();
-
- // UNO Control Widget
- awt::WindowDescriptor desc;
- if ( bToplevel )
- desc.Type = awt::WindowClass_TOP;
- else
- {
- desc.Type = awt::WindowClass_SIMPLE;
-
- uno::Reference< awt::XWindowPeer > xWinParent( xParent, uno::UNO_QUERY );
- assert( xParent.is() );
- assert( xWinParent.is() );
- /*
- With the new three layer instarr/rpath feature, when
- prepending toolkit/unxlngx6.pro/lib or $SOLARVER/lib to
- LD_LIBRARY_PATH, VCLXWindow::GetImplementation returns 0x0
- vclxtoolkit::ImplCreateWindow failing to create any widget;
- although it succeeds here.
-
- While developing, one now must copy libtlx.so to
- $OOO_INSTALL_PREFIX/openoffice.org/basis3.0/program/libtklx.so
- each time.
- */
- VCLXWindow* parentComponent = VCLXWindow::GetImplementation( xWinParent );
- if ( !parentComponent )
- throw uno::RuntimeException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("parent has no implementation")),
- uno::Reference< uno::XInterface >() );
- desc.Parent = xWinParent;
- }
-
- desc.ParentIndex = 0;
- // debugging help ...
- desc.Bounds.X = 0;
- desc.Bounds.Y = 0;
- desc.Bounds.Width = 300;
- desc.Bounds.Height = 200;
-
- desc.WindowAttributes = properties;
- desc.WindowServiceName = name;
-
- uno::Reference< awt::XWindowPeer > xWinPeer;
- try
- {
- OSL_TRACE("Asking toolkit: %s", OUSTRING_CSTR( desc.WindowServiceName ) );
- xWinPeer = xToolkit->createWindow( desc );
- if ( !xWinPeer.is() )
- throw uno::RuntimeException(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot create peer" ) ),
- uno::Reference< uno::XInterface >() );
- xPeer = uno::Reference< awt::XLayoutConstrains >( xWinPeer, uno::UNO_QUERY );
- }
- catch( uno::Exception & )
- {
- OSL_TRACE( "Warning: %s is not a recognized type\n", OUSTRING_CSTR( name ) );
- return uno::Reference< awt::XLayoutConstrains >();
- }
-
- return xPeer;
-}
-
-uno::Reference< awt::XLayoutConstrains >
-WidgetFactory::createWidget (uno::Reference< awt::XToolkit > xToolkit, uno::Reference< uno::XInterface > xParent, OUString const& name, long properties)
-{
- uno::Reference< awt::XLayoutConstrains > xPeer;
-
- xPeer = uno::Reference <awt::XLayoutConstrains> (createContainer (name), uno::UNO_QUERY);
- if ( xPeer.is() )
- return xPeer;
-
- xPeer = implCreateWidget (xParent, name, properties);
- if (xPeer.is ())
- return xPeer;
-
-#define FIXED_INFO 1
-#if FIXED_INFO
- OUString tName = name;
- // FIXME
- if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "fixedinfo" ) ) )
- tName = OUString(RTL_CONSTASCII_USTRINGPARAM("fixedtext"));
- xPeer = toolkitCreateWidget (xToolkit, xParent, tName, properties);
-#else
- xPeer = toolkitCreateWidget (xToolkit, xParent, name, properties);
-#endif
-
- return xPeer;
-}
-
-PropHelper::PropHelper() : LockHelper()
- , cppu::OPropertySetHelper( maBrdcstHelper )
- , pHelper( NULL )
-{
-}
-
-void
-PropHelper::addProp (const char *pName, sal_Int32 nNameLen, rtl_TextEncoding e,
- uno::Type aType, void *pPtr)
-{
- // this sucks rocks for effiency ...
- PropDetails aDetails;
- aDetails.aName = rtl::OUString::intern( pName, nNameLen, e );
- aDetails.aType = aType;
- aDetails.pValue = pPtr;
- maDetails.push_back( aDetails );
-}
-
-cppu::IPropertyArrayHelper & SAL_CALL
-PropHelper::getInfoHelper()
-{
- if ( ! pHelper )
- {
- uno::Sequence< beans::Property > aProps( maDetails.size() );
- for ( unsigned int i = 0; i < maDetails.size(); i++)
- {
- aProps[i].Name = maDetails[i].aName;
- aProps[i].Type = maDetails[i].aType;
- aProps[i].Handle = i;
- aProps[i].Attributes = 0;
- }
- pHelper = new cppu::OPropertyArrayHelper( aProps, false /* fixme: faster ? */ );
-
- }
- return *pHelper;
-}
-
-sal_Bool SAL_CALL
-PropHelper::convertFastPropertyValue(
- uno::Any & rConvertedValue,
- uno::Any & rOldValue,
- sal_Int32 nHandle,
- const uno::Any& rValue )
- throw (lang::IllegalArgumentException)
-{
- OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
-
- // FIXME: no Any::getValue ...
- getFastPropertyValue( rOldValue, nHandle );
- if ( rOldValue != rValue )
- {
- rConvertedValue = rValue;
- return sal_True; // changed
- }
- else
- {
- rConvertedValue.clear();
- rOldValue.clear();
- }
- return sal_False;
-}
-
-
-void SAL_CALL
-PropHelper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
- const uno::Any& rValue )
- throw (uno::Exception)
-{
- OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
-
- const PropDetails &rInfo = maDetails[ nHandle ];
-
- uno_type_assignData( rInfo.pValue, rInfo.aType.getTypeLibType(),
- rValue.pData, rValue.pType,
- 0, 0, 0 );
-
- if ( mpListener )
- mpListener->propertiesChanged();
-}
-
-void SAL_CALL
-PropHelper::getFastPropertyValue( uno::Any& rValue,
- sal_Int32 nHandle ) const
-{
- OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
- const PropDetails &rInfo = maDetails[ nHandle ];
- rValue.setValue( rInfo.pValue, rInfo.aType );
-}
-
-::com::sun::star::uno::Any
-PropHelper::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- return OPropertySetHelper::queryInterface( rType );
-}
-
-uno::Reference <beans::XPropertySetInfo> SAL_CALL PropHelper::getPropertySetInfo () throw (uno::RuntimeException)
-{
- return css::uno::Reference <css::beans::XPropertySetInfo> (createPropertySetInfo (getInfoHelper ()));
-}
-
-} // namespace layoutimpl
-
-#include <awt/vclxbutton.hxx>
-#include <awt/vclxdialog.hxx>
-#include <awt/vclxfixedline.hxx>
-#include <awt/vclxplugin.hxx>
-#include <awt/vclxscroller.hxx>
-#include <awt/vclxsplitter.hxx>
-#include <awt/vclxtabcontrol.hxx>
-#include <awt/vclxtabpage.hxx>
-#include <toolkit/awt/vclxtoolkit.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/tabctrl.hxx>
-#include <vcl/tabpage.hxx>
-#include <vcl/unohelp.hxx>
-
-#include <layout/layout.hxx>
-#include <toolkit/awt/vclxwindows.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl.hxx>
-
-#include <typeinfo>
-
-namespace layoutimpl
-{
-
-uno::Reference <awt::XLayoutConstrains> WidgetFactory::implCreateWidget (uno::Reference <uno::XInterface> xParent, OUString name, long attributes)
-{
- Window* parent = 0;
-
- if (VCLXWindow* parentComponent = VCLXWindow::GetImplementation (xParent))
- parent = parentComponent->GetWindow ();
-
- VCLXWindow* component = 0;
- Window* window = 0; //sfx2CreateWindow (&component, parent, name, attributes);
- if (!window)
- window = layoutCreateWindow (&component, parent, name, attributes);
-
- uno::Reference <awt::XLayoutConstrains> reference;
- if (window)
- {
- window->SetCreatedWithToolkit( sal_True );
- if ( component )
- component->SetCreatedWithToolkit( true );
- reference = component;
- window->SetComponentInterface( component );
- if ( attributes & awt::WindowAttribute::SHOW )
- window->Show();
- }
-
- return reference;
-}
-
-extern "C" { static void SAL_CALL thisModule() {} }
-
-Window* WidgetFactory::sfx2CreateWindow (VCLXWindow** component, Window* parent, OUString const& name, long& attributes)
-{
- OSL_TRACE("Asking sfx2: %s", OUSTRING_CSTR (name));
-
- if (!mSfx2Library)
- {
- OUString libraryName = ::vcl::unohelper::CreateLibraryName ("sfx", sal_True);
- mSfx2Library = osl_loadModuleRelative (&thisModule, libraryName.pData, SAL_LOADMODULE_DEFAULT);
- if (mSfx2Library)
- {
- OUString functionName (RTL_CONSTASCII_USTRINGPARAM ("CreateWindow"));
- mSfx2CreateWidget = (WindowCreator) osl_getFunctionSymbol (mSfx2Library, functionName.pData);
- }
- }
-
- if (mSfx2CreateWidget)
- return mSfx2CreateWidget (component, name, parent, attributes);
-
- return 0;
-}
-
-Window* WidgetFactory::layoutCreateWindow (VCLXWindow** component, Window *parent, OUString const& name, long& attributes)
-{
- Window* window = 0;
-
- if (0)
- {
- ;
- }
- if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "dialog" ) ) )
- {
- if ( parent == NULL )
- parent = DIALOG_NO_PARENT;
- window = new Dialog( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXDialog();
-
- attributes ^= awt::WindowAttribute::SHOW;
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "modaldialog" ) ) )
- {
- if ( parent == NULL )
- parent = DIALOG_NO_PARENT;
- window = new ModalDialog( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXDialog();
-
- attributes ^= awt::WindowAttribute::SHOW;
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "modelessdialog" ) ) )
- {
- if ( parent == NULL )
- parent = DIALOG_NO_PARENT;
- window = new ModelessDialog (parent, ImplGetWinBits (attributes, 0));
- *component = new layoutimpl::VCLXDialog();
-
- attributes ^= awt::WindowAttribute::SHOW;
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sfxdialog" ) ) )
- {
- if ( parent == NULL )
- parent = DIALOG_NO_PARENT;
- window = new ClosingDialog (parent, ImplGetWinBits (attributes, 0));
- *component = new layoutimpl::VCLXDialog();
-
- attributes ^= awt::WindowAttribute::SHOW;
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sfxmodaldialog" ) ) )
- {
- if ( parent == NULL )
- parent = DIALOG_NO_PARENT;
- window = new ClosingModalDialog( parent,
- ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXDialog();
-
- attributes ^= awt::WindowAttribute::SHOW;
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sfxmodelessdialog" ) ) )
- {
- if ( parent == NULL )
- parent = DIALOG_NO_PARENT;
- window = new ClosingModelessDialog (parent, ImplGetWinBits (attributes, 0));
- *component = new layoutimpl::VCLXDialog();
-
- attributes ^= awt::WindowAttribute::SHOW;
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "tabcontrol" ) ) )
- {
- window = new TabControl( parent, ImplGetWinBits( attributes, WINDOW_TABCONTROL ) );
- *component = new layoutimpl::VCLXTabControl();
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "scroller" ) ) )
- {
- // used FixedImage because I just want some empty non-intrusive widget
- window = new FixedImage( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXScroller();
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hsplitter" ) ) || name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "vsplitter" ) ) )
- {
- window = new FixedImage( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXSplitter( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hsplitter" ) ) );
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hfixedline" ) ) || name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "vfixedline" ) ) )
- {
- WinBits nStyle = ImplGetWinBits( attributes, 0 );
- nStyle ^= WB_HORZ;
- if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hfixedline" ) ) )
- nStyle |= WB_HORZ;
- else
- nStyle |= WB_VERT;
- window = new FixedLine( parent, nStyle );
- *component = new layoutimpl::VCLXFixedLine();
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "okbutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXOKButton( window );
- window->SetType (WINDOW_OKBUTTON);
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "cancelbutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXCancelButton( window );
- window->SetType (WINDOW_CANCELBUTTON);
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "yesbutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXYesButton( window );
- window->SetType (WINDOW_OKBUTTON);
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "nobutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- window->SetType (WINDOW_CANCELBUTTON);
- *component = new layoutimpl::VCLXNoButton( window );
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "retrybutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXRetryButton( window );
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ignorebutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXIgnoreButton( window );
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "resetbutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXResetButton( window );
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "applybutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXApplyButton( window );
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "helpbutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXHelpButton( window );
- window->SetType (WINDOW_HELPBUTTON);
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "morebutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXMoreButton( window );
- window->SetType (WINDOW_MOREBUTTON);
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "advancedbutton" ) ) )
- {
- window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::VCLXAdvancedButton( window );
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "plugin" ) ) )
- {
- window = new Control( parent, ImplGetWinBits( attributes, 0 ) );
-#ifndef __SUNPRO_CC
- OSL_TRACE( "%s: parent=%p (%s)\n", __FUNCTION__, parent, typeid( *parent ).name() );
-#endif
- *component = new layoutimpl::VCLXPlugin( window, ImplGetWinBits( attributes, 0 ) );
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "tabpage" ) ) )
- {
- if (layout::TabPage::global_parent)
- parent = layout::TabPage::global_parent;
- layout::TabPage::global_parent = 0;
- //window = new TabPage( parent, ImplGetWinBits( attributes, 0 ) );
- attributes ^= awt::WindowAttribute::SHOW;
- WinBits nStyle = ImplGetWinBits( attributes, 0 );
- nStyle |= WB_HIDE;
-
- if (!parent)
- {
- window = new Dialog( parent, nStyle );
- *component = new VCLXDialog();
- }
- else
- {
- window = new TabPage( parent, nStyle );
- *component = new VCLXTabPage( window );
- }
- }
- else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "string" ) ) )
- {
- // FIXME: move <string>s.text to simple map<string> in root?
- attributes &= ~awt::WindowAttribute::SHOW;
- window = new Window( parent, ImplGetWinBits( attributes, 0 ) );
- *component = new layoutimpl::LocalizedString();
- }
- else if (name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("svxfontlistbox"))
- || name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("svxlanguagebox")))
- {
- window = new ListBox (parent, ImplGetWinBits (attributes, 0));
- *component = new VCLXListBox ();
- }
- return window;
-}
-
-} // namespace layoutimpl
-
-// Avoid polluting the rest of the code with vcl linkage pieces ...
-
-#include <vcl/imagerepository.hxx>
-#include <vcl/bitmapex.hxx>
-#include <vcl/graph.hxx>
-
-namespace layoutimpl
-{
-
-uno::Reference< graphic::XGraphic > loadGraphic( const char *pName )
-{
- BitmapEx aBmp;
-
- OUString aStr( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US );
- if ( aStr.compareToAscii( ".uno:" ) == 0 )
- aStr = aStr.copy( 5 ).toAsciiLowerCase();
-
- if ( !vcl::ImageRepository::loadImage( OUString::createFromAscii( pName ), aBmp, true, true ) )
- return uno::Reference< graphic::XGraphic >();
-
- return Graphic( aBmp ).GetXGraphic();
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/helper.hxx b/toolkit/source/layout/core/helper.hxx
deleted file mode 100644
index f19f74611f..0000000000
--- a/toolkit/source/layout/core/helper.hxx
+++ /dev/null
@@ -1,152 +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_CORE_HELPER_HXX
-#define LAYOUT_CORE_HELPER_HXX
-
-#include <toolkit/dllapi.h>
-#include <vector>
-
-#include <com/sun/star/awt/XLayoutConstrains.hpp>
-#include <com/sun/star/awt/XLayoutContainer.hpp>
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#include <com/sun/star/xml/input/XRoot.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/propshlp.hxx>
-#include <osl/module.h>
-#include <rtl/ustring.hxx>
-
-class Window;
-class VCLXWindow;
-extern "C"
-{
- typedef Window* (SAL_CALL *WindowCreator) (VCLXWindow** component, rtl::OUString const& name, Window* parent, long& attributes);
-}
-
-namespace layoutimpl
-{
-
-namespace css = ::com::sun::star;
-
-/* ChildProps -- a helper to set child properties for the XLayoutContainer interface. */
-
-class LockHelper
-{
-public:
- osl::Mutex maGuard;
- cppu::OBroadcastHelper maBrdcstHelper;
- LockHelper() : maBrdcstHelper( maGuard )
- {
- }
-};
-
-class PropHelper : public LockHelper
- , public cppu::OPropertySetHelper
- , public cppu::OWeakObject
-{
- cppu::OPropertyArrayHelper *pHelper;
-
- struct PropDetails
- {
- rtl::OUString aName;
- css::uno::Type aType;
- void *pValue;
- };
- std::vector< PropDetails > maDetails;
-
-protected:
- void addProp( char const *pName, sal_Int32 nNameLen, rtl_TextEncoding e,
- css::uno::Type aType, void *pPtr );
-
-public:
- PropHelper();
-
- // com::sun::star::uno::XInterface
- void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
- void SAL_CALL release() throw() { OWeakObject::release(); }
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-
- // cppu::OPropertySetHelper
- virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
- virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any &,
- css::uno::Any &, sal_Int32 nHandle, const css::uno::Any & )
- throw(css::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
- const css::uno::Any& rValue ) throw (css::uno::Exception);
- using OPropertySetHelper::getFastPropertyValue;
- virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue,
- sal_Int32 nHandle ) const;
-
- virtual css::uno::Reference <css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo () throw (css::uno::RuntimeException);
-
- struct Listener
- {
- virtual void propertiesChanged() = 0;
- };
-
- void setChangeListener( Listener *pListener )
- {
- mpListener = pListener;
- }
-
-protected:
- Listener *mpListener;
-};
-
-css::uno::Any anyFromString (const rtl::OUString &value, const css::uno::Type &type);
-
-// The native widgets wrapper hierarchy may not reflect that of the layout
-// hierarchy as some containers don't have an associated native widget.
-// Use this function to get the native parent of the given peer.
-css::uno::Reference< css::awt::XWindowPeer >
-getParent( css::uno::Reference< css::uno::XInterface > xPeer );
-
-class TOOLKIT_DLLPUBLIC WidgetFactory
-{
-public:
- static oslModule mSfx2Library;
- static WindowCreator mSfx2CreateWidget;
-
- // Should use UNO services in due course
- static css::uno::Reference <css::awt::XLayoutConstrains> toolkitCreateWidget (css::uno::Reference <css::awt::XToolkit> xToolkit, css::uno::Reference <css::uno::XInterface> xParent, rtl::OUString const& name, long properties);
- static css::uno::Reference< css::awt::XLayoutConstrains > createWidget( css::uno::Reference <css::awt::XToolkit > xToolkit, css::uno::Reference< css::uno::XInterface > xParent, rtl::OUString const &name, long properties);
- static css::uno::Reference <css::awt::XLayoutContainer> createContainer (rtl::OUString const& name);
- static css::uno::Reference <css::awt::XLayoutConstrains> implCreateWidget (css::uno::Reference <css::uno::XInterface> xParent, rtl::OUString name, long attributes);
- static Window* sfx2CreateWindow (VCLXWindow** component, Window* parent, rtl::OUString const& name, long& attributes);
- static Window* layoutCreateWindow (VCLXWindow** component, Window *parent, rtl::OUString const& name, long& attributes);
-};
-
-
-css::uno::Reference< css::graphic::XGraphic > loadGraphic( const char *pName );
-
-} // end namespace layoutimpl
-
-#endif /* LAYOUT_CORE_HELPER_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/import.cxx b/toolkit/source/layout/core/import.cxx
deleted file mode 100644
index 5b9262a771..0000000000
--- a/toolkit/source/layout/core/import.cxx
+++ /dev/null
@@ -1,328 +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 "import.hxx"
-
-#include <com/sun/star/awt/XButton.hpp>
-#include <com/sun/star/awt/XDialog2.hpp>
-#include <vcl/image.hxx>
-#include <tools/debug.hxx>
-#include <layout/layout.hxx>
-
-#include "root.hxx"
-#include "helper.hxx"
-#include "dialogbuttonhbox.hxx"
-
-
-#define XMLNS_LAYOUT_URI "http://openoffice.org/2007/layout"
-#define XMLNS_CONTAINER_URI "http://openoffice.org/2007/layout/container"
-
-namespace layoutimpl
-{
-using namespace css;
-
-using ::rtl::OUString;
-
-ElementBase::~ElementBase()
-SAL_THROW( () )
-{
- //delete mpImport;
- //mpImport = 0;
-}
-
-//** parser
-WidgetElement::WidgetElement ( sal_Int32 nUid, const OUString &rName,
- uno::Reference <xml::input::XAttributes> const &attributes,
- ElementBase *pParent,
- ImportContext *pImport)
-SAL_THROW (())
-: ElementBase( nUid, rName, attributes, pParent, pImport )
-{
- OUString name = rName.toAsciiLowerCase();
-
- PropList aProps;
- propsFromAttributes( attributes, aProps, pImport->XMLNS_LAYOUT_UID );
-
- OUString aId;
- findAndRemove( "id", aProps, aId );
- OUString aLang;
- findAndRemove( "xml-lang", aProps, aLang );
-
- {
-//DEBUG
- uno::Reference< awt::XLayoutConstrains > xParent;
- if ( pParent )
- xParent = ((WidgetElement *) pParent)->mpWidget->getPeer();
-
-
- mpWidget = pImport->mrRoot.create( aId, name,
- getAttributeProps( aProps ), uno::Reference< awt::XLayoutContainer >( xParent, uno::UNO_QUERY ) );
-
- }
-
- // TODO: handle with non-existing widgets
-
- mpWidget->setProperties( aProps );
-
- uno::Reference< awt::XDialog2 > xDialog( mpWidget->getPeer(), uno::UNO_QUERY );
- if ( xDialog.is() )
- {
- OUString aTitle;
- if ( findAndRemove( "title", aProps, aTitle ) )
- {
- OSL_TRACE("Setting title: %s", OUSTRING_CSTR( aTitle ) );
- xDialog->setTitle( aTitle );
- }
- OUString aHelpId;
- if ( findAndRemove( "help-id", aProps, aHelpId ) )
- {
- OSL_TRACE("Setting help-id: %s", OUSTRING_CSTR( aHelpId ) );
- xDialog->setHelpId( aHelpId );
- }
- } // DEBUG:
- else if ( pParent == NULL )
- {
- OSL_FAIL( "Fatal error: top node isn't a dialog" );
- }
-
- OUString aOrdering;
- if ( findAndRemove( "ordering", aProps, aOrdering ) )
- if ( DialogButtonHBox *b = dynamic_cast<DialogButtonHBox *> ( mpWidget->getPeer().get() ) )
- b->setOrdering ( aOrdering );
-
- bool bSetRadioGroup;
- OUString aRadioGroup;
- bSetRadioGroup = findAndRemove( "radiogroup", aProps, aRadioGroup );
-
- mpWidget->setProperties( aProps );
-
- // we need to add radio buttons to the group after their properties are
- // set, so we can check if they should be the one selected by default or not.
- // And the state changed event isn't fired when changing properties.
-
- uno::Reference< awt::XRadioButton > xRadio( mpWidget->getPeer(), uno::UNO_QUERY );
- if ( xRadio.is() )
- {
- if (!bSetRadioGroup)
- aRadioGroup = OUString(RTL_CONSTASCII_USTRINGPARAM ("default"));
- pImport->mxRadioGroups.addItem( aRadioGroup, xRadio );
- }
-}
-
-WidgetElement::~WidgetElement()
-{
- //delete mpWidget;
- //mpWidget = 0;
-}
-
-uno::Reference <xml::input::XElement>
-WidgetElement::startChildElement ( sal_Int32 nUid, OUString const &name,
- uno::Reference <xml::input::XAttributes> const &attributes )
- throw( xml::sax::SAXException, uno::RuntimeException )
-{
- // Adding a child to the widget
- WidgetElement *pChild = new WidgetElement ( nUid, name, attributes, this, mpImport );
-
- if ( !mpWidget->addChild( pChild->mpWidget ) )
- {
- OSL_TRACE( "ERROR: cannot add %s to container %s, container full", OUSTRING_CSTR( name ), OUSTRING_CSTR( getLocalName() ) );
- throw xml::sax::SAXException();
- }
-
- PropList aProps;
- propsFromAttributes( attributes, aProps, mpImport->XMLNS_CONTAINER_UID );
- mpWidget->setChildProperties( pChild->mpWidget, aProps );
-
- return pChild;
-}
-
-// Support Ivo Hinkelmann's move label/text/title attribute to CONTENT
-// transex3 hack.
-void SAL_CALL
-WidgetElement::characters( OUString const& rChars )
- throw (xml::sax::SAXException, uno::RuntimeException)
-{
- if ( mpWidget && rChars.trim().getLength() )
- {
- uno::Reference< awt::XDialog2 > xDialog( mpWidget->getPeer(), uno::UNO_QUERY );
- uno::Reference< awt::XButton > xButton( mpWidget->getPeer(), uno::UNO_QUERY );
- if ( xDialog.is() )
- xDialog->setTitle( rChars );
- else if ( xButton.is() )
- mpWidget->setProperty( OUString(RTL_CONSTASCII_USTRINGPARAM("label")), rChars );
- else
- mpWidget->setProperty( OUString(RTL_CONSTASCII_USTRINGPARAM("text")), rChars );
- }
-}
-// ---- ElementBase ----
-
-ElementBase::ElementBase( sal_Int32 nUid, OUString const & rLocalName,
- uno::Reference< xml::input::XAttributes > const & xAttributes,
- ElementBase* pParent,
- ImportContext* pImport )
-SAL_THROW(())
-: mpImport( pImport )
- , mpParent( pParent )
- , mnUid( nUid )
- , maLocalName( rLocalName )
- , mxAttributes( xAttributes )
-{
-}
-
-// ---- ImportContext ----
-
-void ImportContext::startDocument(
- uno::Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
- throw (xml::sax::SAXException, uno::RuntimeException)
-{
- XMLNS_LAYOUT_UID = xNamespaceMapping->getUidByUri(
- OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_LAYOUT_URI ) ) );
- XMLNS_CONTAINER_UID = xNamespaceMapping->getUidByUri(
- OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_CONTAINER_URI ) ) );
-}
-
-ToplevelElement::ToplevelElement (OUString const &rName,
- uno::Reference <xml::input::XAttributes> const &xAttributes,
- ImportContext *pImport)
-SAL_THROW(())
-: WidgetElement( 0, rName, xAttributes, NULL, pImport )
-{
-}
-
-ToplevelElement::~ToplevelElement()
-{
-}
-
-uno::Reference< xml::input::XElement > ImportContext::startRootElement(
- sal_Int32 nUid, OUString const & rLocalName,
- uno::Reference< xml::input::XAttributes > const & xAttributes )
- throw (xml::sax::SAXException, uno::RuntimeException)
-{
- if ( XMLNS_LAYOUT_UID != nUid )
- throw xml::sax::SAXException(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid namespace!" ) ),
- uno::Reference< uno::XInterface >(), uno::Any() );
- return new ToplevelElement( rLocalName, xAttributes, this );
-}
-
-RadioGroups::RadioGroups()
-{
-}
-
-void RadioGroups::addItem( rtl::OUString id, uno::Reference< awt::XRadioButton > xRadio )
- throw (uno::RuntimeException)
-{
- if ( ! xRadio.is() )
- throw uno::RuntimeException();
-
- uno::Reference< RadioGroup > group;
- RadioGroupsMap::iterator it = mxRadioGroups.find( id );
- if ( it == mxRadioGroups.end() )
- {
- group = uno::Reference< RadioGroup > ( new RadioGroup() );
- mxRadioGroups [id] = group;
- }
- else
- group = it->second;
- group->addItem( xRadio );
-}
-
-RadioGroups::RadioGroup::RadioGroup()
-{
-}
-
-void RadioGroups::RadioGroup::addItem( uno::Reference< awt::XRadioButton > xRadio )
-{
- if ( ! mxSelectedRadio.is() )
- {
- xRadio->setState( true );
- mxSelectedRadio = xRadio;
- }
- else if ( xRadio->getState() )
- {
-#if 1
- xRadio->setState( false );
-#else // huh, why select last added?
- mxSelectedRadio->setState( false );
- mxSelectedRadio = xRadio;
-#endif
- }
-
- // TOO late: actionPerformed is called before itemStateChanged.
- // If client code (wrongly?) uses actionPerformed, it will see
- // the previous RadioButtons' state.
- xRadio->addItemListener( this );
-
- uno::Reference< awt::XButton > xButton = uno::Reference< awt::XButton > ( xRadio, uno::UNO_QUERY );
- xButton->addActionListener( this );
-
- mxRadios.push_back (xRadio);
-}
-
-void RadioGroups::RadioGroup::handleSelected ()
- throw (uno::RuntimeException)
-{
- for ( RadioButtonsList::iterator it = mxRadios.begin();
- it != mxRadios.end(); ++it )
- if ( *it != mxSelectedRadio && (*it)->getState() )
- {
- mxSelectedRadio->setState( false );
- mxSelectedRadio = *it;
- break;
- }
-}
-
-// awt::XItemListener
-void RadioGroups::RadioGroup::itemStateChanged( const awt::ItemEvent& e )
- throw (uno::RuntimeException)
-{
- // TOO late: actionPerformed is called before itemStateChanged.
- // If client code (wrongly?) uses actionPerformed, it will see
- // the previous RadioButtons' state.
-
- // Need this for initialization, though.
- if ( e.Selected )
- handleSelected ();
-}
-
-// awt::XActionListener
-void RadioGroups::RadioGroup::actionPerformed( const awt::ActionEvent& )
- throw (uno::RuntimeException)
-{
- handleSelected ();
-}
-
-// lang::XEventListener
-void SAL_CALL RadioGroups::RadioGroup::disposing( const lang::EventObject& )
- throw (uno::RuntimeException)
-{
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/import.hxx b/toolkit/source/layout/core/import.hxx
deleted file mode 100644
index 8d3584a255..0000000000
--- a/toolkit/source/layout/core/import.hxx
+++ /dev/null
@@ -1,214 +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_CORE_IMPORT_HXX
-#define LAYOUT_CORE_IMPORT_HXX
-
-#include <map>
-#include <list>
-#define _BACKWARD_BACKWARD_WARNING_H 1
-#include <boost/unordered_map.hpp>
-
-
-#include <com/sun/star/xml/input/XRoot.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/awt/XButton.hpp>
-#include <com/sun/star/awt/XRadioButton.hpp>
-
-namespace layoutimpl
-{
-class LayoutRoot;
-class LayoutWidget;
-namespace css = ::com::sun::star;
-
-class RadioGroups
-{
-public:
- RadioGroups();
-
- void addItem( rtl::OUString id, css::uno::Reference< css::awt::XRadioButton > xRadio )
- throw (css::uno::RuntimeException);
-
-private:
- class RadioGroup : public ::cppu::WeakImplHelper1< css::awt::XItemListener >
- , public ::cppu::WeakImplHelper1< css::awt::XActionListener >
- {
- public:
- RadioGroup();
- void addItem( css::uno::Reference< css::awt::XRadioButton > xRadio );
-
- private:
- typedef std::list< css::uno::Reference< css::awt::XRadioButton > > RadioButtonsList;
- RadioButtonsList mxRadios;
- css::uno::Reference< css::awt::XRadioButton > mxSelectedRadio;
-
- void handleSelected ()
- throw (css::uno::RuntimeException);
-
- // awt::XItemListener
- void SAL_CALL itemStateChanged( const css::awt::ItemEvent& e )
- throw (css::uno::RuntimeException);
-
- // awt::XActionListener
- void SAL_CALL actionPerformed( const css::awt::ActionEvent& e )
- throw (css::uno::RuntimeException);
-
- // lang::XEventListener
- void SAL_CALL disposing( const css::lang::EventObject& )
- throw (css::uno::RuntimeException);
- };
-
- // each RadioGroup will stay alive after RadioGroups die with the ImportContext
- // because they are referenced by every XRadioButton through the listener
- typedef std::map< rtl::OUString, css::uno::Reference< RadioGroup > > RadioGroupsMap;
- RadioGroupsMap mxRadioGroups;
-};
-
-// parser
-class ImportContext : public ::cppu::WeakImplHelper1< css::xml::input::XRoot >
-{
-public:
- sal_Int32 XMLNS_LAYOUT_UID, XMLNS_CONTAINER_UID;
- LayoutRoot &mrRoot; // switch to XNameContainer ref ?
- RadioGroups mxRadioGroups;
-
- inline ImportContext( LayoutRoot &rRoot ) SAL_THROW( () )
- : mrRoot( rRoot ) {}
- virtual ~ImportContext() {}
-
- // XRoot
- virtual void SAL_CALL startDocument(
- css::uno::Reference< css::xml::input::XNamespaceMapping >
- const & xNamespaceMapping )
- throw (css::xml::sax::SAXException, css::uno::RuntimeException);
- virtual void SAL_CALL endDocument()
- throw (css::xml::sax::SAXException, css::uno::RuntimeException)
- { /* ignore */ }
- virtual void SAL_CALL processingInstruction(
- ::rtl::OUString const & /* rTarget */, ::rtl::OUString const & /* rData */ )
- throw (css::xml::sax::SAXException, css::uno::RuntimeException)
- { /* ignore */ }
- virtual void SAL_CALL setDocumentLocator(
- css::uno::Reference< css::xml::sax::XLocator > const & /* xLocator */ )
- throw (css::xml::sax::SAXException, css::uno::RuntimeException)
- { /* ignore */ }
- virtual css::uno::Reference< css::xml::input::XElement >
- SAL_CALL startRootElement(
- sal_Int32 nUid, ::rtl::OUString const & rLocalName,
- css::uno::Reference<css::xml::input::XAttributes > const & xAttributes )
- throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-};
-
-class ElementBase : public ::cppu::WeakImplHelper1< css::xml::input::XElement >
-{
-protected:
- ImportContext *mpImport;
-/* TODO: check if all this memebers are needed. */
- ElementBase *mpParent;
- sal_Int32 mnUid;
-
- ::rtl::OUString maLocalName;
- css::uno::Reference< css::xml::input::XAttributes > mxAttributes;
-public:
- ElementBase(
- sal_Int32 nUid, ::rtl::OUString const & rLocalName,
- css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
- ElementBase * pParent, ImportContext * pImport )
- SAL_THROW( () );
- virtual ~ElementBase() SAL_THROW(());
-
- // XElement
- virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL getParent()
- throw (css::uno::RuntimeException)
- { return static_cast< css::xml::input::XElement * >( mpParent ); }
- virtual ::rtl::OUString SAL_CALL getLocalName() throw (css::uno::RuntimeException)
- { return maLocalName; }
- virtual sal_Int32 SAL_CALL getUid() throw (css::uno::RuntimeException)
- { return mnUid; }
- virtual css::uno::Reference< css::xml::input::XAttributes >
- SAL_CALL getAttributes() throw (css::uno::RuntimeException)
- { return mxAttributes; }
-
- virtual void SAL_CALL ignorableWhitespace(
- ::rtl::OUString const & /* rWhitespaces */ )
- throw (css::xml::sax::SAXException, css::uno::RuntimeException)
- { /* ignore */ }
- virtual void SAL_CALL characters( ::rtl::OUString const & /* rChars */ )
- throw (css::xml::sax::SAXException, css::uno::RuntimeException)
- { /* ignore */ }
- virtual void SAL_CALL processingInstruction(
- ::rtl::OUString const & /* Target */, ::rtl::OUString const & /* Data */ )
- throw (css::xml::sax::SAXException, css::uno::RuntimeException)
- { /* ignore */ }
-
- virtual css::uno::Reference< css::xml::input::XElement >
- SAL_CALL startChildElement(
- sal_Int32 nUid, ::rtl::OUString const & rLocalName,
- css::uno::Reference<css::xml::input::XAttributes > const & xAttributes )
- throw (css::xml::sax::SAXException, css::uno::RuntimeException) = 0;
- virtual void SAL_CALL endElement()
- throw (css::xml::sax::SAXException, css::uno::RuntimeException)
- { /* ignore */ }
-};
-
-class WidgetElement : public ElementBase
-{
-protected:
- LayoutWidget *mpWidget;
-
-public:
- WidgetElement( sal_Int32 nUid, rtl::OUString const &name,
- css::uno::Reference< css::xml::input::XAttributes > const &attributes,
- ElementBase *parent, ImportContext *import ) SAL_THROW (());
-
- ~WidgetElement();
-
-
- virtual css::uno::Reference< css::xml::input::XElement> SAL_CALL
- startChildElement (sal_Int32 id, rtl::OUString const &name,
- css::uno::Reference< css::xml::input::XAttributes > const &attributes)
- throw( css::xml::sax::SAXException, css::uno::RuntimeException );
- virtual void SAL_CALL characters( ::rtl::OUString const & /* rChars */ )
- throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-};
-
-class ToplevelElement : public WidgetElement
-{
-public:
- ToplevelElement( rtl::OUString const &name,
- css::uno::Reference< css::xml::input::XAttributes > const &attributes,
- ImportContext *import ) SAL_THROW (());
- ~ToplevelElement();
-};
-
-
-} // namespace layoutimpl
-
-#endif /* LAYOUT_CORE_IMPORT_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/localized-string.cxx b/toolkit/source/layout/core/localized-string.cxx
deleted file mode 100644
index 6d3625e5d4..0000000000
--- a/toolkit/source/layout/core/localized-string.cxx
+++ /dev/null
@@ -1,83 +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 "localized-string.hxx"
-
-#include <toolkit/helper/property.hxx>
-#include <vcl/window.hxx>
-#include <vcl/svapp.hxx>
-
-namespace layoutimpl
-{
-
-namespace css = ::com::sun::star;
-using namespace css;
-using rtl::OUString;
-
-LocalizedString::LocalizedString()
- : VCLXWindow()
-{
-}
-
-void LocalizedString::ImplGetPropertyIds( std::list< sal_uInt16 > &ids )
-{
- PushPropertyIds( ids, BASEPROPERTY_TEXT, 0);
- VCLXWindow::ImplGetPropertyIds( ids );
-}
-
-// XInterface
-uno::Any LocalizedString::queryInterface( uno::Type const& rType )
- throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XFixedText*, this ) );
- return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
-}
-
-void LocalizedString::setText( OUString const& s )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if ( Window *w = GetWindow() )
- return w->SetText( s );
-}
-
-OUString LocalizedString::getText()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if ( Window *w = GetWindow() )
- return w->GetText();
- return OUString();
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/localized-string.hxx b/toolkit/source/layout/core/localized-string.hxx
deleted file mode 100644
index 884c702cc3..0000000000
--- a/toolkit/source/layout/core/localized-string.hxx
+++ /dev/null
@@ -1,79 +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_CORE_LOCALIZED_STRING_HXX
-#define LAYOUT_CORE_LOCALIZED_STRING_HXX
-
-#include <com/sun/star/awt/XFixedText.hpp>
-#include <toolkit/awt/vclxwindow.hxx>
-
-namespace layoutimpl
-{
-namespace css = ::com::sun::star;
-
-// FIXME: misuse XFixedText interface for simple string
-class LocalizedString : public css::awt::XFixedText
- , public VCLXWindow
-{
-public:
- LocalizedString();
-
- // css::uno::XInterface
- css::uno::Any SAL_CALL queryInterface( css::uno::Type const& rType )
- throw(css::uno::RuntimeException);
- void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
- void SAL_CALL release() throw() { OWeakObject::release(); }
-
- // css::awt::XFixedText
- void SAL_CALL setText( ::rtl::OUString const& s )
- throw(css::uno::RuntimeException);
- ::rtl::OUString SAL_CALL getText()
- throw(css::uno::RuntimeException);
- void SAL_CALL setAlignment( sal_Int16 )
- throw(css::uno::RuntimeException) { }
- sal_Int16 SAL_CALL getAlignment()
- throw(css::uno::RuntimeException) { return 0; }
-
- // css::awt::XLayoutConstrains
- virtual css::awt::Size SAL_CALL getMinimumSize()
- throw(css::uno::RuntimeException) { return css::awt::Size( 0, 0 ); }
- css::awt::Size SAL_CALL getPreferredSize()
- throw(css::uno::RuntimeException) { return getMinimumSize(); }
- css::awt::Size SAL_CALL calcAdjustedSize( css::awt::Size const& size )
- throw(css::uno::RuntimeException) { return size; }
-
- static void ImplGetPropertyIds( std::list< sal_uInt16 > &ids );
- virtual void GetPropertyIds( std::list< sal_uInt16 > &ids )
- { return ImplGetPropertyIds( ids ); }
-};
-
-} // namespace layoutimpl
-
-#endif /* LAYOUT_CORE_LOCALIZED_STRING_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/precompiled_xmlscript.hxx b/toolkit/source/layout/core/precompiled_xmlscript.hxx
deleted file mode 100644
index 67a7d2d4ee..0000000000
--- a/toolkit/source/layout/core/precompiled_xmlscript.hxx
+++ /dev/null
@@ -1,38 +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.
- *
- ************************************************************************/
-
-/*
- xmlscript/source/xml_helper/xml_byteseq.cxx compile helper.
-
- Avoid introducing a toolkit dependency on xmlscript.
-
- It would be nice to modify xml_byteseq.cxx making it friendlier
- to include.
-*/
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/proplist.cxx b/toolkit/source/layout/core/proplist.cxx
deleted file mode 100644
index 802e6f27cf..0000000000
--- a/toolkit/source/layout/core/proplist.cxx
+++ /dev/null
@@ -1,422 +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 "proplist.hxx"
-
-#include <rtl/ustrbuf.hxx>
-#include <toolkit/dllapi.h>
-#include <com/sun/star/awt/WindowAttribute.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
-#include <tools/debug.hxx>
-
-#include "helper.hxx"
-
-namespace layoutimpl
-{
-
-using namespace com::sun::star;
-using rtl::OString;
-using rtl::OUString;
-using rtl::OUStringBuffer;
-
-namespace prophlp
-{
-
-bool TOOLKIT_DLLPUBLIC
-canHandleProps( const uno::Reference< uno::XInterface > &xPeer )
-{
- uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
- if ( xPropSet.is() )
- return true;
- uno::Reference< beans::XPropertySetInfo > xInfo( xPeer, uno::UNO_QUERY );
- uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
- return xInfo.is() && xVclPeer.is();
-}
-
-uno::Reference< beans::XPropertySetInfo > TOOLKIT_DLLPUBLIC
-queryPropertyInfo(
- const uno::Reference< uno::XInterface > &xPeer )
-{
- uno::Reference< beans::XPropertySetInfo > xInfo( xPeer, uno::UNO_QUERY );
- if ( !xInfo.is() )
- {
- uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
- if ( xPropSet.is() )
- xInfo = xPropSet->getPropertySetInfo();
- }
- return xInfo;
-}
-
-void TOOLKIT_DLLPUBLIC
-setProperty( const uno::Reference< uno::XInterface > &xPeer,
- const OUString &rName, uno::Any aValue )
-{
- uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
- if ( xVclPeer.is() )
- xVclPeer->setProperty( rName, aValue );
- else
- {
- uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
- xPropSet->setPropertyValue( rName, aValue );
- }
-}
-
-uno::Any TOOLKIT_DLLPUBLIC
-getProperty( const uno::Reference< uno::XInterface > &xPeer,
- const OUString &rName )
-{
- uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
- if ( xVclPeer.is() )
- return xVclPeer->getProperty( rName );
-
- uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
- return xPropSet->getPropertyValue( rName );
-}
-
-} // namespace prophlp
-
-
-/* Given a string and a type, it converts the string to the type, and returns
- it encapsulated in Any. */
-uno::Any anyFromString( OUString const& value, uno::Type const& type )
-{
- sal_Int16 radix = 10;
- OUString intval = value;
- if ( value.getLength() > 2 && value[0] == '0' && value[1] == 'x' )
- intval = value.copy( 2 ), radix = 16;
- else if ( value.getLength() > 1 && value[0] == '#' )
- intval = value.copy( 1 ), radix = 16;
- switch ( type.getTypeClass() )
- {
- case uno::TypeClass_CHAR:
- return uno::makeAny( value.toChar() );
- case uno::TypeClass_BOOLEAN:
- if ( value == OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) )
- return uno::makeAny( true );
- else if ( value == OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) )
- return uno::makeAny( false );
- break; // ends switch, throws exception
- case uno::TypeClass_BYTE:
- return uno::makeAny( ( sal_uInt8 ) intval.toInt32( radix ) );
- case uno::TypeClass_SHORT:
- return uno::makeAny( ( sal_Int16 ) intval.toInt32( radix ) );
- case uno::TypeClass_UNSIGNED_SHORT:
- return uno::makeAny( ( sal_uInt16 ) intval.toInt32( radix ) );
- case uno::TypeClass_ENUM:
- return uno::makeAny( ( sal_Int16 ) intval.toInt32( radix ) );
- case uno::TypeClass_LONG:
- return uno::makeAny( ( sal_Int32 ) intval.toInt32( radix ) );
- case uno::TypeClass_UNSIGNED_LONG:
- return uno::makeAny( ( sal_uInt32 ) intval.toInt32( radix ) );
- case uno::TypeClass_HYPER:
- return uno::makeAny( ( sal_Int64 ) intval.toInt64( radix ) );
- case uno::TypeClass_UNSIGNED_HYPER:
- return uno::makeAny( ( sal_uInt16 ) intval.toInt64( radix ) );
- case uno::TypeClass_FLOAT:
- return uno::makeAny( value.toFloat() );
- case uno::TypeClass_DOUBLE:
- return uno::makeAny( value.toDouble() );
- case uno::TypeClass_STRING:
- return uno::makeAny( value );
- case uno::TypeClass_CONSTANT:
- return uno::makeAny( intval.toInt32( radix ) );
- case uno::TypeClass_INTERFACE:
- return uno::makeAny( loadGraphic( OUSTRING_CSTR( value ) ) );
- case uno::TypeClass_SEQUENCE:
- {
- sal_Int32 i = 0;
- bool escaped = false, first = true;
- OUString item, token;
- std::list< OUString > values;
- do
- {
- token = value.getToken( 0, ':', i );
-
- if ( !token.getLength() && !escaped )
- {
- escaped = true;
- item += OUString( ':' );
- }
- else if ( escaped )
- {
- escaped = false;
- item += token;
- }
- else
- {
- if ( !first )
- values.push_back( item );
- item = token;
- }
- first = false;
- }
- while ( i >= 0 );
- if ( item.getLength() )
- values.push_back( item );
-
- uno::Sequence< OUString > seq( values.size() );
- i = 0;
- for ( std::list< OUString >::const_iterator it = values.begin();
- it != values.end(); ++it, ++i )
- seq[ i ] = *it;
-
- return uno::makeAny( seq );
- }
-
- default:
- OSL_TRACE( "ERROR: unknown property type of value: `%s'\n", OUSTRING_CSTR( value ) );
- break;
- }
- throw uno::RuntimeException();
-}
-
-/* Converts the XML naming scheme to UNO's, for legacy compatibility
- (so, ergo, "one-two-three-four" -> "OneTwoThreeFour"). */
-static OUString toUnoNaming ( OUString const &string )
-{
- OUStringBuffer buffer( string.getLength() );
- sal_Unicode *str = string.pData->buffer;
- bool capitalize = true;
-
- for ( int i = 0; i < string.getLength(); i++ )
- {
- if ( i == 0 && str[0] == '_' )
- /* Skip translate-me prefix. */
- continue;
- if ( str[i] == '-' )
- capitalize = true;
- else
- {
- if ( capitalize && str[i] >= 'a' && str[i] <= 'z' )
- buffer.append( (sal_Unicode ) ( str[i] - 'a' + 'A' ) );
- else
- buffer.append( (sal_Unicode ) str[i] );
- capitalize = false;
- }
- }
-
- return buffer.makeStringAndClear();
-}
-
-/*
- * convert incoming XML style property names, to AWT style property names.
- * convert the values based on introspection information.
- * apply to either an XPropertySet or an XPropertySetInfo | XVclWindowPeer
- * aggregate.
- */
-void
-setProperties( uno::Reference< uno::XInterface > const& xPeer,
- PropList const& rProps )
-{
- if ( !prophlp::canHandleProps( xPeer ) )
- {
- OSL_FAIL( "Error: setProperties - bad handle ignoring props:\n" );
- for ( PropList::const_iterator it = rProps.begin(); it != rProps.end();
- ++it )
- {
- OSL_TRACE( "%s=%s\n", OUSTRING_CSTR( it->first ), OUSTRING_CSTR( it->second ) );
- }
- return;
- }
-
- for ( PropList::const_iterator it = rProps.begin(); it != rProps.end();
- ++it )
- setProperty( xPeer, it->first, it->second );
-}
-
-void
-setProperty( uno::Reference< uno::XInterface > const& xPeer,
- OUString const& attr, OUString const& value )
-{
- OUString unoAttr = toUnoNaming( attr );
-
- OSL_TRACE( "setting %s=%s", OUSTRING_CSTR( attr ), OUSTRING_CSTR( value ) );
- // get a Property object
- beans::Property prop;
- try
- {
- uno::Reference< beans::XPropertySetInfo > xInfo
- = prophlp::queryPropertyInfo( xPeer );
- prop = xInfo->getPropertyByName( unoAttr );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_TRACE( "Warning: unknown attribute: `%s'\n", OUSTRING_CSTR( unoAttr ) );
- return;
- }
-
- if ( prop.Name.getLength() <= 0 )
- {
- OSL_TRACE( "Warning: missing prop: `%s'\n", OUSTRING_CSTR( unoAttr ) );
- return;
- }
-
- // encapsulates value in an uno::Any
- uno::Any any;
- try
- {
- any = anyFromString( value, prop.Type );
- }
- catch( uno::RuntimeException & )
- {
- OSL_TRACE( "Warning: %s( %s )( %s ) attribute is of type %s( rejected: %s )\n", OUSTRING_CSTR( unoAttr ), OUSTRING_CSTR( value ), OUSTRING_CSTR( prop.Name ), OUSTRING_CSTR( prop.Type.getTypeName() ), OUSTRING_CSTR( value ) );
- return;
- }
-
- // sets value on property
- try
- {
- prophlp::setProperty( xPeer, unoAttr, any );
- }
- catch( ... )
- {
- OSL_TRACE( "Warning: cannot set attribute %s to %s \n", OUSTRING_CSTR( unoAttr ), OUSTRING_CSTR( value ) );
- }
-}
-
-
-
-
-struct AttributesMap
-{
- const char *name;
- long value;
- bool windowAttr;
-};
-static const AttributesMap attribsMap[] =
-{
- { "autohscroll", awt::VclWindowPeerAttribute::AUTOHSCROLL, false },
- { "autovscroll", awt::VclWindowPeerAttribute::AUTOVSCROLL, false },
- { "center", awt::VclWindowPeerAttribute::CENTER, false },
- { "clipchildren", awt::VclWindowPeerAttribute::CLIPCHILDREN, false },
- { "closeable", awt::WindowAttribute::CLOSEABLE, true },
- { "defbutton", awt::VclWindowPeerAttribute::DEFBUTTON, false },
- { "dropdown", awt::VclWindowPeerAttribute::DROPDOWN, false },
- { "fullsize", awt::WindowAttribute::FULLSIZE, true }, //FIXME?
- { "group", awt::VclWindowPeerAttribute::GROUP, false },
- { "has_border", awt::WindowAttribute::BORDER, true },
- { "hscroll", awt::VclWindowPeerAttribute::HSCROLL, false },
- { "left", awt::VclWindowPeerAttribute::LEFT, false },
- { "moveable", awt::WindowAttribute::MOVEABLE, true },
- { "noborder", awt::VclWindowPeerAttribute::NOBORDER, false },
- { "nolabel", awt::VclWindowPeerAttribute::NOLABEL, false },
- { "optimumsize", awt::WindowAttribute::OPTIMUMSIZE, false },
- { "readonly", awt::VclWindowPeerAttribute::READONLY, false },
- { "right", awt::VclWindowPeerAttribute::RIGHT, false },
- { "show", awt::WindowAttribute::SHOW, true },
- { "sizeable", awt::WindowAttribute::SIZEABLE, true },
- { "sort", awt::VclWindowPeerAttribute::SORT, false },
- { "spin", awt::VclWindowPeerAttribute::SPIN, false },
- { "vscroll", awt::VclWindowPeerAttribute::VSCROLL, false },
-
- // cutting on OK, YES_NO_CANCEL and related obsite attributes...
-};
-static const int attribsMapLen = sizeof( attribsMap ) / sizeof( AttributesMap );
-
-void propsFromAttributes( const uno::Reference<xml::input::XAttributes> & xAttributes,
- PropList &rProps, sal_Int32 nNamespace )
-{
- sal_Int32 nAttrs = xAttributes->getLength();
- for ( sal_Int32 i = 0; i < nAttrs; i++ )
- {
- if ( nNamespace != xAttributes->getUidByIndex( i ) )
- continue;
-
- std::pair< OUString, OUString > aElem
- ( xAttributes->getLocalNameByIndex( i ),
- xAttributes->getValueByIndex( i ) );
-
- if ( aElem.first.getLength() > 0 ) // namespace bits ..
- rProps.push_back( aElem );
- }
-}
-
-bool
-findAndRemove( const char *pAttr, PropList &rProps, OUString &rValue )
-{
- PropList::iterator it;
- OUString aName = OUString::createFromAscii( pAttr );
-
- for ( it = rProps.begin(); it != rProps.end(); ++it )
- {
- if ( it->first.equalsIgnoreAsciiCase( aName )
- || it->first.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM ("_")) + aName ) )
- {
- rValue = it->second;
- rProps.erase( it );
- return true;
- }
- }
- rValue = OUString();
- return false;
-}
-
-long
-getAttributeProps( PropList &rProps )
-{
- long nAttrs = 0;
- OUString aValue;
-
- OUString trueStr( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
-
- if ( findAndRemove( "show", rProps, aValue ) &&
- aValue.equalsIgnoreAsciiCase(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) ) )
- ;
- else
- nAttrs |= awt::WindowAttribute::SHOW;
-
- for ( int i = 0; i < attribsMapLen; i++ )
- {
- if ( findAndRemove( attribsMap[i].name, rProps, aValue ) )
- {
- if ( aValue.equalsIgnoreAsciiCase( trueStr ) )
- nAttrs |= attribsMap[i].value;
- }
- }
-
- if ( findAndRemove( "align", rProps, aValue ) )
- {
- sal_Int32 nVal = aValue.toInt32();
-
- if ( nVal == 0 /* PROPERTY_ALIGN_LEFT */ )
- nAttrs |= awt::VclWindowPeerAttribute::LEFT;
- else if ( nVal == 1 /* PROPERTY_ALIGN_CENTER */ )
- nAttrs |= awt::VclWindowPeerAttribute::CENTER;
- else if ( nVal == 2 )
- nAttrs |= awt::VclWindowPeerAttribute::RIGHT;
- }
-
- return nAttrs;
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/proplist.hxx b/toolkit/source/layout/core/proplist.hxx
deleted file mode 100644
index 20eacbd198..0000000000
--- a/toolkit/source/layout/core/proplist.hxx
+++ /dev/null
@@ -1,94 +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_CORE_PROPLIST_HXX
-#define LAYOUT_CORE_PROPLIST_HXX
-
-#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#include <com/sun/star/xml/input/XAttributes.hpp>
-#include <list>
-#include <rtl/ustring.hxx>
-#include <toolkit/dllapi.h>
-\
-namespace layoutimpl
-{
-
-namespace css = ::com::sun::star;
-
-typedef std::list< std::pair< rtl::OUString, rtl::OUString > > PropList;
-
-void propsFromAttributes( const css::uno::Reference<css::xml::input::XAttributes> & xAttributes,
- PropList &rProps, sal_Int32 nNamespace );
-
-void setProperties( css::uno::Reference< css::uno::XInterface > const& xPeer,
- PropList const& rProps);
-
-void setProperty( css::uno::Reference< css::uno::XInterface > const& xPeer,
- rtl::OUString const& attr, rtl::OUString const& value );
-
-long getAttributeProps( PropList &rProps );
-bool findAndRemove( const char *pAttr, PropList &rProps, rtl::OUString &rValue);
-
-// Helpers - unfortunately VCLXWindows don't implement XPropertySet
-// but containers do - these helpers help us to hide this
-namespace prophlp
-{
-
-// can we set properties on this handle ?
-bool TOOLKIT_DLLPUBLIC canHandleProps( const css::uno::Reference< css::uno::XInterface > &xRef );
-// if so which properties ?
-css::uno::Reference< css::beans::XPropertySetInfo > TOOLKIT_DLLPUBLIC queryPropertyInfo(
- const css::uno::Reference< css::uno::XInterface > &xRef );
-// set / get ...
-void TOOLKIT_DLLPUBLIC setProperty( const css::uno::Reference< css::uno::XInterface > &xRef,
- const rtl::OUString &rName,
- css::uno::Any aValue );
-css::uno::Any TOOLKIT_DLLPUBLIC getProperty( const css::uno::Reference< css::uno::XInterface > &xRef,
- const rtl::OUString &rName );
-} // namespace prophlp
-
-} // namespace layoutimpl
-
-
-#if !OUSTRING_CSTR_PARANOIA
-#define OUSTRING_CSTR( str ) \
- rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr()
-#else
-
-inline char const* OUSTRING_CSTR( rtl::OUString const& str )
-{
- rtl::OString *leak
- = new rtl::OString (rtl::OUStringToOString (str, RTL_TEXTENCODING_ASCII_US));
- return leak->getStr();
-}
-
-#endif
-
-#endif /* LAYOUT_CORE_PROPLIST_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/root.cxx b/toolkit/source/layout/core/root.cxx
deleted file mode 100644
index 16379e41c5..0000000000
--- a/toolkit/source/layout/core/root.cxx
+++ /dev/null
@@ -1,393 +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 "root.hxx"
-
-#include <cassert>
-
-#include <com/sun/star/awt/WindowAttribute.hpp>
-#include <com/sun/star/awt/XMessageBox.hpp>
-#include <com/sun/star/awt/MessageBoxButtons.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <com/sun/star/awt/XMessageBoxFactory.hpp>
-#include <com/sun/star/xml/sax/SAXParseException.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
-
-#include "helper.hxx"
-#include "import.hxx"
-#include "timer.hxx"
-#include "translate.hxx"
-
-namespace layoutimpl
-{
-
-using namespace css;
-using ::rtl::OUString;
-
-LayoutRoot::LayoutRoot( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
- : mbDisposed( sal_False )
- , mxFactory( xFactory )
- , mpListeners( NULL )
- , mpToplevel( NULL )
-{
- if ( !xFactory.is() )
- throw uno::RuntimeException();
- mxLayoutUnit = uno::Reference< awt::XLayoutUnit >( new LayoutUnit() );
-}
-
-LayoutRoot::~LayoutRoot()
-{
-// TODO: we want to delete the top level LayoutWidget...
- ::osl::MutexGuard aGuard( maMutex );
- if ( !mbDisposed )
- {
- try
- {
- m_refCount++; // inhibit multiple destruction
- dispose();
- }
- catch (const uno::Exception&)
- {
- }
- }
-}
-
-void ShowMessageBox( uno::Reference< lang::XMultiServiceFactory > const& xFactory, uno::Reference< awt::XToolkit > xToolkit, OUString const& aTitle, OUString const& aMessage )
-{
- uno::Reference< uno::XInterface > iDesktop = xFactory->createInstance
- ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) );
- uno::Reference< frame::XDesktop > xDesktop ( iDesktop, uno::UNO_QUERY );
- uno::Reference< frame::XFrame > xFrame ( xDesktop->getCurrentFrame() );
- uno::Reference< awt::XWindow > xContainerWindow( xFrame->getContainerWindow() );
- uno::Reference< awt::XWindowPeer > xWindowPeer( xContainerWindow, uno::UNO_QUERY_THROW );
- uno::Reference< awt::XMessageBoxFactory > xMessageBoxFactory( xToolkit, uno::UNO_QUERY );
-
- awt::Rectangle aRectangle;
- uno::Reference< awt::XMessageBox > xMessageBox
- = xMessageBoxFactory->createMessageBox
- ( xWindowPeer, aRectangle, OUString(RTL_CONSTASCII_USTRINGPARAM("errorbox")),
- awt::MessageBoxButtons::BUTTONS_OK, aTitle, aMessage );
-
- if ( xMessageBox.is() )
- xMessageBox->execute();
- //FIXME: exceptions not caught and printed at top level??
- //else
- //printf( "%s\n", OUSTRING_CSTR( aMessage ) );
-}
-
-void LayoutRoot::error( OUString const& message )
-{
- OSL_TRACE( "%s\n", OUSTRING_CSTR( message ) );
- ShowMessageBox( mxFactory, mxToolkit,
- OUString(RTL_CONSTASCII_USTRINGPARAM("Fatal error")),
- message );
- throw uno::RuntimeException( message, uno::Reference< uno::XInterface >() );
-}
-
-// XInitialization
-void SAL_CALL LayoutRoot::initialize( const uno::Sequence< uno::Any >& aArguments )
- throw ( uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( maMutex );
-
- if ( mbDisposed )
- throw lang::DisposedException();
-
- if ( mxContainer.is() ) // only 1 init ...
- throw uno::Exception();
-
- if ( !aArguments.getLength() )
- throw lang::IllegalArgumentException();
-
- OSL_ENSURE( aArguments.getLength() == 1, "Wrong arg count\n" );
-
- OUString aXMLName;
- if ( !( aArguments[0] >>= aXMLName ) )
- throw lang::IllegalArgumentException();
-
- uno::Reference< xml::sax::XParser > xParser
- ( mxFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) ),
- uno::UNO_QUERY );
- OSL_ASSERT( xParser.is() );
- if (! xParser.is())
- {
- throw uno::RuntimeException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("cannot create sax-parser component")),
- uno::Reference< uno::XInterface >() );
- }
-
- // FIXME: quite possibly we want to pass this in ...
- uno::Reference< awt::XToolkit > xToolkit;
-
- mxToolkit = uno::Reference< awt::XToolkit >(
- mxFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")) ),
- uno::UNO_QUERY );
-
- if ( !mxToolkit.is() )
- throw uno::RuntimeException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("failed to create toolkit!")),
- uno::Reference< uno::XInterface >() );
-
- OUString aXMLFile = readRightTranslation( aXMLName );
- uno::Reference< io::XInputStream > xStream = getFileAsStream( aXMLFile );
- if (! xStream.is() )
- error( OUString(RTL_CONSTASCII_USTRINGPARAM("Installation problem: cannot find XML file:")) + aXMLName );
-
- // error handler, entity resolver omitted
-
- ImportContext *pCtx = new ImportContext( *this );
-
- uno::Reference< xml::input::XRoot > xRoot( pCtx );
- uno::Sequence < uno::Any > aArgs( 1 );
- aArgs[0] <<= xRoot;
- uno::Reference< xml::sax::XDocumentHandler > xDocHandler
- (mxFactory->createInstanceWithArguments
- ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.input.SaxDocumentHandler")),
- aArgs ), uno::UNO_QUERY );
-
- if (! xDocHandler.is() )
- error( OUString(RTL_CONSTASCII_USTRINGPARAM("cannot find SAx handler for document type of:")) + aXMLName );
-
- xParser->setDocumentHandler( xDocHandler );
-
- xml::sax::InputSource source;
- source.aInputStream = xStream;
- source.sSystemId = OUString(RTL_CONSTASCII_USTRINGPARAM("virtual file"));
-
- try
- {
- xParser->parseStream( source );
- }
- catch (const xml::sax::SAXParseException& e)
- {
- OUString c(RTL_CONSTASCII_USTRINGPARAM(":"));
- error( aXMLName
- + c + OUString::valueOf( e.LineNumber )
- + c + OUString::valueOf( e.ColumnNumber )
- + c + OUString(RTL_CONSTASCII_USTRINGPARAM("Sax parse error")) );
- }
-}
-
-// XLayoutContainer
-uno::Reference< awt::XLayoutContainer > LayoutRoot::getLayoutContainer() throw (uno::RuntimeException)
-{
- return uno::Reference< awt::XLayoutContainer >();
-}
-
-// local helper ...
-void LayoutRoot::addItem( const OUString &rName,
- const uno::Reference< awt::XLayoutConstrains > &xRef )
-{
- maItems[ rName ] = xRef;
-}
-
-// XNameAccess
-uno::Any SAL_CALL LayoutRoot::getByName( const OUString &rName )
- throw ( container::NoSuchElementException,
- lang::WrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( maMutex );
- if ( mbDisposed )
- throw lang::DisposedException();
-
- uno::Reference< awt::XLayoutConstrains > xItem;
- ItemHash::iterator i = maItems.find( rName );
- if ( i != maItems.end() )
- xItem = i->second;
- return uno::makeAny( xItem );
-}
-
-sal_Bool SAL_CALL LayoutRoot::hasByName( const OUString &rName )
- throw (uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( maMutex );
- if ( mbDisposed ) throw lang::DisposedException();
-
- ItemHash::iterator i = maItems.find( rName );
- return i != maItems.end();
-}
-
-uno::Sequence< OUString > SAL_CALL LayoutRoot::getElementNames()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( maMutex );
- if ( mbDisposed ) throw lang::DisposedException();
-
- uno::Sequence< OUString > aNames( maItems.size() );
- sal_Int32 nPos = 0;
-
- for ( ItemHash::const_iterator it = maItems.begin();
- it != maItems.end(); ++it )
- aNames[ nPos++ ] = it->first;
-
- return aNames;
-}
-
-uno::Type SAL_CALL LayoutRoot::getElementType()
- throw ( uno::RuntimeException )
-{
- return getCppuType( ( const uno::Reference< awt::XLayoutConstrains >* )NULL );
-}
-
-sal_Bool SAL_CALL LayoutRoot::hasElements()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( maMutex );
-
- if ( mbDisposed ) throw lang::DisposedException();
-
- return maItems.size() > 0;
-}
-
-// XComponent
-void SAL_CALL LayoutRoot::dispose()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( maMutex );
-
- if ( mbDisposed ) throw lang::DisposedException();
-
- if ( mpListeners )
- {
-
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) );
- mpListeners->disposeAndClear( aSource );
- delete mpListeners;
- mpListeners = NULL;
- }
-
- maItems.clear();
- mbDisposed = sal_True;
-}
-
-void SAL_CALL LayoutRoot::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( maMutex );
-
- if ( mbDisposed ) throw lang::DisposedException();
-
- if ( !mpListeners )
- mpListeners = new ::cppu::OInterfaceContainerHelper( maMutex );
- mpListeners->addInterface( xListener );
-}
-
-void SAL_CALL LayoutRoot::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( maMutex );
-
- if ( mbDisposed ) throw lang::DisposedException();
-
- if ( mpListeners )
- mpListeners->removeInterface( xListener );
-}
-
-// builder
-
-LayoutWidget *LayoutRoot::create( OUString id, const OUString unoName, long attrbs,uno::Reference< awt::XLayoutContainer > xParent )
-{
- LayoutWidget *pWidget = new LayoutWidget( mxToolkit, xParent, unoName, attrbs );
- if ( !mpToplevel )
- {
- mpToplevel = pWidget;
- mxWindow = uno::Reference< awt::XWindow >( pWidget->getPeer(), uno::UNO_QUERY );
- mxContainer = pWidget->mxContainer;
- }
- if ( pWidget->mxContainer.is() )
- pWidget->mxContainer->setLayoutUnit( mxLayoutUnit );
- if ( id.getLength() )
- maItems[ id ] = pWidget->getPeer();
- return pWidget;
-}
-
-LayoutWidget::LayoutWidget( uno::Reference< awt::XToolkit > xToolkit,
- uno::Reference< awt::XLayoutContainer > xParent,
- OUString unoName, long attrbs )
-{
- while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() )
- {
- uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY );
- assert( xContainer.is() );
- xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY );
- }
-
- mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, attrbs );
- assert( mxWidget.is() );
- mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY );
-}
-
-LayoutWidget::~LayoutWidget()
-{
- /* should we dispose of the references...? */
- // at least of its children... Or should root?
-}
-
-bool LayoutWidget::addChild( LayoutWidget *pChild )
-{
- if ( !mxContainer.is() )
- return false;
-
- try
- {
- mxContainer->addChild( pChild->mxWidget );
- }
- catch (const awt::MaxChildrenException&)
- {
- return false;
- }
- return true;
-}
-
-void LayoutWidget::setProperties( PropList const& rProps )
-{
- ::layoutimpl::setProperties( mxWidget, rProps );
-}
-
-void LayoutWidget::setProperty( OUString const& attr, OUString const& value )
-{
- ::layoutimpl::setProperty( mxWidget, attr, value );
-}
-
-void LayoutWidget::setChildProperties( LayoutWidget *pChild,
- PropList const& rProps )
-{
- uno::Reference< beans::XPropertySet > xChildPeer;
- xChildPeer = mxContainer->getChildProperties( pChild->mxWidget );
-
- if ( xChildPeer.is() )
- ::layoutimpl::setProperties( xChildPeer, rProps );
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/root.hxx b/toolkit/source/layout/core/root.hxx
deleted file mode 100644
index 1b566778b0..0000000000
--- a/toolkit/source/layout/core/root.hxx
+++ /dev/null
@@ -1,159 +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_CORE_ROOT_HXX
-#define LAYOUT_CORE_ROOT_HXX
-
-#define _BACKWARD_BACKWARD_WARNING_H 1
-#include <boost/unordered_map.hpp>
-
-#include <com/sun/star/awt/XLayoutRoot.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/interfacecontainer.h>
-#include <toolkit/dllapi.h>
-
-#include <layout/core/proplist.hxx>
-
-namespace layoutimpl
-{
-
-namespace css = ::com::sun::star;
-
-css::uno::Reference< css::io::XInputStream > getFileAsStream( const rtl::OUString &rName );
-
-/* Interface generation code -- to hook to a parser. */
-
-/*
- TODO: (ricardo) I think we should cut on LayoutRoot, stripping out its widget
- proxy interface (just make it return the root widget). Would even make it easier
- if there was interest to support multiple toplevel widgets in the same file.
-
- We also need to make sure the code gets diposed well... There is no need to keep
- these objects around after initialization...
-*/
-
-
-class LayoutWidget;
-
-class TOOLKIT_DLLPUBLIC LayoutRoot : public ::cppu::WeakImplHelper3<
- css::awt::XLayoutRoot,
- css::lang::XInitialization,
- css::lang::XComponent>
-{
-protected:
- ::osl::Mutex maMutex;
-
- typedef boost::unordered_map< rtl::OUString,
- css::uno::Reference< css::awt::XLayoutConstrains >,
- ::rtl::OUStringHash > ItemHash;
- ItemHash maItems;
-
- sal_Bool mbDisposed;
- css::uno::Reference< css::lang::XMultiServiceFactory > mxFactory;
- ::cppu::OInterfaceContainerHelper *mpListeners;
-
- css::uno::Reference< css::awt::XWindow > mxWindow;
- css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
-
- css::uno::Reference< css::awt::XToolkit > mxToolkit;
- LayoutWidget *mpToplevel;
- css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit;
-
- void error( rtl::OUString const& message );
-
-public:
- LayoutRoot( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
- virtual ~LayoutRoot();
-
- void addItem( const rtl::OUString &rName,
- const css::uno::Reference< css::awt::XLayoutConstrains > &xRef );
-
- void setWindow( css::uno::Reference< css::awt::XLayoutConstrains > xPeer )
- {
- mxWindow = css::uno::Reference< css::awt::XWindow >( xPeer, css::uno::UNO_QUERY );
- }
-
- // get XLayoutContainer
- virtual css::uno::Reference< css::awt::XLayoutContainer > SAL_CALL getLayoutContainer() throw (css::uno::RuntimeException);
-
- // XInitialization
- virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException);
-
- // XNameAccess
- virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException);
-
- // XComponent
- virtual void SAL_CALL dispose() throw (css::uno::RuntimeException);
- virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException);
-
- // generator
- virtual LayoutWidget *create( rtl::OUString id, const rtl::OUString unoName, long attrbs, css::uno::Reference< css::awt::XLayoutContainer > xParent );
-};
-
-class TOOLKIT_DLLPUBLIC LayoutWidget
-{
- friend class LayoutRoot;
-
-public:
- LayoutWidget() {}
- LayoutWidget( css::uno::Reference< css::awt::XToolkit > xToolkit,
- css::uno::Reference< css::awt::XLayoutContainer > xToplevel,
- rtl::OUString unoName, long attrbs );
- virtual ~LayoutWidget();
-
- virtual void setProperties( const PropList &rProps );
- virtual void setProperty( rtl::OUString const& attr, rtl::OUString const& value );
-
- virtual bool addChild( LayoutWidget *pChild );
- virtual void setChildProperties( LayoutWidget *pChild, const PropList &rProps );
-
- inline css::uno::Reference< css::awt::XLayoutConstrains > getPeer()
- { return mxWidget; }
- inline css::uno::Reference< css::awt::XLayoutContainer > getContainer()
- { return mxContainer; }
-
-protected:
- css::uno::Reference< css::awt::XLayoutConstrains > mxWidget;
- css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
-};
-
-} // namespace layoutimpl
-
-#endif /* LAYOUT_CORE_ROOT_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/table.cxx b/toolkit/source/layout/core/table.cxx
deleted file mode 100644
index c8258b8552..0000000000
--- a/toolkit/source/layout/core/table.cxx
+++ /dev/null
@@ -1,314 +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 <table.hxx>
-
-#include <sal/macros.h>
-#include <osl/mutex.hxx>
-#include <cppuhelper/propshlp.hxx>
-#include <cppuhelper/interfacecontainer.h>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <tools/debug.hxx>
-
-// fixed point precision for distributing error
-#define FIXED_PT 16
-
-namespace layoutimpl
-{
-
-using namespace com::sun::star;
-
-Table::ChildProps::ChildProps( Table::ChildData *pData )
-{
- addProp( RTL_CONSTASCII_USTRINGPARAM( "XExpand" ),
- ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
- &( pData->mbExpand[ 0 ] ) );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "YExpand" ),
- ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
- &( pData->mbExpand[ 1 ] ) );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "ColSpan" ),
- ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
- &( pData->mnColSpan ) );
- addProp( RTL_CONSTASCII_USTRINGPARAM( "RowSpan" ),
- ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
- &( pData->mnRowSpan ) );
-}
-
-bool Table::ChildData::isVisible()
-{
- return Box_Base::ChildData::isVisible()
- && ( mnColSpan > 0 ) && ( mnRowSpan > 0 );
-}
-
-Table::Table()
- : Box_Base()
- , mnColsLen( 1 )// another default value could be 0xffff for infinite columns( = 1 row )
-{
- addProp( RTL_CONSTASCII_USTRINGPARAM( "Columns" ),
- ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
- &mnColsLen );
-}
-
-Table::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
- : Box_Base::ChildData( xChild )
-// , mbExpand( { 1, 1 } )
- , mnColSpan( 1 )
- , mnRowSpan( 1 )
- , mnLeftCol( 0 )
- , mnRightCol( 0 )
- , mnTopRow( 0 )
- , mnBottomRow( 0 )
-{
- mbExpand[ 0 ] = 1;
- mbExpand[ 1 ] = 1;
-}
-
-Table::ChildData*
-Table::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
-{
- return new ChildData( xChild );
-}
-
-Table::ChildProps*
-Table::createChildProps( Box_Base::ChildData *pData )
-{
- return new ChildProps( static_cast<Table::ChildData*> ( pData ) );
-}
-
-void SAL_CALL
-Table::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
- throw( uno::RuntimeException, awt::MaxChildrenException )
-{
- if ( xChild.is() )
- {
- Box_Base::addChild( xChild );
- // cause of flicker
- allocateChildAt( xChild, awt::Rectangle( 0,0,0,0 ) );
- }
-}
-
-awt::Size SAL_CALL
-Table::getMinimumSize() throw( uno::RuntimeException )
-{
- int nRowsLen = 0;
-
- // 1. layout the table -- adjust to cope with row-spans...
- {
- // temporary 1D representation of the table
- std::vector< ChildData *> aTable;
-
- int col = 0;
- int row = 0;
- for ( std::list<Box_Base::ChildData *>::iterator it
- = maChildren.begin(); it != maChildren.end(); ++it )
- {
- ChildData *child = static_cast<Table::ChildData*> ( *it );
- if ( !child->isVisible() )
- continue;
-
- while ( col + SAL_MIN( child->mnColSpan, mnColsLen ) > mnColsLen )
- {
- col = 0;
- row++;
-
- unsigned int i = col +( row*mnColsLen );
- while ( aTable.size() > i && !aTable[ i ] )
- i++;
-
- col = i % mnColsLen;
- row = i / mnColsLen;
- }
-
- child->mnLeftCol = col;
- child->mnRightCol = SAL_MIN( col + child->mnColSpan, mnColsLen );
- child->mnTopRow = row;
- child->mnBottomRow = row + child->mnRowSpan;
-
- col += child->mnColSpan;
-
- unsigned int start = child->mnLeftCol +( child->mnTopRow*mnColsLen );
- unsigned int end =( child->mnRightCol-1 ) +( ( child->mnBottomRow-1 )*mnColsLen );
- if ( aTable.size() < end+1 )
- aTable.resize( end+1, NULL );
- for ( unsigned int i = start; i < end; i++ )
- aTable[ i ] = child;
-
- nRowsLen = SAL_MAX( nRowsLen, child->mnBottomRow );
- }
- }
-
- // 2. calculate columns/rows sizes
- for ( int g = 0; g < 2; g++ )
- {
- std::vector< GroupData > &aGroup = g == 0 ? maCols : maRows;
-
- aGroup.clear();
- aGroup.resize( g == 0 ? mnColsLen : nRowsLen );
-
- // 2.1 base sizes on one-column/row children
- for ( std::list<Box_Base::ChildData *>::iterator it
- = maChildren.begin(); it != maChildren.end(); ++it )
- {
- ChildData *child = static_cast<Table::ChildData*> ( *it );
- if ( !child->isVisible() )
- continue;
- const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
- const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
-
- if ( nFirstAttach == nLastAttach-1 )
- {
- child->maRequisition = child->mxChild->getMinimumSize();
- int attach = nFirstAttach;
- int child_size = g == 0 ? child->maRequisition.Width
- : child->maRequisition.Height;
- aGroup[ attach ].mnSize = SAL_MAX( aGroup[ attach ].mnSize,
- child_size );
- if ( child->mbExpand[ g ] )
- aGroup[ attach ].mbExpand = true;
- }
- }
-
- // 2.2 make sure multiple-columns/rows children fit
- for ( std::list<Box_Base::ChildData *>::iterator it
- = maChildren.begin(); it != maChildren.end(); ++it )
- {
- ChildData *child = static_cast<Table::ChildData*> ( *it );
- if ( !child->isVisible() )
- continue;
- const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
- const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
-
- if ( nFirstAttach != nLastAttach-1 )
- {
- child->maRequisition = child->mxChild->getMinimumSize();
- int size = 0;
- int expandables = 0;
- for ( int i = nFirstAttach; i < nLastAttach; i++ )
- {
- size += aGroup[ i ].mnSize;
- if ( aGroup[ i ].mbExpand )
- expandables++;
- }
-
- int child_size = g == 0 ? child->maRequisition.Width
- : child->maRequisition.Height;
- int extra = child_size - size;
- if ( extra > 0 )
- {
- if ( expandables )
- extra /= expandables;
- else
- extra /= nLastAttach - nFirstAttach;
-
- for ( int i = nFirstAttach; i < nLastAttach; i++ )
- if ( expandables == 0 || aGroup[ i ].mbExpand )
- aGroup[ i ].mnSize += extra;
- }
- }
- }
- }
-
- // 3. Sum everything up
- mnColExpandables =( mnRowExpandables = 0 );
- maRequisition.Width =( maRequisition.Height = 0 );
- for ( std::vector<GroupData>::iterator it = maCols.begin();
- it != maCols.end(); ++it )
- {
- maRequisition.Width += it->mnSize;
- if ( it->mbExpand )
- mnColExpandables++;
- }
- for ( std::vector<GroupData>::iterator it = maRows.begin();
- it != maRows.end(); ++it )
- {
- maRequisition.Height += it->mnSize;
- if ( it->mbExpand )
- mnRowExpandables++;
- }
-
- return maRequisition;
-}
-
-void SAL_CALL
-Table::allocateArea( const awt::Rectangle &rArea )
- throw( uno::RuntimeException )
-{
- maAllocation = rArea;
- if ( maCols.size() == 0 || maRows.size() == 0 )
- return;
-
- int nExtraSize[ 2 ] = { SAL_MAX( rArea.Width - maRequisition.Width, 0 ),
- SAL_MAX( rArea.Height - maRequisition.Height, 0 ) };
- // split it
- nExtraSize[ 0 ] /= mnColExpandables ? mnColExpandables : mnColsLen;
- nExtraSize[ 1 ] /= mnRowExpandables ? mnRowExpandables : maRows.size();
-
- for ( std::list<Box_Base::ChildData *>::const_iterator it
- = maChildren.begin(); it != maChildren.end(); ++it )
- {
- ChildData *child = static_cast<Table::ChildData*> ( *it );
- if ( !child->isVisible() )
- continue;
-
- awt::Rectangle rChildArea( rArea.X, rArea.Y, 0, 0 );
-
- for ( int g = 0; g < 2; g++ )
- {
- std::vector< GroupData > &aGroup = g == 0 ? maCols : maRows;
- const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
- const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
-
- for ( int i = 0; i < nFirstAttach; i++ )
- {
- int gSize = aGroup[ i ].mnSize;
- if ( aGroup[ i ].mbExpand )
- gSize += nExtraSize[ g ];
- if ( g == 0 )
- rChildArea.X += gSize;
- else
- rChildArea.Y += gSize;
- }
- for ( int i = nFirstAttach; i < nLastAttach; i++ )
- {
- int gSize = aGroup[ i ].mnSize;
- if ( aGroup[ i ].mbExpand )
- gSize += nExtraSize[ g ];
- if ( g == 0 )
- rChildArea.Width += gSize;
- else
- rChildArea.Height += gSize;
- }
- }
-
- allocateChildAt( child->mxChild, rChildArea );
- }
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/table.hxx b/toolkit/source/layout/core/table.hxx
deleted file mode 100644
index 5fa20d2412..0000000000
--- a/toolkit/source/layout/core/table.hxx
+++ /dev/null
@@ -1,105 +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_CORE_TABLE_HXX
-#define LAYOUT_CORE_TABLE_HXX
-
-#include <layout/core/box-base.hxx>
-
-namespace layoutimpl
-{
-
-class Table : public Box_Base
-{
-public:
- // Children properties
- struct ChildData : public Box_Base::ChildData
- {
- sal_Bool mbExpand[ 2 ];
- sal_Int32 mnColSpan;
- sal_Int32 mnRowSpan;
- int mnLeftCol;
- int mnRightCol;
- int mnTopRow;
- int mnBottomRow;
-
- ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
- bool isVisible();
- };
-
- struct ChildProps : public Box_Base::ChildProps
- {
- ChildProps( ChildData *pData );
- };
-
-protected:
-
- // a group of children; either a column or a row
- struct GroupData
- {
- sal_Bool mbExpand;
- int mnSize; // request size (width or height)
- GroupData() : mbExpand( false ), mnSize( 0 ) {}
- };
-
- // Table properties
- sal_Int32 mnColsLen;
- std::vector< GroupData > maCols;
- std::vector< GroupData > maRows;
- int mnColExpandables, mnRowExpandables;
-
- ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
- ChildProps *createChildProps( Box_Base::ChildData* pData );
-
-public:
- Table();
-
- // css::awt::XLayoutContainer
- virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
- throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
-
- virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
- throw (css::uno::RuntimeException);
-
- virtual css::awt::Size SAL_CALL getMinimumSize()
- throw(css::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; }
-};
-
-} // namespace layoutimpl
-
-#endif /* LAYOUT_CORE_TABLE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/timer.cxx b/toolkit/source/layout/core/timer.cxx
deleted file mode 100644
index da95988d8b..0000000000
--- a/toolkit/source/layout/core/timer.cxx
+++ /dev/null
@@ -1,151 +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 "timer.hxx"
-
-#include <vector>
-#include <list>
-#include <vcl/timer.hxx>
-#include <com/sun/star/awt/XLayoutContainer.hpp>
-
-namespace layoutimpl
-{
-using namespace ::com::sun::star;
-
-class AllocateTimer : public Timer
-{
- typedef std::list< uno::Reference< awt::XLayoutContainer > > ContainerList;
- ContainerList mxContainers;
- uno::Reference< awt::XLayoutContainer > mxLastAdded;
-
-public:
- AllocateTimer()
- {
- // timer set to 0 -- just process it as soon as it gets idle
- SetTimeout( 0 );
- }
-
- static inline bool isParentOf( uno::Reference< awt::XLayoutContainer > xParent,
- uno::Reference< awt::XLayoutContainer > xWidget )
- {
- while ( xWidget.is() )
- {
- if ( xWidget == xParent )
- return true;
- xWidget = uno::Reference< awt::XLayoutContainer >( xWidget->getParent(), uno::UNO_QUERY );
- }
- return false;
- }
-
- static inline void eraseChildren( ContainerList::iterator &it, ContainerList &list )
- {
- ContainerList::iterator jt = list.begin();
- while ( jt != list.end() )
- {
- if ( it != jt && isParentOf( *it, *jt ) )
- jt = list.erase( jt );
- else
- ++jt;
- }
- }
-
- static inline bool isContainerDamaged( uno::Reference< awt::XLayoutContainer > xContainer )
- {
- uno::Reference< awt::XLayoutConstrains > xConstrains( xContainer, uno::UNO_QUERY );
- awt::Size lastReq( xContainer->getRequestedSize() );
- awt::Size curReq( xConstrains->getMinimumSize() );
- return lastReq.Width != curReq.Width || lastReq.Height != curReq.Height;
- }
-
- void add( const uno::Reference< awt::XLayoutContainer > &xContainer )
- {
- // small optimization
- if ( mxLastAdded == xContainer )
- return;
- mxLastAdded = xContainer;
-
- mxContainers.push_back( xContainer );
- }
-
- virtual void Timeout()
- {
- mxLastAdded = uno::Reference< awt::XLayoutContainer >();
-
- // 1. remove duplications and children
- for ( ContainerList::iterator it = mxContainers.begin();
- it != mxContainers.end(); ++it )
- eraseChildren( it, mxContainers );
-
- // 2. check damage extent
- for ( ContainerList::iterator it = mxContainers.begin();
- it != mxContainers.end(); ++it )
- {
- uno::Reference< awt::XLayoutContainer > xContainer = *it;
- while ( xContainer->getParent().is() && isContainerDamaged( xContainer ) )
- {
- xContainer = uno::Reference< awt::XLayoutContainer >(
- xContainer->getParent(), uno::UNO_QUERY );
- }
-
- if ( *it != xContainer )
- {
- // 2.2 replace it with parent
- *it = xContainer;
-
- // 2.3 remove children of new parent
- eraseChildren( it, mxContainers );
- }
- }
-
- // 3. force re-calculations
- for ( ContainerList::iterator it = mxContainers.begin();
- it != mxContainers.end(); ++it )
- (*it)->allocateArea( (*it)->getAllocatedArea() );
- }
-};
-
-static void AddResizeTimeout( const uno::Reference< awt::XLayoutContainer > &xCont )
-{
- static AllocateTimer timer;
- timer.add( xCont );
- timer.Start();
-}
-
-LayoutUnit::LayoutUnit() : LayoutUnit_Base()
-{
-}
-
-void SAL_CALL LayoutUnit::queueResize( const uno::Reference< awt::XLayoutContainer > &xContainer )
- throw( uno::RuntimeException )
-{
- AddResizeTimeout( xContainer );
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/timer.hxx b/toolkit/source/layout/core/timer.hxx
deleted file mode 100644
index 5c64089855..0000000000
--- a/toolkit/source/layout/core/timer.hxx
+++ /dev/null
@@ -1,52 +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_CORE_TIMER_HXX
-#define LAYOUT_CORE_TIMER_HXX
-
-#include <com/sun/star/awt/XLayoutUnit.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-namespace layoutimpl
-{
-
-typedef ::cppu::WeakImplHelper1< com::sun::star::awt::XLayoutUnit > LayoutUnit_Base;
-
-class LayoutUnit : public LayoutUnit_Base
-{
-public:
- LayoutUnit();
- void SAL_CALL queueResize( const com::sun::star::uno::Reference< com::sun::star::awt::XLayoutContainer > &xContainer )
- throw( com::sun::star::uno::RuntimeException );
-};
-
-}
-
-#endif /* LAYOUT_CORE_TIMER_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/translate.cxx b/toolkit/source/layout/core/translate.cxx
deleted file mode 100644
index def1c10f1e..0000000000
--- a/toolkit/source/layout/core/translate.cxx
+++ /dev/null
@@ -1,133 +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 "translate.hxx"
-
-#include <list>
-#if TEST_LAYOUT
-#include <cstdio>
-#include "tools/getprocessworkingdir.hxx"
-#endif
-
-#include <unotools/bootstrap.hxx>
-#include <unotools/localfilehelper.hxx>
-#include <unotools/ucbhelper.hxx>
-#include <vcl/svapp.hxx>
-
-#include "proplist.hxx"
-
-namespace layoutimpl
-{
-namespace css = ::com::sun::star;
-using namespace css;
-using ::rtl::OUString;
-using ::utl::LocalFileHelper;
-using ::utl::UCBContentHelper;
-using ::utl::Bootstrap;
-
-static std::list<OUString>
-getLocaleSubdirList( lang::Locale const& rLocale )
-{
- std::list<OUString> aSubdirs;
- aSubdirs.push_front( OUString(RTL_CONSTASCII_USTRINGPARAM(".")) );
- aSubdirs.push_front( OUString(RTL_CONSTASCII_USTRINGPARAM("en-US")) );
- if ( rLocale.Language.getLength() )
- aSubdirs.push_front( rLocale.Language );
- if ( rLocale.Country.getLength() )
- {
- OUString aLocaleCountry = rLocale.Language
- + OUString(RTL_CONSTASCII_USTRINGPARAM("-"))
- + rLocale.Country;
- aSubdirs.push_front( aLocaleCountry );
- if ( rLocale.Variant.getLength() )
- aSubdirs.push_front( aLocaleCountry
- + OUString(RTL_CONSTASCII_USTRINGPARAM("."))
- + rLocale.Variant );
- }
- return aSubdirs;
-}
-
-static bool
-fileExists( String const& aFile )
-{
- String aUrl;
- LocalFileHelper::ConvertPhysicalNameToURL( aFile, aUrl );
- return UCBContentHelper::Exists( aUrl );
-}
-
-static OUString
-getFirstExisting( OUString const& aDir, std::list<OUString> const& aSubDirs,
- OUString const& aXMLName )
-{
- static OUString const aSlash(RTL_CONSTASCII_USTRINGPARAM("/"));
- String aResult;
- for ( std::list<OUString>::const_iterator i = aSubDirs.begin();
- i != aSubDirs.end(); ++i )
- {
- String aFile = aDir + aSlash + *i + aSlash + aXMLName;
- OSL_TRACE( "testing: %s", OUSTRING_CSTR( aFile ) );
- if ( fileExists( aFile ) )
- return aFile;
- }
- return OUString();
-}
-
-/* FIXME: IWBN to share code with impimagetree.cxx, also for reading
- from zip files. */
-OUString
-readRightTranslation( OUString const& aXMLName )
-{
- String aXMLFile;
- std::list<OUString> aSubdirs
- = getLocaleSubdirList( Application::GetSettings().GetUILocale() );
-#if TEST_LAYOUT // read from cwd first
- OUString aCurrentWorkingUrl;
- tools::getProcessWorkingDir( aCurrentWorkingUrl );
- String aCurrentWorkingDir;
- LocalFileHelper::ConvertURLToPhysicalName( aCurrentWorkingUrl, aCurrentWorkingDir );
- aXMLFile = getFirstExisting( aCurrentWorkingDir, aSubdirs, aXMLName );
- if ( aXMLFile.Len() )
- ;
- else
-#endif /* TEST_LAYOUT */
- {
- OUString aShareUrl;
- Bootstrap::locateSharedData( aShareUrl );
- OUString aXMLUrl = aShareUrl + OUString(RTL_CONSTASCII_USTRINGPARAM("/layout"));
- String aXMLDir;
- LocalFileHelper::ConvertURLToPhysicalName( aXMLUrl, aXMLDir );
- aXMLFile = getFirstExisting( aXMLDir, aSubdirs, aXMLName );
- }
-
- OSL_TRACE( "FOUND:%s", OUSTRING_CSTR ( OUString (aXMLFile) ) );
- return aXMLFile;
-}
-
-} // namespace layoutimpl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/translate.hxx b/toolkit/source/layout/core/translate.hxx
deleted file mode 100644
index 251958ff92..0000000000
--- a/toolkit/source/layout/core/translate.hxx
+++ /dev/null
@@ -1,43 +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_CORE_TRANSLATE_HXX
-#define LAYOUT_CORE_TRANSLATE_HXX
-
-namespace rtl {
-class OUString;
-} // namespace rtl
-
-namespace layoutimpl
-{
-::rtl::OUString readRightTranslation( ::rtl::OUString const& aXMLName );
-} // namespace layoutimpl
-
-#endif /* LAYOUT_CORE_TRANSLATE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/vcl.cxx b/toolkit/source/layout/core/vcl.cxx
deleted file mode 100644
index 7caf231fa6..0000000000
--- a/toolkit/source/layout/core/vcl.cxx
+++ /dev/null
@@ -1,69 +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 <vcl.hxx>
-
-#include <sal/types.h>
-#include <vcl/button.hxx>
-
-static PushButton* get_button (Dialog const* dialog, sal_uInt32 type)
-{
- Window* child = dialog->GetWindow (WINDOW_FIRSTCHILD);
- while (child)
- {
- if (child->GetType () == type)
- return static_cast <PushButton*> (child);
- child = child->GetWindow (WINDOW_NEXT);
- }
-
- return 0;
-}
-
-#define IMPLEMENT_CLOSING_DIALOG(cls)\
- Closing##cls::Closing##cls (Window* parent, WinBits bits)\
- : cls (parent, bits)\
- , mClosing (false)\
- {\
- }\
- sal_Bool Closing##cls::Close ()\
- {\
- if (mClosing)\
- EndDialog (false);\
- else if (PushButton *cancel = get_button (this, WINDOW_CANCELBUTTON))\
- cancel->Click ();\
- else if (PushButton *ok = get_button (this, WINDOW_OKBUTTON))\
- ok->Click ();\
- mClosing = true;\
- return false;\
- }
-
-IMPLEMENT_CLOSING_DIALOG (Dialog);
-IMPLEMENT_CLOSING_DIALOG (ModelessDialog);
-IMPLEMENT_CLOSING_DIALOG (ModalDialog);
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/core/vcl.hxx b/toolkit/source/layout/core/vcl.hxx
deleted file mode 100644
index 7422b767de..0000000000
--- a/toolkit/source/layout/core/vcl.hxx
+++ /dev/null
@@ -1,51 +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_CORE_VCL_HXX
-#define LAYOUT_CORE_VCL_HXX
-
-#include <vcl/dialog.hxx>
-
-#define DECLARE_CLOSING_DIALOG(cls)\
- class Closing##cls : public cls\
- {\
- public:\
- bool mClosing;\
- Closing##cls (Window* parent, WinBits bits);\
- virtual sal_Bool Close ();\
- }
-
-DECLARE_CLOSING_DIALOG (Dialog);
-DECLARE_CLOSING_DIALOG (ModalDialog);
-DECLARE_CLOSING_DIALOG (ModelessDialog);
-
-#undef DECLARE_CLOSING_DIALOG
-
-#endif /* LAYOUT_CORE_VCL_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/vcl/wbutton.cxx b/toolkit/source/layout/vcl/wbutton.cxx
deleted file mode 100644
index 96e6aeb5d2..0000000000
--- a/toolkit/source/layout/vcl/wbutton.cxx
+++ /dev/null
@@ -1,680 +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 "wrapper.hxx"
-
-#include <com/sun/star/awt/PosSize.hpp>
-#include <com/sun/star/awt/XActionListener.hpp>
-#include <com/sun/star/awt/XButton.hpp>
-#include <com/sun/star/awt/XCheckBox.hpp>
-#include <com/sun/star/awt/XRadioButton.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <toolkit/awt/vclxwindows.hxx>
-#include <toolkit/helper/convert.hxx>
-#include <vcl/button.hxx>
-#include <vcl/event.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/window.hxx>
-
-#include <list>
-
-#include <layout/core/helper.hxx>
-
-using namespace ::com::sun::star;
-
-using rtl::OUString;
-
-namespace layout
-{
-
-class ImageImpl
-{
- public:
- uno::Reference< graphic::XGraphic > mxGraphic;
- ImageImpl( const char *pName )
- : mxGraphic( layoutimpl::loadGraphic( pName ) )
- {
- if ( !mxGraphic.is() )
- {
- OSL_TRACE( "ERROR: failed to load image: `%s'\n", pName );
- }
- }
-};
-
-Image::Image( const char *pName )
- : pImpl( new ImageImpl( pName ) )
-{
-}
-
-Image::~Image()
-{
- delete pImpl;
-}
-
-class ButtonImpl : public ControlImpl
- , public ::cppu::WeakImplHelper1< awt::XActionListener >
-{
- Link maClickHdl;
-
-public:
- uno::Reference< awt::XButton > mxButton;
- ButtonImpl( Context *context, const PeerHandle &peer, Window *window )
- : ControlImpl( context, peer, window )
- , mxButton( peer, uno::UNO_QUERY )
- {
- /* We have default action when clicked, always listen. */
- mxButton->addActionListener( this );
- }
-
- ~ButtonImpl()
- {
- }
-
- virtual void Click() { /* make me pure virtual? */ };
-
- Link& GetClickHdl ()
- {
- return maClickHdl;
- }
-
- virtual void SetClickHdl( Link const& link )
- {
- maClickHdl = link;
- }
-
- void SAL_CALL disposing( lang::EventObject const& e )
- throw (uno::RuntimeException)
- {
- mxButton->removeActionListener( this );
- ControlImpl::disposing (e);
- mxButton.clear ();
- }
-
- virtual void SAL_CALL actionPerformed( const awt::ActionEvent& )
- throw (uno::RuntimeException)
- {
- if ( !maClickHdl )
- Click();
- else
- maClickHdl.Call( static_cast<Window *>( mpWindow ) );
- }
-
- bool SetModeImage( uno::Reference< graphic::XGraphic > xGraph )
- {
- setProperty( "Graphic", uno::Any( xGraph ) );
- return true;
- }
-};
-
-Button::~Button ()
-{
-}
-
-String Button::GetStandardText (sal_uInt16 button_type)
-{
- return ::Button::GetStandardText (button_type);
-}
-
-void Button::SetText( OUString const& rStr )
-{
- if ( !getImpl().mxButton.is() )
- return;
- getImpl().mxButton->setLabel( rStr );
-}
-
-void Button::SetClickHdl( const Link& link )
-{
- if (&getImpl () && getImpl().mxButton.is ())
- getImpl().SetClickHdl( link );
-}
-
-Link& Button::GetClickHdl ()
-{
- return getImpl().GetClickHdl ();
-}
-
-bool Button::SetModeImage (Image const& image)
-{
- return getImpl().SetModeImage (image.getImpl().mxGraphic);
-}
-
-bool Button::SetModeImage (::Image const& image)
-{
- return GetButton ()->SetModeImage (image);
-}
-
-void Button::SetImageAlign( ImageAlign eAlign )
-{
- getImpl().setProperty( "ImageAlign", uno::Any( (sal_Int16) eAlign ) );
-}
-
-void Button::Click()
-{
-}
-
-IMPL_GET_IMPL( Button );
-IMPL_CONSTRUCTORS( Button, Control, "button" );
-IMPL_GET_WINDOW (Button);
-
-class PushButtonImpl : public ButtonImpl
- , public ::cppu::WeakImplHelper1< awt::XItemListener >
-{
- Link maToggleHdl;
-public:
- PushButtonImpl( Context *context, const PeerHandle &peer, Window *window )
- : ButtonImpl( context, peer, window )
- {
- }
-
- void SetToggleHdl( const Link& link )
- {
- // XButton doesn't have an explicit event for Toggle. Anyway, it is a
- // superset of the clicks: all clicks, and explicit toggles
- if (!link && !!maToggleHdl)
- mxButton->removeActionListener( this );
- else if (!!link && !maToggleHdl)
- mxButton->addActionListener( this );
- maToggleHdl = link;
- }
- void SAL_CALL disposing( lang::EventObject const& e )
- throw (uno::RuntimeException)
- {
- ButtonImpl::disposing (e);
- }
- virtual void SAL_CALL actionPerformed( awt::ActionEvent const& e )
- throw (uno::RuntimeException)
- {
- ButtonImpl::actionPerformed( e );
- fireToggle();
- }
- virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
- throw (uno::RuntimeException)
- {
- maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
- }
- void fireToggle()
- {
- maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
- }
-
-};
-
-PushButton::~PushButton ()
-{
- SetToggleHdl (Link ());
-}
-
-void PushButton::Check( bool bCheck )
-{
- getImpl().setProperty( "State", uno::Any( (sal_Int16) !!bCheck ) );
- // XButton doesn't have explicit toggle event
- getImpl().fireToggle();
-}
-
-bool PushButton::IsChecked() const
-{
- return !!( getImpl().getProperty( "State" ).get< sal_Int16 >() );
-}
-
-void PushButton::Toggle()
-{
- Check( true );
-}
-
-void PushButton::SetToggleHdl( const Link& link )
-{
- if (&getImpl () && getImpl().mxButton.is ())
- getImpl().SetToggleHdl( link );
-}
-
-IMPL_GET_IMPL( PushButton );
-IMPL_CONSTRUCTORS( PushButton, Button, "pushbutton" );
-IMPL_GET_WINDOW (PushButton);
-
-class RadioButtonImpl : public ButtonImpl
- , public ::cppu::WeakImplHelper1< awt::XItemListener >
-{
- Link maToggleHdl;
-public:
- uno::Reference< awt::XRadioButton > mxRadioButton;
- RadioButtonImpl( Context *context, const PeerHandle &peer, Window *window )
- : ButtonImpl( context, peer, window )
- , mxRadioButton( peer, uno::UNO_QUERY )
- {
- }
-
- void Check( bool bCheck )
- {
- if ( !mxRadioButton.is() )
- return;
-
- // Have setState fire item event for
- // RadioGroups::RadioGroup::itemStateChanged ()
- ::RadioButton *r = static_cast<RadioButton*>(mpWindow)->GetRadioButton ();
- bool state = r->IsRadioCheckEnabled ();
- r->EnableRadioCheck();
- mxRadioButton->setState( !!bCheck );
- r->EnableRadioCheck (state);
- fireToggle();
- }
-
- bool IsChecked()
- {
- if ( !mxRadioButton.is() )
- return false;
- return mxRadioButton->getState();
- }
-
- void SetToggleHdl( const Link& link )
- {
- if (!link && !!maToggleHdl)
- mxRadioButton->removeItemListener( this );
- else if (!!link && !maToggleHdl)
- mxRadioButton->addItemListener( this );
- maToggleHdl = link;
- }
-
- inline void fireToggle()
- {
- maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
- }
-
- virtual void SetClickHdl( const Link& link )
- {
- // Keep RadioGroups::RadioGroup's actionListener at HEAD
- // of list. This way, it can handle RadioGroup's button
- // states before all other callbacks and make sure the
- // client code has the right state.
-
- // IWBN to add an XRadioButton2 and layout::VCLXRadioButton
- // with {get,set}RadioGroup() (and a "radiogroup" property
- // even) and handle the grouping here in RadioButtonImpl.
- uno::Reference< uno::XInterface > x = static_cast<VCLXRadioButton*> (mpWindow->GetVCLXWindow ())->getFirstActionListener ();
- uno::Reference< awt::XActionListener > a = uno::Reference< awt::XActionListener> (x ,uno::UNO_QUERY );
- mxButton->removeActionListener (a);
- ButtonImpl::SetClickHdl (link);
- mxButton->addActionListener (a);
- }
-
- void SAL_CALL disposing( lang::EventObject const& e )
- throw (uno::RuntimeException)
- {
- ButtonImpl::disposing (e);
- }
-
- virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
- throw (uno::RuntimeException)
- {
- maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
- }
-};
-
-RadioButton::~RadioButton ()
-{
- SetToggleHdl (Link ());
-}
-
-void RadioButton::Check( bool bCheck )
-{
- getImpl().Check( bCheck );
-}
-
-bool RadioButton::IsChecked() const
-{
- return getImpl().IsChecked();
-}
-
-void RadioButton::SetToggleHdl( const Link& link )
-{
- if (&getImpl () && getImpl().mxRadioButton.is ())
- getImpl().SetToggleHdl( link );
-}
-
-IMPL_GET_IMPL( RadioButton );
-IMPL_GET_WINDOW( RadioButton );
-IMPL_GET_VCLXWINDOW( RadioButton );
-IMPL_CONSTRUCTORS( RadioButton, Button, "radiobutton" );
-
-class CheckBoxImpl : public ButtonImpl
- , public ::cppu::WeakImplHelper1< awt::XItemListener >
-{
- Link maToggleHdl;
- public:
- uno::Reference< awt::XCheckBox > mxCheckBox;
- CheckBoxImpl( Context *context, const PeerHandle &peer, Window *window )
- : ButtonImpl( context, peer, window )
- , mxCheckBox( peer, uno::UNO_QUERY )
- {
- }
-
- void SetToggleHdl( const Link& link )
- {
- if (!link && !!maToggleHdl)
- mxCheckBox->removeItemListener( this );
- else if (!!link && !maToggleHdl)
- mxCheckBox->addItemListener( this );
- maToggleHdl = link;
- }
- void SAL_CALL disposing( lang::EventObject const& e )
- throw (uno::RuntimeException)
- {
- ButtonImpl::disposing (e);
- }
- virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
- throw (uno::RuntimeException)
- {
- maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
- }
-};
-
-CheckBox::~CheckBox ()
-{
- SetToggleHdl (Link ());
-}
-
-void CheckBox::Check( bool bCheck )
-{
- if ( !getImpl().mxCheckBox.is() )
- return;
- getImpl().mxCheckBox->setState( !!bCheck );
-}
-
-bool CheckBox::IsChecked() const
-{
- if ( !getImpl().mxCheckBox.is() )
- return false;
- return getImpl().mxCheckBox->getState() != 0;
-}
-
-void CheckBox::SetToggleHdl( const Link& link )
-{
- if (&getImpl () && getImpl().mxCheckBox.is ())
- getImpl().SetToggleHdl( link );
-}
-
-IMPL_GET_IMPL( CheckBox );
-IMPL_CONSTRUCTORS( CheckBox, Button, "checkbox" );
-
-#define BUTTON_IMPL(t, parent, response) \
- class t##Impl : public parent##Impl \
- { \
- public: \
- t##Impl( Context *context, PeerHandle const& peer, Window *window ) \
- : parent##Impl( context, peer, window ) \
- { \
- } \
- void Click() \
- { \
- if (Dialog *d = static_cast<Dialog *> (mpCtx)) \
- d->EndDialog( response ); \
- } \
- }
-
-/* Common button types currently unavailable in OOo: */
-/* mpReset */
-/* mpApply */
-/* mpAction */
-#define RET_RESET 6
-#define RET_APPLY 7
-#define BUTTONID_RESET RET_RESET
-#define BUTTONID_APPLY RET_APPLY
-
-BUTTON_IMPL( OKButton, PushButton, BUTTONID_OK );
-BUTTON_IMPL( CancelButton, PushButton, BUTTONID_CANCEL );
-BUTTON_IMPL( YesButton, PushButton, BUTTONID_YES );
-BUTTON_IMPL( NoButton, PushButton, BUTTONID_NO );
-BUTTON_IMPL( RetryButton, PushButton, BUTTONID_RETRY );
-BUTTON_IMPL( IgnoreButton, PushButton, BUTTONID_IGNORE );
-BUTTON_IMPL( ResetButton, PushButton, BUTTONID_RESET );
-BUTTON_IMPL( ApplyButton, PushButton, BUTTONID_APPLY ); /* Deprecated? */
-BUTTON_IMPL( HelpButton, PushButton, BUTTONID_HELP );
-
-IMPL_CONSTRUCTORS( OKButton, PushButton, "okbutton" );
-IMPL_CONSTRUCTORS( CancelButton, PushButton, "cancelbutton" );
-IMPL_CONSTRUCTORS( YesButton, PushButton, "yesbutton" );
-IMPL_CONSTRUCTORS( NoButton, PushButton, "nobutton" );
-IMPL_CONSTRUCTORS( RetryButton, PushButton, "retrybutton" );
-IMPL_CONSTRUCTORS( IgnoreButton, PushButton, "ignorebutton" );
-IMPL_CONSTRUCTORS( ResetButton, PushButton, "resetbutton" );
-IMPL_CONSTRUCTORS( ApplyButton, PushButton, "applybutton" ); /* Deprecated? */
-IMPL_CONSTRUCTORS( HelpButton, PushButton, "helpbutton" );
-
-IMPL_IMPL (ImageButton, PushButton)
-
-
-IMPL_CONSTRUCTORS( ImageButton, PushButton, "imagebutton" );
-
-class AdvancedButtonImpl : public PushButtonImpl
-{
-protected:
- bool bAdvancedMode;
- std::list< Window*> maAdvanced;
- std::list< Window*> maSimple;
-
-public:
- rtl::OUString mAdvancedLabel;
- rtl::OUString mSimpleLabel;
-
-protected:
- Window* Remove( std::list< Window*> lst, Window* w )
- {
- for ( std::list< Window*>::iterator it = maAdvanced.begin();
- it != maAdvanced.end(); ++it )
- if ( *it == w )
- {
- lst.erase( it );
- return *it;
- }
- return 0;
- }
-
-public:
- AdvancedButtonImpl( Context *context, PeerHandle const& peer, Window *window )
- : PushButtonImpl( context, peer, window )
- , bAdvancedMode( false )
- // TODO: i18n
- // Button::GetStandardText( BUTTON_ADVANCED );
- // Button::GetStandardText( BUTTON_SIMPLE );
- , mAdvancedLabel( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Advanced...")) )
- , mSimpleLabel( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Simple...")) )
- {
- }
- void Click()
- {
- bAdvancedMode = !bAdvancedMode;
- if ( bAdvancedMode )
- advancedMode();
- else
- simpleMode();
- }
- void setAlign ()
- {
- ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
- b->SetSymbolAlign (SYMBOLALIGN_RIGHT);
- b->SetSmallSymbol ();
- //mpWindow->SetStyle (mpWindow->GetStyle() | WB_CENTER);
- }
- void advancedMode()
- {
- ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
- b->SetSymbol (SYMBOL_PAGEUP);
- setAlign ();
- if (mSimpleLabel.getLength ())
- b->SetText (mSimpleLabel);
- for ( std::list< Window*>::iterator it = maAdvanced.begin();
- it != maAdvanced.end(); ++it )
- ( *it )->Show();
- for ( std::list< Window*>::iterator it = maSimple.begin();
- it != maSimple.end(); ++it )
- ( *it )->Hide();
-
- redraw ();
- }
- void simpleMode()
- {
- //mxButton->setLabel( mSimpleLabel );
- ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
- b->SetSymbol (SYMBOL_PAGEDOWN);
- if (mAdvancedLabel.getLength ())
- b->SetText (mAdvancedLabel);
- setAlign ();
- for ( std::list< Window*>::iterator it = maAdvanced.begin();
- it != maAdvanced.end(); ++it )
- ( *it )->Hide();
- for ( std::list< Window*>::iterator it = maSimple.begin();
- it != maSimple.end(); ++it )
- ( *it )->Show();
-
- redraw (true);
- }
- void AddAdvanced( Window* w )
- {
- maAdvanced.push_back( w );
- if ( !bAdvancedMode )
- w->Hide();
- }
- void AddSimple( Window* w )
- {
- maSimple.push_back( w );
- if ( bAdvancedMode )
- w->Hide();
- }
- void RemoveAdvanced( Window* w )
- {
- Remove( maAdvanced, w );
- }
- void RemoveSimple( Window* w )
- {
- Remove( maSimple, w );
- }
-};
-
-void AdvancedButton::AddAdvanced( Window* w )
-{
- getImpl().AddAdvanced( w );
-}
-
-void AdvancedButton::AddSimple( Window* w )
-{
- getImpl().AddSimple( w );
-}
-
-void AdvancedButton::RemoveAdvanced( Window* w )
-{
- getImpl().RemoveAdvanced( w );
-}
-
-void AdvancedButton::RemoveSimple( Window* w )
-{
- getImpl().RemoveSimple( w );
-}
-
-void AdvancedButton::SetAdvancedText (rtl::OUString const& text)
-{
- if (text.getLength ())
- getImpl ().mAdvancedLabel = text;
-}
-
-void AdvancedButton::SetSimpleText (rtl::OUString const& text)
-{
- if (text.getLength ())
- getImpl ().mSimpleLabel = text;
-}
-
-rtl::OUString AdvancedButton::GetAdvancedText () const
-{
- return getImpl ().mAdvancedLabel;
-}
-
-rtl::OUString AdvancedButton::GetSimpleText () const
-{
- return getImpl ().mSimpleLabel;
-}
-
-void AdvancedButton::SetDelta (int)
-{
-}
-
-IMPL_CONSTRUCTORS_BODY( AdvancedButton, PushButton, "advancedbutton", getImpl().simpleMode () );
-IMPL_GET_IMPL( AdvancedButton );
-
-
-class MoreButtonImpl : public AdvancedButtonImpl
-{
-public:
- MoreButtonImpl( Context *context, PeerHandle const& peer, Window *window )
- : AdvancedButtonImpl( context, peer, window)
- {
- mSimpleLabel = Button::GetStandardText( BUTTON_MORE );
- mAdvancedLabel = Button::GetStandardText( BUTTON_LESS );
- }
- void AddWindow( Window* w ) { AddAdvanced( w ); }
- void RemoveWindow( Window* w ) { RemoveAdvanced( w ); }
-};
-
-// TODO
-//BUTTON_IMPL( MoreButton, PushButton, 0 );
-IMPL_CONSTRUCTORS_BODY( MoreButton, AdvancedButton, "morebutton", getImpl().simpleMode () );
-IMPL_GET_IMPL( MoreButton );
-
-void MoreButton::AddWindow( Window* w )
-{
- getImpl().AddWindow( w );
-}
-
-void MoreButton::RemoveWindow( Window* w )
-{
- getImpl().RemoveWindow( w );
-}
-
-void MoreButton::SetMoreText (rtl::OUString const& text)
-{
- SetAdvancedText (text);
-}
-
-void MoreButton::SetLessText (rtl::OUString const& text)
-{
- SetSimpleText (text);
-}
-
-rtl::OUString MoreButton::GetMoreText () const
-{
- return GetAdvancedText ();
-}
-
-rtl::OUString MoreButton::GetLessText () const
-{
- return GetSimpleText ();
-}
-
-} // namespace layout
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/vcl/wcontainer.cxx b/toolkit/source/layout/vcl/wcontainer.cxx
deleted file mode 100644
index ed3071f69a..0000000000
--- a/toolkit/source/layout/vcl/wcontainer.cxx
+++ /dev/null
@@ -1,269 +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 "wrapper.hxx"
-
-#include <com/sun/star/awt/XLayoutRoot.hpp>
-#include <com/sun/star/awt/XLayoutContainer.hpp>
-#include <comphelper/processfactory.hxx>
-#include <layout/core/helper.hxx>
-#include <tools/debug.hxx>
-
-using namespace ::com::sun::star;
-
-namespace layout
-{
-
-Container::Container( Context const* context, char const* pId )
- : mxContainer( context->GetPeerHandle( pId ), uno::UNO_QUERY )
-{
- if ( !mxContainer.is() )
- {
- OSL_TRACE( "Error: failed to associate container with '%s'", pId );
- }
-}
-
-Container::Container( rtl::OUString const& rName, sal_Int32 nBorder )
-{
- mxContainer = layoutimpl::WidgetFactory::createContainer( rName );
-
- uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
- xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ),
- uno::Any( nBorder ) );
-}
-
-void Container::Add( Window *pChild )
-{
- if ( pChild )
- {
- uno::Reference< awt::XLayoutConstrains > xChild( pChild->GetPeer(), uno::UNO_QUERY );
- mxContainer->addChild( xChild );
- }
-}
-
-void Container::Add( Container *pChild )
-{
- if ( pChild )
- {
- uno::Reference< awt::XLayoutConstrains > xChild( pChild->getImpl(), uno::UNO_QUERY );
- mxContainer->addChild( xChild );
- }
-}
-
-void Container::Remove( Window *pChild )
-{
- if ( pChild )
- {
- uno::Reference< awt::XLayoutConstrains > xChild( pChild->GetPeer(), uno::UNO_QUERY );
- mxContainer->removeChild( xChild );
- }
-}
-
-void Container::Remove( Container *pChild )
-{
- if ( pChild )
- {
- uno::Reference< awt::XLayoutConstrains > xChild( pChild->getImpl(), uno::UNO_QUERY );
- mxContainer->removeChild( xChild );
- }
-}
-
-void Container::Clear()
-{
- css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > children;
- children = mxContainer->getChildren();
- for (int i = 0; i < children.getLength(); i++)
- mxContainer->removeChild( children[i] );
-}
-
-void Container::ShowAll( bool bShow )
-{
- struct inner
- {
- static void setChildrenVisible( uno::Reference < awt::XLayoutContainer > xCont,
- bool bVisible ) /* auxiliary */
- {
- if ( xCont.is() )
- {
- uno::Sequence< uno::Reference < awt::XLayoutConstrains > > aChildren;
- aChildren = xCont->getChildren();
- for (int i = 0; i < aChildren.getLength(); i++)
- {
- uno::Reference < awt::XLayoutConstrains > xChild( aChildren[ i ] );
-
- uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY);
- if ( xWin.is() )
- xWin->setVisible( bVisible );
-
- uno::Reference < awt::XLayoutContainer > xChildCont(
- xChild, uno::UNO_QUERY );
- setChildrenVisible( xChildCont, bVisible );
- }
- }
- }
- };
-
- inner::setChildrenVisible( mxContainer, bShow );
-}
-
-void Container::Show()
-{
- ShowAll( true );
-}
-
-void Container::Hide()
-{
- ShowAll( false );
-}
-
-Table::Table( sal_Int32 nBorder, sal_Int32 nColumns )
- : Container( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "table" ) ), nBorder )
-{
- uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
- xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ) ),
- uno::Any( nColumns ) );
-}
-
-void Table::Add( Window *window, bool bXExpand, bool bYExpand,
- sal_Int32 nXSpan, sal_Int32 nYSpan )
-{
- if ( !window )
- return;
- WindowImpl &rImpl = window->getImpl();
- uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow,
- uno::UNO_QUERY );
- mxContainer->addChild( xChild );
- setProps( xChild, bXExpand, bYExpand, nXSpan, nYSpan );
-}
-
-void Table::Add( Container *pContainer, bool bXExpand, bool bYExpand,
- sal_Int32 nXSpan, sal_Int32 nYSpan )
-{
- if ( !pContainer )
- return;
- uno::Reference< awt::XLayoutConstrains > xChild( pContainer->getImpl(),
- uno::UNO_QUERY );
- mxContainer->addChild( xChild );
- setProps( xChild, bXExpand, bYExpand, nXSpan, nYSpan );
-}
-
-void Table::setProps( uno::Reference< awt::XLayoutConstrains > xChild,
- bool bXExpand, bool bYExpand, sal_Int32 nXSpan, sal_Int32 nYSpan )
-{
- uno::Reference< beans::XPropertySet > xProps
- ( mxContainer->getChildProperties( xChild ), uno::UNO_QUERY_THROW );
- xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "XExpand" ) ),
- uno::Any( bXExpand ) );
- xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "YExpand" ) ),
- uno::Any( bYExpand ) );
- xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "ColSpan" ) ),
- uno::Any( nXSpan ) );
- xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "RowSpan" ) ),
- uno::Any( nYSpan ) );
-}
-
-Box::Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous )
- : Container( rName, nBorder )
-{
- uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
- xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ) ),
- uno::Any( bHomogeneous ) );
-}
-
-void Box::Add( Window *window, bool bExpand, bool bFill, sal_Int32 nPadding)
-{
- if ( !window )
- return;
- WindowImpl &rImpl = window->getImpl();
- uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow,
- uno::UNO_QUERY );
-
- mxContainer->addChild( xChild );
- setProps( xChild, bExpand, bFill, nPadding );
-}
-
-void Box::Add( Container *pContainer, bool bExpand, bool bFill, sal_Int32 nPadding)
-{
- if ( !pContainer )
- return;
-
- uno::Reference< awt::XLayoutConstrains > xChild( pContainer->getImpl(),
- uno::UNO_QUERY );
- mxContainer->addChild( xChild );
- setProps( xChild, bExpand, bFill, nPadding );
-}
-
-void Box::setProps( uno::Reference< awt::XLayoutConstrains > xChild,
- bool bExpand, bool bFill, sal_Int32 nPadding )
-{
- uno::Reference< beans::XPropertySet > xProps
- ( mxContainer->getChildProperties( xChild ), uno::UNO_QUERY_THROW );
-
- xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Expand" ) ),
- uno::Any( bExpand ) );
- xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Fill" ) ),
- uno::Any( bFill ) );
- xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Padding" ) ),
- uno::Any( nPadding ) );
-}
-
-Table::Table( Context const* context, char const* pId )
- : Container( context, pId )
-{
-}
-
-Box::Box( Context const* context, char const* pId )
- : Container( context, pId )
-{
-}
-
-HBox::HBox( sal_Int32 nBorder, bool bHomogeneous )
- : Box( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hbox" ) ),
- nBorder, bHomogeneous )
-{
-}
-
-HBox::HBox( Context const* context, char const* pId )
- : Box( context, pId )
-{
-}
-
-VBox::VBox( sal_Int32 nBorder, bool bHomogeneous )
- : Box( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vbox" ) ),
- nBorder, bHomogeneous )
-{
-}
-
-VBox::VBox( Context const* context, char const* pId )
- : Box( context, pId )
-{
-}
-
-} // namespace layout
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/vcl/wfield.cxx b/toolkit/source/layout/vcl/wfield.cxx
deleted file mode 100644
index f4584796f2..0000000000
--- a/toolkit/source/layout/vcl/wfield.cxx
+++ /dev/null
@@ -1,795 +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 "wrapper.hxx"
-
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/awt/XMetricField.hpp>
-#include <com/sun/star/awt/XNumericField.hpp>
-#include <com/sun/star/awt/XTextComponent.hpp>
-#include <com/sun/star/awt/XListBox.hpp>
-#include <com/sun/star/awt/XComboBox.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/awt/XActionListener.hpp>
-#include <com/sun/star/awt/XItemListener.hpp>
-#include <com/sun/star/awt/XMouseListener.hpp>
-#include <vcl/combobox.hxx>
-#include <vcl/lstbox.hxx>
-
-#include <toolkit/awt/vclxwindows.hxx>
-
-using namespace ::com::sun::star;
-using rtl::OUString;
-
-#define LAYOUT_API_CALLS_HANDLER 0
-
-namespace layout
-{
-
-class EditImpl : public ControlImpl
- , public ::cppu::WeakImplHelper1< awt::XTextListener >
-{
-public:
- Link maModifyHdl;
-
- uno::Reference< awt::XTextComponent > mxEdit;
- EditImpl( Context *context, const PeerHandle &peer, Window *window )
- : ControlImpl( context, peer, window )
- , mxEdit( peer, uno::UNO_QUERY )
- {
- }
-
- ~EditImpl ();
-
- virtual void SAL_CALL disposing( lang::EventObject const& e )
- throw (uno::RuntimeException);
-
- virtual void SetModifyHdl( Link const& link );
-
- void SAL_CALL textChanged( const awt::TextEvent& /* rEvent */ )
- throw (uno::RuntimeException)
- {
- maModifyHdl.Call( mpWindow );
- }
-};
-
-EditImpl::~EditImpl ()
-{
-}
-
-void SAL_CALL EditImpl::disposing( lang::EventObject const& e )
- throw (uno::RuntimeException)
-{
- ControlImpl::disposing (e);
- mxEdit.clear ();
-}
-
-void EditImpl::SetModifyHdl( Link const& link )
-{
- if (!link && !!maModifyHdl)
- mxEdit->removeTextListener( this );
- else if (!!link && !maModifyHdl)
- mxEdit->addTextListener( this );
- maModifyHdl = link;
-}
-
-Edit::~Edit ()
-{
- SetModifyHdl (Link ());
-}
-
-void Edit::SetSelection( Selection const& rSelection )
-{
-#if LAYOUT_API_CALLS_HANDLER
- if ( !getImpl().mxEdit.is() )
- getImpl().mxEdit->setSelection( awt::Selection( rSelection.Min(), rSelection.Max() ) );
-#else /* !LAYOUT_API_CALLS_HANDLER */
- GetEdit ()->SetSelection (rSelection);
-#endif /* !LAYOUT_API_CALLS_HANDLER */
-}
-
-void Edit::SetText( OUString const& rStr )
-{
-#if LAYOUT_API_CALLS_HANDLER
- if ( getImpl().mxEdit.is() )
- /// this calls handlers; endless loop in numfmt.cxx
- getImpl().mxEdit->setText( rStr );
-#else /* !LAYOUT_API_CALLS_HANDLER */
- GetEdit ()->SetText (rStr);
-#endif /* !LAYOUT_API_CALLS_HANDLER */
-}
-
-String Edit::GetText() const
-{
- if ( !getImpl().mxEdit.is() )
- return getImpl().mxEdit->getText();
- return OUString();
-}
-
-void Edit::SetModifyHdl( const Link& link )
-{
- if (&getImpl () && getImpl().mxEdit.is ())
- getImpl().SetModifyHdl( link );
-}
-
-IMPL_CONSTRUCTORS( Edit, Control, "edit" );
-IMPL_GET_IMPL( Edit );
-IMPL_GET_WINDOW (Edit);
-
-class MultiLineEditImpl : public EditImpl
-{
-public:
- MultiLineEditImpl( Context *context, const PeerHandle &peer, Window *window )
- : EditImpl( context, peer, window )
- {
- }
-};
-
-IMPL_CONSTRUCTORS( MultiLineEdit, Edit, "multilineedit" );
-IMPL_GET_IMPL( MultiLineEdit );
-
-class SpinFieldImpl : public EditImpl
-{
- public:
- SpinFieldImpl( Context *context, const PeerHandle &peer, Window *window )
- : EditImpl( context, peer, window )
- {
- }
-};
-
-IMPL_CONSTRUCTORS( SpinField, Edit, "spinfield" );
-
-class NumericFieldImpl : public SpinFieldImpl
-{
- public:
- NumericFieldImpl( Context *context, const PeerHandle &peer, Window *window )
- : SpinFieldImpl( context, peer, window )
- {
- }
-};
-
-class MetricFieldImpl : public SpinFieldImpl
-{
- public:
- MetricFieldImpl( Context *context, const PeerHandle &peer, Window *window )
- : SpinFieldImpl( context, peer, window )
- {
- }
-};
-
-IMPL_GET_IMPL( SpinField );
-IMPL_GET_IMPL( NumericField );
-IMPL_GET_IMPL( MetricField );
-
-class FormatterBaseImpl
-{
- protected:
- PeerHandle mpeer;
- public:
- explicit FormatterBaseImpl( const PeerHandle &peer )
- : mpeer( peer )
- {
- };
-};
-
-FormatterBase::FormatterBase( FormatterBaseImpl *pFormatImpl )
- : mpFormatImpl( pFormatImpl )
-{
-}
-
-class NumericFormatterImpl : public FormatterBaseImpl
-{
- public:
- uno::Reference< awt::XNumericField > mxField;
- explicit NumericFormatterImpl( const PeerHandle &peer )
- : FormatterBaseImpl( peer )
- , mxField( peer, uno::UNO_QUERY )
- {
- }
-
- // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx
- double valueToDouble( sal_Int64 nValue )
- {
- sal_Int16 nDigits = mxField->getDecimalDigits();
- double n = (double)nValue;
- for ( sal_uInt16 d = 0; d < nDigits; d++ )
- n /= 10;
- return n;
- } // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx
- sal_Int64 doubleToValue( double nValue )
- {
- sal_Int16 nDigits = mxField->getDecimalDigits();
- double n = nValue;
- for ( sal_uInt16 d = 0; d < nDigits; d++ )
- n *= 10;
- return (sal_Int64) n;
- }
-};
-
-class MetricFormatterImpl : public FormatterBaseImpl
-{
- public:
- uno::Reference< awt::XMetricField > mxField;
- explicit MetricFormatterImpl( const PeerHandle &peer )
- : FormatterBaseImpl( peer )
- , mxField( peer, uno::UNO_QUERY )
- {
- }
-};
-
-NumericFormatter::NumericFormatter( FormatterBaseImpl *pImpl )
- : FormatterBase( pImpl )
-{
-}
-
-NumericFormatterImpl& NumericFormatter::getFormatImpl() const
-{
- return *( static_cast<NumericFormatterImpl *>( mpFormatImpl ) );
-}
-
-#define SET_IMPL(vclmethod, idlmethod) \
- void NumericFormatter::vclmethod( sal_Int64 nValue ) \
- { \
- if ( !getFormatImpl().mxField.is() ) \
- return; \
- getFormatImpl().mxField->idlmethod( getFormatImpl().valueToDouble( nValue ) ); \
- }
-
-SET_IMPL( SetMin, setMin )
-SET_IMPL( SetMax, setMax )
-SET_IMPL( SetLast, setLast )
-SET_IMPL( SetFirst, setFirst )
-SET_IMPL( SetValue, setValue )
-SET_IMPL( SetSpinSize, setSpinSize )
-
-sal_Int64 NumericFormatter::GetValue() const
-{
- if ( !getFormatImpl().mxField.is() )
- return 0;
- return getFormatImpl().doubleToValue( getFormatImpl().mxField->getValue() );
-}
-
-#undef SET_IMPL
-
-IMPL_CONSTRUCTORS_2( NumericField, SpinField, NumericFormatter, "numericfield" );
-
-MetricFormatter::MetricFormatter( FormatterBaseImpl *pImpl )
- : FormatterBase( pImpl )
-{
-}
-MetricFormatterImpl& MetricFormatter::getFormatImpl() const
-{ return *( static_cast<MetricFormatterImpl *>( mpFormatImpl ) ); }
-
-#define MetricUnitVclToUno(a) ((sal_uInt16)(a))
-
-#define SET_IMPL(vclmethod, idlmethod) \
- void MetricFormatter::vclmethod( sal_Int64 nValue, FieldUnit nUnit ) \
- { \
- if ( !getFormatImpl().mxField.is() ) \
- return; \
- getFormatImpl().mxField->idlmethod( nValue, MetricUnitVclToUno( nUnit ) ); \
- }
-
-SET_IMPL( SetMin, setMin )
-SET_IMPL( SetMax, setMax )
-SET_IMPL( SetLast, setLast )
-SET_IMPL( SetFirst, setFirst )
-SET_IMPL( SetValue, setValue )
-
-#undef SET_IMPL
-
-void MetricFormatter::SetSpinSize( sal_Int64 nValue )
-{
- if ( !getFormatImpl().mxField.is() )
- return;
- getFormatImpl().mxField->setSpinSize( nValue );
-}
-
-sal_Int64 MetricFormatter::GetValue( FieldUnit nUnit ) const
-{
- if ( !getFormatImpl().mxField.is() )
- return 0;
- return getFormatImpl().mxField->getValue( MetricUnitVclToUno( nUnit ) );
-}
-
-IMPL_CONSTRUCTORS_2( MetricField, SpinField, MetricFormatter, "metricfield" );
-
-class ComboBoxImpl : public EditImpl
- , public ::cppu::WeakImplHelper1< awt::XActionListener >
- , public ::cppu::WeakImplHelper1< awt::XItemListener >
-{
-public:
- uno::Reference< awt::XComboBox > mxComboBox;
-
- Link maClickHdl;
- Link maSelectHdl;
-
- Window *parent;
-
- ComboBoxImpl( Context *context, const PeerHandle &peer, Window *window )
- : EditImpl( context, peer, window )
- , mxComboBox( peer, uno::UNO_QUERY )
- {
- }
-
- ~ComboBoxImpl ();
-
- sal_uInt16 InsertEntry( OUString const& rStr, sal_uInt16 nPos )
- {
- if ( nPos == COMBOBOX_APPEND )
- nPos = GetEntryCount();
- mxComboBox->addItem( rtl::OUString( rStr ), nPos );
- return nPos;
- }
-
- void RemoveEntry( sal_uInt16 nPos )
- {
- mxComboBox->removeItems( nPos, 1 );
- }
-
- sal_uInt16 GetEntryPos( String const& rStr ) const
- {
- uno::Sequence< rtl::OUString> aItems( mxComboBox->getItems() );
- rtl::OUString rKey( rStr );
- sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength());
- for (sal_uInt16 i = 0; i < n; i++)
- {
- if ( aItems[ i ] == rKey )
- return i;
- }
- return COMBOBOX_ENTRY_NOTFOUND;
- }
-
- OUString GetEntry( sal_uInt16 nPos ) const
- {
- return OUString( mxComboBox->getItem( nPos ) );
- }
-
- sal_uInt16 GetEntryCount() const
- {
- return mxComboBox->getItemCount();
- }
-
- void SetClickHdl( Link const& link )
- {
- if (!link && !!maClickHdl)
- mxComboBox->removeActionListener( this );
- else if (!!link && !maClickHdl)
- mxComboBox->addActionListener( this );
- maClickHdl = link;
- }
-
- void SetSelectHdl( Link const& link )
- {
- if (!link && !!maSelectHdl)
- mxComboBox->removeItemListener( this );
- else if (!!link && !maSelectHdl)
- mxComboBox->addItemListener( this );
- maSelectHdl = link;
- }
-
- void SAL_CALL disposing( lang::EventObject const& e )
- throw (uno::RuntimeException);
-
- void SAL_CALL actionPerformed (const awt::ActionEvent&)
- throw (uno::RuntimeException)
- {
- ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow );
- if ( !pComboBox )
- return;
- maClickHdl.Call( pComboBox );
- }
-
- void SAL_CALL itemStateChanged( awt::ItemEvent const&)
- throw (uno::RuntimeException)
- {
- ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow );
- if ( !pComboBox )
- return;
- maSelectHdl.Call( pComboBox );
- }
-};
-
-ComboBox::~ComboBox ()
-{
-#ifndef __SUNPRO_CC
- OSL_TRACE ("%s: deleting ComboBox for window: %p", __FUNCTION__, GetWindow ());
-#endif
-}
-
-ComboBoxImpl::~ComboBoxImpl ()
-{
-#ifndef __SUNPRO_CC
- OSL_TRACE ("%s: deleting ComboBoxImpl for window: %p", __FUNCTION__, mpWindow ? mpWindow->GetWindow () : 0);
- OSL_TRACE ("%s: deleting ComboBoxImpl for listener: %p", __FUNCTION__, static_cast<XFocusListener*> (this));
-#endif
-}
-
-void ComboBoxImpl::disposing( lang::EventObject const& e )
- throw (uno::RuntimeException)
-{
- EditImpl::disposing (e);
- mxComboBox.clear ();
-}
-
-sal_uInt16 ComboBox::InsertEntry( String const& rStr, sal_uInt16 nPos )
-{
- return getImpl().InsertEntry( rStr, nPos );
-}
-
-void ComboBox::RemoveEntry( String const& rStr )
-{
- getImpl().RemoveEntry( GetEntryPos( rStr ) );
-}
-
-void ComboBox::RemoveEntry( sal_uInt16 nPos )
-{
- getImpl().RemoveEntry( nPos );
-}
-
-void ComboBox::Clear()
-{
- uno::Sequence< rtl::OUString> aNoItems;
- getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
-}
-
-sal_uInt16 ComboBox::GetEntryPos( String const& rStr ) const
-{
- return getImpl().GetEntryPos( rStr );
-}
-
-String ComboBox::GetEntry( sal_uInt16 nPos ) const
-{
- rtl::OUString rItem = getImpl().mxComboBox->getItem( nPos );
- return OUString( rItem );
-}
-
-sal_uInt16 ComboBox::GetEntryCount() const
-{
- return getImpl().GetEntryCount();
-}
-
-void ComboBox::SetClickHdl( const Link& link )
-{
- if (&getImpl () && getImpl().mxComboBox.is ())
- getImpl().SetClickHdl( link );
-}
-
-void ComboBox::SetSelectHdl( const Link& link )
-{
- if (&getImpl () && getImpl().mxComboBox.is ())
- getImpl().SetSelectHdl( link );
-}
-
-void ComboBox::EnableAutocomplete (bool enable, bool matchCase)
-{
- GetComboBox ()->EnableAutocomplete (enable, matchCase);
-}
-
-IMPL_CONSTRUCTORS_BODY( ComboBox, Edit, "combobox", getImpl().parent = parent; );
-IMPL_GET_WINDOW (ComboBox);
-/// IMPL_GET_IMPL( ComboBox );
-
-static ComboBoxImpl* null_combobox_impl = 0;
-
-ComboBoxImpl &ComboBox::getImpl () const
-{
- if (ComboBoxImpl* c = static_cast<ComboBoxImpl *>(mpImpl))
- return *c;
- return *null_combobox_impl;
-}
-
-class ListBoxImpl : public ControlImpl
- , public ::cppu::WeakImplHelper1< awt::XActionListener >
- , public ::cppu::WeakImplHelper1< awt::XItemListener >
- , public ::cppu::WeakImplHelper1< awt::XMouseListener >
-{
- Link maClickHdl;
- Link maSelectHdl;
- Link maDoubleClickHdl;
-
-public:
- uno::Reference< awt::XListBox > mxListBox;
- ListBoxImpl( Context *context, const PeerHandle &peer, Window *window )
- : ControlImpl( context, peer, window )
- , mxListBox( peer, uno::UNO_QUERY )
- {
- SelectEntryPos (0, true);
- }
-
- sal_uInt16 InsertEntry (String const& rStr, sal_uInt16 nPos)
- {
- if ( nPos == LISTBOX_APPEND )
- nPos = mxListBox->getItemCount();
- mxListBox->addItem( rtl::OUString( rStr ), nPos );
- return nPos;
- }
-
- void RemoveEntry( sal_uInt16 nPos )
- {
- mxListBox->removeItems( nPos, 1 );
- }
-
- sal_uInt16 RemoveEntry( String const& rStr, sal_uInt16 nPos)
- {
- if ( nPos == LISTBOX_APPEND )
- nPos = mxListBox->getItemCount();
- mxListBox->addItem( rtl::OUString( rStr ), nPos );
- return nPos;
- }
-
- sal_uInt16 GetEntryPos( String const& rStr ) const
- {
- uno::Sequence< rtl::OUString> aItems( mxListBox->getItems() );
- rtl::OUString rKey( rStr );
- sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength());
- for (sal_uInt16 i = 0; i < n; i++)
- {
- if ( aItems[ i ] == rKey )
- return i;
- }
- return LISTBOX_ENTRY_NOTFOUND;
- }
-
- OUString GetEntry( sal_uInt16 nPos ) const
- {
- return mxListBox->getItem( nPos );
- }
-
- sal_uInt16 GetEntryCount() const
- {
- return mxListBox->getItemCount();
- }
-
- void SelectEntryPos( sal_uInt16 nPos, bool bSelect )
- {
- mxListBox->selectItemPos( nPos, bSelect );
- }
-
- sal_uInt16 GetSelectEntryCount() const
- {
- return sal::static_int_cast< sal_uInt16 >( mxListBox->getSelectedItems().getLength() );
- }
-
- sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex ) const
- {
- sal_uInt16 nSelected = 0;
- if ( mxListBox->isMutipleMode() )
- {
- uno::Sequence< short > aItems( mxListBox->getSelectedItemsPos() );
- if ( nSelIndex < aItems.getLength() )
- nSelected = aItems[ nSelIndex ];
- }
- else
- nSelected = mxListBox->getSelectedItemPos();
- return nSelected;
- }
-
- virtual void SAL_CALL disposing( lang::EventObject const& e )
- throw (uno::RuntimeException)
- {
- ControlImpl::disposing (e);
- mxListBox.clear ();
- }
-
- Link& GetClickHdl ()
- {
- return maClickHdl;
- }
-
- void SetClickHdl( Link const& link )
- {
- if (!link && !!maClickHdl)
- mxListBox->removeActionListener( this );
- else if (!!link && !maClickHdl)
- mxListBox->addActionListener( this );
- maClickHdl = link;
- }
-
- void SAL_CALL actionPerformed( const awt::ActionEvent& /* rEvent */ )
- throw (uno::RuntimeException)
- {
- maClickHdl.Call( mpWindow );
- }
-
- Link& GetSelectHdl ()
- {
- return maSelectHdl;
- }
-
- void SetSelectHdl( Link const& link )
- {
- if (!link && !!maSelectHdl)
- mxListBox->removeItemListener( this );
- else if (!!link && !maSelectHdl)
- mxListBox->addItemListener( this );
- maSelectHdl = link;
- }
-
- void SAL_CALL itemStateChanged (awt::ItemEvent const&)
- throw (uno::RuntimeException)
- {
- maSelectHdl.Call (static_cast <ListBox*> (mpWindow));
- }
-
- Link& GetDoubleClickHdl ()
- {
- return maDoubleClickHdl;
- }
-
- void SetDoubleClickHdl (Link const& link)
- {
- if (!link && !!maDoubleClickHdl)
- mxWindow->removeMouseListener (this);
- else if (!!link && !maSelectHdl)
- mxWindow->addMouseListener (this);
- maDoubleClickHdl = link;
- }
-
- void SAL_CALL mousePressed (awt::MouseEvent const&) throw (uno::RuntimeException)
- {
- }
- void SAL_CALL mouseReleased (awt::MouseEvent const& e) throw (uno::RuntimeException)
- {
- if (e.ClickCount == 2)
- maDoubleClickHdl.Call (mpWindow);
- }
- void SAL_CALL mouseEntered (awt::MouseEvent const&) throw (uno::RuntimeException)
- {
- }
- void SAL_CALL mouseExited (awt::MouseEvent const&) throw (uno::RuntimeException)
- {
- }
-};
-
-ListBox::~ListBox ()
-{
-}
-
-sal_uInt16 ListBox::InsertEntry (String const& rStr, sal_uInt16 nPos)
-{
- return getImpl().InsertEntry(rStr, nPos);
-}
-
-void ListBox::RemoveEntry( sal_uInt16 nPos )
-{
- return getImpl().RemoveEntry( nPos );
-}
-
-void ListBox::RemoveEntry( String const& rStr )
-{
- return getImpl().RemoveEntry( GetEntryPos( rStr ) );
-}
-
-void ListBox::Clear()
-{
- uno::Sequence< rtl::OUString> aNoItems;
- getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
-}
-
-sal_uInt16 ListBox::GetEntryPos( String const& rStr ) const
-{
- return getImpl().GetEntryPos( rStr );
-}
-
-String ListBox::GetEntry( sal_uInt16 nPos ) const
-{
- return getImpl().GetEntry( nPos );
-}
-
-sal_uInt16 ListBox::GetEntryCount() const
-{
- return getImpl().GetEntryCount();
-}
-
-void ListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect )
-{
-#if LAYOUT_API_CALLS_HANDLER
- getImpl().SelectEntryPos( nPos, bSelect );
-#else /* !LAYOUT_API_CALLS_HANDLER */
- GetListBox ()->SelectEntryPos (nPos, bSelect);
-#endif /* !LAYOUT_API_CALLS_HANDLER */
-}
-
-void ListBox::SelectEntry( String const& rStr, bool bSelect )
-{
- SelectEntryPos( GetEntryPos( rStr ), bSelect );
-}
-
-sal_uInt16 ListBox::GetSelectEntryCount() const
-{
- return getImpl().GetSelectEntryCount();
-}
-
-sal_uInt16 ListBox::GetSelectEntryPos( sal_uInt16 nSelIndex ) const
-{
- return getImpl().GetSelectEntryPos( nSelIndex );
-}
-
-String ListBox::GetSelectEntry( sal_uInt16 nSelIndex ) const
-{
- return GetEntry( GetSelectEntryPos( nSelIndex ) );
-}
-
-Link& ListBox::GetSelectHdl ()
-{
- return getImpl ().GetSelectHdl ();
-}
-
-void ListBox::SetSelectHdl( Link const& link )
-{
- getImpl().SetSelectHdl( link );
-}
-
-Link& ListBox::GetClickHdl ()
-{
- return getImpl ().GetSelectHdl ();
-}
-
-void ListBox::SetClickHdl( Link const& link )
-{
- if (&getImpl () && getImpl().mxListBox.is ())
- getImpl().SetClickHdl( link );
-}
-
-Link& ListBox::GetDoubleClickHdl ()
-{
- return getImpl ().GetSelectHdl ();
-}
-
-void ListBox::SetDoubleClickHdl( Link const& link )
-{
- getImpl().SetDoubleClickHdl( link );
-}
-
-void ListBox::SetEntryData( sal_uInt16 pos, void* data)
-{
- GetListBox ()->SetEntryData (pos, data);
-}
-
-void* ListBox::GetEntryData( sal_uInt16 pos) const
-{
- return GetListBox ()->GetEntryData (pos);
-}
-
-void ListBox::SetNoSelection ()
-{
- GetListBox ()->SetNoSelection ();
-}
-
-IMPL_CONSTRUCTORS (ListBox, Control, "listbox");
-IMPL_GET_IMPL (ListBox);
-IMPL_GET_WINDOW (ListBox);
-
-IMPL_IMPL (MultiListBox, ListBox)
-IMPL_CONSTRUCTORS_BODY( MultiListBox, ListBox, "multilistbox", GetMultiListBox()->EnableMultiSelection( true ); );
-IMPL_GET_IMPL( MultiListBox );
-IMPL_GET_WINDOW( MultiListBox );
-} // namespace layout
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/vcl/wrapper.cxx b/toolkit/source/layout/vcl/wrapper.cxx
deleted file mode 100644
index ab68620b2d..0000000000
--- a/toolkit/source/layout/vcl/wrapper.cxx
+++ /dev/null
@@ -1,1363 +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 <tools/rc.h>
-//#define RESOURCE_PUBLISH_PROTECTED 1
-#if RESOURCE_PUBLISH_PROTECTED
-// ugh, override non-helpful proctection
-#define protected public
-#endif /* RESOURCE_PUBLISH_PROTECTED */
-#include <tools/rc.hxx>
-#undef protected
-
-
-#include "wrapper.hxx"
-
-#include <awt/vclxplugin.hxx>
-#include <awt/vclxtabcontrol.hxx>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
-#include <com/sun/star/awt/WindowAttribute.hpp>
-#include <com/sun/star/awt/XDialog2.hpp>
-#include <com/sun/star/awt/XProgressBar.hpp>
-#include <com/sun/star/awt/XSimpleTabController.hpp>
-#include <com/sun/star/awt/XTabListener.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <comphelper/processfactory.hxx>
-#include <layout/core/factory.hxx>
-#include <layout/core/localized-string.hxx>
-#include <layout/core/root.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <vcl/ctrl.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/image.hxx>
-#include <vcl/tabctrl.hxx>
-#include <vcl/tabpage.hxx>
-#include <vcl/window.hxx>
-
-using namespace ::com::sun::star;
-using rtl::OUString;
-
-namespace layout
-{
-
-// Context bits ...
-class ContextImpl
-{
- uno::Reference< awt::XLayoutRoot > mxRoot;
- uno::Reference< container::XNameAccess > mxNameAccess;
- PeerHandle mxTopLevel;
-
-public:
- ContextImpl( char const *pPath )
- {
- uno::Sequence< uno::Any > aParams( 1 );
- aParams[0] <<= OUString( pPath, strlen( pPath ), RTL_TEXTENCODING_UTF8 );
-
- uno::Reference< lang::XSingleServiceFactory > xFactory(
- comphelper::createProcessComponent(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Layout")) ),
- uno::UNO_QUERY );
- if ( !xFactory.is() )
- {
- throw uno::RuntimeException(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "Layout engine not installed" ) ),
- uno::Reference< uno::XInterface >() );
- }
- mxRoot = uno::Reference< awt::XLayoutRoot >(
- xFactory->createInstanceWithArguments( aParams ),
- uno::UNO_QUERY );
-
- mxNameAccess = uno::Reference< container::XNameAccess >( mxRoot, uno::UNO_QUERY );
- }
-
- ~ContextImpl()
- {
- }
-
- PeerHandle getByName( const OUString &rName )
- {
- uno::Any val = mxNameAccess->getByName( rName );
- PeerHandle xRet;
- val >>= xRet;
- return xRet;
- }
- PeerHandle getTopLevel()
- {
- return mxTopLevel;
- }
- void setTopLevel( PeerHandle xToplevel )
- {
- mxTopLevel = xToplevel;
- }
- PeerHandle getRoot()
- {
- return mxRoot;
- }
-};
-
-Context::Context( const char *pPath )
- : pImpl( new ContextImpl( pPath ) )
-{
-}
-Context::~Context()
-{
- delete pImpl;
- pImpl = NULL;
-}
-
-void Context::setToplevel( PeerHandle xToplevel )
-{
- pImpl->setTopLevel( xToplevel );
-}
-
-PeerHandle Context::getToplevel()
-{
- return pImpl->getTopLevel();
-}
-PeerHandle Context::getRoot()
-{
- return pImpl->getRoot();
-}
-
-PeerHandle Context::GetPeerHandle( const char *id, sal_uInt32 nId ) const
-{
- PeerHandle xHandle;
- xHandle = pImpl->getByName( OUString( id, strlen( id ), RTL_TEXTENCODING_UTF8 ) );
- if ( !xHandle.is() )
- {
- OSL_TRACE( "Failed to fetch widget '%s'", id );
- }
-
- if ( nId != 0 )
- {
- rtl::OString aStr = rtl::OString::valueOf( (sal_Int32) nId );
- xHandle = GetPeerHandle( aStr.getStr(), 0 );
- }
- return xHandle;
-}
-
-WindowImpl::WindowImpl (Context *context, const PeerHandle &peer, Window *window)
- : mpWindow (window)
- , mpCtx (context)
- , mxWindow (peer, uno::UNO_QUERY)
- , mxVclPeer (peer, uno::UNO_QUERY)
- , mvclWindow (0)
- , bFirstTimeVisible (true)
-{
-}
-
-WindowImpl::~WindowImpl ()
-{
- if (mpWindow)
- mpWindow->mpImpl = 0;
- if (mvclWindow)
- {
- VCLXWindow *v = mvclWindow->GetWindowPeer ();
- v->SetWindow (0);
- mvclWindow->SetComponentInterface (uno::Reference <awt::XWindowPeer> ());
- mvclWindow->SetWindowPeer (uno::Reference <awt::XWindowPeer> (), 0);
- delete mvclWindow;
- mvclWindow = 0;
- }
-}
-
-void WindowImpl::wrapperGone ()
-{
- mvclWindow = 0;
- mpWindow->mpImpl = 0;
- mpWindow = 0;
- mpCtx = 0;
- if ( mxWindow.is() )
- {
- uno::Reference< lang::XComponent > xComp( mxWindow, uno::UNO_QUERY );
- mxWindow.clear ();
- if ( xComp.is() )
- xComp->dispose();
- }
-}
-
-void SAL_CALL WindowImpl::disposing (lang::EventObject const&)
- throw (uno::RuntimeException)
-{
- if (mxWindow.is ())
- mxWindow.clear ();
-}
-
-uno::Any WindowImpl::getProperty (char const* name)
-{
- if ( !this || !mxVclPeer.is() )
- return css::uno::Any();
- return mxVclPeer->getProperty
- ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ) );
-}
-
-void WindowImpl::setProperty (char const *name, uno::Any any)
-{
- if ( !this || !mxVclPeer.is() )
- return;
- mxVclPeer->setProperty
- ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ), any );
-}
-
-void WindowImpl::redraw (bool resize)
-{
- uno::Reference <awt::XWindow> ref (mxWindow, uno::UNO_QUERY);
- ::Window* window = VCLXWindow::GetImplementation (ref)->GetWindow ();
- ::Window* parent = window->GetParent();
- ::Rectangle r = Rectangle (parent->GetPosPixel (),
- parent->GetSizePixel ());
- parent->Invalidate (r, INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN );
- if (resize)
- parent->SetPosSizePixel (0, 0, 1, 1, awt::PosSize::SIZE);
- else
- parent->SetPosSizePixel (0, 0, r.nRight - r.nLeft, r.nBottom - r.nTop,
- awt::PosSize::SIZE);
-}
-
-Window::Window( WindowImpl *pImpl )
- : mpImpl( pImpl )
-{
- mpImpl->mvclWindow = GetVCLXWindow () ? GetWindow () : 0;
-}
-
-Window::~Window()
-{
- /* likely to be an UNO object - with floating references */
- if (mpImpl)
- mpImpl->wrapperGone ();
- mpImpl = 0;
-}
-
-///IMPL_GET_IMPL( Control );
-
-static ControlImpl* null_control_impl = 0;
-
-ControlImpl &Control::getImpl () const
-{
- if (ControlImpl* c = static_cast<ControlImpl *>(mpImpl))
- return *c;
- return *null_control_impl;
-}
-
-Control::~Control ()
-{
- SetGetFocusHdl (Link ());
- SetLoseFocusHdl (Link ());
-}
-
-void Window::setRes (ResId const& res)
-{
-#if RESOURCE_PUBLISH_PROTECTED
- // Resources are shut-off from use. Is that really necessary?
- Resource &r = *GetWindow ();
- r.GetRes (res);
-#else /* !RESOURCE_PUBLISH_PROTECTED */
- //We *must* derive. Is this also really necessary?
- //Resource r (res);
-
- // ugh, I wonder which solution is cleaner...
- class Resource_open_up : public Resource
- {
- public:
- Resource_open_up (ResId const& r)
- : Resource (r)
- {
- }
- static sal_Int32 GetLongRes (void *p)
- {
- return Resource::GetLongRes (p);
- }
- void* GetClassRes ()
- {
- return Resource::GetClassRes ();
- }
- sal_Int32 ReadLongRes ()
- {
- return Resource::ReadLongRes ();
- }
- UniString ReadStringRes ()
- {
- return Resource::ReadStringRes ();
- }
- rtl::OString ReadByteStringRes()
- {
- return Resource::ReadByteStringRes();
- }
- };
-
- Resource_open_up r (res);
-#endif /* !RESOURCE_PUBLISH_PROTECTED */
- sal_uInt32 mask = r.ReadLongRes ();
- if (mask & WINDOW_HELPID)
- SetHelpId (r.ReadByteStringRes());
- if ( mask & WINDOW_TEXT )
- SetText( r.ReadStringRes ());
-}
-
-void Window::SetParent( ::Window *parent )
-{
- uno::Reference <awt::XWindow> ref( GetPeer(), uno::UNO_QUERY );
- if (VCLXWindow *vcl = VCLXWindow::GetImplementation( ref ))
- if (::Window *window = vcl->GetWindow())
- window->SetParent( parent );
-}
-
-void Window::SetParent( Window *parent )
-{
- /* Let's hear it for C++: poor man's dynamic binding. */
- parent->ParentSet (this);
-}
-
-void Window::ParentSet (Window *window)
-{
- window->SetParent (GetWindow ());
-}
-
-Context *Window::getContext()
-{
- return this && mpImpl ? mpImpl->mpCtx : NULL;
-}
-
-PeerHandle Window::GetPeer() const
-{
- if ( !mpImpl )
- return PeerHandle();
- return mpImpl->mxWindow;
-}
-
-uno::Reference<awt::XWindow> Window::GetRef() const
-{
- return uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY );
-}
-
-VCLXWindow* Window::GetVCLXWindow() const
-{
- return VCLXWindow::GetImplementation( GetRef() );
-}
-
-::Window* Window::GetWindow() const
-{
- return GetVCLXWindow()->GetWindow();
-}
-
-::Window* Window::GetParent() const
-{
- return GetWindow()->GetParent();
-}
-
-void Window::SetHelpId( const rtl::OString& id )
-{
- GetWindow()->SetHelpId( id );
-}
-
-void Window::Invalidate (sal_uInt8 flags)
-{
- GetWindow ()->Invalidate (flags);
-}
-
-struct ToolkitVclPropsMap
-{
- WinBits vclStyle;
- long initAttr;
- const char *propName;
-
- // the value to give the prop to enable/disable it -- not the most brilliant
- // type declaration and storage, but does the work... properties are
- // either a boolean or a short since they are either a directly wrappers for
- // a WinBit, or aggregates related (like Align for WB_LEFT, _RIGHT and _CENTER).
- bool isBoolean;
- short enableProp, disableProp;
-};
-
-#define TYPE_BOOL true
-#define TYPE_SHORT false
-#define NOTYPE 0
-static const ToolkitVclPropsMap toolkitVclPropsMap[] =
-{
- { WB_BORDER, awt::WindowAttribute::BORDER, "Border", TYPE_SHORT, 1, 0 },
- { WB_NOBORDER, awt::VclWindowPeerAttribute::NOBORDER, "Border", TYPE_SHORT, 0, 1 },
- { WB_SIZEABLE, awt::WindowAttribute::SIZEABLE, NULL, NOTYPE, 0, 0 },
- { WB_MOVEABLE, awt::WindowAttribute::MOVEABLE, NULL, NOTYPE, 0, 0 },
- { WB_CLOSEABLE, awt::WindowAttribute::CLOSEABLE, NULL, NOTYPE, 0, 0 },
-
- { WB_HSCROLL, awt::VclWindowPeerAttribute::HSCROLL, NULL, NOTYPE, 0, 0 },
- { WB_VSCROLL, awt::VclWindowPeerAttribute::VSCROLL, NULL, NOTYPE, 0, 0 },
- { WB_LEFT, awt::VclWindowPeerAttribute::LEFT, "Align", TYPE_SHORT, 0, 0 },
- { WB_CENTER, awt::VclWindowPeerAttribute::CENTER, "Align", TYPE_SHORT, 1, 0 },
- { WB_RIGHT, awt::VclWindowPeerAttribute::RIGHT, "Align", TYPE_SHORT, 2, 0 },
- { WB_SPIN, awt::VclWindowPeerAttribute::SPIN, NULL, NOTYPE, 0, 0 },
- { WB_SORT, awt::VclWindowPeerAttribute::SORT, NULL, NOTYPE, 0, 0 },
- { WB_DROPDOWN, awt::VclWindowPeerAttribute::DROPDOWN, "Dropdown", TYPE_BOOL, 1, 0 },
- { WB_DEFBUTTON, awt::VclWindowPeerAttribute::DEFBUTTON, "DefaultButton", TYPE_BOOL, 1, 0 },
- { WB_READONLY, awt::VclWindowPeerAttribute::READONLY, NULL, NOTYPE, 0, 0 },
- { WB_CLIPCHILDREN, awt::VclWindowPeerAttribute::CLIPCHILDREN, NULL, NOTYPE, 0, 0 },
- { WB_GROUP, awt::VclWindowPeerAttribute::GROUP, NULL, NOTYPE, 0, 0 },
-
- { WB_OK, awt::VclWindowPeerAttribute::OK, NULL, NOTYPE, 0, 0 },
- { WB_OK_CANCEL, awt::VclWindowPeerAttribute::OK_CANCEL, NULL, NOTYPE, 0, 0 },
- { WB_YES_NO, awt::VclWindowPeerAttribute::YES_NO, NULL, NOTYPE, 0, 0 },
- { WB_YES_NO_CANCEL, awt::VclWindowPeerAttribute::YES_NO_CANCEL, NULL, NOTYPE, 1, 0 },
- { WB_RETRY_CANCEL, awt::VclWindowPeerAttribute::RETRY_CANCEL, NULL, NOTYPE, 1, 0 },
- { WB_DEF_OK, awt::VclWindowPeerAttribute::DEF_OK, NULL, NOTYPE, 0, 0 },
- { WB_DEF_CANCEL, awt::VclWindowPeerAttribute::DEF_CANCEL, NULL, NOTYPE, 1, 0 },
- { WB_DEF_RETRY, awt::VclWindowPeerAttribute::DEF_RETRY, NULL, NOTYPE, 0, 0 },
- { WB_DEF_YES, awt::VclWindowPeerAttribute::DEF_YES, NULL, NOTYPE, 0, 0 },
- { WB_DEF_NO, awt::VclWindowPeerAttribute::DEF_NO, NULL, NOTYPE, 0, 0 },
-
- { WB_AUTOHSCROLL, awt::VclWindowPeerAttribute::AUTOHSCROLL, "AutoHScroll", TYPE_BOOL, 1, 0 },
- { WB_AUTOVSCROLL, awt::VclWindowPeerAttribute::AUTOVSCROLL, "AutoVScroll", TYPE_BOOL, 1, 0 },
-
- { WB_WORDBREAK, 0, "MultiLine", TYPE_BOOL, 1, 0 },
- { WB_NOPOINTERFOCUS, 0, "FocusOnClick", TYPE_BOOL, 1, 0 },
- { WB_TOGGLE, 0, "Toggle", TYPE_BOOL, 1, 0 },
- { WB_REPEAT, 0, "Repeat", TYPE_BOOL, 1, 0 },
- { WB_NOHIDESELECTION, 0, "HideInactiveSelection", TYPE_BOOL, 1, 0 },
-};
-#undef TYPE_BOOL
-#undef TYPE_SHORT
-#undef NOTYPE
-
-static const int toolkitVclPropsMapLen =
- sizeof( toolkitVclPropsMap ) / sizeof( ToolkitVclPropsMap );
-
-/* Unpleasant way to get an xToolkit pointer ... */
-uno::Reference< awt::XToolkit > getToolkit()
-{
- static uno::Reference< awt::XToolkit > xToolkit;
- if (!xToolkit.is())
- {
- // Urgh ...
- xToolkit = uno::Reference< awt::XToolkit >(
- ::comphelper::getProcessServiceFactory()->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ),
- uno::UNO_QUERY );
- if ( !xToolkit.is() )
- throw uno::RuntimeException(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "failed to create toolkit!") ),
- uno::Reference< uno::XInterface >() );
- }
- return xToolkit;
-}
-
-PeerHandle Window::CreatePeer( Window *parent, WinBits nStyle, const char *pName)
-{
- long nWinAttrbs = 0;
- for (int i = 0; i < toolkitVclPropsMapLen; i++)
- if ( nStyle & toolkitVclPropsMap[ i ].vclStyle )
- nWinAttrbs |= toolkitVclPropsMap[ i ].initAttr;
-
- return layoutimpl::WidgetFactory::createWidget (getToolkit(), parent->GetPeer(), OUString::createFromAscii( pName ), nWinAttrbs);
-}
-
-void Window::Show( bool bVisible )
-{
- if ( !getImpl().mxWindow.is() )
- return;
- getImpl().mxWindow->setVisible( bVisible );
- if (!bVisible)
- getImpl ().bFirstTimeVisible = true;
- else if (GetParent() && getImpl().bFirstTimeVisible)
- {
- getImpl().redraw ();
- getImpl().bFirstTimeVisible = false;
- }
-}
-
-void Window::SetText( OUString const& str )
-{
- GetWindow()->SetText( str );
-}
-
-ControlImpl::ControlImpl (Context *context, const PeerHandle &peer, Window *window)
- : WindowImpl( context, peer, window )
-{
-}
-
-ControlImpl::~ControlImpl ()
-{
- if ((!!mGetFocusHdl || !!mLoseFocusHdl) && mxWindow.is ())
- /* Disposing will be done @ VCLXWindow::dispose () maFocusListeners.disposeAndClear()
- don't do it twice */
- mxWindow.clear ();
-}
-
-void ControlImpl::SetGetFocusHdl (Link const& link)
-{
- if (!mLoseFocusHdl || !link)
- UpdateListening (link);
- mGetFocusHdl = link;
-}
-
-Link& ControlImpl::GetGetFocusHdl ()
-{
- return mGetFocusHdl;
-}
-
-void ControlImpl::SetLoseFocusHdl (Link const& link)
-{
- if (!mGetFocusHdl || !link)
- UpdateListening (link);
- mLoseFocusHdl = link;
-}
-
-Link& ControlImpl::GetLoseFocusHdl ()
-{
- return mGetFocusHdl;
-}
-
-void ControlImpl::UpdateListening (Link const& link)
-{
- if (!link && (!!mGetFocusHdl || !!mLoseFocusHdl)
- && (!mGetFocusHdl || !mLoseFocusHdl))
- mxWindow->removeFocusListener (this);
- else if (!!link && !mGetFocusHdl && !mLoseFocusHdl)
- mxWindow->addFocusListener (this);
-}
-
-void SAL_CALL ControlImpl::disposing (lang::EventObject const&)
- throw (uno::RuntimeException)
-{
-/// mxWindow.clear ();
-}
-
-void SAL_CALL ControlImpl::focusGained (awt::FocusEvent const&)
- throw (uno::RuntimeException)
-{
- mGetFocusHdl.Call (mpWindow);
-}
-
-void SAL_CALL ControlImpl::focusLost (awt::FocusEvent const&)
- throw (uno::RuntimeException)
-{
- mLoseFocusHdl.Call (mpWindow);
-}
-
-Link& Control::GetGetFocusHdl ()
-{
- return getImpl ().GetGetFocusHdl ();
-}
-
-void Control::SetGetFocusHdl (Link const& link)
-{
- if (&getImpl () && getImpl().mxWindow.is ())
- getImpl ().SetGetFocusHdl (link);
-}
-
-Link& Control::GetLoseFocusHdl ()
-{
- return getImpl ().GetLoseFocusHdl ();
-}
-
-void Control::SetLoseFocusHdl (Link const& link)
-{
- if (&getImpl () && getImpl().mxWindow.is ())
- getImpl ().SetLoseFocusHdl (link);
-}
-
-class DialogImpl : public WindowImpl
-{
-public:
- uno::Reference< awt::XDialog2 > mxDialog;
- DialogImpl( Context *context, PeerHandle const &peer, Window *window );
-};
-
-DialogImpl::DialogImpl( Context *context, const PeerHandle &peer, Window *window )
- : WindowImpl( context, peer, window )
- , mxDialog( peer, uno::UNO_QUERY )
-{
-}
-
-Dialog::Dialog( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId )
- : Context( xml_file )
- , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) )
- , bConstruct (true)
-{
- if ( parent )
- SetParent( parent );
-}
-
-Dialog::Dialog( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId )
- : Context( xml_file )
- , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) )
-{
- if ( parent )
- SetParent( parent );
-}
-
-Dialog::~Dialog ()
-{
-}
-
-IMPL_GET_WINDOW (Dialog);
-IMPL_GET_IMPL (Dialog);
-
-#define MX_DIALOG if (getImpl ().mxDialog.is ()) getImpl ().mxDialog
-#define RETURN_MX_DIALOG if (getImpl ().mxDialog.is ()) return getImpl ().mxDialog
-
-short Dialog::Execute()
-{
- RETURN_MX_DIALOG->execute ();
- return -1;
-}
-
-void Dialog::EndDialog( long result )
-{
- MX_DIALOG->endDialog (result);
-}
-
-void Dialog::SetText( OUString const& str )
-{
- SetTitle (str);
-}
-
-void Dialog::SetTitle( OUString const& str )
-{
- MX_DIALOG->setTitle (str);
-}
-
-bool Dialog::Close ()
-{
- EndDialog (false);
- return true;
-}
-
-long Dialog::Notify (NotifyEvent& event)
-{
- return GetDialog ()->Notify (event);
-}
-
-void Dialog::Initialize (SfxChildWinInfo*)
-{
-}
-
-#define MESSAGE_BOX_MEMBER_INIT\
- Dialog (parent, xml_file, id)\
- , imageError (this, "FI_ERROR")\
- , imageInfo (this, "FI_INFO")\
- , imageQuery (this, "FI_QUERY")\
- , imageWarning (this, "FI_WARNING")\
- , messageText (this, "FT_MESSAGE")\
- , cancelButton (this, "BTN_CANCEL")\
- , helpButton (this, "BTN_HELP")\
- , ignoreButton (this, "BTN_IGNORE")\
- , noButton (this, "BTN_NO")\
- , retryButton (this, "BTN_RETRY")\
- , yesButton (this, "BTN_YES")
-
-MessageBox::MessageBox (::Window *parent, char const* message,
- char const* yes, char const* no, const rtl::OString& help_id,
- char const* xml_file, char const* id)
- : MESSAGE_BOX_MEMBER_INIT
-{
- ignoreButton.Hide ();
- retryButton.Hide ();
- init (message, yes, no, help_id);
-}
-
-MessageBox::MessageBox (::Window *parent, OUString const& message,
- OUString yes, OUString no, const rtl::OString& help_id,
- char const* xml_file, char const* id)
- : MESSAGE_BOX_MEMBER_INIT
-{
- ignoreButton.Hide ();
- retryButton.Hide ();
- init (message, yes, no, help_id);
-}
-
-#if !defined (__GNUC__)
-#define __PRETTY_FUNCTION__ __FUNCTION__
-#endif /* !__GNUC__ */
-
-MessageBox::MessageBox (::Window *parent, WinBits bits, char const* message,
- char const* yes, char const* no, const rtl::OString& help_id,
- char const* xml_file, char const* id)
- : MESSAGE_BOX_MEMBER_INIT
-{
- // HIG suggests using verbs instead of yes/no/retry etc.
- // This constructor provides client-code compatibility: Client code should be fixed.
-#ifndef __SUNPRO_CC
- OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__);
-#endif
- bits_init (bits, OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id);
-}
-
-MessageBox::MessageBox (::Window *parent, WinBits bits, OUString const& message,
- OUString yes, OUString no, const rtl::OString& help_id,
- char const* xml_file, char const* id)
- : MESSAGE_BOX_MEMBER_INIT
-{
- // HIG suggests using verbs instead of yes/no/retry etc.
- // This constructor provides client-code compatibility: Client code should be fixed.
-#ifndef __SUNPRO_CC
- OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__);
-#endif
- bits_init (bits, message, yes, no, help_id);
-}
-
-void MessageBox::bits_init (WinBits bits, OUString const& message,
- OUString yes, OUString no, const rtl::OString& help_id)
-{
- if ( bits & ( WB_OK_CANCEL | WB_OK ))
- yes = Button::GetStandardText ( BUTTON_OK );
- if ( bits & (WB_YES_NO | WB_YES_NO_CANCEL ))
- {
- yes = Button::GetStandardText ( BUTTON_YES );
- no = Button::GetStandardText ( BUTTON_NO );
- }
- if (! (bits & (WB_RETRY_CANCEL | WB_YES_NO_CANCEL | WB_ABORT_RETRY_IGNORE )))
- cancelButton.Hide ();
- if (! (bits & (WB_RETRY_CANCEL | WB_ABORT_RETRY_IGNORE)))
- retryButton.Hide ();
- if ( bits & WB_ABORT_RETRY_IGNORE )
- cancelButton.SetText ( Button::GetStandardText (BUTTON_ABORT));
- else
- ignoreButton.Hide ();
- if ( !(bits & ( WB_OK | WB_OK_CANCEL | WB_YES_NO | WB_YES_NO_CANCEL)))
- yesButton.Hide ();
- if ( !(bits & ( WB_YES_NO | WB_YES_NO_CANCEL)))
- noButton.Hide ();
-
- init (message, yes, no, help_id);
-}
-
-void MessageBox::init (char const* message, char const* yes, char const* no, const rtl::OString& help_id)
-{
- init ( OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id);
-}
-
-void MessageBox::init (OUString const& message, OUString const& yes, OUString const& no, const rtl::OString& help_id)
-{
- imageError.Hide ();
- imageInfo.Hide ();
- imageQuery.Hide ();
- imageWarning.Hide ();
- if (message.getLength ())
- messageText.SetText (message);
- if (yes.getLength ())
- {
- yesButton.SetText (yes);
- if (yes != OUString (Button::GetStandardText (BUTTON_OK))
- && yes != OUString (Button::GetStandardText (BUTTON_YES)))
- SetTitle (yes);
- if (no.getLength ())
- noButton.SetText (no);
- else
- noButton.Hide ();
- }
- if (help_id)
- SetHelpId (help_id);
- else
- helpButton.Hide ();
-}
-
-#undef MESSAGE_BOX_IMPL
-#define MESSAGE_BOX_IMPL(Name)\
- Name##Box::Name##Box (::Window *parent, char const* message,\
- char const* yes, char const* no, const rtl::OString& help_id,\
- char const* xml_file, char const* id)\
- : MessageBox (parent, message, yes, no, help_id, xml_file, id)\
- {\
- image##Name.Show ();\
- }\
- Name##Box::Name##Box (::Window *parent, OUString const& message,\
- OUString yes, OUString no, const rtl::OString& help_id,\
- char const* xml_file, char const* id)\
- : MessageBox (parent, message, yes, no, help_id, xml_file, id)\
- {\
- image##Name.Show ();\
- }\
- Name##Box::Name##Box (::Window *parent, WinBits bits, char const* message,\
- char const* yes, char const* no, const rtl::OString& help_id,\
- char const* xml_file, char const* id)\
- : MessageBox (parent, bits, message, yes, no, help_id, xml_file, id)\
- {\
- image##Name.Show ();\
- }\
- Name##Box::Name##Box (::Window *parent, WinBits bits, OUString const& message,\
- OUString yes, OUString no, const rtl::OString& help_id,\
- char const* xml_file, char const* id)\
- : MessageBox (parent, bits, message, yes, no, help_id, xml_file, id)\
- {\
- image##Name.Show ();\
- }
-
-MESSAGE_BOX_IMPL (Error);
-MESSAGE_BOX_IMPL (Info);
-MESSAGE_BOX_IMPL (Query);
-MESSAGE_BOX_IMPL (Warning);
-
-class TabControlImpl
- : public ControlImpl
- , public ::cppu::WeakImplHelper1 <awt::XTabListener>
-{
- Link mActivatePageHdl;
- Link mDeactivatePageHdl;
-
-public:
- uno::Reference <awt::XSimpleTabController> mxTabControl;
- TabControlImpl (Context *context, const PeerHandle &peer, Window *window)
- : ControlImpl (context, peer, window)
- , mxTabControl (peer, uno::UNO_QUERY)
- {
- }
-
- virtual void SAL_CALL disposing (lang::EventObject const& e)
- throw (uno::RuntimeException)
- {
- ControlImpl::disposing (e);
- mxTabControl.clear ();
- }
-
- Link& GetActivatePageHdl ()
- {
- return mActivatePageHdl;
- }
-
- void SetActivatePageHdl (Link const& link)
- {
- if (!mDeactivatePageHdl || !link)
- UpdateListening (link);
- mActivatePageHdl = link;
- }
-
- Link& GetDeactivatePageHdl ()
- {
- return mDeactivatePageHdl;
- }
-
- void SetDeactivatePageHdl (Link const& link)
- {
- if (!mActivatePageHdl || !link)
- UpdateListening (link);
- mDeactivatePageHdl = link;
- }
-
- void UpdateListening (Link const& link)
- {
- if (!link && (!!mActivatePageHdl || !!mDeactivatePageHdl))
- mxTabControl->removeTabListener (this);
- else if (!!link && !mActivatePageHdl && !mDeactivatePageHdl)
- mxTabControl->addTabListener (this);
- }
-
- void SAL_CALL activated (sal_Int32)
- throw (uno::RuntimeException)
- {
- mActivatePageHdl.Call (mpWindow);
- }
-
- void SAL_CALL deactivated (sal_Int32)
- throw (uno::RuntimeException)
- {
- mDeactivatePageHdl.Call (mpWindow);
- }
-
- void SAL_CALL inserted (sal_Int32)
- throw (uno::RuntimeException)
- {
- }
-
- void SAL_CALL removed (sal_Int32)
- throw (uno::RuntimeException)
- {
- }
-
- void SAL_CALL changed (sal_Int32, uno::Sequence <beans::NamedValue> const&)
- throw (uno::RuntimeException)
- {
- }
-};
-
-IMPL_GET_WINDOW (TabControl);
-IMPL_GET_LAYOUT_VCLXWINDOW (TabControl);
-
-#define MX_TABCONTROL if (getImpl ().mxTabControl.is ()) getImpl ().mxTabControl
-#define RETURN_MX_TABCONTROL if (getImpl ().mxTabControl.is ()) return getImpl ().mxTabControl
-
-TabControl::~TabControl ()
-{
- SetActivatePageHdl (Link ());
- SetDeactivatePageHdl (Link ());
-}
-
-void TabControl::InsertPage (sal_uInt16 id, OUString const& title, sal_uInt16 pos)
-{
- (void) pos;
-
- MX_TABCONTROL->insertTab ();
- SetCurPageId (id);
-
-#if 1 // colour me loc productive -- NOT
-#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 > seq (1);
- ADD_PROP ( seq, 0, "Title", OUString (title) );
- MX_TABCONTROL->setTabProps (id, seq);
-#else
- GetTabPage (id)->SetText (title);
-#endif
-}
-void TabControl::RemovePage (sal_uInt16 id)
-{
- GetTabControl ()->RemovePage (id);
-}
-sal_uInt16 TabControl::GetPageCount () const
-{
- return GetTabControl ()->GetPageCount ();
-}
-sal_uInt16 TabControl::GetPageId (sal_uInt16 pos) const
-{
- return GetTabControl ()->GetPageId (pos);
-}
-sal_uInt16 TabControl::GetPagePos (sal_uInt16 id) const
-{
- getImpl ().redraw ();
- return GetTabControl ()->GetPagePos (id);
-}
-void TabControl::SetCurPageId (sal_uInt16 id)
-{
- getImpl ().redraw ();
- GetTabControl ()->SetCurPageId (id);
-}
-sal_uInt16 TabControl::GetCurPageId () const
-{
- return GetTabControl ()->GetCurPageId ();
-}
-void TabControl::SetTabPage (sal_uInt16 id, ::TabPage* page)
-{
- GetTabControl ()->SetTabPage (id, page);
- getImpl ().redraw ();
-}
-::TabPage* TabControl::GetTabPage (sal_uInt16 id) const
-{
- return GetTabControl ()->GetTabPage (id);
-}
-void TabControl::SetActivatePageHdl (Link const& link)
-{
- if (&getImpl () && getImpl().mxTabControl.is ())
- getImpl ().SetActivatePageHdl (link);
-}
-Link& TabControl::GetActivatePageHdl () const
-{
- return getImpl ().GetActivatePageHdl ();
-}
-void TabControl::SetDeactivatePageHdl (Link const& link)
-{
- if (&getImpl () && getImpl().mxTabControl.is ())
- getImpl ().SetDeactivatePageHdl (link);
-}
-Link& TabControl::GetDeactivatePageHdl () const
-{
- return getImpl ().GetDeactivatePageHdl ();
-}
-void TabControl::SetTabPageSizePixel (Size const& size)
-{
- GetTabControl ()->SetTabPageSizePixel (size);
-}
-Size TabControl::GetTabPageSizePixel () const
-{
- return GetTabControl ()->GetTabPageSizePixel ();
-}
-
-IMPL_CONSTRUCTORS (TabControl, Control, "tabcontrol");
-IMPL_GET_IMPL (TabControl);
-
-class TabPageImpl : public WindowImpl
-{
-public:
- uno::Reference< awt::XWindow > mxTabPage;
- TabPageImpl( Context *context, const PeerHandle &peer, Window *window )
- : WindowImpl( context, peer, window )
- , mxTabPage( peer, uno::UNO_QUERY )
- {
- }
-};
-
-::Window* TabPage::global_parent = 0;
-TabControl* TabPage::global_tabcontrol = 0;
-
-IMPL_GET_IMPL( TabPage );
-
-TabPage::TabPage( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId)
- : Context( xml_file )
- , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) )
-{
- if ( parent )
- SetParent( parent );
-}
-
-TabPage::TabPage( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId)
- : Context( xml_file )
- , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) )
-{
- if ( parent )
- SetParent( parent );
-}
-
-TabPage::~TabPage()
-{
- delete GetTabPage();
-}
-
-IMPL_GET_WINDOW( TabPage );
-
-void TabPage::ActivatePage()
-{
-}
-
-void TabPage::DeactivatePage()
-{
-}
-
-class FixedLineImpl : public ControlImpl
-{
-public:
- FixedLineImpl( Context *context, const PeerHandle &peer, Window *window )
- : ControlImpl( context, peer, window )
- {
- }
-};
-
-IMPL_CONSTRUCTORS( FixedLine, Control, "hfixedline" );
-IMPL_GET_IMPL( FixedLine );
-
-bool FixedLine::IsEnabled() const
-{
- //FIXME
- return true;
-}
-
-class FixedTextImpl : public ControlImpl
-{
-public:
- uno::Reference< awt::XFixedText > mxFixedText;
- FixedTextImpl( Context *context, const PeerHandle &peer, Window *window )
- : ControlImpl( context, peer, window )
- , mxFixedText( peer, uno::UNO_QUERY )
- {
- }
-
- ~FixedTextImpl ();
-
- virtual void SAL_CALL disposing( lang::EventObject const& e )
- throw (uno::RuntimeException);
-};
-
-FixedTextImpl::~FixedTextImpl ()
-{
-}
-
-void SAL_CALL FixedTextImpl::disposing( lang::EventObject const& e )
- throw (uno::RuntimeException)
-{
- ControlImpl::disposing (e);
- mxFixedText.clear ();
-}
-
-FixedText::~FixedText ()
-{
-}
-
-IMPL_CONSTRUCTORS( FixedText, Control, "fixedtext" );
-IMPL_GET_IMPL( FixedText );
-
-void FixedText::SetText( OUString const& rStr )
-{
- if ( !getImpl().mxFixedText.is() )
- return;
- getImpl().mxFixedText->setText( rStr );
-}
-
-class FixedInfoImpl : public FixedTextImpl
-{
-public:
- FixedInfoImpl( Context *context, const PeerHandle &peer, Window *window )
- : FixedTextImpl( context, peer, window )
- {
- }
-};
-
-IMPL_CONSTRUCTORS( FixedInfo, FixedText, "fixedinfo" );
-IMPL_GET_IMPL( FixedInfo );
-
-class ProgressBarImpl : public ControlImpl
-{
-public:
- uno::Reference< awt::XProgressBar > mxProgressBar;
- ProgressBarImpl( Context *context, const PeerHandle &peer, Window *window )
- : ControlImpl( context, peer, window )
- , mxProgressBar( peer, uno::UNO_QUERY )
- {
- }
-
- virtual void SAL_CALL disposing( lang::EventObject const& e )
- throw (uno::RuntimeException)
- {
- ControlImpl::disposing (e);
- mxProgressBar.clear ();
- }
-};
-
-
-class FixedImageImpl: public ControlImpl
-{
-public:
- uno::Reference< graphic::XGraphic > mxGraphic;
- FixedImageImpl( Context *context, const PeerHandle &peer, Window *window)
- : ControlImpl( context, peer, window )
- , mxGraphic( peer, uno::UNO_QUERY )
- {
- if ( !mxGraphic.is() )
- {
- OSL_FAIL( "ERROR: failed to load image: `%s'" );
- }
- }
-};
-
-IMPL_CONSTRUCTORS( FixedImage, Control, "fixedimage" );
-IMPL_GET_IMPL( FixedImage )
-
-void FixedImage::setImage( ::Image const& i )
-{
- (void) i;
- if ( !getImpl().mxGraphic.is() )
- return;
- //FIXME: hack moved to proplist
- //getImpl().mxGraphic =
-}
-
-
-IMPL_CONSTRUCTORS( ProgressBar, Control, "ProgressBar" );
-IMPL_GET_IMPL( ProgressBar );
-
-void ProgressBar::SetForegroundColor( util::Color color )
-{
- if ( !getImpl().mxProgressBar.is() )
- return;
- getImpl().mxProgressBar->setForegroundColor( color );
-}
-
-void ProgressBar::SetBackgroundColor( util::Color color )
-{
- if ( !getImpl().mxProgressBar.is() )
- return;
- getImpl().mxProgressBar->setBackgroundColor( color );
-}
-
-void ProgressBar::SetValue( sal_Int32 i )
-{
- if ( !getImpl().mxProgressBar.is() )
- return;
- getImpl().mxProgressBar->setValue( i );
-}
-
-void ProgressBar::SetRange( sal_Int32 min, sal_Int32 max )
-{
- if ( !getImpl().mxProgressBar.is() )
- return;
- getImpl().mxProgressBar->setRange( min, max );
-}
-
-sal_Int32 ProgressBar::GetValue()
-{
- if ( !getImpl().mxProgressBar.is() )
- return 0;
- return getImpl().mxProgressBar->getValue();
-}
-
-class PluginImpl: public ControlImpl
-{
-public:
- ::Control *mpPlugin;
-
- PluginImpl( Context *context, const PeerHandle &peer, Window *window, :: Control *plugin )
- : ControlImpl( context, peer, window )
- , mpPlugin( plugin )
- {
- uno::Reference <awt::XWindow> ref( mxWindow, uno::UNO_QUERY );
- layoutimpl::VCLXPlugin *vcl
- = static_cast<layoutimpl::VCLXPlugin*>( VCLXWindow::GetImplementation( ref ) );
- ::Window *parent = vcl->mpWindow->GetParent();
- vcl->SetWindow( plugin );
- vcl->SetPlugin( mpPlugin );
- plugin->SetParent( parent );
- plugin->SetStyle( vcl->mStyle );
- plugin->SetCreatedWithToolkit( true );
- plugin->SetComponentInterface( vcl );
- plugin->Show();
- }
-};
-
-Plugin::Plugin( Context *context, char const *id, ::Control *plugin )
- : Control( new PluginImpl( context, context->GetPeerHandle( id, 0 ), this, plugin ) )
- , mpPlugin( plugin )
-{
-}
-
-IMPL_GET_IMPL( Plugin );
-
-class LocalizedStringImpl : public WindowImpl
-{
-public:
- layoutimpl::LocalizedString *mpString;
- OUString maString;
- LocalizedStringImpl( Context *context, const PeerHandle &peer, Window *window )
- : WindowImpl( context, peer, window )
- , mpString( static_cast<layoutimpl::LocalizedString*>( VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( mxWindow, uno::UNO_QUERY ) ) ) )
- , maString ()
- {
- }
- OUString getText()
- {
- if (mpString)
- maString = mpString->getText ();
- return maString;
- }
- void setText( OUString const& s )
- {
- if (mpString)
- mpString->setText( s );
- }
-};
-
-IMPL_GET_IMPL( LocalizedString );
-
-LocalizedString::LocalizedString( Context *context, char const* id )
- : Window( new LocalizedStringImpl( context, context->GetPeerHandle( id, 0 ), this ) )
-{
-}
-
-String LocalizedString::getString ()
-{
- return getImpl ().getText ();
-}
-
-OUString LocalizedString::getOUString ()
-{
- return getImpl ().getText ();
-}
-
-LocalizedString::operator OUString ()
-{
- return getOUString ();
-}
-
-LocalizedString::operator OUString const& ()
-{
- getOUString ();
- return getImpl ().maString;
-}
-
-LocalizedString::operator String()
-{
- getOUString ();
- return getImpl ().maString;
-}
-
-String LocalizedString::GetToken (sal_uInt16 i, sal_Char c)
-{
- return getString ().GetToken (i, c);
-}
-
-OUString LocalizedString::operator= (OUString const& s)
-{
- getImpl().setText( s );
- return getImpl().getText();
-}
-
-OUString LocalizedString::operator+= (OUString const& b)
-{
- OUString a = getImpl ().getText ();
- a += b;
- getImpl ().setText (a);
- return getImpl ().getText ();
-}
-
-OUString LocalizedString::operator+= (sal_Unicode const b)
-{
- String a = getImpl ().getText ();
- a += b;
- getImpl ().setText (a);
- return getImpl ().getText ();
-}
-
-class InPlugImpl : public WindowImpl
-{
-public:
- InPlugImpl (Context *context, const PeerHandle &peer, Window *window)
- : WindowImpl (context, peer, window)
- {
- }
-};
-
-IMPL_GET_IMPL (InPlug);
-
-static char const *FIXME_set_parent (::Window *parent, char const *xml_file)
-{
- layout::TabPage::global_parent = parent;
- return xml_file;
-}
-
-InPlug::InPlug (Window *parent, char const* xml_file, char const* id, sal_uInt32 nId)
- : Context (FIXME_set_parent (parent ? parent->GetWindow () : 0, xml_file))
- , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this))
-{
- if (parent)
- SetParent (parent);
- if (::Window *w = dynamic_cast< ::Window* > (this))
- w->SetComponentInterface (GetVCLXWindow ());
-}
-
-InPlug::InPlug (::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId)
- : Context (FIXME_set_parent (parent, xml_file))
- , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this))
-{
- if (parent)
- layout::Window::SetParent (parent);
- if (::Window *w = dynamic_cast< ::Window* > (this))
- w->SetComponentInterface (GetVCLXWindow ());
-}
-
-void InPlug::ParentSet (Window *window)
-{
- window->SetParent (dynamic_cast< ::Window* > (this));
-
- /// FIXME: for standalone run of layout::SfxTabDialog
- SetParent (window->GetParent ());
-}
-
-} // namespace layout
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/layout/vcl/wrapper.hxx b/toolkit/source/layout/vcl/wrapper.hxx
deleted file mode 100644
index 56046cc73f..0000000000
--- a/toolkit/source/layout/vcl/wrapper.hxx
+++ /dev/null
@@ -1,152 +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_VCL_WRAPPER_HXX
-#define LAYOUT_VCL_WRAPPER_HXX
-
-#include <layout/layout.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/awt/XDialog2.hpp>
-#include <com/sun/star/awt/XFocusListener.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-#include <cstring>
-
-namespace layout
-{
-
-namespace css = com::sun::star;
-
-class WindowImpl
-{
-public:
- Window *mpWindow;
- Context *mpCtx;
- css::uno::Reference< css::awt::XWindow > mxWindow;
- css::uno::Reference< css::awt::XVclWindowPeer > mxVclPeer;
- ::Window *mvclWindow;
- bool bFirstTimeVisible;
-
- WindowImpl (Context *context, PeerHandle const &peer, Window *window);
- virtual ~WindowImpl ();
-
- void wrapperGone();
- css::uno::Any getProperty (char const *name);
- void setProperty (char const *name, css::uno::Any any);
- void redraw (bool resize=false);
-
- // XFocusListener
- virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException);
-};
-
-class ControlImpl : public WindowImpl
- , public ::cppu::WeakImplHelper1 <css::awt::XFocusListener>
-{
-public:
- Link mGetFocusHdl;
- Link mLoseFocusHdl;
-
- ControlImpl( Context *context, PeerHandle const& peer, Window *window );
- ~ControlImpl ();
-
- virtual void SetGetFocusHdl (Link const& link);
- Link& GetGetFocusHdl ();
- virtual void SetLoseFocusHdl (Link const& link);
- Link& GetLoseFocusHdl ();
- virtual void UpdateListening (Link const& link);
-
- // XFocusListener
- virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException);
- void SAL_CALL focusGained (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException);
- void SAL_CALL focusLost (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException);
-};
-
-inline WindowImpl &Window::getImpl() const{ return *(static_cast< WindowImpl * >( mpImpl )); }
-
-// Helpers for defining boiler-plate constructors ...
-// Could in-line in top-level but not with safe static_casts.
-#define IMPL_GET_IMPL(t) \
- inline t##Impl &t::getImpl() const \
- { \
- return *(static_cast<t##Impl *>(mpImpl)); \
- }
-#define IMPL_CONSTRUCTORS_BODY(t,par,unoName,body) \
- t::t( Context *context, const char *pId, sal_uInt32 nId ) \
- : par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \
- { \
- Window *parent = dynamic_cast<Window*> (context);\
- body;\
- if (parent)\
- SetParent (parent);\
- } \
- t::t( Window *parent, WinBits bits) \
- : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \
- { \
- body;\
- if ( parent )\
- SetParent (parent);\
- } \
- t::t( Window *parent, ResId const& res) \
- : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, 0, unoName ), this ) ) \
- { \
- body;\
- setRes (res);\
- if (parent)\
- SetParent (parent);\
- }
-#define IMPL_CONSTRUCTORS(t,par,unoName) IMPL_CONSTRUCTORS_BODY(t, par, unoName, )
-#define IMPL_CONSTRUCTORS_2(t,win_par,other_par,unoName) \
- t::t( Context *context, const char *pId, sal_uInt32 nId ) \
- : win_par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \
- , other_par( new other_par##Impl( Window::GetPeer() ) ) \
- { \
- } \
- t::t( Window *parent, WinBits bits) \
- : win_par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \
- , other_par( new other_par##Impl( Window::GetPeer() ) ) \
- { \
- }
-
-#define IMPL_IMPL(t, parent) \
- class t##Impl : public parent##Impl \
- { \
- public: \
- t##Impl( Context *context, PeerHandle const& peer, Window *window ) \
- : parent##Impl( context, peer, window ) \
- { \
- } \
- };
-
-
-} // namespace layout
-
-#endif /* LAYOUT_VCL_WRAPPER_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */