summaryrefslogtreecommitdiff
path: root/toolkit/source/awt/vclxwindows.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/source/awt/vclxwindows.cxx')
-rw-r--r--toolkit/source/awt/vclxwindows.cxx138
1 files changed, 114 insertions, 24 deletions
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 4a68b4c80e3f..db34c840f8eb 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -2363,15 +2363,23 @@ sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException)
Dialog* pDlg = (Dialog*) GetWindow();
Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP );
Window* pOldParent = NULL;
+ Window* pSetParent = NULL;
if ( pParent && !pParent->IsReallyVisible() )
{
pOldParent = pDlg->GetParent();
Window* pFrame = pDlg->GetWindow( WINDOW_FRAME );
if( pFrame != pDlg )
+ {
pDlg->SetParent( pFrame );
+ pSetParent = pFrame;
+ }
}
+
nRet = pDlg->Execute();
- if ( pOldParent )
+
+ // set the parent back only in case no new parent was set from outside
+ // in other words, revert only own changes
+ if ( pOldParent && pDlg->GetParent() == pSetParent )
pDlg->SetParent( pOldParent );
}
return nRet;
@@ -3896,20 +3904,6 @@ VCLXComboBox::~VCLXComboBox()
#endif
}
-// ::com::sun::star::uno::XInterface
-::com::sun::star::uno::Any VCLXComboBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XComboBox*, this ) );
- return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType ));
-}
-
-// ::com::sun::star::lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( VCLXComboBox )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XComboBox>* ) NULL ),
- VCLXEdit::getTypes()
-IMPL_XTYPEPROVIDER_END
-
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXComboBox::CreateAccessibleContext()
{
::vos::OGuard aGuard( GetMutex() );
@@ -3973,8 +3967,12 @@ void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUStr
for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ )
{
pBox->InsertEntry( aItems.getConstArray()[n], nP );
- if ( (sal_uInt16)nPos < 0xFFFF ) // Nicht wenn 0xFFFF, weil LIST_APPEND
- nP++;
+ if ( nP == 0xFFFF )
+ {
+ OSL_ENSURE( false, "VCLXComboBox::addItems: too many entries!" );
+ // skip remaining entries, list cannot hold them, anyway
+ break;
+ }
}
}
}
@@ -4078,14 +4076,8 @@ void VCLXComboBox::setProperty( const ::rtl::OUString& PropertyName, const ::com
::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
if ( Value >>= aItems )
{
- sal_Bool bUpdate = pComboBox->IsUpdateMode();
- pComboBox->SetUpdateMode( sal_False );
pComboBox->Clear();
- const ::rtl::OUString* pStrings = aItems.getConstArray();
- sal_Int32 nItems = aItems.getLength();
- for ( sal_Int32 n = 0; n < nItems; n++ )
- pComboBox->InsertEntry( pStrings[n], LISTBOX_APPEND );
- pComboBox->SetUpdateMode( bUpdate );
+ addItems( aItems, 0 );
}
}
break;
@@ -4255,6 +4247,104 @@ void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) thr
nLines = nL;
}
}
+void SAL_CALL VCLXComboBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemInserted: no ComboBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pComboBox->GetEntryCount() ) ),
+ "VCLXComboBox::listItemInserted: illegal (inconsistent) item position!" );
+ pComboBox->InsertEntry(
+ i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
+ i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
+ i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXComboBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemRemoved: no ComboBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
+ "VCLXComboBox::listItemRemoved: illegal (inconsistent) item position!" );
+
+ pComboBox->RemoveEntry( i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXComboBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
+ "VCLXComboBox::listItemModified: illegal (inconsistent) item position!" );
+
+ // VCL's ComboBox does not support changing an entry's text or image, so remove and re-insert
+
+ const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pComboBox->GetEntry( i_rEvent.ItemPosition ) );
+ const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pComboBox->GetEntryImage( i_rEvent.ItemPosition ) );
+
+ pComboBox->RemoveEntry( i_rEvent.ItemPosition );
+ pComboBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXComboBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
+
+ pComboBox->Clear();
+
+ (void)i_rEvent;
+}
+
+void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
+
+ pComboBox->Clear();
+
+ uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+ // bool localize = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) );
+ uno::Reference< resource::XStringResourceResolver > xStringResourceResolver;
+ if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) )
+ {
+ xStringResourceResolver.set(
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ),
+ uno::UNO_QUERY
+ );
+ }
+
+
+ Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
+ uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
+ for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
+ {
+ ::rtl::OUString aLocalizationKey( aItems[i].First );
+ if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' )
+ {
+ aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
+ }
+ pComboBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) );
+ }
+}
+void SAL_CALL VCLXComboBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ // just disambiguate
+ VCLXEdit::disposing( i_rEvent );
+}
// ----------------------------------------------------
// class VCLXFormattedSpinField