toolkit/source/awt/vclxwindows.cxx | 204 +++++++++++++++++-------------------- 1 file changed, 99 insertions(+), 105 deletions(-)
New commits: commit e3f9e085cc58bedb82b7f279de642ff5fa2180ce Author: Michael Meeks <michael.me...@collabora.com> Date: Sat Mar 14 22:30:45 2015 +0000 toolkit: more cleanup. Change-Id: I2aa5c818d4f2c07926bda539da30ada63620f69d diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 2cd23a9..51f49da 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -1234,7 +1234,7 @@ void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::Runtim { SolarMutexGuard aGuard; - VclPtr< RadioButton > pButton = GetAs< RadioButton >(); + VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >(); if ( pRadioButton) { pRadioButton->Check( b ); @@ -1253,7 +1253,7 @@ sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeExcepti { SolarMutexGuard aGuard; - VclPtr< RadioButton > pButton = GetAs< RadioButton >(); + VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >(); return pRadioButton ? pRadioButton->IsChecked() : sal_False; } @@ -1262,7 +1262,7 @@ sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeExcepti SolarMutexGuard aGuard; Size aSz; - VclPtr< RadioButton > pButton = GetAs< RadioButton >(); + VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >(); if ( pRadioButton ) aSz = pRadioButton->CalcMinimumSize(); return AWTSize(aSz); @@ -1278,7 +1278,7 @@ sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeExcepti SolarMutexGuard aGuard; Size aSz = VCLSize(rNewSize); - VclPtr< RadioButton > pButton = GetAs< RadioButton >(); + VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >(); if ( pRadioButton ) { Size aMinSz = pRadioButton->CalcMinimumSize(); @@ -1324,7 +1324,7 @@ void VCLXRadioButton::ImplClickedOrToggled( bool bToggled ) { // In the formulars, RadioChecked is not enabled, call itemStateChanged only for click // In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled - VclPtr< RadioButton > pButton = GetAs< RadioButton >(); + VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >(); if ( pRadioButton && ( pRadioButton->IsRadioCheckEnabled() == bToggled ) && ( bToggled || pRadioButton->IsStateChanged() ) && maItemListeners.getLength() ) { ::com::sun::star::awt::ItemEvent aEvent; @@ -1793,7 +1793,7 @@ void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { case VCLEVENT_LISTBOX_SELECT: { - VclPtr< ListBox > pBox = GetAs< ListBox >(); + VclPtr< ListBox > pListBox = GetAs< ListBox >(); if( pListBox ) { bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) ? sal_True : sal_False; @@ -2316,7 +2316,7 @@ sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException, s sal_Int16 nRet = 0; if ( GetWindow() ) { - Dialog* pDlg = static_cast<Dialog*>(GetWindow()); + VclPtr< Dialog > pDlg = GetAs< Dialog >(); vcl::Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP ); vcl::Window* pOldParent = NULL; vcl::Window* pSetParent = NULL; @@ -2350,7 +2350,6 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s { SolarMutexGuard aGuard; VclPtr< vcl::Window > pWindow = GetWindow(); - if ( pWindow ) { OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); @@ -2369,7 +2368,7 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo(); SolarMutexGuard aGuard; - Dialog* pDlg = static_cast<Dialog*>(GetWindow()); + VclPtr< Dialog > pDlg = GetAs< Dialog >(); if ( pDlg ) pDlg->GetDrawWindowBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset ); @@ -2382,8 +2381,7 @@ void SAL_CALL VCLXDialog::setProperty( throw(::com::sun::star::uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - - Dialog* pDialog = static_cast<Dialog*>(GetWindow()); + VclPtr< Dialog > pDialog = GetAs< Dialog >(); if ( pDialog ) { bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; @@ -2536,7 +2534,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception) SolarMutexGuard aGuard; OSL_TRACE(" **** VCLXMultiPage::setProperty( %s )", OUStringToOString( PropertyName, RTL_TEXTENCODING_UTF8 ).getStr() ); - TabControl* pTabControl = static_cast<TabControl*>(GetWindow()); + VclPtr< TabControl > pTabControl = GetAs< TabControl >(); if ( pTabControl ) { bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; @@ -2588,7 +2586,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception) TabControl *VCLXMultiPage::getTabControl() const throw (uno::RuntimeException) { - TabControl *pTabControl = dynamic_cast< TabControl* >( GetWindow() ); + VclPtr<TabControl> pTabControl = GetAsDynamic< TabControl >(); if ( pTabControl ) return pTabControl; throw uno::RuntimeException(); @@ -2786,8 +2784,7 @@ void SAL_CALL VCLXTabPage::setProperty( throw(::com::sun::star::uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - - TabPage* pTabPage = static_cast<TabPage*>(GetWindow()); + VclPtr< TabPage > pTabPage = GetAs< TabPage >(); if ( pTabPage ) { bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; @@ -2837,7 +2834,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception) TabPage *VCLXTabPage::getTabPage() const throw (uno::RuntimeException) { - TabPage *pTabPage = dynamic_cast< TabPage* >( GetWindow() ); + VclPtr< TabPage > pTabPage = GetAsDynamic< TabPage >(); if ( pTabPage ) return pTabPage; throw uno::RuntimeException(); @@ -2898,7 +2895,7 @@ void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve { // open the URL OUString sURL; - FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow()); + VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >(); if ( pBase ) sURL = pBase->GetURL(); Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute( ::com::sun::star::system::SystemShellExecute::create( @@ -2932,8 +2929,7 @@ void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve void VCLXFixedHyperlink::setText( const OUString& Text ) throw(::com::sun::star::uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - - FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow()); + VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >(); if (pBase) pBase->SetText(Text); } @@ -2952,8 +2948,7 @@ OUString VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeExcep void VCLXFixedHyperlink::setURL( const OUString& URL ) throw(::com::sun::star::uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - - FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow()); + VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >(); if ( pBase ) pBase->SetURL( URL ); } @@ -2963,7 +2958,7 @@ OUString VCLXFixedHyperlink::getURL( ) throw(::com::sun::star::uno::RuntimeExce SolarMutexGuard aGuard; OUString aText; - FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow()); + VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >(); if ( pBase ) aText = pBase->GetURL(); return aText; @@ -3024,9 +3019,8 @@ void VCLXFixedHyperlink::removeActionListener( const ::com::sun::star::uno::Refe ::com::sun::star::awt::Size VCLXFixedHyperlink::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - Size aSz; - FixedText* pFixedText = static_cast<FixedText*>(GetWindow()); + VclPtr< FixedText > pFixedText = GetAs< FixedText >(); if ( pFixedText ) aSz = pFixedText->CalcMinimumSize(); return AWTSize(aSz); @@ -3053,7 +3047,7 @@ void VCLXFixedHyperlink::setProperty( const OUString& PropertyName, const ::com: { SolarMutexGuard aGuard; - FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow()); + VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >(); if ( pBase ) { sal_uInt16 nPropType = GetPropertyId( PropertyName ); @@ -3088,7 +3082,7 @@ void VCLXFixedHyperlink::setProperty( const OUString& PropertyName, const ::com: SolarMutexGuard aGuard; ::com::sun::star::uno::Any aProp; - FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow()); + VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >(); if ( pBase ) { sal_uInt16 nPropType = GetPropertyId( PropertyName ); @@ -3256,7 +3250,7 @@ short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeExceptio SolarMutexGuard aGuard; Size aSz; - FixedText* pFixedText = static_cast<FixedText*>(GetWindow()); + VclPtr< FixedText > pFixedText = GetAs< FixedText >(); if ( pFixedText ) aSz = pFixedText->CalcMinimumSize(); return AWTSize(aSz); @@ -3272,7 +3266,7 @@ short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeExceptio SolarMutexGuard aGuard; Size aAdjustedSize( VCLUnoHelper::ConvertToVCLSize( rMaxSize ) ); - FixedText* pFixedText = static_cast<FixedText*>(GetWindow()); + VclPtr< FixedText > pFixedText = GetAs< FixedText >(); if ( pFixedText ) aAdjustedSize = pFixedText->CalcMinimumSize( rMaxSize.Width ); return VCLUnoHelper::ConvertToAWTSize( aAdjustedSize ); @@ -3361,7 +3355,7 @@ void VCLXScrollBar::setValue( sal_Int32 n ) throw(::com::sun::star::uno::Runtime { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); if ( pScrollBar ) pScrollBar->DoScroll( n ); } @@ -3370,7 +3364,7 @@ void VCLXScrollBar::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 n { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); if ( pScrollBar ) { pScrollBar->SetVisibleSize( nVisible ); @@ -3383,7 +3377,7 @@ sal_Int32 VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeExceptio { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); return pScrollBar ? pScrollBar->GetThumbPos() : 0; } @@ -3391,7 +3385,7 @@ void VCLXScrollBar::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::Runti { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); if ( pScrollBar ) pScrollBar->SetRangeMax( n ); } @@ -3400,7 +3394,7 @@ sal_Int32 VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeExcept { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); return pScrollBar ? pScrollBar->GetRangeMax() : 0; } @@ -3408,7 +3402,7 @@ void VCLXScrollBar::setMinimum( sal_Int32 n ) throw(::com::sun::star::uno::Runti { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() ); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); if ( pScrollBar ) pScrollBar->SetRangeMin( n ); } @@ -3417,7 +3411,7 @@ sal_Int32 VCLXScrollBar::getMinimum() throw(::com::sun::star::uno::RuntimeExcept { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() ); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); return pScrollBar ? pScrollBar->GetRangeMin() : 0; } @@ -3425,7 +3419,7 @@ void VCLXScrollBar::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno: { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); if ( pScrollBar ) pScrollBar->SetLineSize( n ); } @@ -3434,7 +3428,7 @@ sal_Int32 VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::Runtime { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); return pScrollBar ? pScrollBar->GetLineSize() : 0; } @@ -3442,7 +3436,7 @@ void VCLXScrollBar::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); if ( pScrollBar ) pScrollBar->SetPageSize( n ); } @@ -3451,7 +3445,7 @@ sal_Int32 VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::Runtim { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); return pScrollBar ? pScrollBar->GetPageSize() : 0; } @@ -3459,7 +3453,7 @@ void VCLXScrollBar::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::R { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); if ( pScrollBar ) pScrollBar->SetVisibleSize( n ); } @@ -3468,7 +3462,7 @@ sal_Int32 VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeEx { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); return pScrollBar ? pScrollBar->GetVisibleSize() : 0; } @@ -3514,7 +3508,7 @@ void VCLXScrollBar::setProperty( const OUString& PropertyName, const ::com::sun: { SolarMutexGuard aGuard; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); if ( pScrollBar ) { bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; @@ -3630,7 +3624,7 @@ void VCLXScrollBar::setProperty( const OUString& PropertyName, const ::com::sun: SolarMutexGuard aGuard; ::com::sun::star::uno::Any aProp; - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); if ( pScrollBar ) { sal_uInt16 nPropType = GetPropertyId( PropertyName ); @@ -3707,7 +3701,7 @@ void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) if ( maAdjustmentListeners.getLength() ) { - ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow()); + VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >(); if( pScrollBar ) { @@ -3847,7 +3841,7 @@ void VCLXEdit::setText( const OUString& aText ) throw(::com::sun::star::uno::Run { SolarMutexGuard aGuard; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) { pEdit->SetText( aText ); @@ -3864,7 +3858,7 @@ void VCLXEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const O { SolarMutexGuard aGuard; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) { pEdit->SetSelection( Selection( rSel.Min, rSel.Max ) ); @@ -3894,7 +3888,7 @@ OUString VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeExcepti SolarMutexGuard aGuard; OUString aText; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit) aText = pEdit->GetSelected(); return aText; @@ -3905,7 +3899,7 @@ void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection { SolarMutexGuard aGuard; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) pEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) ); } @@ -3915,7 +3909,7 @@ void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection SolarMutexGuard aGuard; Selection aSel; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) aSel = pEdit->GetSelection(); return ::com::sun::star::awt::Selection( aSel.Min(), aSel.Max() ); @@ -3925,7 +3919,7 @@ sal_Bool VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException, s { SolarMutexGuard aGuard; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); return ( pEdit && !pEdit->IsReadOnly() && pEdit->IsEnabled() ) ? sal_True : sal_False; } @@ -3933,7 +3927,7 @@ void VCLXEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::Ru { SolarMutexGuard aGuard; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) pEdit->SetReadOnly( !bEditable ); } @@ -3943,7 +3937,7 @@ void VCLXEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::Runt { SolarMutexGuard aGuard; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) pEdit->SetMaxTextLen( nLen ); } @@ -3952,7 +3946,7 @@ sal_Int16 VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeExceptio { SolarMutexGuard aGuard; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); return pEdit ? pEdit->GetMaxTextLen() : 0; } @@ -3960,7 +3954,7 @@ void VCLXEdit::setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::Run { SolarMutexGuard aGuard; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) pEdit->SetEchoChar( cEcho ); } @@ -3969,7 +3963,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star { SolarMutexGuard aGuard; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) { sal_uInt16 nPropType = GetPropertyId( PropertyName ); @@ -4015,7 +4009,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star SolarMutexGuard aGuard; ::com::sun::star::uno::Any aProp; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) { sal_uInt16 nPropType = GetPropertyId( PropertyName ); @@ -4047,7 +4041,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star SolarMutexGuard aGuard; Size aSz; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) aSz = pEdit->CalcMinimumSize(); return AWTSize(aSz); @@ -4058,7 +4052,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star SolarMutexGuard aGuard; Size aSz; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) { aSz = pEdit->CalcMinimumSize(); @@ -4084,7 +4078,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star SolarMutexGuard aGuard; Size aSz; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) { if ( nCols ) @@ -4101,7 +4095,7 @@ void VCLXEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(: nLines = 1; nCols = 0; - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) nCols = pEdit->GetMaxVisChars(); } @@ -4227,7 +4221,7 @@ void VCLXComboBox::addItem( const OUString& aItem, sal_Int16 nPos ) throw(::com: { SolarMutexGuard aGuard; - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pBox = GetAs< ComboBox >(); if ( pBox ) pBox->InsertEntry( aItem, nPos ); } @@ -4236,7 +4230,7 @@ void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence< OUString>& a { SolarMutexGuard aGuard; - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pBox = GetAs< ComboBox >(); if ( pBox ) { sal_uInt16 nP = nPos; @@ -4257,7 +4251,7 @@ void VCLXComboBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com:: { SolarMutexGuard aGuard; - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pBox = GetAs< ComboBox >(); if ( pBox ) { for ( sal_uInt16 n = nCount; n; ) @@ -4269,7 +4263,7 @@ sal_Int16 VCLXComboBox::getItemCount() throw(::com::sun::star::uno::RuntimeExcep { SolarMutexGuard aGuard; - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pBox = GetAs< ComboBox >(); return pBox ? pBox->GetEntryCount() : 0; } @@ -4278,7 +4272,7 @@ OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru SolarMutexGuard aGuard; OUString aItem; - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pBox = GetAs< ComboBox >(); if ( pBox ) aItem = pBox->GetEntry( nPos ); return aItem; @@ -4289,7 +4283,7 @@ OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru SolarMutexGuard aGuard; ::com::sun::star::uno::Sequence< OUString> aSeq; - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pBox = GetAs< ComboBox >(); if ( pBox ) { sal_uInt16 nEntries = pBox->GetEntryCount(); @@ -4307,7 +4301,7 @@ void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::st { SolarMutexGuard aGuard; - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pBox = GetAs< ComboBox >(); if ( pBox ) pBox->SetDropDownLineCount( nLines ); } @@ -4317,7 +4311,7 @@ sal_Int16 VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::Runt SolarMutexGuard aGuard; sal_Int16 nLines = 0; - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pBox = GetAs< ComboBox >(); if ( pBox ) nLines = pBox->GetDropDownLineCount(); return nLines; @@ -4327,7 +4321,7 @@ void VCLXComboBox::setProperty( const OUString& PropertyName, const ::com::sun:: { SolarMutexGuard aGuard; - ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if ( pComboBox ) { sal_uInt16 nPropType = GetPropertyId( PropertyName ); @@ -4384,7 +4378,7 @@ void VCLXComboBox::setProperty( const OUString& PropertyName, const ::com::sun:: SolarMutexGuard aGuard; ::com::sun::star::uno::Any aProp; - ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if ( pComboBox ) { sal_uInt16 nPropType = GetPropertyId( PropertyName ); @@ -4432,7 +4426,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) case VCLEVENT_COMBOBOX_SELECT: if ( maItemListeners.getLength() ) { - ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if( pComboBox ) { if ( !pComboBox->IsTravelSelect() ) @@ -4471,7 +4465,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SolarMutexGuard aGuard; Size aSz; - ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if ( pComboBox ) aSz = pComboBox->CalcMinimumSize(); return AWTSize(aSz); @@ -4482,7 +4476,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SolarMutexGuard aGuard; Size aSz; - ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if ( pComboBox ) { aSz = pComboBox->CalcMinimumSize(); @@ -4497,7 +4491,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SolarMutexGuard aGuard; Size aSz = VCLSize(rNewSize); - ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if ( pComboBox ) aSz = pComboBox->CalcAdjustedSize( aSz ); return AWTSize(aSz); @@ -4508,7 +4502,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SolarMutexGuard aGuard; Size aSz; - ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if ( pComboBox ) aSz = pComboBox->CalcBlockSize( nCols, nLines ); return AWTSize(aSz); @@ -4519,7 +4513,7 @@ void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) thr SolarMutexGuard aGuard; nCols = nLines = 0; - ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); + VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if ( pComboBox ) { sal_uInt16 nC, nL; @@ -4532,7 +4526,7 @@ void SAL_CALL VCLXComboBox::listItemInserted( const ItemListEvent& i_rEvent ) th { SolarMutexGuard aGuard; - ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); + VclPtr< ComboBox > pComboBox = GetAsDynamic< ComboBox >(); ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemInserted: no ComboBox?!" ); ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pComboBox->GetEntryCount() ) ), @@ -4547,7 +4541,7 @@ void SAL_CALL VCLXComboBox::listItemRemoved( const ItemListEvent& i_rEvent ) thr { SolarMutexGuard aGuard; - ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); + VclPtr< ComboBox > pComboBox = GetAsDynamic< ComboBox >(); ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemRemoved: no ComboBox?!" ); ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ), @@ -4560,7 +4554,7 @@ void SAL_CALL VCLXComboBox::listItemModified( const ItemListEvent& i_rEvent ) th { SolarMutexGuard aGuard; - ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); + VclPtr< ComboBox > pComboBox = GetAsDynamic< ComboBox >(); ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" ); ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ), @@ -4579,7 +4573,7 @@ void SAL_CALL VCLXComboBox::allItemsRemoved( const EventObject& i_rEvent ) throw { SolarMutexGuard aGuard; - ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); + VclPtr< ComboBox > pComboBox = GetAsDynamic< ComboBox >(); ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" ); pComboBox->Clear(); @@ -4591,7 +4585,7 @@ void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) throw { SolarMutexGuard aGuard; - ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); + VclPtr< ComboBox > pComboBox = GetAsDynamic< ComboBox >(); ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" ); pComboBox->Clear(); @@ -4823,8 +4817,8 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const ::com::sun: { if ( bVoid ) { - static_cast<DateField*>(GetWindow())->EnableEmptyFieldValue( true ); - static_cast<DateField*>(GetWindow())->SetEmptyFieldValue(); + GetAs< DateField >()->EnableEmptyFieldValue( true ); + GetAs< DateField >()->SetEmptyFieldValue(); } else { @@ -4852,21 +4846,21 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const ::com::sun: { sal_Int16 n = sal_Int16(); if ( Value >>= n ) - static_cast<DateField*>(GetWindow())->SetExtDateFormat( (ExtDateFieldFormat) n ); + GetAs< DateField >()->SetExtDateFormat( (ExtDateFieldFormat) n ); } break; case BASEPROPERTY_DATESHOWCENTURY: { bool b = bool(); if ( Value >>= b ) - static_cast<DateField*>(GetWindow())->SetShowDateCentury( b ); + GetAs< DateField >()->SetShowDateCentury( b ); } break; case BASEPROPERTY_ENFORCE_FORMAT: { bool bEnforce( true ); OSL_VERIFY( Value >>= bEnforce ); - static_cast< DateField* >( GetWindow() )->EnforceValidValue( bEnforce ); + GetAs< DateField >()->EnforceValidValue( bEnforce ); } break; default: @@ -4905,12 +4899,12 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const ::com::sun: break; case BASEPROPERTY_DATESHOWCENTURY: { - aProp <<= static_cast<DateField*>(GetWindow())->IsShowDateCentury(); + aProp <<= GetAs< DateField >()->IsShowDateCentury(); } break; case BASEPROPERTY_ENFORCE_FORMAT: { - aProp <<= static_cast< DateField* >( GetWindow() )->IsEnforceValidValue( ); + aProp <<= GetAs< DateField >()->IsEnforceValidValue( ); } break; default: @@ -4927,7 +4921,7 @@ void VCLXDateField::setDate( const util::Date& aDate ) throw(::com::sun::star::u { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) { pDateField->SetDate( aDate ); @@ -4944,7 +4938,7 @@ util::Date VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeExceptio { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) return pDateField->GetDate().GetUNODate(); else @@ -4955,7 +4949,7 @@ void VCLXDateField::setMin( const util::Date& aDate ) throw(::com::sun::star::un { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) pDateField->SetMin( aDate ); } @@ -4964,7 +4958,7 @@ util::Date VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) return pDateField->GetMin().GetUNODate(); else @@ -4975,7 +4969,7 @@ void VCLXDateField::setMax( const util::Date& aDate ) throw(::com::sun::star::un { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) pDateField->SetMax( aDate ); } @@ -4984,7 +4978,7 @@ util::Date VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) return pDateField->GetMax().GetUNODate(); else @@ -4995,7 +4989,7 @@ void VCLXDateField::setFirst( const util::Date& aDate ) throw(::com::sun::star:: { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) pDateField->SetFirst( aDate ); } @@ -5004,7 +4998,7 @@ util::Date VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) return pDateField->GetFirst().GetUNODate(); else @@ -5015,7 +5009,7 @@ void VCLXDateField::setLast( const util::Date& aDate ) throw(::com::sun::star::u { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) pDateField->SetLast( aDate ); } @@ -5024,7 +5018,7 @@ util::Date VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeExceptio { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) return pDateField->GetLast().GetUNODate(); else @@ -5035,7 +5029,7 @@ void VCLXDateField::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno: { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) pDateField->SetLongFormat( bLong ); } @@ -5044,7 +5038,7 @@ sal_Bool VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeExcep { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); return pDateField ? pDateField->IsLongFormat() : sal_False; } @@ -5052,7 +5046,7 @@ void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException, st { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) { pDateField->SetEmptyDate(); @@ -5069,7 +5063,7 @@ sal_Bool VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException, { SolarMutexGuard aGuard; - DateField* pDateField = static_cast<DateField*>(GetWindow()); + VclPtr< DateField > pDateField = GetAs< DateField >(); return pDateField ? pDateField->IsEmptyDate() : sal_False; } @@ -5469,7 +5463,7 @@ void VCLXNumericField::setValue( double Value ) throw(::com::sun::star::uno::Run (long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) ); // #107218# Call same listeners like VCL would do after user interaction - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) { SetSynthesizingVCLEvent( true ); @@ -5850,7 +5844,7 @@ METRIC_MAP_PAIR(Last, Field) void VCLXMetricField::CallListeners() { // #107218# Call same listeners like VCL would do after user interaction - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) { SetSynthesizingVCLEvent( true ); @@ -6065,7 +6059,7 @@ void VCLXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::Ru ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) ); // #107218# Call same listeners like VCL would do after user interaction - Edit* pEdit = static_cast<Edit*>(GetWindow()); + VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) { SetSynthesizingVCLEvent( true ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits