summaryrefslogtreecommitdiffstats
path: root/toolkit/source/controls
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-03-27 16:05:12 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-03-27 16:05:12 +0000
commitfd2cf3dc7cd9c73070fa4d70c8ca99c9fc1ce135 (patch)
tree9569a564e06fba817528ea414129b4074d83cb61 /toolkit/source/controls
parentMWS_SRX644: migrate branch mws_srx644 -> HEAD (diff)
downloadcore-fd2cf3dc7cd9c73070fa4d70c8ca99c9fc1ce135.tar.gz
core-fd2cf3dc7cd9c73070fa4d70c8ca99c9fc1ce135.zip
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'toolkit/source/controls')
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx1381
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx230
-rw-r--r--toolkit/source/controls/geometrycontrolmodel.cxx194
-rw-r--r--toolkit/source/controls/makefile.mk8
-rw-r--r--toolkit/source/controls/stdtabcontroller.cxx207
-rw-r--r--toolkit/source/controls/unocontrol.cxx144
-rw-r--r--toolkit/source/controls/unocontrolbase.cxx14
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx30
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx44
-rw-r--r--toolkit/source/controls/unocontrols.cxx1205
10 files changed, 1984 insertions, 1473 deletions
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
new file mode 100644
index 000000000000..42dc7949f125
--- /dev/null
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -0,0 +1,1381 @@
+/*************************************************************************
+ *
+ * $RCSfile: dialogcontrol.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2003-03-27 17:03:19 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_DIALOG_CONTROL_HXX
+#include <toolkit/controls/dialogcontrol.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_PROPERTY_HXX_
+#include <toolkit/helper/property.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#endif
+#ifndef _TOOLKIT_HELPERS_GEOMETRYCONTROLMODEL_HXX_
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_UNOCONTROLS_HXX_
+#include <toolkit/controls/unocontrols.hxx>
+#endif
+#include "toolkit/controls/formattedcontrol.hxx"
+#ifndef _TOOLKIT_CONTROLS_STDTABCONTROLLER_HXX_
+#include <toolkit/controls/stdtabcontroller.hxx>
+#endif
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
+#include <comphelper/processfactory.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <vcl/outdev.hxx>
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+
+#include <map>
+#include <algorithm>
+
+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;
+
+// ----------------------------------------------------------------------------
+// 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& )
+ {
+ DBG_ERROR( "DisposeControlModel::(): caught an exception while disposing a component!" );
+ }
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for searching control model by name
+struct FindControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, bool >
+{
+private:
+ const ::rtl::OUString& m_rName;
+
+public:
+ FindControlModel( const ::rtl::OUString& _rName ) : m_rName( _rName ) { }
+
+ bool operator()( const UnoControlDialogModel::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< UnoControlDialogModel::UnoControlModelHolder, void >
+{
+private:
+ UnoControlDialogModel::UnoControlModelHolderList& m_rTargetList;
+
+public:
+ CloneControlModel( UnoControlDialogModel::UnoControlModelHolderList& _rTargetList )
+ :m_rTargetList( _rTargetList )
+ {
+ }
+
+ void operator()( const UnoControlDialogModel::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( UnoControlDialogModel::UnoControlModelHolder( xClone, _rSource.second ) );
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for comparing a XControlModel with a given reference
+struct CompareControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, bool >
+{
+private:
+ Reference< XControlModel > m_xReference;
+public:
+ CompareControlModel( const Reference< XControlModel >& _rxReference ) : m_xReference( _rxReference ) { }
+
+ bool operator()( const UnoControlDialogModel::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 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 UnoControlDialogModel
+// ----------------------------------------------------
+UnoControlDialogModel::UnoControlDialogModel()
+ :maContainerListeners( *this )
+ ,maChangeListeners ( GetMutex() )
+ ,mbGroupsUpToDate( sal_False )
+{
+ 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 );
+
+ Any aBool;
+ aBool <<= (sal_Bool) sal_True;
+ ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
+ ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
+}
+
+UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
+ :UnoControlModel( rModel )
+ ,maContainerListeners( *this )
+ ,maChangeListeners ( GetMutex() )
+ ,mbGroupsUpToDate( sal_False )
+{
+}
+
+UnoControlDialogModel::~UnoControlDialogModel()
+{
+ maModels.clear();
+ mbGroupsUpToDate = sal_False;
+}
+
+Any UnoControlDialogModel::queryAggregation( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet( UnoControlDialogModel_IBase::queryInterface( rType ) );
+ return (aRet.hasValue() ? aRet : UnoControlDialogModel_Base::queryAggregation( rType ));
+}
+
+// XTypeProvider
+IMPL_IMPLEMENTATION_ID( UnoControlDialogModel )
+Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
+{
+ return ::comphelper::concatSequences(
+ UnoControlDialogModel_IBase::getTypes(),
+ UnoControlDialogModel_Base::getTypes()
+ );
+}
+
+::rtl::OUString UnoControlDialogModel::getServiceName( ) throw(RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel );
+}
+
+Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialog );
+ return aAny;
+ }
+
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlDialogModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+void SAL_CALL UnoControlDialogModel::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
+ ::std::select1st< UnoControlModelHolder >( ) // 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 > UnoControlDialogModel::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+UnoControlModel* UnoControlDialogModel::Clone() const
+{
+ // clone the container itself
+ UnoControlDialogModel* pClone = new UnoControlDialogModel( *this );
+
+ // clone all children
+ ::std::for_each(
+ maModels.begin(), maModels.end(),
+ CloneControlModel( pClone->maModels )
+ );
+
+ return pClone;
+}
+
+UnoControlDialogModel::UnoControlModelHolderList::iterator UnoControlDialogModel::ImplFindElement( const ::rtl::OUString& rName )
+{
+ return ::std::find_if( maModels.begin(), maModels.end(), FindControlModel( rName ) );
+}
+
+// ::XMultiServiceFactory
+Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(Exception, RuntimeException)
+{
+ OGeometryControlModel_Base* pNewModel = NULL;
+
+ if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlEditModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFileControlModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlButtonModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlImageControlModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedTextModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlListBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >;
+
+ Reference< XInterface > xNewModel = (::cppu::OWeakObject*)pNewModel;
+ return xNewModel;
+}
+
+Reference< XInterface > UnoControlDialogModel::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /* Arguments */ ) throw(Exception, RuntimeException)
+{
+ return createInstance( ServiceSpecifier );
+}
+
+Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() throw(RuntimeException)
+{
+ static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
+ if ( !pNamesSeq )
+ {
+ pNamesSeq = new Sequence< ::rtl::OUString >( 19 );
+ ::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 );
+ }
+ return *pNamesSeq;
+}
+
+// XContainer
+void UnoControlDialogModel::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.addInterface( l );
+}
+
+void UnoControlDialogModel::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.removeInterface( l );
+}
+
+// XElementAcces
+Type UnoControlDialogModel::getElementType() throw(RuntimeException)
+{
+ Type aType = getCppuType( ( Reference< XControlModel>* ) NULL );
+ return aType;
+}
+
+sal_Bool UnoControlDialogModel::hasElements() throw(RuntimeException)
+{
+ return !maModels.empty();
+}
+
+// XNameContainer, XNameReplace, XNameAccess
+void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ Reference< XControlModel > xNewModel;
+ aElement >>= xNewModel;
+ if ( !xNewModel.is() )
+ lcl_throwIllegalArgumentException();
+
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() == aElementPos )
+ lcl_throwNoSuchElementException();
+
+ // 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 UnoControlDialogModel::getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ Any aElement;
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() != aElementPos )
+ aElement <<= aElementPos->first;
+ return aElement;
+}
+
+Sequence< ::rtl::OUString > UnoControlDialogModel::getElementNames() throw(RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames( maModels.size() );
+
+ ::std::transform(
+ maModels.begin(), maModels.end(), // source range
+ aNames.getArray(), // target range
+ ::std::select2nd< UnoControlModelHolder >() // operator to apply: select the second element (the name)
+ );
+
+ return aNames;
+}
+
+sal_Bool UnoControlDialogModel::hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
+{
+ return maModels.end() != ImplFindElement( aName );
+}
+
+void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ Reference< XControlModel > xM;
+ aElement >>= xM;
+
+ if ( !aName.getLength() || !xM.is() )
+ lcl_throwIllegalArgumentException();
+
+ 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 UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() != aElementPos )
+ {
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElementPos->first;
+ aEvent.Accessor <<= aName;
+ maContainerListeners.elementRemoved( aEvent );
+
+ stopControlListening( aElementPos->first );
+ maModels.erase( aElementPos );
+ mbGroupsUpToDate = sal_False;
+ }
+
+ // our "tab controller model" has potentially changed -> notify this
+ implNotifyTabModelChange( aName );
+}
+
+// ----------------------------------------------------------------------------
+sal_Bool SAL_CALL UnoControlDialogModel::getGroupControl( ) throw (RuntimeException)
+{
+ return sal_True;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::setGroupControl( sal_Bool GroupControl ) throw (RuntimeException)
+{
+ DBG_ERROR( "UnoControlDialogModel::setGroupControl: explicit grouping not supported" );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::setControlModels( const Sequence< Reference< XControlModel > >& _rControls ) throw (RuntimeException)
+{
+ // 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 UnoControlDialogModel::getControlModels( ) throw (RuntimeException)
+{
+ 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() ),
+ ::std::select2nd< MapIndexToModel::value_type >( )
+ );
+
+ return aReturn;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::setGroup( const Sequence< Reference< XControlModel > >& Group, const ::rtl::OUString& GroupName ) 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.
+ DBG_ERROR( "UnoControlDialogModel::setGroup: grouping not supported" );
+}
+
+// ----------------------------------------------------------------------------
+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& )
+ {
+ DBG_ERROR( "lcl_getDialogStep: caught an exception while determining the dialog page!" );
+ }
+ return nStep;
+ }
+}
+
+// ----------------------------------------------------------------------------
+sal_Int32 SAL_CALL UnoControlDialogModel::getGroupCount( ) throw (RuntimeException)
+{
+ implUpdateGroupStructure();
+
+ return maGroups.size();
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::getGroup( sal_Int32 _nGroup, Sequence< Reference< XControlModel > >& _rGroup, ::rtl::OUString& _rName ) throw (RuntimeException)
+{
+ implUpdateGroupStructure();
+
+ if ( ( _nGroup < 0 ) || ( _nGroup >= (sal_Int32)maGroups.size() ) )
+ {
+ DBG_ERROR( "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 UnoControlDialogModel::getGroupByName( const ::rtl::OUString& _rName, Sequence< Reference< XControlModel > >& _rGroup ) throw (RuntimeException)
+{
+ ::rtl::OUString sDummyName;
+ getGroup( _rName.toInt32( ), _rGroup, sDummyName );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::addChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
+{
+ maChangeListeners.addInterface( _rxListener );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::removeChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
+{
+ maChangeListeners.removeInterface( _rxListener );
+}
+
+// ----------------------------------------------------------------------------
+void UnoControlDialogModel::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 UnoControlDialogModel::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?
+
+#ifdef DEBUG
+ ::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;
+
+#ifdef DEBUG
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ }
+ break;
+
+ case eExpandingGroup:
+ {
+ if ( !bIsRadioButton )
+ { // no radio button -> the group is done
+ aCurrentGroup = maGroups.end();
+ eState = eLookingForGroup;
+#ifdef DEBUG
+ 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;
+
+#ifdef DEBUG
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "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();
+#ifdef DEBUG
+ 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;
+#ifdef DEBUG
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ }
+ break;
+ }
+ }
+
+ mbGroupsUpToDate = sal_True;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::propertyChange( const PropertyChangeEvent& _rEvent ) throw (RuntimeException)
+{
+ 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 ) )
+ );
+ DBG_ASSERT( 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 UnoControlDialogModel::disposing( const EventObject& evt ) throw (RuntimeException)
+{
+ // TODO
+}
+
+// ----------------------------------------------------------------------------
+void UnoControlDialogModel::startControlListening( const Reference< XControlModel >& _rxChildModel )
+{
+ 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 UnoControlDialogModel::stopControlListening( const Reference< XControlModel >& _rxChildModel )
+{
+ 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 UnoDialogControl
+// ============================================================================
+UnoDialogControl::UnoDialogControl() : maTopWindowListeners( *this )
+{
+ maComponentInfos.nWidth = 300;
+ maComponentInfos.nHeight = 450;
+}
+
+::rtl::OUString UnoDialogControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "Dialog" );
+}
+
+// XInterface
+Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet( UnoDialogControl_IBase::queryInterface( rType ) );
+ return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
+}
+
+// XTypeProvider
+IMPL_IMPLEMENTATION_ID( UnoDialogControl )
+Sequence< Type > UnoDialogControl::getTypes() throw(RuntimeException)
+{
+ return ::comphelper::concatSequences(
+ UnoDialogControl_IBase::getTypes(),
+ UnoControlContainer::getTypes()
+ );
+}
+
+void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
+{
+ Reference< XPropertySet > xP( rxModel, UNO_QUERY );
+
+ ::rtl::OUString aDefCtrl;
+ xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
+
+ 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 UnoDialogControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
+{
+ Sequence< Reference< XControl > > aControls = getControls();
+ Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
+ if ( xCtrl.is() )
+ removeControl( xCtrl );
+}
+
+void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
+{
+ Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
+
+ sal_Int32 nX, nY, nWidth, nHeight;
+ 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;
+
+ // Currentley we are simply using MAP_APPFONT
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ DBG_ASSERT( pOutDev, "Missing Default Device!" );
+ if ( pOutDev )
+ {
+ ::Size aTmp( nX, nY );
+ aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
+ nX = aTmp.Width();
+ nY = aTmp.Height();
+ aTmp = ::Size( nWidth, nHeight );
+ aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
+ 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 UnoDialogControl::dispose() throw(RuntimeException)
+{
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+ maTopWindowListeners.disposeAndClear( aEvt );
+
+ UnoControlContainer::dispose();
+}
+
+sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
+{
+ // 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 );
+ }
+
+ return bRet;
+}
+
+void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ 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 );
+}
+
+void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+{
+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+
+ Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
+ xTW->setMenuBar( mxMenuBar );
+ if ( maTopWindowListeners.getLength() )
+ xTW->addTopWindowListener( &maTopWindowListeners );
+}
+
+void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ Reference< XControlModel > xModel;
+ ::rtl::OUString aName;
+
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ImplInsertControl( xModel, aName );
+}
+
+void UnoDialogControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ Reference< XControlModel > xModel;
+ Event.Element >>= xModel;
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+}
+
+void UnoDialogControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ Reference< XControlModel > xModel;
+ Event.ReplacedElement >>= xModel;
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+
+ ::rtl::OUString aName;
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ImplInsertControl( xModel, aName );
+}
+
+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)
+{
+ if ( getPeer().is() )
+ {
+ Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
+ if( xTW.is() )
+ xTW->toFront();
+ }
+}
+
+void UnoDialogControl::toBack( ) throw (RuntimeException)
+{
+ if ( getPeer().is() )
+ {
+ Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
+ if( xTW.is() )
+ xTW->toBack();
+ }
+}
+
+void UnoDialogControl::setMenuBar( const Reference< XMenuBar >& rxMenuBar ) throw (RuntimeException)
+{
+ mxMenuBar = rxMenuBar;
+ if ( getPeer().is() )
+ {
+ Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
+ if( xTW.is() )
+ xTW->setMenuBar( mxMenuBar );
+ }
+}
+
+// XPropertiesChangeListener
+void UnoDialogControl::propertiesChange( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
+{
+ if( !isDesignMode() && !IsUpdatingModel() && !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 )
+ {
+ 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::propertiesChange( rEvents );
+}
+
+void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException)
+{
+ Any aAny;
+ aAny <<= Title;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ), aAny, sal_True );
+}
+
+::rtl::OUString UnoDialogControl::getTitle() throw(RuntimeException)
+{
+ return ImplGetPropertyValue_UString( BASEPROPERTY_TITLE );
+}
+
+sal_Int16 UnoDialogControl::execute() throw(RuntimeException)
+{
+ 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)
+{
+ if ( getPeer().is() )
+ {
+ Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
+ if( xDlg.is() )
+ {
+ xDlg->endExecute();
+ GetComponentInfos().bVisible = sal_False;
+ }
+ }
+}
+
+void UnoDialogControl::addingControl( const Reference< XControl >& _rxControl )
+{
+ 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::createFromAscii( "PositionX" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
+
+ xProps->addPropertiesChangeListener( aNames, this );
+ }
+ }
+}
+
+void UnoDialogControl::removingControl( const Reference< XControl >& _rxControl )
+{
+ UnoControlContainer::removingControl( _rxControl );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xProps.is() )
+ xProps->removePropertiesChangeListener( this );
+ }
+
+}
+
+void SAL_CALL UnoDialogControl::changesOccurred( const ChangesEvent& Event ) throw (RuntimeException)
+{
+ // a tab controller model may have changed
+ if ( mxTabController.is() )
+ mxTabController->activateTabOrder();
+}
diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx
new file mode 100644
index 000000000000..bcf90344752c
--- /dev/null
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * $RCSfile: formattedcontrol.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2003-03-27 17:03:19 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_FORMATTED_CONTROL_HXX
+#include <toolkit/controls/formattedcontrol.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_PROPERTY_HXX_
+#include <toolkit/helper/property.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#endif
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+
+//........................................................................
+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;
+
+ // ===================================================================
+ // = UnoControlFormattedFieldModel
+ // ===================================================================
+ // -------------------------------------------------------------------
+ UnoControlFormattedFieldModel::UnoControlFormattedFieldModel()
+ {
+ ImplRegisterProperty( BASEPROPERTY_ALIGN );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_DEFAULT );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_VALUE );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MAX );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MIN );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_FORMATKEY );
+ ImplRegisterProperty( BASEPROPERTY_FORMATSSUPPLIER );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_MAXTEXTLEN );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_SPIN );
+ ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+
+ Any aTreatAsNumber;
+ aTreatAsNumber <<= (sal_Bool) sal_True;
+ ImplRegisterProperty( BASEPROPERTY_TREATASNUMBER, aTreatAsNumber );
+ }
+
+ // -------------------------------------------------------------------
+ ::rtl::OUString UnoControlFormattedFieldModel::getServiceName() throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedFieldModel );
+ }
+
+ // -------------------------------------------------------------------
+ sal_Bool UnoControlFormattedFieldModel::convertFastPropertyValue(
+ Any& rConvertedValue, Any& rOldValue, sal_Int32 nPropId,
+ const Any& rValue ) throw (IllegalArgumentException)
+ {
+ if ( BASEPROPERTY_EFFECTIVE_DEFAULT == nPropId )
+ {
+ double dVal = 0;
+ sal_Int32 nVal = 0;
+ ::rtl::OUString sVal;
+ if ( ( rValue >>= dVal ) || ( rValue >>= nVal ) || ( rValue >>= sVal ) )
+ {
+ getFastPropertyValue( rOldValue, nPropId );
+ return !CompareProperties( rConvertedValue, rOldValue );
+ }
+
+ throw IllegalArgumentException(
+ ( ::rtl::OUString::createFromAscii("Unable to convert the given value for the property ")
+ += GetPropertyName((sal_uInt16)nPropId) )
+ += ::rtl::OUString::createFromAscii(" (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()
+ {
+ }
+
+ // -------------------------------------------------------------------
+ ::rtl::OUString UnoFormattedFieldControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString::createFromAscii( "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 ?");
+ ::rtl::OUString sEffectiveValue = GetPropertyName( BASEPROPERTY_EFFECTIVE_VALUE );
+ ImplSetPropertyValue( sEffectiveValue, xPeer->getProperty( sEffectiveValue ), sal_False );
+
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
diff --git a/toolkit/source/controls/geometrycontrolmodel.cxx b/toolkit/source/controls/geometrycontrolmodel.cxx
index 9a3d5fc1a8b9..d4d162fba938 100644
--- a/toolkit/source/controls/geometrycontrolmodel.cxx
+++ b/toolkit/source/controls/geometrycontrolmodel.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: geometrycontrolmodel.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: fs $ $Date: 2002-02-01 12:07:32 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:03:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,11 +87,6 @@
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
-#include <algorithm>
-#include <functional>
-#ifndef _COMPHELPER_SEQUENCE_HXX_
-#include <comphelper/sequence.hxx>
-#endif
#define GCM_PROPERTY_ID_POS_X 1
@@ -344,7 +339,7 @@
}
//--------------------------------------------------------------------
- void OGeometryControlModel_Base::releaseAggregation()
+ OGeometryControlModel_Base::~OGeometryControlModel_Base()
{
// release the aggregate (_before_ clearing m_xAggregate)
if (m_xAggregate.is())
@@ -353,12 +348,6 @@
}
//--------------------------------------------------------------------
- OGeometryControlModel_Base::~OGeometryControlModel_Base()
- {
- releaseAggregation();
- }
-
- //--------------------------------------------------------------------
sal_Bool SAL_CALL OGeometryControlModel_Base::convertFastPropertyValue(Any& _rConvertedValue, Any& _rOldValue,
sal_Int32 _nHandle, const Any& _rValue) throw (IllegalArgumentException)
{
@@ -492,183 +481,6 @@
xComp->dispose();
}
- //====================================================================
- //= OCommonGeometryControlModel
- //====================================================================
- //--------------------------------------------------------------------
- OCommonGeometryControlModel::HashMapString2Int OCommonGeometryControlModel::s_aServiceSpecifierMap;
- OCommonGeometryControlModel::PropSeqArray OCommonGeometryControlModel::s_aAggregateProperties;
- OCommonGeometryControlModel::IntArrayArray OCommonGeometryControlModel::s_aAmbiguousPropertyIds;
-
- //--------------------------------------------------------------------
- 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::const_iterator aPropMapIdPos = s_aServiceSpecifierMap.find( m_sServiceSpecifier );
- if ( s_aServiceSpecifierMap.end() == aPropMapIdPos )
- {
- m_nPropertyMapId = s_aAggregateProperties.size();
- s_aAggregateProperties.push_back( xPI->getProperties() );
- s_aAmbiguousPropertyIds.push_back( IntArrayArray::value_type() );
-
- s_aServiceSpecifierMap[ 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)s_aAggregateProperties.size(), "OCommonGeometryControlModel::createArrayHelper: invalid status info (1)!" );
- OSL_ENSURE( _nId < (sal_Int32)s_aAmbiguousPropertyIds.size(), "OCommonGeometryControlModel::createArrayHelper: invalid status info (2)!" );
-
- // our own properties
- Sequence< Property > aProps;
- OPropertyContainer::describeProperties( aProps );
-
- // the aggregate properties
- Sequence< Property > aAggregateProps;
- aAggregateProps = s_aAggregateProperties[ _nId ];
-
- // look for duplicates, and remember them
- IntArrayArray::value_type& rDuplicateIds = s_aAmbiguousPropertyIds[ _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 );
- }
-
- //--------------------------------------------------------------------
- Sequence< sal_Int8 > SAL_CALL OCommonGeometryControlModel::getImplementationId( ) throw (RuntimeException)
- {
- static ::cppu::OImplementationId * pId = NULL;
- if ( !pId )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !pId )
- {
- static ::cppu::OImplementationId s_aId;
- pId = &s_aId;
- }
- }
- return pId->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 = s_aAmbiguousPropertyIds[ 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
//........................................................................
diff --git a/toolkit/source/controls/makefile.mk b/toolkit/source/controls/makefile.mk
index c40232aba65d..e63ad8e17acb 100644
--- a/toolkit/source/controls/makefile.mk
+++ b/toolkit/source/controls/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.7 $
+# $Revision: 1.8 $
#
-# last change: $Author: fs $ $Date: 2002-04-26 14:34:00 $
+# last change: $Author: hr $ $Date: 2003-03-27 17:03:20 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -86,7 +86,9 @@ SLOFILES= \
$(SLO)$/unocontrolcontainer.obj \
$(SLO)$/unocontrolcontainermodel.obj \
$(SLO)$/unocontrolmodel.obj \
- $(SLO)$/unocontrols.obj
+ $(SLO)$/unocontrols.obj \
+ $(SLO)$/formattedcontrol.obj\
+ $(SLO)$/dialogcontrol.obj
# --- Targets ------------------------------------------------------
diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx
index c67d05545f1f..a7223974a81c 100644
--- a/toolkit/source/controls/stdtabcontroller.cxx
+++ b/toolkit/source/controls/stdtabcontroller.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: stdtabcontroller.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: mt $ $Date: 2001-09-04 08:06:31 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:03:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,12 @@
#include <comphelper/sequence.hxx>
#endif
+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
// ----------------------------------------------------
@@ -92,7 +98,12 @@ StdTabController::~StdTabController()
{
}
-sal_Bool StdTabController::ImplCreateComponentSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rControls, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rModels, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& rComponents, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>* pTabStops, sal_Bool bPeerComponent ) const
+sal_Bool 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;
@@ -100,56 +111,70 @@ sal_Bool StdTabController::ImplCreateComponentSequence( ::com::sun::star::uno::S
sal_Int32 nModels = rModels.getLength();
if (nModels != rControls.getLength())
{
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >(nModels);
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pModels = rModels.getConstArray();
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCurrentModel;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCurrentControl;
+ Sequence< Reference< XControl > > aSeq = Sequence< Reference< XControl > >(nModels);
+ const Reference< XControlModel > * pModels = rModels.getConstArray();
+ Reference< XControl > xCurrentControl;
sal_Int32 nRealControls = 0;
- for (sal_Int32 n = 0; n < nModels; ++n)
+ for (sal_Int32 n = 0; n < nModels; ++n, ++pModels)
{
- xCurrentModel = pModels[n];
- xCurrentControl = FindControl(rControls, xCurrentModel);
+ xCurrentControl = FindControl(rControls, *pModels);
if (xCurrentControl.is())
aSeq.getArray()[nRealControls++] = xCurrentControl;
}
aSeq.realloc(nRealControls);
rControls = aSeq;
}
+#ifdef DBG_UTIL
+ {
+ sal_Int32 nControls = rControls.getLength();
+ sal_Int32 nModels = rModels.getLength();
+ DBG_ASSERT( nControls == nModels, "StdTabController:ImplCreateComponentSequence: inconsistence!" );
+ if ( nControls == nModels )
+ {
+ for ( sal_Int32 i = 0; i < nControls; ++i )
+ {
+ Reference< XControl > xControl = rControls[ i ];
+ DBG_ASSERT( xControl.is() && ( xControl->getModel().get() == rModels[i].get() ),
+ "StdTabController:ImplCreateComponentSequence: inconsistence (elements)!" );
+ }
+ }
+ }
+#endif
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pControls = rControls.getConstArray();
+ const Reference< XControl > * pControls = rControls.getConstArray();
sal_uInt32 nCtrls = rControls.getLength();
- rComponents = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >( nCtrls );
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComps = rComponents.getArray();
- ::com::sun::star::uno::Any* pTabs = NULL;
+ rComponents.realloc( nCtrls );
+ Reference< XWindow > * pComps = rComponents.getArray();
+ Any* pTabs = NULL;
if ( pTabStops )
{
- *pTabStops = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>( nCtrls );
+ *pTabStops = Sequence< Any>( nCtrls );
pTabs = pTabStops->getArray();
}
for ( sal_uInt32 n = 0; bOK && ( n < nCtrls ); n++ )
{
// Zum Model passendes Control suchen
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl(pControls[n]);
+ Reference< XControl > xCtrl(pControls[n]);
if ( xCtrl.is() )
{
if (bPeerComponent)
- pComps[n] = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > (xCtrl->getPeer(), ::com::sun::star::uno::UNO_QUERY);
+ pComps[n] = Reference< XWindow > (xCtrl->getPeer(), UNO_QUERY);
else
- pComps[n] = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > (xCtrl, ::com::sun::star::uno::UNO_QUERY);
+ pComps[n] = Reference< XWindow > (xCtrl, UNO_QUERY);
- // TabStop-::com::sun::star::beans::Property
+ // TabStop-Property
if ( pTabs )
{
// opt: String fuer TabStop als Konstante
static const ::rtl::OUString aTabStopName( ::rtl::OUString::createFromAscii( "Tabstop" ) );
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( xCtrl->getModel(), ::com::sun::star::uno::UNO_QUERY );
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
+ Reference< XPropertySet > xPSet( xCtrl->getModel(), UNO_QUERY );
+ Reference< XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
if( xInfo->hasPropertyByName( aTabStopName ) )
pTabs[n] = xPSet->getPropertyValue( aTabStopName );
}
@@ -166,18 +191,18 @@ sal_Bool StdTabController::ImplCreateComponentSequence( ::com::sun::star::uno::S
void StdTabController::ImplActivateControl( sal_Bool bFirst ) const
{
// HACK wegen #53688#, muss auf ein Interface abgebildet werden, wenn Controls Remote liegen koennen.
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > xTabController(const_cast< ::cppu::OWeakObject* >(static_cast< const ::cppu::OWeakObject* >(this)), ::com::sun::star::uno::UNO_QUERY);
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = xTabController->getControls();
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pControls = aCtrls.getConstArray();
+ 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 ::com::sun::star::sdbcx::Container!" );
+ DBG_ASSERT( pControls[nCtrl].is(), "Control nicht im Container!" );
if ( pControls[nCtrl].is() )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xCP = pControls[nCtrl]->getPeer();
+ Reference< XWindowPeer > xCP = pControls[nCtrl]->getPeer();
if ( xCP.is() )
{
VCLXWindow* pC = VCLXWindow::GetImplementation( xCP );
@@ -191,77 +216,77 @@ void StdTabController::ImplActivateControl( sal_Bool bFirst ) const
}
}
-// ::com::sun::star::uno::XInterface
-::com::sun::star::uno::Any StdTabController::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+// XInterface
+Any StdTabController::queryAggregation( const Type & rType ) throw(RuntimeException)
{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XTabController*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ 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 ));
}
-// ::com::sun::star::lang::XTypeProvider
+// XTypeProvider
IMPL_XTYPEPROVIDER_START( StdTabController )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL )
+ getCppuType( ( Reference< XTabController>* ) NULL ),
+ getCppuType( ( Reference< XServiceInfo>* ) NULL )
IMPL_XTYPEPROVIDER_END
-void StdTabController::setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& Model ) throw(::com::sun::star::uno::RuntimeException)
+void StdTabController::setModel( const Reference< XTabControllerModel >& Model ) throw(RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
mxModel = Model;
}
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > StdTabController::getModel( ) throw(::com::sun::star::uno::RuntimeException)
+Reference< XTabControllerModel > StdTabController::getModel( ) throw(RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mxModel;
}
-void StdTabController::setContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& Container ) throw(::com::sun::star::uno::RuntimeException)
+void StdTabController::setContainer( const Reference< XControlContainer >& Container ) throw(RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
mxControlContainer = Container;
}
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > StdTabController::getContainer( ) throw(::com::sun::star::uno::RuntimeException)
+Reference< XControlContainer > StdTabController::getContainer( ) throw(RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mxControlContainer;
}
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > StdTabController::getControls( ) throw(::com::sun::star::uno::RuntimeException)
+Sequence< Reference< XControl > > StdTabController::getControls( ) throw(RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aSeq;
+ Sequence< Reference< XControl > > aSeq;
if ( mxControlContainer.is() )
{
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aModels = mxModel->getControlModels();
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pModels = aModels.getConstArray();
+ Sequence< Reference< XControlModel > > aModels = mxModel->getControlModels();
+ const Reference< XControlModel > * pModels = aModels.getConstArray();
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > xCtrls = mxControlContainer->getControls();
+ Sequence< Reference< XControl > > xCtrls = mxControlContainer->getControls();
sal_uInt32 nCtrls = aModels.getLength();
- aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >( nCtrls );
+ aSeq = Sequence< Reference< XControl > >( nCtrls );
for ( sal_uInt32 n = 0; n < nCtrls; n++ )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrlModel = pModels[n];
+ Reference< XControlModel > xCtrlModel = pModels[n];
// Zum Model passendes Control suchen
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl = FindControl( xCtrls, xCtrlModel );
+ Reference< XControl > xCtrl = FindControl( xCtrls, xCtrlModel );
aSeq.getArray()[n] = xCtrl;
}
}
return aSeq;
}
-void StdTabController::autoTabOrder( ) throw(::com::sun::star::uno::RuntimeException)
+void StdTabController::autoTabOrder( ) throw(RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
@@ -269,30 +294,30 @@ void StdTabController::autoTabOrder( ) throw(::com::sun::star::uno::RuntimeExce
if ( !mxControlContainer.is() )
return;
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = mxModel->getControlModels();
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aCompSeq;
+ Sequence< Reference< XControlModel > > aSeq = mxModel->getControlModels();
+ Sequence< Reference< XWindow > > aCompSeq;
// vieleicht erhalte ich hier einen TabController,
// der schneller die Liste meiner Controls ermittelt
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), ::com::sun::star::uno::UNO_QUERY);
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aControls = xTabController->getControls();
+ 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 ::com::sun::star::sdbcx::Container,
+ // #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();
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComponents = aCompSeq.getArray();
+ Reference< XWindow > * pComponents = aCompSeq.getArray();
ComponentEntryList aCtrls;
sal_uInt32 n;
for ( n = 0; n < nCtrls; n++ )
{
- ::com::sun::star::awt::XWindow* pC = (::com::sun::star::awt::XWindow*)pComponents[n].get();
+ XWindow* pC = (XWindow*)pComponents[n].get();
ComponentEntry* pE = new ComponentEntry;
pE->pComponent = pC;
- ::com::sun::star::awt::Rectangle aPosSize = pC->getPosSize();
+ awt::Rectangle aPosSize = pC->getPosSize();
pE->aPos.X() = aPosSize.X;
pE->aPos.Y() = aPosSize.Y;
@@ -313,11 +338,11 @@ void StdTabController::autoTabOrder( ) throw(::com::sun::star::uno::RuntimeExce
aCtrls.Insert( pE, nPos );
}
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aNewSeq( nCtrls );
+ Sequence< Reference< XControlModel > > aNewSeq( nCtrls );
for ( n = 0; n < nCtrls; n++ )
{
ComponentEntry* pE = aCtrls.GetObject( n );
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xUC( pE->pComponent, ::com::sun::star::uno::UNO_QUERY );
+ Reference< XControl > xUC( pE->pComponent, UNO_QUERY );
aNewSeq.getArray()[n] = xUC->getModel();
delete pE;
}
@@ -326,62 +351,68 @@ void StdTabController::autoTabOrder( ) throw(::com::sun::star::uno::RuntimeExce
mxModel->setControlModels( aNewSeq );
}
-void StdTabController::activateTabOrder( ) throw(::com::sun::star::uno::RuntimeException)
+void StdTabController::activateTabOrder( ) throw(RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- // Am ::com::sun::star::sdbcx::Container die Tab-Reihenfolge aktivieren...
+ // Am Container die Tab-Reihenfolge aktivieren...
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xC( mxControlContainer, ::com::sun::star::uno::UNO_QUERY );
+ Reference< XControl > xC( mxControlContainer, UNO_QUERY );
if ( !xC.is() || !xC->getPeer().is() )
return;
// vieleicht erhalte ich hier einen TabController,
// der schneller die Liste meiner Controls ermittelt
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), ::com::sun::star::uno::UNO_QUERY);
+ Reference< XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY);
// Flache Liste besorgen...
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = mxModel->getControlModels();
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aCompSeq;
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aTabSeq;
+ Sequence< Reference< XControlModel > > aSeq = 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
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = xTabController->getControls();
+ Sequence< Reference< XControl > > aControls = xTabController->getControls();
- // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im ::com::sun::star::sdbcx::Container,
+ // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im Container,
// dann kommt spaeter nochmal ein activateTabOrder...
- if( !ImplCreateComponentSequence( aCtrls, aSeq, aCompSeq, &aTabSeq, sal_True ) )
+ if( !ImplCreateComponentSequence( aControls, aSeq, aCompSeq, &aTabSeq, sal_True ) )
return;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerPeer > xVclContainerPeer( xC->getPeer(), ::com::sun::star::uno::UNO_QUERY );
-
+ Reference< XVclContainerPeer > xVclContainerPeer( xC->getPeer(), UNO_QUERY );
xVclContainerPeer->setTabOrder( aCompSeq, aTabSeq, mxModel->getGroupControl() );
- // Gruppen...
- aCtrls = xTabController->getControls();
-
::rtl::OUString aName;
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aGroupSeq;
+ Sequence< Reference< XControlModel > > aThisGroupModels;
+ Sequence< Reference< XWindow > > aControlComponents;
+
sal_uInt32 nGroups = mxModel->getGroupCount();
for ( sal_uInt32 nG = 0; nG < nGroups; nG++ )
{
- mxModel->getGroup( nG, aGroupSeq, aName );
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aCompSeq;
- ImplCreateComponentSequence( aCtrls, aGroupSeq, aCompSeq, NULL, sal_True );
- xVclContainerPeer->setGroup( aCompSeq );
+ 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(::com::sun::star::uno::RuntimeException)
+void StdTabController::activateFirst( ) throw(RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
ImplActivateControl( sal_True );
}
-void StdTabController::activateLast( ) throw(::com::sun::star::uno::RuntimeException)
+void StdTabController::activateLast( ) throw(RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
@@ -389,8 +420,8 @@ void StdTabController::activateLast( ) throw(::com::sun::star::uno::RuntimeExce
}
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > StdTabController::FindControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rCtrls,
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & rxCtrlModel )
+Reference< XControl > StdTabController::FindControl( Sequence< Reference< XControl > >& rCtrls,
+ const Reference< XControlModel > & rxCtrlModel )
{
/*
@@ -413,7 +444,7 @@ void StdTabController::activateLast( ) throw(::com::sun::star::uno::RuntimeExce
while( aIt.hasMoreElements() )
{
XEventListener* pL = aIt.next();
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xC( pL, ::com::sun::star::uno::UNO_QUERY );
+ Reference< XControl > xC( pL, UNO_QUERY );
if ( xC.is() )
{
if( xC->getContext() == mxControlContainer )
@@ -428,17 +459,17 @@ void StdTabController::activateLast( ) throw(::com::sun::star::uno::RuntimeExce
*/
DBG_ASSERT( rxCtrlModel.is(), "ImplFindControl - welches ?!" );
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pCtrls = rCtrls.getConstArray();
+ const Reference< XControl > * pCtrls = rCtrls.getConstArray();
sal_Int32 nCtrls = rCtrls.getLength();
for ( sal_Int32 n = 0; n < nCtrls; n++ )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xModel(pCtrls[n].is() ? pCtrls[n]->getModel() : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ());
- if ( (::com::sun::star::awt::XControlModel*)xModel.get() == (::com::sun::star::awt::XControlModel*)rxCtrlModel.get() )
+ Reference< XControlModel > xModel(pCtrls[n].is() ? pCtrls[n]->getModel() : Reference< XControlModel > ());
+ if ( (XControlModel*)xModel.get() == (XControlModel*)rxCtrlModel.get() )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl( pCtrls[n] );
+ Reference< XControl > xCtrl( pCtrls[n] );
::comphelper::removeElementAt( rCtrls, n );
return xCtrl;
}
}
- return ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > ();
+ return Reference< XControl > ();
}
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 533e69988177..e8b476ce7977 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unocontrol.cxx,v $
*
- * $Revision: 1.22 $
+ * $Revision: 1.23 $
*
- * last change: $Author: fs $ $Date: 2002-09-11 09:42:27 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:03:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,10 +59,6 @@
*
************************************************************************/
-#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
-#include <com/sun/star/awt/XVclWindowPeer.hpp>
-#endif
-
#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
#include <com/sun/star/awt/XControlContainer.hpp>
#endif
@@ -230,7 +226,7 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptE
Reference< XWindowPeer > xP;
if ( bAcceptExistingPeer )
- xP = mxPeer;
+ xP = getPeer();
if ( !xP.is() )
{
@@ -239,8 +235,8 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptE
if( bVis )
maComponentInfos.bVisible = sal_False;
- Reference< XWindowPeer > xCurrentPeer = mxPeer;
- mxPeer = NULL;
+ Reference< XWindowPeer > xCurrentPeer = getPeer();
+ setPeer( NULL );
// Ueber queryInterface, wegen Aggregation...
Any aAny = OWeakAggObject::queryInterface( ::getCppuType((const Reference< XControl>*)0) );
@@ -253,8 +249,8 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptE
pWW = lcl_GetDefaultWindow();
}
xMe->createPeer( Reference< XToolkit >(), pWW->GetComponentInterface( sal_True ) );
- xP = mxPeer;
- mxPeer = xCurrentPeer;
+ xP = getPeer();
+ setPeer( xCurrentPeer );
if( bVis )
maComponentInfos.bVisible = sal_True;
@@ -267,13 +263,12 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptE
void UnoControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const Any& rVal )
{
- Reference< XVclWindowPeer > xW( mxPeer, UNO_QUERY );
- if (xW.is())
- // since a change made in propertiesChange, we can't be sure that this is called with an valid mxPeer,
+ if ( mxVclWindowPeer.is() )
+ // 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
- xW->setProperty( rPropName, rVal );
+ mxVclWindowPeer->setProperty( rPropName, rVal );
}
void UnoControl::PrepareWindowDescriptor( WindowDescriptor& rDesc )
@@ -299,7 +294,7 @@ Reference< XWindow > UnoControl::getParentPeer() const
void UnoControl::updateFromModel()
{
// Alle standard Properties werden ausgelesen und in das Peer uebertragen
- if( mxPeer.is() )
+ if( getPeer().is() )
{
Reference< XMultiPropertySet > xPropSet( mxModel, UNO_QUERY );
Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet );
@@ -333,10 +328,10 @@ void UnoControl::dispose( ) throw(RuntimeException)
{
::osl::MutexGuard aGuard( GetMutex() );
- if( mxPeer.is() && mbDisposePeer )
+ if( getPeer().is() && mbDisposePeer )
{
- mxPeer->dispose();
- mxPeer = NULL;
+ getPeer()->dispose();
+ setPeer( NULL);
}
// dispose and release our AccessibleContext
@@ -379,7 +374,7 @@ void UnoControl::propertiesChange( const Sequence< PropertyChangeEvent >& rEvent
::osl::ClearableGuard< ::osl::Mutex > aGuard( GetMutex() );
// kommt von xModel
- if( !IsUpdatingModel() && mxPeer.is() )
+ if( !IsUpdatingModel() && getPeer().is() )
{
DECLARE_STL_VECTOR( PropertyValue, PropertyValueVector);
PropertyValueVector aPeerPropertiesToSet;
@@ -389,15 +384,21 @@ void UnoControl::propertiesChange( const Sequence< PropertyChangeEvent >& rEvent
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
+
+ const PropertyChangeEvent* pEvents = rEvents.getConstArray();
+
sal_Int32 nLen = rEvents.getLength();
- for( sal_Int32 i = 0; i < nLen; i++ )
+ aPeerPropertiesToSet.reserve(nLen);
+
+ for( sal_Int32 i = 0; i < nLen; ++i, ++pEvents )
{
- const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
- Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
- sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
+ Reference< XControlModel > xModel( pEvents->Source, UNO_QUERY );
+ sal_Bool bOwnModel = xModel.get() == xOwnModel.get();
if ( bOwnModel )
{
- sal_uInt16 nPType = GetPropertyId( rEvt.PropertyName );
+ sal_uInt16 nPType = GetPropertyId( pEvents->PropertyName );
if ( nPType && mbDesignMode && mbDisposePeer && !mbRefeshingPeer && !mbCreatingPeer )
{
// Im Design-Mode koennen sich Props aendern, die eine
@@ -420,12 +421,12 @@ void UnoControl::propertiesChange( const Sequence< PropertyChangeEvent >& rEvent
// 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(rEvt.PropertyName, 0, rEvt.NewValue, PropertyState_DIRECT_VALUE));
+ aPeerPropertiesToSet.push_back(PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE));
}
else
{
aPeerPropertiesToSet.insert(aPeerPropertiesToSet.begin() + nIndependentPos,
- PropertyValue(rEvt.PropertyName, 0, rEvt.NewValue, PropertyState_DIRECT_VALUE));
+ PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE));
++nIndependentPos;
}
}
@@ -449,8 +450,9 @@ void UnoControl::propertiesChange( const Sequence< PropertyChangeEvent >& rEvent
// 01.03.2001 - FS
// Funktioniert beim Container nicht!
- mxPeer->dispose();
+ getPeer()->dispose();
mxPeer.clear();
+ mxVclWindowPeer = NULL;
mbRefeshingPeer = sal_True;
Reference< XWindowPeer > xP( xParent, UNO_QUERY );
xThis->createPeer( Reference< XToolkit > (), xP );
@@ -462,8 +464,9 @@ void UnoControl::propertiesChange( const Sequence< PropertyChangeEvent >& rEvent
// 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
// FS - 11/03/2000
+ PropertyValueVectorIterator aEnd = aPeerPropertiesToSet.end();
for ( PropertyValueVectorIterator aLoop = aPeerPropertiesToSet.begin();
- aLoop != aPeerPropertiesToSet.end();
+ aLoop != aEnd;
++aLoop
)
{
@@ -477,7 +480,7 @@ void UnoControl::disposing( const EventObject& rEvt ) throw(RuntimeException)
::osl::MutexGuard aGuard( GetMutex() );
// bei "Multible Inheritance" nicht unterschiedliche Typen vergleichen.
- if( mxModel == rEvt.Source )
+ if( mxModel.get() == Reference< XControlModel >(rEvt.Source,UNO_QUERY).get() )
{
// #62337# Ohne Model wollen wir nicht weiterleben
Reference< XControl > xThis = this;
@@ -511,7 +514,7 @@ void UnoControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int3
maComponentInfos.nHeight = Height;
maComponentInfos.nFlags |= Flags;
- xWindow = xWindow.query( mxPeer );
+ xWindow = xWindow.query( getPeer() );
}
if( xWindow.is() )
@@ -524,7 +527,7 @@ awt::Rectangle UnoControl::getPosSize( ) throw(RuntimeException)
awt::Rectangle aRect( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight);
- Reference< XWindow > xWindow( mxPeer, uno::UNO_QUERY );
+ Reference< XWindow > xWindow( getPeer(), uno::UNO_QUERY );
if( xWindow.is() )
aRect = xWindow->getPosSize();
@@ -539,7 +542,7 @@ void UnoControl::setVisible( sal_Bool bVisible ) throw(RuntimeException)
// Visible status ist Sache der View
maComponentInfos.bVisible = bVisible;
- xWindow = xWindow.query( mxPeer );
+ xWindow = xWindow.query( getPeer() );
}
if ( xWindow.is() )
xWindow->setVisible( bVisible );
@@ -553,7 +556,7 @@ void UnoControl::setEnable( sal_Bool bEnable ) throw(RuntimeException)
// Enable status ist Sache der View
maComponentInfos.bEnable = bEnable;
- xWindow = xWindow.query( mxPeer );
+ xWindow = xWindow.query( getPeer() );
}
if ( xWindow.is() )
xWindow->setEnable( bEnable );
@@ -564,7 +567,7 @@ void UnoControl::setFocus( ) throw(RuntimeException)
Reference< XWindow > xWindow;
{
::osl::MutexGuard aGuard( GetMutex() );
- xWindow = xWindow.query( mxPeer );
+ xWindow = xWindow.query( getPeer() );
}
if ( xWindow.is() )
xWindow->setFocus();
@@ -575,10 +578,10 @@ void UnoControl::addWindowListener( const Reference< XWindowListener >& rxListen
::osl::MutexGuard aGuard( GetMutex() );
maWindowListeners.addInterface( rxListener );
- if( mxPeer.is() && maWindowListeners.getLength() == 1 )
+ if( getPeer().is() && maWindowListeners.getLength() == 1 )
{
// erster Focus Listener, also am Peer anmelden
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->addWindowListener( &maWindowListeners );
}
}
@@ -587,10 +590,10 @@ void UnoControl::removeWindowListener( const Reference< XWindowListener >& rxLis
{
::osl::MutexGuard aGuard( GetMutex() );
- if( mxPeer.is() && maWindowListeners.getLength() == 1 )
+ if( getPeer().is() && maWindowListeners.getLength() == 1 )
{
// letzter Focus Listener, also am Peer abmelden
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->removeWindowListener( &maWindowListeners );
}
maWindowListeners.removeInterface( rxListener );
@@ -601,9 +604,9 @@ void UnoControl::addFocusListener( const Reference< XFocusListener >& rxListener
::osl::MutexGuard aGuard( GetMutex() );
maFocusListeners.addInterface( rxListener );
- if( mxPeer.is() && maFocusListeners.getLength() == 1 )
+ if( getPeer().is() && maFocusListeners.getLength() == 1 )
{
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->addFocusListener( &maFocusListeners );
}
}
@@ -612,9 +615,9 @@ void UnoControl::removeFocusListener( const Reference< XFocusListener >& rxListe
{
::osl::MutexGuard aGuard( GetMutex() );
- if( mxPeer.is() && maFocusListeners.getLength() == 1 )
+ if( getPeer().is() && maFocusListeners.getLength() == 1 )
{
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->removeFocusListener( &maFocusListeners );
}
maFocusListeners.removeInterface( rxListener );
@@ -625,9 +628,9 @@ void UnoControl::addKeyListener( const Reference< XKeyListener >& rxListener ) t
::osl::MutexGuard aGuard( GetMutex() );
maKeyListeners.addInterface( rxListener );
- if( mxPeer.is() && maKeyListeners.getLength() == 1 )
+ if( getPeer().is() && maKeyListeners.getLength() == 1 )
{
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->addKeyListener( &maKeyListeners);
}
}
@@ -636,9 +639,9 @@ void UnoControl::removeKeyListener( const Reference< XKeyListener >& rxListener
{
::osl::MutexGuard aGuard( GetMutex() );
- if( mxPeer.is() && maKeyListeners.getLength() == 1 )
+ if( getPeer().is() && maKeyListeners.getLength() == 1 )
{
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->removeKeyListener( &maKeyListeners);
}
maKeyListeners.removeInterface( rxListener );
@@ -649,9 +652,9 @@ void UnoControl::addMouseListener( const Reference< XMouseListener >& rxListener
::osl::MutexGuard aGuard( GetMutex() );
maMouseListeners.addInterface( rxListener );
- if( mxPeer.is() && maMouseListeners.getLength() == 1 )
+ if( getPeer().is() && maMouseListeners.getLength() == 1 )
{
- Reference< XWindow > xW( mxPeer, UNO_QUERY );;
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );;
xW->addMouseListener( &maMouseListeners);
}
}
@@ -660,9 +663,9 @@ void UnoControl::removeMouseListener( const Reference< XMouseListener >& rxListe
{
::osl::MutexGuard aGuard( GetMutex() );
- if( mxPeer.is() && maMouseListeners.getLength() == 1 )
+ if( getPeer().is() && maMouseListeners.getLength() == 1 )
{
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->removeMouseListener( &maMouseListeners);
}
maMouseListeners.removeInterface( rxListener );
@@ -673,9 +676,9 @@ void UnoControl::addMouseMotionListener( const Reference< XMouseMotionListener >
::osl::MutexGuard aGuard( GetMutex() );
maMouseMotionListeners.addInterface( rxListener );
- if( mxPeer.is() && maMouseMotionListeners.getLength() == 1 )
+ if( getPeer().is() && maMouseMotionListeners.getLength() == 1 )
{
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->addMouseMotionListener( &maMouseMotionListeners);
}
}
@@ -684,9 +687,9 @@ void UnoControl::removeMouseMotionListener( const Reference< XMouseMotionListene
{
::osl::MutexGuard aGuard( GetMutex() );
- if( mxPeer.is() && maMouseMotionListeners.getLength() == 1 )
+ if( getPeer().is() && maMouseMotionListeners.getLength() == 1 )
{
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->removeMouseMotionListener( &maMouseMotionListeners);
}
maMouseMotionListeners.removeInterface( rxListener );
@@ -697,9 +700,9 @@ void UnoControl::addPaintListener( const Reference< XPaintListener >& rxListener
::osl::MutexGuard aGuard( GetMutex() );
maPaintListeners.addInterface( rxListener );
- if( mxPeer.is() && maPaintListeners.getLength() == 1 )
+ if( getPeer().is() && maPaintListeners.getLength() == 1 )
{
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->addPaintListener( &maPaintListeners );
}
}
@@ -708,9 +711,9 @@ void UnoControl::removePaintListener( const Reference< XPaintListener >& rxListe
{
::osl::MutexGuard aGuard( GetMutex() );
- if( mxPeer.is() && maPaintListeners.getLength() == 1 )
+ if( getPeer().is() && maPaintListeners.getLength() == 1 )
{
- Reference< XWindow > xW( mxPeer, UNO_QUERY );
+ Reference< XWindow > xW( getPeer(), UNO_QUERY );
xW->removePaintListener( &maPaintListeners );
}
maPaintListeners.removeInterface( rxListener );
@@ -724,7 +727,7 @@ sal_Bool UnoControl::setGraphics( const Reference< XGraphics >& rDevice ) throw(
::osl::MutexGuard aGuard( GetMutex() );
mxGraphics = rDevice;
- xView = xView.query( mxPeer );
+ xView = xView.query( getPeer() );
}
return xView.is() ? xView->setGraphics( rDevice ) : sal_True;
}
@@ -751,7 +754,7 @@ void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(RuntimeException)
Reference< XView > xV( xP, UNO_QUERY );
xV->draw( x, y );
- if ( !mxPeer.is() || ( mxPeer != xP ) )
+ if ( !getPeer().is() || ( getPeer() != xP ) )
xP->dispose();
}
}
@@ -765,7 +768,7 @@ void UnoControl::setZoom( float fZoomX, float fZoomY ) throw(RuntimeException)
maComponentInfos.nZoomX = fZoomX;
maComponentInfos.nZoomY = fZoomY;
- xView = xView.query( mxPeer );
+ xView = xView.query( getPeer() );
}
if ( xView.is() )
xView->setZoom( fZoomX, fZoomY );
@@ -798,7 +801,7 @@ void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Refer
throw( aException );
}
- if( !mxPeer.is() )
+ if( !getPeer().is() )
{
mbCreatingPeer = sal_True;
@@ -940,7 +943,7 @@ void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Refer
PrepareWindowDescriptor(aDescr);
// create the peer
- mxPeer = xToolkit->createWindow( aDescr );
+ 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
@@ -954,8 +957,8 @@ void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Refer
UnoControlComponentInfos aComponentInfos(maComponentInfos);
sal_Bool bDesignMode(mbDesignMode);
Reference< XGraphics > xGraphics( mxGraphics );
- Reference< XView > xV(mxPeer, UNO_QUERY);
- Reference< XWindow > xW(mxPeer, UNO_QUERY);
+ Reference< XView > xV(getPeer(), UNO_QUERY);
+ Reference< XWindow > xW(getPeer(), UNO_QUERY);
aGuard.clear();
@@ -1002,6 +1005,7 @@ void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Refer
Reference< XWindowPeer > UnoControl::getPeer( ) throw(RuntimeException)
{
+ ::osl::MutexGuard aGuard( GetMutex() );
return mxPeer;
}
@@ -1049,7 +1053,7 @@ void UnoControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
// remember this
mbDesignMode = bOn;
- xWindow = xWindow.query( mxPeer );
+ xWindow = xWindow.query( getPeer() );
// dispose our current AccessibleContext, if we have one
// (changing the design mode implies having a new implementation for this context,
@@ -1101,8 +1105,8 @@ sal_Bool UnoControl::supportsService( const ::rtl::OUString& rServiceName ) thro
Sequence< ::rtl::OUString > UnoControl::getSupportedServiceNames( ) throw(RuntimeException)
{
- DBG_ERROR( "This method should be overloaded!" );
- return Sequence< ::rtl::OUString >();
+ ::rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControl" ) );
+ return Sequence< ::rtl::OUString >( &sName, 1 );
}
// ------------------------------------------------------------------------
@@ -1115,7 +1119,7 @@ Reference< XAccessibleContext > SAL_CALL UnoControl::getAccessibleContext( ) th
{
if ( !mbDesignMode )
{ // in alive mode, use the AccessibleContext of the peer
- Reference< XAccessible > xPeerAcc( mxPeer, UNO_QUERY );
+ Reference< XAccessible > xPeerAcc( getPeer(), UNO_QUERY );
if ( xPeerAcc.is() )
xCurrentContext = xPeerAcc->getAccessibleContext( );
}
diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx
index b0cc24f082c8..df05be1bb241 100644
--- a/toolkit/source/controls/unocontrolbase.cxx
+++ b/toolkit/source/controls/unocontrolbase.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unocontrolbase.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mt $ $Date: 2001-10-11 14:58:22 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:03:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -196,7 +196,7 @@ double UnoControlBase::ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp )
if ( xL.is() )
aSz = xL->getMinimumSize();
- if ( !mxPeer.is() || ( mxPeer != xP ) )
+ if ( !getPeer().is() || ( getPeer() != xP ) )
xP->dispose();
}
return aSz;
@@ -213,7 +213,7 @@ double UnoControlBase::ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp )
if ( xL.is() )
aSz = xL->getPreferredSize();
- if ( !mxPeer.is() || ( mxPeer != xP ) )
+ if ( !getPeer().is() || ( getPeer() != xP ) )
xP->dispose();
}
return aSz;
@@ -230,7 +230,7 @@ double UnoControlBase::ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp )
if ( xL.is() )
aSz = xL->calcAdjustedSize( rNewSize );
- if ( !mxPeer.is() || ( mxPeer != xP ) )
+ if ( !getPeer().is() || ( getPeer() != xP ) )
xP->dispose();
}
return aSz;
@@ -247,7 +247,7 @@ double UnoControlBase::ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp )
if ( xL.is() )
aSz = xL->getMinimumSize( nCols, nLines );
- if ( !mxPeer.is() || ( mxPeer != xP ) )
+ if ( !getPeer().is() || ( getPeer() != xP ) )
xP->dispose();
}
return aSz;
@@ -263,7 +263,7 @@ void UnoControlBase::Impl_getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLine
if ( xL.is() )
xL->getColumnsAndLines( nCols, nLines );
- if ( !mxPeer.is() || ( mxPeer != xP ) )
+ if ( !getPeer().is() || ( getPeer() != xP ) )
xP->dispose();
}
}
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
index 99e2d5499238..22f66a81009b 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unocontrolcontainer.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: fs $ $Date: 2002-01-08 13:41:13 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:03:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -198,7 +198,7 @@ UnoControlContainer::UnoControlContainer() : maCListeners( *this )
UnoControlContainer::UnoControlContainer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP )
: maCListeners( *this )
{
- mxPeer = xP;
+ setPeer( xP );
mbDisposePeer = sal_False;
mpControls = new UnoControlHolderList;
}
@@ -374,10 +374,10 @@ void UnoControlContainer::addControl( const ::rtl::OUString& rName, const ::com:
addingControl( rControl );
- if( mxPeer.is() )
+ if( getPeer().is() )
{
// Hat der Container ein Peer, dann auch gleich im Child erzeugen
- rControl->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), mxPeer );
+ rControl->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), getPeer() );
ImplActivateTabControllers();
}
@@ -451,12 +451,9 @@ void UnoControlContainer::addTabController( const ::com::sun::star::uno::Referen
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- sal_uInt32 nOldCount = maTabControllers.getLength();
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > aNewSeq( nOldCount + 1 );
- for ( sal_uInt32 n = 0; n < nOldCount; n++ )
- aNewSeq.getArray()[n] = maTabControllers.getConstArray()[n];
- aNewSeq.getArray()[nOldCount] = TabController;
- maTabControllers = aNewSeq;
+ sal_uInt32 nCount = maTabControllers.getLength();
+ maTabControllers.realloc( nCount + 1 );
+ maTabControllers[ nCount ] = TabController;
}
void UnoControlContainer::removeTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException)
@@ -464,9 +461,10 @@ void UnoControlContainer::removeTabController( const ::com::sun::star::uno::Refe
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
sal_uInt32 nCount = maTabControllers.getLength();
- for ( sal_uInt32 n = 0; n < nCount; n++ )
+ const uno::Reference< awt::XTabController >* pLoop = maTabControllers.getConstArray();
+ for ( sal_uInt32 n = 0; n < nCount; ++n, ++pLoop )
{
- if( maTabControllers.getConstArray()[n] == TabController )
+ if( pLoop->get() == TabController.get() )
{
::comphelper::removeElementAt( maTabControllers, n );
break;
@@ -479,7 +477,7 @@ void UnoControlContainer::createPeer( const ::com::sun::star::uno::Reference< ::
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- if( !mxPeer.is() )
+ if( !getPeer().is() )
{
sal_Bool bVis = maComponentInfos.bVisible;
if( bVis )
@@ -515,9 +513,9 @@ void UnoControlContainer::createPeer( const ::com::sun::star::uno::Reference< ::
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = getControls();
sal_uInt32 nCtrls = aCtrls.getLength();
for( sal_uInt32 n = 0; n < nCtrls; n++ )
- aCtrls.getArray()[n]->createPeer( rxToolkit, mxPeer );
+ aCtrls.getArray()[n]->createPeer( rxToolkit, getPeer() );
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerPeer > xC( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerPeer > xC( getPeer(), ::com::sun::star::uno::UNO_QUERY );
xC->enableDialogControl( sal_True );
ImplActivateTabControllers();
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index 225ef9731405..e19f0bd17dad 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unocontrolmodel.cxx,v $
*
- * $Revision: 1.31 $
+ * $Revision: 1.32 $
*
- * last change: $Author: fs $ $Date: 2002-12-02 10:09:04 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:03:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -209,7 +209,10 @@ static void lcl_ImplMergeFontProperty( ::com::sun::star::awt::FontDescriptor& rF
break;
case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue >>= rFD.Weight;
break;
- case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: rValue >>= nExtractShort; rFD.Slant = (::com::sun::star::awt::FontSlant)nExtractShort;
+ 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;
@@ -253,12 +256,7 @@ UnoControlModel::UnoControlModel( const UnoControlModel& rModel )
{
ImplControlProperty* pProp = rModel.mpData->GetObject( --n );
ImplControlProperty* pNew = new ImplControlProperty( *pProp );
-
-#ifdef DBG_UTIL
- BOOL bSuccess =
-#endif
mpData->Insert( pNew->GetId(), pNew );
- DBG_ASSERT( bSuccess, "UnoControlModel::UnoControlModel: property was already known!" );
}
}
@@ -485,18 +483,6 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 nPropId )
void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault )
{
- if ( mpData->Get( nPropId ) )
- {
- // property is already known
- DBG_ASSERT( ( BASEPROPERTY_TEXTCOLOR == nPropId )
- || ( BASEPROPERTY_TEXTLINECOLOR == nPropId )
- || ( BASEPROPERTY_FONTRELIEF == nPropId )
- || ( BASEPROPERTY_FONTEMPHASISMARK == nPropId ),
- "UnoControlModel::ImplRegisterProperty: property was already known!"
- );
- return;
- }
-
ImplControlProperty* pProp = new ImplControlProperty( nPropId, rDefault );
mpData->Insert( nPropId, pProp );
}
@@ -1104,10 +1090,8 @@ sal_Bool UnoControlModel::supportsService( const ::rtl::OUString& rServiceName )
::com::sun::star::uno::Sequence< ::rtl::OUString > UnoControlModel::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- DBG_ERROR( "This method should be overloaded!" );
- return ::com::sun::star::uno::Sequence< ::rtl::OUString >();
+ ::rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlModel" ) );
+ return Sequence< ::rtl::OUString >( &sName, 1 );
}
// ::cppu::OPropertySetHelper
@@ -1225,15 +1209,11 @@ sal_Bool UnoControlModel::convertFastPropertyValue( Any & rConvertedValue, Any &
if (!bConverted)
{
- ::rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM( "Unable to convert the given value for the property " ) );
- sMessage += GetPropertyName((sal_uInt16)nPropId);
- sMessage += ::rtl::OUString::createFromAscii( "\n(expected " );
- sMessage += pDestType->getTypeName();
- sMessage += ::rtl::OUString::createFromAscii( ", found " );
- sMessage += rValue.getValueType().getTypeName();
- sMessage += ::rtl::OUString::createFromAscii( ")" );
throw ::com::sun::star::lang::IllegalArgumentException(
- sMessage, static_cast< ::com::sun::star::beans::XPropertySet* >(this), 1);
+ ::rtl::OUString::createFromAscii("Unable to convert the given value for the property ")
+ += GetPropertyName((sal_uInt16)nPropId),
+ static_cast< ::com::sun::star::beans::XPropertySet* >(this),
+ 1);
}
}
}
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index ee73d4e6469f..272bae23ac59 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unocontrols.cxx,v $
*
- * $Revision: 1.57 $
+ * $Revision: 1.58 $
*
- * last change: $Author: mt $ $Date: 2002-09-05 08:54:42 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:03:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,6 +73,9 @@
#endif
+#ifndef TOOLKIT_FORMATTED_CONTROL_HXX
+#include <toolkit/controls/formattedcontrol.hxx>
+#endif
#ifndef _TOOLKIT_HELPER_UNOCONTROLS_HXX_
#include <toolkit/controls/unocontrols.hxx>
#endif
@@ -143,809 +146,10 @@
#include <tools/time.hxx>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
-
-// ----------------------------------------------------
-// class UnoControlHolder
-// ----------------------------------------------------
-struct UnoControlModelHolder
-{
-public:
- uno::Reference< awt::XControlModel > xModel;
- ::rtl::OUString aName;
-
- UnoControlModelHolder( const ::rtl::OUString& rName, const uno::Reference< awt::XControlModel > & rModel )
- : aName( rName )
- {
- xModel = rModel;
- }
-};
-
-DECLARE_LIST( UnoControlModelHolderList, UnoControlModelHolder* );
+using namespace ::toolkit;
// ----------------------------------------------------
-// class UnoControlDialogModel
-// ----------------------------------------------------
-UnoControlDialogModel::UnoControlDialogModel()
- : maContainerListeners( *this )
-{
- mpModels = new UnoControlModelHolderList;
-
- 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 );
-
- uno::Any aBool;
- aBool <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-}
-
-UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel ) :
- UnoControlModel( rModel ) , maContainerListeners( *this )
-{
- mpModels = new UnoControlModelHolderList;
-}
-
-UnoControlDialogModel::~UnoControlDialogModel()
-{
- for ( sal_uInt32 n = mpModels->Count(); n; )
- delete mpModels->GetObject( --n );
- delete mpModels;
-}
-
-uno::Any UnoControlDialogModel::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( lang::XMultiServiceFactory*, this ),
- SAL_STATIC_CAST( container::XContainer*, this ),
- SAL_STATIC_CAST( container::XElementAccess*, this ),
- SAL_STATIC_CAST( container::XNameAccess*, this ),
- SAL_STATIC_CAST( container::XNameReplace*, this ),
- SAL_STATIC_CAST( container::XNameContainer*, this ) );
- return (aRet.hasValue() ? aRet : UnoControlModel::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoControlDialogModel )
-getCppuType( ( uno::Reference< lang::XMultiServiceFactory>* ) NULL ),
-getCppuType( ( uno::Reference< container::XContainer>* ) NULL ),
-getCppuType( ( uno::Reference< container::XElementAccess>* ) NULL ),
-getCppuType( ( uno::Reference< container::XNameAccess>* ) NULL ),
-getCppuType( ( uno::Reference< container::XNameReplace>* ) NULL ),
-getCppuType( ( uno::Reference< container::XNameContainer>* ) NULL ),
-UnoControlModel::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-
-::rtl::OUString UnoControlDialogModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel );
-}
-
-uno::Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialog );
- return aAny;
- }
-
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoControlDialogModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-void SAL_CALL UnoControlDialogModel::dispose( ) throw(uno::RuntimeException)
-{
- // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
- // tell our listeners
- {
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- lang::EventObject aDisposeEvent;
- aDisposeEvent.Source = static_cast< uno::XAggregation* >( static_cast< ::cppu::OWeakAggObject* >( this ) );
- maContainerListeners.disposeAndClear( aDisposeEvent );
- }
-
- // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
- // call the base class
- UnoControlModel::dispose();
-
- // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
- // dispose our child models
- // for this, collect the models (we collect them from mpModels, and this is modified when disposing children)
- ::std::vector< uno::Reference< lang::XComponent > > aChildModels;
- aChildModels.reserve( mpModels->Count() );
- for ( sal_uInt32 n = mpModels->Count(); n; )
- {
- uno::Reference< lang::XComponent > xChildComp( mpModels->GetObject( --n )->xModel, uno::UNO_QUERY );
- if ( xChildComp.is() )
- aChildModels.push_back( xChildComp );
- }
- // now dispose
- for ( const uno::Reference< lang::XComponent >* pChildModel = aChildModels.begin();
- pChildModel != aChildModels.end();
- ++pChildModel
- )
- {
- try
- {
- if ( pChildModel->is() )
- (*pChildModel)->dispose();
- }
- catch( const uno::Exception& )
- {
- DBG_ERROR( "UnoControlDialogModel::dispose: caught an exception while disposing a child model!" );
- }
- }
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-UnoControlModel* UnoControlDialogModel::Clone() const
-{
- UnoControlDialogModel* pClone = new UnoControlDialogModel( *this );
-
- for ( sal_uInt32 n = 0; n < mpModels->Count(); n++ )
- {
- UnoControlModelHolder* pH = mpModels->GetObject( n );
-
- uno::Reference< util::XCloneable > xC( pH->xModel, uno::UNO_QUERY );
- uno::Reference< util::XCloneable > xNew = xC->createClone();
- uno::Reference< awt::XControlModel > xM( xNew, uno::UNO_QUERY );
- UnoControlModelHolder* pNew = new UnoControlModelHolder( pH->aName, xM );
- pClone->mpModels->Insert( pNew, LIST_APPEND );
- }
-
- return pClone;
-}
-
-UnoControlModelHolder* UnoControlDialogModel::ImplFindElement( const ::rtl::OUString& rName ) const
-{
- UnoControlModelHolder* pE = NULL;
- for ( sal_uInt32 n = mpModels->Count(); n && !pE; )
- {
- UnoControlModelHolder* pH = mpModels->GetObject( --n );
- if ( pH->aName == rName )
- pE = pH;
- }
- return pE;
-}
-
-// ::lang::XMultiServiceFactory
-uno::Reference< uno::XInterface >UnoControlDialogModel::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(uno::Exception, uno::RuntimeException)
-{
- OGeometryControlModel_Base* pNewModel = NULL;
-
- if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlEditModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFileControlModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlButtonModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlImageControlModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedTextModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlListBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >;
-
- if ( !pNewModel )
- {
- Reference< XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
- if ( xORB.is() )
- {
- Reference< XInterface > xObject = xORB->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::createFromAscii( "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 );
- }
- }
- }
- }
-
- uno::Reference< uno::XInterface > xNewModel = static_cast< ::cppu::OWeakObject* >( pNewModel );
- return xNewModel;
-}
-
-uno::Reference< uno::XInterface > UnoControlDialogModel::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& /* Arguments */ ) throw(uno::Exception, uno::RuntimeException)
-{
- return createInstance( ServiceSpecifier );
-}
-
-uno::Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() throw(uno::RuntimeException)
-{
- static uno::Sequence< ::rtl::OUString >* pNamesSeq = NULL;
- if ( !pNamesSeq )
- {
- pNamesSeq = new uno::Sequence< ::rtl::OUString >( 19 );
- ::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 );
- }
- return *pNamesSeq;
-}
-
-// container::XContainer
-void UnoControlDialogModel::addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException)
-{
- maContainerListeners.addInterface( l );
-}
-
-void UnoControlDialogModel::removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException)
-{
- maContainerListeners.removeInterface( l );
-}
-
-// container::XElementAcces
-uno::Type UnoControlDialogModel::getElementType() throw(uno::RuntimeException)
-{
- uno::Type aType = getCppuType( ( uno::Reference< awt::XControlModel>* ) NULL );
- return aType;
-}
-
-sal_Bool UnoControlDialogModel::hasElements() throw(uno::RuntimeException)
-{
- return mpModels->Count() ? sal_True : sal_False;
-}
-
-// container::XNameContainer, XNameReplace, XNameAccess
-void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
- UnoControlModelHolder* pE = ImplFindElement( aName );
- if ( pE )
- {
- container::ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElement;
- aEvent.ReplacedElement <<= pE->xModel;
- aEvent.Accessor <<= aName;
-
- aElement >>= pE->xModel;
-
- maContainerListeners.elementReplaced( aEvent );
- }
-}
-
-uno::Any UnoControlDialogModel::getByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
- uno::Any aElement;
- UnoControlModelHolder* pE = ImplFindElement( aName );
- if ( pE )
- aElement <<= pE->xModel;
- return aElement;
-}
-
-uno::Sequence< ::rtl::OUString > UnoControlDialogModel::getElementNames() throw(uno::RuntimeException)
-{
- uno::Sequence< ::rtl::OUString > aNames( mpModels->Count() );
- ::rtl::OUString* pNames = aNames.getArray();
-
- for ( sal_uInt32 n = 0; n < mpModels->Count(); n++ )
- {
- UnoControlModelHolder* pH = mpModels->GetObject( n );
- pNames[n] = pH->aName;
- }
- return aNames;
-}
-
-sal_Bool UnoControlDialogModel::hasByName( const ::rtl::OUString& aName ) throw(uno::RuntimeException)
-{
- return ImplFindElement( aName ) ? sal_True : sal_False;
-}
-
-void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
-{
- uno::Reference< awt::XControlModel > xM;
- aElement >>= xM;
- if ( !xM.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "The to be inserted element must not be NULL." ), *this, 1 );
-
- UnoControlModelHolder* pNew = new UnoControlModelHolder( aName, xM );
- mpModels->Insert( pNew, LIST_APPEND );
-
- container::ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElement;
- aEvent.Accessor <<= aName;
- maContainerListeners.elementInserted( aEvent );
-}
-
-void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
- UnoControlModelHolder* pE = ImplFindElement( aName );
- if ( pE )
- {
- container::ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= pE->xModel;
- aEvent.Accessor <<= aName;
- maContainerListeners.elementRemoved( aEvent );
-
- mpModels->Remove( pE );
- delete pE;
- }
-}
-
-// ----------------------------------------------------
-// class UnoDialogControl
-// ----------------------------------------------------
-UnoDialogControl::UnoDialogControl() : maTopWindowListeners( *this )
-{
- maComponentInfos.nWidth = 300;
- maComponentInfos.nHeight = 450;
-}
-
-::rtl::OUString UnoDialogControl::GetComponentServiceName()
-{
- return ::rtl::OUString::createFromAscii( "Dialog" );
-}
-
-// uno::XInterface
-uno::Any UnoDialogControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( awt::XTopWindow*, this ),
- SAL_STATIC_CAST( awt::XDialog*, this ) );
- return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
-}
-
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoDialogControl )
-getCppuType( ( uno::Reference< awt::XDialog>* ) NULL ),
-getCppuType( ( uno::Reference< awt::XTopWindow>* ) NULL ),
-UnoControlContainer::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-
-void UnoDialogControl::ImplInsertControl( uno::Reference< awt::XControlModel >& rxModel, const ::rtl::OUString& rName )
-{
- uno::Reference< beans::XPropertySet > xP( rxModel, uno::UNO_QUERY );
-
- // be more tolerant against invalid arguments
- // this is part of the fix for #97087# - 05.03.2002 - fs@openoffice.org
- DBG_ASSERT( xP.is(), "UnoDialogControl::ImplInsertControl: invalid model!" );
- if ( !xP.is() )
- return;
-
- ::rtl::OUString aDefCtrl;
- xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
- uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- uno::Reference < awt::XControl > xCtrl( xMSF->createInstance( aDefCtrl ), uno::UNO_QUERY );
-
- 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 UnoDialogControl::ImplRemoveControl( uno::Reference< awt::XControlModel >& rxModel )
-{
- uno::Sequence< uno::Reference< awt::XControl > > aControls = getControls();
- uno::Reference< awt::XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
- if ( xCtrl.is() )
- removeControl( xCtrl );
-}
-
-void UnoDialogControl::ImplSetPosSize( uno::Reference< awt::XControl >& rxCtrl )
-{
- uno::Reference< beans::XPropertySet > xP( rxCtrl->getModel(), uno::UNO_QUERY );
-
- sal_Int32 nX, nY, nWidth, nHeight;
- 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;
-
- // Currentley we are simply using MAP_APPFONT
- OutputDevice*pOutDev = Application::GetDefaultDevice();
- DBG_ASSERT( pOutDev, "Missing Default Device!" );
- if ( pOutDev )
- {
- Size aTmp( nX, nY );
- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
- nX = aTmp.Width();
- nY = aTmp.Height();
- aTmp = Size( nWidth, nHeight );
- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
- nWidth = aTmp.Width();
- nHeight = aTmp.Height();
- }
- else
- {
- uno::Reference< awt::XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
- uno::Reference< awt::XDevice > xD( xPeer, uno::UNO_QUERY );
-
- awt::SimpleFontMetric aFM;
- awt::FontDescriptor aFD;
- uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
- aVal >>= aFD;
- if ( aFD.StyleName.getLength() )
- {
- uno::Reference< awt::XFont > xFont = xD->getFont( aFD );
- aFM = xFont->getFontMetric();
- }
- else
- {
- uno::Reference< awt::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;
- }
- uno::Reference < awt::XWindow > xW( rxCtrl, uno::UNO_QUERY );
- xW->setPosSize( nX, nY, nWidth, nHeight, awt::PosSize::POSSIZE );
-}
-
-void UnoDialogControl::dispose() throw(uno::RuntimeException)
-{
- lang::EventObject aEvt;
- aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
- maTopWindowListeners.disposeAndClear( aEvt );
-
- UnoControlContainer::dispose();
-}
-
-sal_Bool UnoDialogControl::setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ) throw(::com::sun::star::uno::RuntimeException)
-{
- if ( getModel().is() )
- {
- uno::Sequence< uno::Reference< awt::XControl > > aControls = getControls();
- const uno::Reference< awt::XControl >* pCtrls = aControls.getConstArray();
- const uno::Reference< awt::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
-
- uno::Reference< container::XContainer > xC( getModel(), uno::UNO_QUERY );
- if ( xC.is() )
- xC->removeContainerListener( this );
- }
-
- sal_Bool bRet = UnoControl::setModel( rxModel );
-
- if ( getModel().is() )
- {
- uno::Reference< container::XNameAccess > xNA( getModel(), uno::UNO_QUERY );
- if ( xNA.is() )
- {
- uno::Sequence< ::rtl::OUString > aNames = xNA->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_uInt32 nCtrls = aNames.getLength();
-
- uno::Reference< awt::XControlModel > xCtrlModel;
- for( sal_uInt32 n = 0; n < nCtrls; ++n, ++pNames )
- {
- xNA->getByName( *pNames ) >>= xCtrlModel;
- ImplInsertControl( xCtrlModel, *pNames );
- }
- }
-
- uno::Reference< container::XContainer > xC( getModel(), uno::UNO_QUERY );
- if ( xC.is() )
- xC->addContainerListener( this );
- }
- return bRet;
-}
-
-void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- UnoControl::setDesignMode( bOn );
-
- uno::Sequence< uno::Reference< awt::XControl > > xCtrls = getControls();
- sal_Int32 nControls = xCtrls.getLength();
- uno::Reference< awt::XControl >* pControls = xCtrls.getArray();
- for ( sal_Int32 n = 0; n < nControls; n++ )
- pControls[n]->setDesignMode( bOn );
-}
-
-void UnoDialogControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
-{
- UnoControlContainer::createPeer( rxToolkit, rParentPeer );
-
- uno::Reference < awt::XTopWindow > xTW( mxPeer, uno::UNO_QUERY );
- xTW->setMenuBar( mxMenuBar );
- if ( maTopWindowListeners.getLength() )
- xTW->addTopWindowListener( &maTopWindowListeners );
-}
-
-void UnoDialogControl::elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Reference< awt::XControlModel > xModel;
- ::rtl::OUString aName;
-
- Event.Accessor >>= aName;
- Event.Element >>= xModel;
- ImplInsertControl( xModel, aName );
-}
-
-void UnoDialogControl::elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Reference< awt::XControlModel > xModel;
- Event.Element >>= xModel;
- if ( xModel.is() )
- ImplRemoveControl( xModel );
-}
-
-void UnoDialogControl::elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException)
-{
- uno::Reference< awt::XControlModel > xModel;
- Event.ReplacedElement >>= xModel;
- if ( xModel.is() )
- ImplRemoveControl( xModel );
-
- ::rtl::OUString aName;
- Event.Accessor >>= aName;
- Event.Element >>= xModel;
- ImplInsertControl( xModel, aName );
-}
-
-void UnoDialogControl::addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw (::com::sun::star::uno::RuntimeException)
-{
- maTopWindowListeners.addInterface( rxListener );
- if( mxPeer.is() && maTopWindowListeners.getLength() == 1 )
- {
- uno::Reference < awt::XTopWindow > xTW( mxPeer, uno::UNO_QUERY );
- xTW->addTopWindowListener( &maTopWindowListeners );
- }
-}
-
-void UnoDialogControl::removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw (::com::sun::star::uno::RuntimeException)
-{
- if( mxPeer.is() && maTopWindowListeners.getLength() == 1 )
- {
- uno::Reference < awt::XTopWindow > xTW( mxPeer, uno::UNO_QUERY );
- xTW->removeTopWindowListener( &maTopWindowListeners );
- }
- maTopWindowListeners.removeInterface( rxListener );
-}
-
-void UnoDialogControl::toFront( ) throw (::com::sun::star::uno::RuntimeException)
-{
- if ( getPeer().is() )
- {
- uno::Reference< awt::XTopWindow > xTW( getPeer(), uno::UNO_QUERY );
- if( xTW.is() )
- xTW->toFront();
- }
-}
-
-void UnoDialogControl::toBack( ) throw (::com::sun::star::uno::RuntimeException)
-{
- if ( getPeer().is() )
- {
- uno::Reference< awt::XTopWindow > xTW( getPeer(), uno::UNO_QUERY );
- if( xTW.is() )
- xTW->toBack();
- }
-}
-
-void UnoDialogControl::setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& rxMenuBar ) throw (::com::sun::star::uno::RuntimeException)
-{
- mxMenuBar = rxMenuBar;
- if ( getPeer().is() )
- {
- uno::Reference< awt::XTopWindow > xTW( getPeer(), uno::UNO_QUERY );
- if( xTW.is() )
- xTW->setMenuBar( mxMenuBar );
- }
-}
-
-// beans::XPropertiesChangeListener
-void UnoDialogControl::propertiesChange( const uno::Sequence< beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException)
-{
- if( !isDesignMode() && !IsUpdatingModel() && !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 beans::PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
- uno::Reference< awt::XControlModel > xModel( rEvt.Source, uno::UNO_QUERY );
- sal_Bool bOwnModel = (awt::XControlModel*)xModel.get() == (awt::XControlModel*)getModel().get();
- if ( ( rEvt.PropertyName == s1 ) || ( rEvt.PropertyName == s2 ) || ( rEvt.PropertyName == s3 ) || ( rEvt.PropertyName == s4 ) )
- {
- if ( bOwnModel )
- {
- uno::Reference< awt::XControl > xThis( (uno::XAggregation*)(::cppu::OWeakAggObject*)this, uno::UNO_QUERY );
- ImplSetPosSize( xThis );
- }
- else
- {
- uno::Sequence<uno::Reference<awt::XControl> > aControlSequence(getControls());
- uno::Reference<awt::XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
- ImplSetPosSize( aControlRef );
- }
- break;
- }
-
- }
- }
-
- UnoControlContainer::propertiesChange( rEvents );
-}
-
-void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(uno::RuntimeException)
-{
- uno::Any aAny;
- aAny <<= Title;
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ), aAny, sal_True );
-}
-
-::rtl::OUString UnoDialogControl::getTitle() throw(uno::RuntimeException)
-{
- return ImplGetPropertyValue_UString( BASEPROPERTY_TITLE );
-}
-
-sal_Int16 UnoDialogControl::execute() throw(uno::RuntimeException)
-{
- sal_Int16 nDone = -1;
- if ( getPeer().is() )
- {
- uno::Reference< awt::XDialog > xDlg( getPeer(), uno::UNO_QUERY );
- if( xDlg.is() )
- {
- GetComponentInfos().bVisible = sal_True;
- nDone = xDlg->execute();
- GetComponentInfos().bVisible = sal_False;
- }
- }
- return nDone;
-}
-
-void UnoDialogControl::endExecute() throw(uno::RuntimeException)
-{
- if ( getPeer().is() )
- {
- uno::Reference< awt::XDialog > xDlg( getPeer(), uno::UNO_QUERY );
- if( xDlg.is() )
- {
- xDlg->endExecute();
- GetComponentInfos().bVisible = sal_False;
- }
- }
-}
-
-void UnoDialogControl::addingControl( const uno::Reference< awt::XControl >& _rxControl )
-{
- UnoControlContainer::addingControl( _rxControl );
-
- if ( _rxControl.is() )
- {
- uno::Reference< beans::XMultiPropertySet > xProps( _rxControl->getModel(), uno::UNO_QUERY );
- if ( xProps.is() )
- {
- uno::Sequence< ::rtl::OUString > aNames( 4 );
- ::rtl::OUString* pNames = aNames.getArray();
- *pNames++ = ::rtl::OUString::createFromAscii( "PositionX" );
- *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
- *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
- *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
-
- xProps->addPropertiesChangeListener( aNames, this );
- }
- }
-}
-
-void UnoDialogControl::removingControl( const uno::Reference< awt::XControl >& _rxControl )
-{
- UnoControlContainer::removingControl( _rxControl );
-
- if ( _rxControl.is() )
- {
- uno::Reference< beans::XMultiPropertySet > xProps( _rxControl->getModel(), uno::UNO_QUERY );
- if ( xProps.is() )
- xProps->removePropertiesChangeListener( this );
- }
-
-}
-
-// ----------------------------------------------------
// class UnoControlEditModel
// ----------------------------------------------------
UnoControlEditModel::UnoControlEditModel()
@@ -1035,10 +239,10 @@ UnoEditControl::UnoEditControl()
void UnoEditControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
{
sal_Bool bDone = sal_False;
- if ( mxPeer.is() && ( GetPropertyId( rPropName ) == BASEPROPERTY_TEXT ) )
+ if ( getPeer().is() && ( GetPropertyId( rPropName ) == BASEPROPERTY_TEXT ) )
{
// #96986# use setText(), or text listener will not be called.
- uno::Reference < awt::XTextComponent > xTextComponent( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XTextComponent > xTextComponent( getPeer(), uno::UNO_QUERY );
if ( xTextComponent.is() )
{
::rtl::OUString aText;
@@ -1086,7 +290,7 @@ void UnoEditControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk
{
UnoControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference< awt::XTextComponent > xText( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
xText->addTextListener( this );
if ( mbSetMaxTextLenInPeer )
@@ -1097,7 +301,7 @@ void UnoEditControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk
void UnoEditControl::textChanged(const awt::TextEvent& e) throw(uno::RuntimeException)
{
- uno::Reference< awt::XTextComponent > xText( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
if ( ImplHasProperty( BASEPROPERTY_TEXT ) )
{
@@ -1136,9 +340,9 @@ void UnoEditControl::setText( const ::rtl::OUString& aText ) throw(uno::RuntimeE
{
maText = aText;
mbSetTextInPeer = TRUE;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XTextComponent > xText( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
xText->setText( maText );
}
}
@@ -1173,9 +377,9 @@ void UnoEditControl::insertText( const awt::Selection& rSel, const ::rtl::OUStri
::rtl::OUString UnoEditControl::getSelectedText( void ) throw(uno::RuntimeException)
{
::rtl::OUString aSelected;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference< awt::XTextComponent > xText( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
aSelected = xText->getSelectedText();
}
return aSelected;
@@ -1183,9 +387,9 @@ void UnoEditControl::insertText( const awt::Selection& rSel, const ::rtl::OUStri
void UnoEditControl::setSelection( const awt::Selection& aSelection ) throw(uno::RuntimeException)
{
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference< awt::XTextComponent > xText( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
xText->setSelection( aSelection );
}
}
@@ -1193,9 +397,9 @@ void UnoEditControl::setSelection( const awt::Selection& aSelection ) throw(uno:
awt::Selection UnoEditControl::getSelection( void ) throw(uno::RuntimeException)
{
awt::Selection aSel;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference< awt::XTextComponent > xText( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
aSel = xText->getSelection();
}
return aSel;
@@ -1235,9 +439,9 @@ void UnoEditControl::setMaxTextLen( sal_Int16 nLen ) throw(uno::RuntimeException
{
mnMaxTextLen = nLen;
mbSetMaxTextLenInPeer = TRUE;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XTextComponent > xText( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
xText->setMaxTextLen( mnMaxTextLen );
}
}
@@ -1268,137 +472,6 @@ void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) t
Impl_getColumnsAndLines( nCols, nLines );
}
-// ----------------------------------------------------
-// class UnoControlFormattedFieldModel
-// ----------------------------------------------------
-UnoControlFormattedFieldModel::UnoControlFormattedFieldModel()
-{
- ImplRegisterProperty( BASEPROPERTY_ALIGN );
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_DEFAULT );
- ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_VALUE );
- ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MAX );
- ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MIN );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_FORMATKEY );
- ImplRegisterProperty( BASEPROPERTY_FORMATSSUPPLIER );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_MAXTEXTLEN );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_READONLY );
- ImplRegisterProperty( BASEPROPERTY_SPIN );
- ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT );
- ImplRegisterProperty( BASEPROPERTY_TABSTOP );
- ImplRegisterProperty( BASEPROPERTY_TEXT );
- ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
-
- uno::Any aTreatAsNumber;
- aTreatAsNumber <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_TREATASNUMBER, aTreatAsNumber );
-}
-
-::rtl::OUString UnoControlFormattedFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedFieldModel );
-}
-
-sal_Bool UnoControlFormattedFieldModel::convertFastPropertyValue(
- ::com::sun::star::uno::Any& rConvertedValue,
- ::com::sun::star::uno::Any& rOldValue,
- sal_Int32 nPropId,
- const ::com::sun::star::uno::Any& rValue
- ) throw (::com::sun::star::lang::IllegalArgumentException)
-{
- if ( BASEPROPERTY_EFFECTIVE_DEFAULT == nPropId )
- {
- double dVal = 0;
- sal_Int32 nVal = 0;
- ::rtl::OUString sVal;
- if ( ( rValue >>= dVal ) || ( rValue >>= nVal ) || ( rValue >>= sVal ) )
- {
- getFastPropertyValue( rOldValue, nPropId );
- return !CompareProperties( rConvertedValue, rOldValue );
- }
-
- throw ::com::sun::star::lang::IllegalArgumentException(
- ( ::rtl::OUString::createFromAscii("Unable to convert the given value for the property ")
- += GetPropertyName((sal_uInt16)nPropId) )
- += ::rtl::OUString::createFromAscii(" (double, integer, or string expected)."),
- static_cast< ::com::sun::star::beans::XPropertySet* >(this),
- 1);
- }
-
- return UnoControlModel::convertFastPropertyValue( rConvertedValue, rOldValue, nPropId, rValue );
-}
-
-uno::Any UnoControlFormattedFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- uno::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 )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoControlFormattedFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ----------------------------------------------------
-// class UnoFormattedFieldControl
-// ----------------------------------------------------
-UnoFormattedFieldControl::UnoFormattedFieldControl()
-{
-}
-
-::rtl::OUString UnoFormattedFieldControl::GetComponentServiceName()
-{
- return ::rtl::OUString::createFromAscii( "FormattedField" );
-}
-
-void UnoFormattedFieldControl::textChanged(const awt::TextEvent& e) throw(uno::RuntimeException)
-{
- uno::Reference< awt::XVclWindowPeer > xPeer(mxPeer, uno::UNO_QUERY);
- DBG_ASSERT(xPeer.is(), "UnoFormattedFieldControl::textChanged : what kind of peer do I have ?");
- ::rtl::OUString sEffectiveValue = GetPropertyName( BASEPROPERTY_EFFECTIVE_VALUE );
- ImplSetPropertyValue( sEffectiveValue, xPeer->getProperty( sEffectiveValue ), sal_False );
-
- if ( GetTextListeners().getLength() )
- GetTextListeners().textChanged( e );
-}
// ----------------------------------------------------
// class UnoControlFileControlModel
@@ -1617,7 +690,7 @@ void UnoButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToo
{
UnoControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
xButton->setActionCommand( maActionCommand );
if ( maActionListeners.getLength() )
xButton->addActionListener( &maActionListeners );
@@ -1626,10 +699,10 @@ void UnoButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToo
void UnoButtonControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
{
sal_uInt16 nType = GetPropertyId( rPropName );
- if ( mxPeer.is() && ( nType == BASEPROPERTY_IMAGEURL ) )
+ if ( getPeer().is() && ( nType == BASEPROPERTY_IMAGEURL ) )
{
uno::Reference < awt::XImageProducer > xImgProd( getModel(), uno::UNO_QUERY );
- uno::Reference < awt::XImageConsumer > xImgCons( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XImageConsumer > xImgCons( getPeer(), uno::UNO_QUERY );
if ( xImgProd.is() && xImgCons.is() )
{
@@ -1646,18 +719,18 @@ void UnoButtonControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, co
void UnoButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
{
maActionListeners.addInterface( l );
- if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
{
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer.is() && maActionListeners.getLength() == 1 )
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
{
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
xButton->removeActionListener( &maActionListeners );
}
maActionListeners.removeInterface( l );
@@ -1673,9 +746,9 @@ void UnoButtonControl::setLabel( const ::rtl::OUString& rLabel ) throw(uno::Run
void UnoButtonControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
{
maActionCommand = rCommand;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
xButton->setActionCommand( rCommand );
}
}
@@ -1844,10 +917,10 @@ awt::Size UnoImageControlControl::calcAdjustedSize( const awt::Size& rNewSize )
void UnoImageControlControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
{
sal_uInt16 nType = GetPropertyId( rPropName );
- if ( mxPeer.is() && ( nType == BASEPROPERTY_IMAGEURL ) )
+ if ( getPeer().is() && ( nType == BASEPROPERTY_IMAGEURL ) )
{
uno::Reference < awt::XImageProducer > xImgProd( getModel(), uno::UNO_QUERY );
- uno::Reference < awt::XImageConsumer > xImgCons( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XImageConsumer > xImgCons( getPeer(), uno::UNO_QUERY );
if ( xImgProd.is() && xImgCons.is() )
{
@@ -1966,10 +1039,10 @@ void UnoRadioButtonControl::createPeer( const uno::Reference< awt::XToolkit > &
{
UnoControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XRadioButton > xRadioButton( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XRadioButton > xRadioButton( getPeer(), uno::UNO_QUERY );
xRadioButton->addItemListener( this );
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
xButton->setActionCommand( maActionCommand );
if ( maActionListeners.getLength() )
xButton->addActionListener( &maActionListeners );
@@ -1995,18 +1068,18 @@ void UnoRadioButtonControl::removeItemListener(const uno::Reference < awt::XItem
void UnoRadioButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
{
maActionListeners.addInterface( l );
- if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
{
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer.is() && maActionListeners.getLength() == 1 )
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
{
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
xButton->removeActionListener( &maActionListeners );
}
maActionListeners.removeInterface( l );
@@ -2022,9 +1095,9 @@ void UnoRadioButtonControl::setLabel( const ::rtl::OUString& rLabel ) throw(uno
void UnoRadioButtonControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
{
maActionCommand = rCommand;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
xButton->setActionCommand( rCommand );
}
}
@@ -2177,10 +1250,10 @@ void UnoCheckBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxT
{
UnoControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XCheckBox > xCheckBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XCheckBox > xCheckBox( getPeer(), uno::UNO_QUERY );
xCheckBox->addItemListener( this );
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
xButton->setActionCommand( maActionCommand );
if ( maActionListeners.getLength() )
xButton->addActionListener( &maActionListeners );
@@ -2199,18 +1272,18 @@ void UnoCheckBoxControl::removeItemListener(const uno::Reference < awt::XItemLis
void UnoCheckBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
{
maActionListeners.addInterface( l );
- if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
{
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer.is() && maActionListeners.getLength() == 1 )
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
{
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
xButton->removeActionListener( &maActionListeners );
}
maActionListeners.removeInterface( l );
@@ -2219,9 +1292,9 @@ void UnoCheckBoxControl::removeActionListener(const uno::Reference< awt::XAction
void UnoCheckBoxControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
{
maActionCommand = rCommand;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XButton > xButton( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
xButton->setActionCommand( rCommand );
}
}
@@ -2645,9 +1718,9 @@ void UnoListBoxControl::dispose() throw(uno::RuntimeException)
void UnoListBoxControl::ImplUpdateSelectedItemsProperty()
{
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
DBG_ASSERT( xListBox.is(), "XListBox?" );
uno::Sequence<sal_Int16> aSeq = xListBox->getSelectedItemsPos();
@@ -2669,7 +1742,7 @@ void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, c
uno::Any aVal = ImplGetPropertyValue( aSelPropName );
if ( !( aVal.getValueType().getTypeClass() == uno::TypeClass_VOID ) )
{
- uno::Reference< awt::XVclWindowPeer > xW( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XVclWindowPeer > xW( getPeer(), uno::UNO_QUERY );
if (xW.is())
// same comment as in UnoControl::ImplSetPeerProperty - see there
xW->setProperty( aSelPropName, aVal );
@@ -2681,7 +1754,7 @@ void UnoListBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxTo
{
UnoControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
xListBox->addItemListener( this );
if ( maActionListeners.getLength() )
@@ -2691,18 +1764,18 @@ void UnoListBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxTo
void UnoListBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
{
maActionListeners.addInterface( l );
- if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer.is() && maActionListeners.getLength() == 1 )
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
xListBox->removeActionListener( &maActionListeners );
}
maActionListeners.removeInterface( l );
@@ -2821,9 +1894,9 @@ uno::Sequence< ::rtl::OUString> UnoListBoxControl::getItems() throw(uno::Runtime
sal_Int16 UnoListBoxControl::getSelectedItemPos() throw(uno::RuntimeException)
{
sal_Int16 n = -1;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
n = xListBox->getSelectedItemPos();
}
return n;
@@ -2832,9 +1905,9 @@ sal_Int16 UnoListBoxControl::getSelectedItemPos() throw(uno::RuntimeException)
uno::Sequence<sal_Int16> UnoListBoxControl::getSelectedItemsPos() throw(uno::RuntimeException)
{
uno::Sequence<sal_Int16> aSeq;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
aSeq = xListBox->getSelectedItemsPos();
}
return aSeq;
@@ -2843,9 +1916,9 @@ uno::Sequence<sal_Int16> UnoListBoxControl::getSelectedItemsPos() throw(uno::Run
::rtl::OUString UnoListBoxControl::getSelectedItem() throw(uno::RuntimeException)
{
::rtl::OUString aItem;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
aItem = xListBox->getSelectedItem();
}
return aItem;
@@ -2854,9 +1927,9 @@ uno::Sequence<sal_Int16> UnoListBoxControl::getSelectedItemsPos() throw(uno::Run
uno::Sequence< ::rtl::OUString> UnoListBoxControl::getSelectedItems() throw(uno::RuntimeException)
{
uno::Sequence< ::rtl::OUString> aSeq;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
aSeq = xListBox->getSelectedItems();
}
return aSeq;
@@ -2864,9 +1937,9 @@ uno::Sequence< ::rtl::OUString> UnoListBoxControl::getSelectedItems() throw(uno:
void UnoListBoxControl::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(uno::RuntimeException)
{
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
xListBox->selectItemPos( nPos, bSelect );
}
ImplUpdateSelectedItemsProperty();
@@ -2874,9 +1947,9 @@ void UnoListBoxControl::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(
void UnoListBoxControl::selectItemsPos( const uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(uno::RuntimeException)
{
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
xListBox->selectItemsPos( aPositions, bSelect );
}
ImplUpdateSelectedItemsProperty();
@@ -2884,9 +1957,9 @@ void UnoListBoxControl::selectItemsPos( const uno::Sequence<sal_Int16>& aPositio
void UnoListBoxControl::selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(uno::RuntimeException)
{
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
xListBox->selectItem( aItem, bSelect );
}
ImplUpdateSelectedItemsProperty();
@@ -2894,9 +1967,9 @@ void UnoListBoxControl::selectItem( const ::rtl::OUString& aItem, sal_Bool bSele
void UnoListBoxControl::makeVisible( sal_Int16 nEntry ) throw(uno::RuntimeException)
{
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XListBox > xListBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
xListBox->makeVisible( nEntry );
}
}
@@ -3060,7 +2133,7 @@ void UnoComboBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxT
{
UnoEditControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XComboBox > xComboBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY );
if ( maActionListeners.getLength() )
xComboBox->addActionListener( &maActionListeners );
if ( maItemListeners.getLength() )
@@ -3070,18 +2143,18 @@ void UnoComboBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxT
void UnoComboBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
{
maActionListeners.addInterface( l );
- if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
{
- uno::Reference < awt::XComboBox > xComboBox( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer.is() && maActionListeners.getLength() == 1 )
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
{
- uno::Reference < awt::XComboBox > xComboBox( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY );
xComboBox->removeActionListener( &maActionListeners );
}
maActionListeners.removeInterface( l );
@@ -3090,18 +2163,18 @@ void UnoComboBoxControl::removeActionListener(const uno::Reference< awt::XAction
void UnoComboBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
{
maItemListeners.addInterface( l );
- if( mxPeer.is() && maItemListeners.getLength() == 1 )
+ if( getPeer().is() && maItemListeners.getLength() == 1 )
{
- uno::Reference < awt::XComboBox > xComboBox( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer.is() && maItemListeners.getLength() == 1 )
+ if( getPeer().is() && maItemListeners.getLength() == 1 )
{
- uno::Reference < awt::XComboBox > xComboBox( mxPeer, uno::UNO_QUERY ); // MT: Mal alles so umstellen, schoener als Ref anlegen und query rufen
+ 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 );
@@ -3246,7 +2319,7 @@ void UnoSpinFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rx
{
UnoEditControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XSpinField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
xField->enableRepeat( mbRepeat );
if ( maSpinListeners.getLength() )
xField->addSpinListener( &maSpinListeners );
@@ -3256,18 +2329,18 @@ void UnoSpinFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rx
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( mxPeer.is() && maSpinListeners.getLength() == 1 )
+ if( getPeer().is() && maSpinListeners.getLength() == 1 )
{
- uno::Reference < awt::XSpinField > xField( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer.is() && maSpinListeners.getLength() == 1 )
+ if( getPeer().is() && maSpinListeners.getLength() == 1 )
{
- uno::Reference < awt::XSpinField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
xField->removeSpinListener( &maSpinListeners );
}
maSpinListeners.removeInterface( l );
@@ -3275,28 +2348,28 @@ void UnoSpinFieldControl::removeSpinListener( const ::com::sun::star::uno::Refer
void UnoSpinFieldControl::up() throw(::com::sun::star::uno::RuntimeException)
{
- uno::Reference < awt::XSpinField > xField( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
if ( xField.is() )
xField->last();
}
@@ -3305,7 +2378,7 @@ void UnoSpinFieldControl::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::sta
{
mbRepeat = bRepeat;
- uno::Reference < awt::XSpinField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
if ( xField.is() )
xField->enableRepeat( bRepeat );
}
@@ -3405,7 +2478,7 @@ void UnoDateFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rx
{
UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XDateField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
xField->setFirst( mnFirst );
xField->setLast( mnLast );
if ( mbLongFormat != 2 ) // not set
@@ -3415,7 +2488,7 @@ void UnoDateFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rx
void UnoDateFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
{
- uno::Reference < awt::XDateField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
uno::Any aValue;
if ( !xField->isEmpty() )
aValue <<= xField->getDate();
@@ -3465,9 +2538,9 @@ sal_Int32 UnoDateFieldControl::getMax() throw(uno::RuntimeException)
void UnoDateFieldControl::setFirst( sal_Int32 Date ) throw(uno::RuntimeException)
{
mnFirst = Date;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XDateField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
xField->setFirst( Date );
}
}
@@ -3480,9 +2553,9 @@ sal_Int32 UnoDateFieldControl::getFirst() throw(uno::RuntimeException)
void UnoDateFieldControl::setLast( sal_Int32 Date ) throw(uno::RuntimeException)
{
mnLast = Date;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XDateField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
xField->setLast( Date );
}
}
@@ -3495,9 +2568,9 @@ sal_Int32 UnoDateFieldControl::getLast() throw(uno::RuntimeException)
void UnoDateFieldControl::setLongFormat( sal_Bool bLong ) throw(uno::RuntimeException)
{
mbLongFormat = bLong;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XDateField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
xField->setLongFormat( bLong );
}
}
@@ -3509,9 +2582,9 @@ sal_Bool UnoDateFieldControl::isLongFormat() throw(uno::RuntimeException)
void UnoDateFieldControl::setEmpty() throw(uno::RuntimeException)
{
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XDateField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
xField->setEmpty();
}
}
@@ -3519,9 +2592,9 @@ void UnoDateFieldControl::setEmpty() throw(uno::RuntimeException)
sal_Bool UnoDateFieldControl::isEmpty() throw(uno::RuntimeException)
{
sal_Bool bEmpty = sal_False;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XDateField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
bEmpty = xField->isEmpty();
}
return bEmpty;
@@ -3631,14 +2704,14 @@ void UnoTimeFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rx
{
UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XTimeField > xField( mxPeer, uno::UNO_QUERY );
+ 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)
{
- uno::Reference < awt::XTimeField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
uno::Any aValue;
if ( !xField->isEmpty() )
aValue <<= xField->getTime();
@@ -3687,9 +2760,9 @@ sal_Int32 UnoTimeFieldControl::getMax() throw(uno::RuntimeException)
void UnoTimeFieldControl::setFirst( sal_Int32 Time ) throw(uno::RuntimeException)
{
mnFirst = Time;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XTimeField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
xField->setFirst( mnFirst );
}
}
@@ -3702,9 +2775,9 @@ sal_Int32 UnoTimeFieldControl::getFirst() throw(uno::RuntimeException)
void UnoTimeFieldControl::setLast( sal_Int32 Time ) throw(uno::RuntimeException)
{
mnLast = Time;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XTimeField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
xField->setFirst( mnLast );
}
}
@@ -3716,9 +2789,9 @@ sal_Int32 UnoTimeFieldControl::getLast() throw(uno::RuntimeException)
void UnoTimeFieldControl::setEmpty() throw(uno::RuntimeException)
{
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XTimeField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
xField->setEmpty();
}
}
@@ -3726,9 +2799,9 @@ void UnoTimeFieldControl::setEmpty() throw(uno::RuntimeException)
sal_Bool UnoTimeFieldControl::isEmpty() throw(uno::RuntimeException)
{
sal_Bool bEmpty = sal_False;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XTimeField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
bEmpty = xField->isEmpty();
}
return bEmpty;
@@ -3840,7 +2913,7 @@ void UnoNumericFieldControl::createPeer( const uno::Reference< awt::XToolkit > &
{
UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XNumericField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
xField->setFirst( mnFirst );
xField->setLast( mnLast );
}
@@ -3848,7 +2921,7 @@ void UnoNumericFieldControl::createPeer( const uno::Reference< awt::XToolkit > &
void UnoNumericFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
{
- uno::Reference < awt::XNumericField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
uno::Any aAny;
aAny <<= xField->getValue();
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False );
@@ -3896,9 +2969,9 @@ double UnoNumericFieldControl::getMax() throw(uno::RuntimeException)
void UnoNumericFieldControl::setFirst( double Value ) throw(uno::RuntimeException)
{
mnFirst = Value;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XNumericField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
xField->setFirst( mnFirst );
}
}
@@ -3911,9 +2984,9 @@ double UnoNumericFieldControl::getFirst() throw(uno::RuntimeException)
void UnoNumericFieldControl::setLast( double Value ) throw(uno::RuntimeException)
{
mnLast = Value;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XNumericField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
xField->setLast( mnLast );
}
}
@@ -4059,14 +3132,14 @@ void UnoCurrencyFieldControl::createPeer( const uno::Reference< awt::XToolkit >
{
UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XCurrencyField > xField( mxPeer, uno::UNO_QUERY );
+ 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( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
uno::Any aAny;
aAny <<= xField->getValue();
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False );
@@ -4114,9 +3187,9 @@ double UnoCurrencyFieldControl::getMax() throw(uno::RuntimeException)
void UnoCurrencyFieldControl::setFirst( double Value ) throw(uno::RuntimeException)
{
mnFirst = Value;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XCurrencyField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
xField->setFirst( mnFirst );
}
}
@@ -4129,9 +3202,9 @@ double UnoCurrencyFieldControl::getFirst() throw(uno::RuntimeException)
void UnoCurrencyFieldControl::setLast( double Value ) throw(uno::RuntimeException)
{
mnLast = Value;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference < awt::XCurrencyField > xField( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
xField->setLast( mnLast );
}
}
@@ -4256,7 +3329,7 @@ void UnoPatternFieldControl::ImplSetPeerProperty( const ::rtl::OUString& rPropNa
::rtl::OUString EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
::rtl::OUString LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
- uno::Reference < awt::XPatternField > xPF( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XPatternField > xPF( getPeer(), uno::UNO_QUERY );
if (xPF.is())
{ // same comment as in UnoControl::ImplSetPeerProperty - see there
xPF->setString( Text );
@@ -4546,7 +3619,7 @@ void UnoScrollBarControl::createPeer( const uno::Reference< awt::XToolkit > & rx
{
UnoControl::createPeer( rxToolkit, rParentPeer );
- uno::Reference < awt::XScrollBar > xScrollBar( mxPeer, uno::UNO_QUERY );
+ uno::Reference < awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
xScrollBar->addAdjustmentListener( this );
}
@@ -4559,7 +3632,7 @@ void UnoScrollBarControl::adjustmentValueChanged( const ::com::sun::star::awt::A
case ::com::sun::star::awt::AdjustmentType_ADJUST_PAGE:
case ::com::sun::star::awt::AdjustmentType_ADJUST_ABS:
{
- uno::Reference< awt::XScrollBar > xScrollBar( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
if ( xScrollBar.is() )
{
@@ -4612,9 +3685,9 @@ void UnoScrollBarControl::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_I
sal_Int32 UnoScrollBarControl::getValue() throw(::com::sun::star::uno::RuntimeException)
{
sal_Int32 n;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference< awt::XScrollBar > xScrollBar( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
n = xScrollBar->getValue();
}
return n;
@@ -4630,9 +3703,9 @@ void UnoScrollBarControl::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno:
sal_Int32 UnoScrollBarControl::getMaximum() throw(::com::sun::star::uno::RuntimeException)
{
sal_Int32 n;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference< awt::XScrollBar > xScrollBar( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
n = xScrollBar->getMaximum();
}
return n;
@@ -4648,9 +3721,9 @@ void UnoScrollBarControl::setLineIncrement( sal_Int32 n ) throw(::com::sun::star
sal_Int32 UnoScrollBarControl::getLineIncrement() throw(::com::sun::star::uno::RuntimeException)
{
sal_Int32 n;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference< awt::XScrollBar > xScrollBar( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
n = xScrollBar->getLineIncrement();
}
return n;
@@ -4666,9 +3739,9 @@ void UnoScrollBarControl::setBlockIncrement( sal_Int32 n ) throw(::com::sun::sta
sal_Int32 UnoScrollBarControl::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException)
{
sal_Int32 n;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference< awt::XScrollBar > xScrollBar( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
n = xScrollBar->getBlockIncrement();
}
return n;
@@ -4684,9 +3757,9 @@ void UnoScrollBarControl::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::
sal_Int32 UnoScrollBarControl::getVisibleSize() throw(::com::sun::star::uno::RuntimeException)
{
sal_Int32 n;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference< awt::XScrollBar > xScrollBar( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
n = xScrollBar->getVisibleSize();
}
return n;
@@ -4702,9 +3775,9 @@ void UnoScrollBarControl::setOrientation( sal_Int32 n ) throw(::com::sun::star::
sal_Int32 UnoScrollBarControl::getOrientation() throw(::com::sun::star::uno::RuntimeException)
{
sal_Int32 n;
- if ( mxPeer.is() )
+ if ( getPeer().is() )
{
- uno::Reference< awt::XScrollBar > xScrollBar( mxPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
n = xScrollBar->getOrientation();
}
return n;