summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-05-23 19:44:15 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-05-23 20:51:12 +0000
commit0792e97bd7ea6f23c908bdebc4826b08c6265d55 (patch)
tree894b40b13a5d9aff3ebb119dad6b06c6e275be7c
parentba203843f5a209cb48e2d6f4ec4e3649982185ea (diff)
VclPtr - add compat methods for old-style focus / notification.
The previous code would only invoke Window:: methods by the time we hit the destructor; do the same to avoid fixing more scattered crashers for now. Change-Id: Ibdcd1290309bb7fc31a44d534c52d357da022591 Reviewed-on: https://gerrit.libreoffice.org/15880 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--include/vcl/window.hxx8
-rw-r--r--vcl/source/control/button.cxx14
-rw-r--r--vcl/source/control/combobox.cxx2
-rw-r--r--vcl/source/control/ctrl.cxx6
-rw-r--r--vcl/source/control/edit.cxx2
-rw-r--r--vcl/source/control/fixed.cxx4
-rw-r--r--vcl/source/control/ilstbox.cxx12
-rw-r--r--vcl/source/control/lstbox.cxx2
-rw-r--r--vcl/source/control/scrbar.cxx6
-rw-r--r--vcl/source/control/slider.cxx4
-rw-r--r--vcl/source/control/spinbtn.cxx8
-rw-r--r--vcl/source/control/spinfld.cxx2
-rw-r--r--vcl/source/window/dialog.cxx4
-rw-r--r--vcl/source/window/dlgctrl.cxx8
-rw-r--r--vcl/source/window/event.cxx9
-rw-r--r--vcl/source/window/globalization.cxx2
-rw-r--r--vcl/source/window/mouse.cxx4
-rw-r--r--vcl/source/window/window.cxx81
-rw-r--r--vcl/source/window/window2.cxx22
-rw-r--r--vcl/source/window/winproc.cxx4
20 files changed, 128 insertions, 76 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 919bd3121ab5..f1d7a92a0718 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -774,6 +774,14 @@ public:
virtual bool Notify( NotifyEvent& rNEvt );
virtual vcl::Window* GetPreferredKeyInputWindow();
+ // These methods call the relevant virtual method when not in/post dispose
+ void CompatGetFocus();
+ void CompatLoseFocus();
+ void CompatStateChanged( StateChangedType nStateChange );
+ void CompatDataChanged( const DataChangedEvent& rDCEvt );
+ bool CompatPreNotify( NotifyEvent& rNEvt );
+ bool CompatNotify( NotifyEvent& rNEvt );
+
void AddEventListener( const Link<>& rEventListener );
void RemoveEventListener( const Link<>& rEventListener );
void AddChildEventListener( const Link<>& rEventListener );
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index d2f128a9f7ce..e8ab9c90da40 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1548,7 +1548,7 @@ void PushButton::SetSymbol( SymbolType eSymbol )
if ( meSymbol != eSymbol )
{
meSymbol = eSymbol;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
@@ -1562,7 +1562,7 @@ void PushButton::SetDropDown( PushButtonDropdownStyle nStyle )
if ( mnDDStyle != nStyle )
{
mnDDStyle = nStyle;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
@@ -1584,7 +1584,7 @@ void PushButton::SetState( TriState eState )
ImplGetButtonState() |= DrawButtonFlags::DontKnow;
}
- StateChanged( StateChangedType::State );
+ CompatStateChanged( StateChangedType::State );
Toggle();
}
}
@@ -1594,7 +1594,7 @@ void PushButton::SetPressed( bool bPressed )
if ( mbPressed != bPressed )
{
mbPressed = bPressed;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
@@ -2641,7 +2641,7 @@ bool RadioButton::SetModeRadioImage( const Image& rImage )
if ( rImage != maImage )
{
maImage = rImage;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
queue_resize();
}
return true;
@@ -2659,7 +2659,7 @@ void RadioButton::SetState( bool bCheck )
if ( mbChecked != bCheck )
{
mbChecked = bCheck;
- StateChanged( StateChangedType::State );
+ CompatStateChanged( StateChangedType::State );
Toggle();
}
}
@@ -2716,7 +2716,7 @@ void RadioButton::Check( bool bCheck )
mbChecked = bCheck;
ImplDelData aDelData;
ImplAddDel( &aDelData );
- StateChanged( StateChangedType::State );
+ CompatStateChanged( StateChangedType::State );
if ( aDelData.IsDead() )
return;
if ( bCheck && mbRadioCheck )
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index dde32dfa3fa2..59656c90344f 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -664,7 +664,7 @@ void ComboBox::StateChanged( StateChangedType nType )
mpBtn->EnableRTL( IsRTLEnabled() );
ImplInitDropDownButton( mpBtn );
}
- mpSubEdit->StateChanged( StateChangedType::Mirroring );
+ mpSubEdit->CompatStateChanged( StateChangedType::Mirroring );
mpImplLB->EnableRTL( IsRTLEnabled() );
Resize();
}
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index ed59e5d99aad..0c40a341b397 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -81,7 +81,7 @@ void Control::EnableRTL( bool bEnable )
// convenience: for controls also switch layout mode
SetLayoutMode( bEnable ? TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT :
TEXT_LAYOUT_TEXTORIGIN_LEFT );
- StateChanged( StateChangedType::Mirroring );
+ CompatStateChanged( StateChangedType::Mirroring );
OutputDevice::EnableRTL(bEnable);
}
@@ -256,7 +256,7 @@ bool Control::Notify( NotifyEvent& rNEvt )
if ( !mbHasControlFocus )
{
mbHasControlFocus = true;
- StateChanged( StateChangedType::ControlFocus );
+ CompatStateChanged( StateChangedType::ControlFocus );
if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_GETFOCUS, maGetFocusHdl, this ) )
// been destroyed within the handler
return true;
@@ -270,7 +270,7 @@ bool Control::Notify( NotifyEvent& rNEvt )
if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) )
{
mbHasControlFocus = false;
- StateChanged( StateChangedType::ControlFocus );
+ CompatStateChanged( StateChangedType::ControlFocus );
if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, maLoseFocusHdl, this ) )
// been destroyed within the handler
return true;
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 558490387d0c..b196dfa2b2fa 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2454,7 +2454,7 @@ void Edit::SetReadOnly( bool bReadOnly )
if ( mpSubEdit )
mpSubEdit->SetReadOnly( bReadOnly );
- StateChanged( StateChangedType::ReadOnly );
+ CompatStateChanged( StateChangedType::ReadOnly );
}
}
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 9d2c38fe8155..92ff28c15aa6 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -840,7 +840,7 @@ void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt )
void FixedBitmap::SetBitmap( const Bitmap& rBitmap )
{
maBitmap = rBitmap;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
queue_resize();
}
@@ -1018,7 +1018,7 @@ void FixedImage::SetImage( const Image& rImage )
if ( rImage != maImage )
{
maImage = rImage;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
queue_resize();
}
}
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index e9c4f92f2eb7..28e5889fcdd4 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2205,7 +2205,7 @@ void ImplListBox::Clear()
}
mpVScrollBar->SetThumbPos( 0 );
mpHScrollBar->SetThumbPos( 0 );
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr )
@@ -2217,7 +2217,7 @@ sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr )
delete pNewEntry;
return nNewPos;
}
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
return nNewPos;
}
@@ -2230,14 +2230,14 @@ sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr, const
delete pNewEntry;
return nNewPos;
}
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
return nNewPos;
}
void ImplListBox::RemoveEntry( sal_Int32 nPos )
{
maLBWindow->RemoveEntry( nPos );
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
void ImplListBox::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
@@ -2277,7 +2277,7 @@ void ImplListBox::Resize()
IMPL_LINK_NOARG(ImplListBox, MRUChanged)
{
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
return 1;
}
@@ -2593,7 +2593,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
{
maLBWindow->GetEntryList()->SetMRUCount( nMRUCount );
SetSeparatorPos( nMRUCount ? nMRUCount-1 : 0 );
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 60683d3f30af..857f78f3d714 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -1408,7 +1408,7 @@ void ListBox::SetReadOnly( bool bReadOnly )
if ( mpImplLB->IsReadOnly() != bReadOnly )
{
mpImplLB->SetReadOnly( bReadOnly );
- StateChanged( StateChangedType::ReadOnly );
+ CompatStateChanged( StateChangedType::ReadOnly );
}
}
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 97a0748d9d24..2db7fc1bdcc7 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1387,7 +1387,7 @@ void ScrollBar::SetRange( const Range& rRange )
if ( mnThumbPos < mnMinRange )
mnThumbPos = mnMinRange;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
@@ -1401,7 +1401,7 @@ void ScrollBar::SetThumbPos( long nNewThumbPos )
if ( mnThumbPos != nNewThumbPos )
{
mnThumbPos = nNewThumbPos;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
@@ -1416,7 +1416,7 @@ void ScrollBar::SetVisibleSize( long nNewSize )
mnThumbPos = mnMaxRange-mnVisibleSize;
if ( mnThumbPos < mnMinRange )
mnThumbPos = mnMinRange;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx
index 4aa94ad8b427..4f0c7e1ebd9f 100644
--- a/vcl/source/control/slider.cxx
+++ b/vcl/source/control/slider.cxx
@@ -986,7 +986,7 @@ void Slider::SetRange( const Range& rRange )
if ( mnThumbPos < mnMinRange )
mnThumbPos = mnMinRange;
ImplUpdateLinkedField();
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
@@ -1001,7 +1001,7 @@ void Slider::SetThumbPos( long nNewThumbPos )
{
mnThumbPos = nNewThumbPos;
ImplUpdateLinkedField();
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx
index 2f196d62a394..6d1d5f324172 100644
--- a/vcl/source/control/spinbtn.cxx
+++ b/vcl/source/control/spinbtn.cxx
@@ -76,7 +76,7 @@ void SpinButton::Up()
if (ImplIsUpperEnabled())
{
mnValue += mnValueStep;
- StateChanged(StateChangedType::Data);
+ CompatStateChanged(StateChangedType::Data);
ImplMoveFocus(true);
}
@@ -89,7 +89,7 @@ void SpinButton::Down()
if (ImplIsLowerEnabled())
{
mnValue -= mnValueStep;
- StateChanged(StateChangedType::Data);
+ CompatStateChanged(StateChangedType::Data);
ImplMoveFocus(false);
}
@@ -372,7 +372,7 @@ void SpinButton::SetRange( const Range& rRange )
if ( mnValue < mnMinRange )
mnValue = mnMinRange;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
@@ -387,7 +387,7 @@ void SpinButton::SetValue( long nValue )
if ( mnValue != nValue )
{
mnValue = nValue;
- StateChanged( StateChangedType::Data );
+ CompatStateChanged( StateChangedType::Data );
}
}
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index d5547dfc4db3..f64c5a7fe626 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -824,7 +824,7 @@ void SpinField::StateChanged(StateChangedType nType)
else if( nType == StateChangedType::Mirroring )
{
if (mpEdit)
- mpEdit->StateChanged(StateChangedType::Mirroring);
+ mpEdit->CompatStateChanged(StateChangedType::Mirroring);
Resize();
}
}
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 4df611e38a5a..c73308903b47 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -805,7 +805,7 @@ bool Dialog::ImplStartExecuteModal()
if ( GetParent() )
{
NotifyEvent aNEvt( MouseNotifyEvent::EXECUTEDIALOG, this );
- GetParent()->Notify( aNEvt );
+ GetParent()->CompatNotify( aNEvt );
}
mbInExecute = true;
SetModalInputMode( true );
@@ -933,7 +933,7 @@ void Dialog::EndDialog( long nResult )
if ( GetParent() )
{
NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );
- GetParent()->Notify( aNEvt );
+ GetParent()->CompatNotify( aNEvt );
}
mpDialogImpl->mnResult = nResult;
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 2ce7843caf93..ef47cd059059 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -689,11 +689,11 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput )
{
NotifyEvent aNEvt1( MouseNotifyEvent::LOSEFOCUS, pSWindow );
if ( !ImplCallPreNotify( aNEvt1 ) )
- pSWindow->LoseFocus();
+ pSWindow->CompatLoseFocus();
pSWindow->mpWindowImpl->mnGetFocusFlags = nGetFocusFlags | GETFOCUS_AROUND;
NotifyEvent aNEvt2( MouseNotifyEvent::GETFOCUS, pSWindow );
if ( !ImplCallPreNotify( aNEvt2 ) )
- pSWindow->GetFocus();
+ pSWindow->CompatGetFocus();
pSWindow->mpWindowImpl->mnGetFocusFlags = 0;
return true;
}
@@ -821,11 +821,11 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput )
{
NotifyEvent aNEvt1( MouseNotifyEvent::LOSEFOCUS, pSWindow );
if ( !ImplCallPreNotify( aNEvt1 ) )
- pSWindow->LoseFocus();
+ pSWindow->CompatLoseFocus();
pSWindow->mpWindowImpl->mnGetFocusFlags = nGetFocusFlags | GETFOCUS_AROUND;
NotifyEvent aNEvt2( MouseNotifyEvent::GETFOCUS, pSWindow );
if ( !ImplCallPreNotify( aNEvt2 ) )
- pSWindow->GetFocus();
+ pSWindow->CompatGetFocus();
pSWindow->mpWindowImpl->mnGetFocusFlags = 0;
return true;
}
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index 3e729fd738f4..61c11ab20bdd 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -38,8 +38,7 @@ void Window::DataChanged( const DataChangedEvent& )
void Window::NotifyAllChildren( DataChangedEvent& rDCEvt )
{
-
- DataChanged( rDCEvt );
+ CompatDataChanged( rDCEvt );
vcl::Window* pChild = mpWindowImpl->mpFirstChild;
while ( pChild )
@@ -53,7 +52,7 @@ bool Window::PreNotify( NotifyEvent& rNEvt )
{
bool bDone = false;
if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() )
- bDone = mpWindowImpl->mpParent->PreNotify( rNEvt );
+ bDone = mpWindowImpl->mpParent->CompatPreNotify( rNEvt );
if ( !bDone )
{
@@ -194,7 +193,7 @@ bool Window::Notify( NotifyEvent& rNEvt )
if ( !nRet )
{
if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() )
- nRet = mpWindowImpl->mpParent->Notify( rNEvt );
+ nRet = mpWindowImpl->mpParent->CompatNotify( rNEvt );
}
return nRet;
@@ -427,7 +426,7 @@ void Window::ImplCallInitShow()
{
mpWindowImpl->mbReallyShown = true;
mpWindowImpl->mbInInitShow = true;
- StateChanged( StateChangedType::InitShow );
+ CompatStateChanged( StateChangedType::InitShow );
mpWindowImpl->mbInInitShow = false;
vcl::Window* pWindow = mpWindowImpl->mpFirstOverlap;
diff --git a/vcl/source/window/globalization.cxx b/vcl/source/window/globalization.cxx
index 980a5867094e..1c56638c6502 100644
--- a/vcl/source/window/globalization.cxx
+++ b/vcl/source/window/globalization.cxx
@@ -24,7 +24,7 @@ namespace vcl {
void Window::EnableRTL ( bool bEnable )
{
- StateChanged( StateChangedType::Mirroring );
+ CompatStateChanged( StateChangedType::Mirroring );
OutputDevice::EnableRTL(bEnable);
}
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index d4ebc94cbdfd..7a4a8262dfa6 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -356,7 +356,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
pOldFocusWindow->EndTracking( TrackingEventFlags::Cancel | TrackingEventFlags::Focus );
NotifyEvent aNEvt( MouseNotifyEvent::LOSEFOCUS, pOldFocusWindow );
if ( !ImplCallPreNotify( aNEvt ) )
- pOldFocusWindow->LoseFocus();
+ pOldFocusWindow->CompatLoseFocus();
pOldFocusWindow->ImplCallDeactivateListeners( this );
}
@@ -384,7 +384,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
mpWindowImpl->mnGetFocusFlags |= GETFOCUS_FLOATWIN_POPUPMODEEND_CANCEL;
NotifyEvent aNEvt( MouseNotifyEvent::GETFOCUS, this );
if ( !ImplCallPreNotify( aNEvt ) && !aDogTag.IsDead() )
- GetFocus();
+ CompatGetFocus();
if( !aDogTag.IsDead() )
ImplCallActivateListeners( (pOldFocusWindow && ! aOldFocusDel.IsDead()) ? pOldFocusWindow : NULL );
if( !aDogTag.IsDead() )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b9ea0e6ba56a..17cb1c92e7d8 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -398,7 +398,7 @@ void Window::dispose()
// announce the window is to be destroyed
{
NotifyEvent aNEvt( MouseNotifyEvent::DESTROY, this );
- Notify( aNEvt );
+ CompatNotify( aNEvt );
}
// EndExtTextInputMode
@@ -1910,14 +1910,14 @@ void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) const
void Window::KeyInput( const KeyEvent& rKEvt )
{
NotifyEvent aNEvt( MouseNotifyEvent::KEYINPUT, this, &rKEvt );
- if ( !Notify( aNEvt ) )
+ if ( !CompatNotify( aNEvt ) )
mpWindowImpl->mbKeyInput = true;
}
void Window::KeyUp( const KeyEvent& rKEvt )
{
NotifyEvent aNEvt( MouseNotifyEvent::KEYUP, this, &rKEvt );
- if ( !Notify( aNEvt ) )
+ if ( !CompatNotify( aNEvt ) )
mpWindowImpl->mbKeyUp = true;
}
@@ -1944,13 +1944,13 @@ void Window::GetFocus()
}
NotifyEvent aNEvt( MouseNotifyEvent::GETFOCUS, this );
- Notify( aNEvt );
+ CompatNotify( aNEvt );
}
void Window::LoseFocus()
{
NotifyEvent aNEvt( MouseNotifyEvent::LOSEFOCUS, this );
- Notify( aNEvt );
+ CompatNotify( aNEvt );
}
void Window::RequestHelp( const HelpEvent& rHEvt )
@@ -2008,7 +2008,7 @@ void Window::Command( const CommandEvent& rCEvt )
CallEventListeners( VCLEVENT_WINDOW_COMMAND, (void*)&rCEvt );
NotifyEvent aNEvt( MouseNotifyEvent::COMMAND, this, &rCEvt );
- if ( !Notify( aNEvt ) )
+ if ( !CompatNotify( aNEvt ) )
mpWindowImpl->mbCommand = true;
}
@@ -2064,12 +2064,11 @@ bool Window::IsLocked( bool bChildren ) const
void Window::SetStyle( WinBits nStyle )
{
-
- if ( mpWindowImpl->mnStyle != nStyle )
+ if ( mpWindowImpl && mpWindowImpl->mnStyle != nStyle )
{
mpWindowImpl->mnPrevStyle = mpWindowImpl->mnStyle;
mpWindowImpl->mnStyle = nStyle;
- StateChanged( StateChangedType::Style );
+ CompatStateChanged( StateChangedType::Style );
}
}
@@ -2093,7 +2092,7 @@ void Window::SetExtendedStyle( WinBits nExtendedStyle )
}
mpWindowImpl->mnPrevExtendedStyle = mpWindowImpl->mnExtendedStyle;
mpWindowImpl->mnExtendedStyle = nExtendedStyle;
- StateChanged( StateChangedType::ExtendedStyle );
+ CompatStateChanged( StateChangedType::ExtendedStyle );
}
}
@@ -2303,7 +2302,7 @@ void Window::Show(bool bVisible, sal_uInt16 nFlags)
mpWindowImpl->mpFrame->Show( false, false );
}
- StateChanged( StateChangedType::Visible );
+ CompatStateChanged( StateChangedType::Visible );
if ( mpWindowImpl->mbReallyVisible )
{
@@ -2391,7 +2390,7 @@ void Window::Show(bool bVisible, sal_uInt16 nFlags)
ImplCallResize();
}
- StateChanged( StateChangedType::Visible );
+ CompatStateChanged( StateChangedType::Visible );
vcl::Window* pTestParent;
if ( ImplIsOverlapWindow() )
@@ -2578,7 +2577,7 @@ void Window::Enable( bool bEnable, bool bChild )
mpWindowImpl->mbDisabled = !bEnable;
if ( mpWindowImpl->mpSysObj )
mpWindowImpl->mpSysObj->Enable( bEnable && !mpWindowImpl->mbInputDisabled );
- StateChanged( StateChangedType::Enable );
+ CompatStateChanged( StateChangedType::Enable );
CallEventListeners( bEnable ? VCLEVENT_WINDOW_ENABLED : VCLEVENT_WINDOW_DISABLED );
}
@@ -2673,7 +2672,7 @@ void Window::EnableInput( bool bEnable, bool bChild )
if ( bNotify )
{
NotifyEvent aNEvt( bEnable ? MouseNotifyEvent::INPUTENABLE : MouseNotifyEvent::INPUTDISABLE, this );
- Notify( aNEvt );
+ CompatNotify( aNEvt );
}
}
@@ -3130,9 +3129,8 @@ void Window::Sync()
void Window::SetUpdateMode( bool bUpdate )
{
-
mpWindowImpl->mbNoUpdate = !bUpdate;
- StateChanged( StateChangedType::UpdateMode );
+ CompatStateChanged( StateChangedType::UpdateMode );
}
void Window::GrabFocus()
@@ -3203,7 +3201,7 @@ void Window::SetText( const OUString& rStr )
pWindow->CallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldTitle );
}
- StateChanged( StateChangedType::Text );
+ CompatStateChanged( StateChangedType::Text );
}
OUString Window::GetText() const
@@ -3723,7 +3721,7 @@ void Window::EnableNativeWidget( bool bEnable )
// send datachanged event to allow for internal changes required for NWF
// like clipmode, transparency, etc.
DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, mxSettings.get(), AllSettingsFlags::STYLE );
- DataChanged( aDCEvt );
+ CompatDataChanged( aDCEvt );
// sometimes the borderwindow is queried, so keep it in sync
if( mpWindowImpl->mpBorderWindow )
@@ -3946,6 +3944,53 @@ void Window::SetDoubleBuffering(bool bDoubleBuffering)
mpWindowImpl->mbDoubleBuffering = bDoubleBuffering;
}
+/*
+ * The rational here is that we moved destructors to
+ * dispose and this altered a lot of code paths, that
+ * are better left unchanged for now.
+ */
+#define COMPAT_BODY(method,args) \
+ if (!mpWindowImpl || mpWindowImpl->mbInDispose) \
+ Window::method args; \
+ else \
+ method args;
+
+void Window::CompatGetFocus()
+{
+ COMPAT_BODY(GetFocus,())
+}
+
+void Window::CompatLoseFocus()
+{
+ COMPAT_BODY(LoseFocus,())
+}
+
+void Window::CompatStateChanged( StateChangedType nStateChange )
+{
+ COMPAT_BODY(StateChanged,(nStateChange))
+}
+
+void Window::CompatDataChanged( const DataChangedEvent& rDCEvt )
+{
+ COMPAT_BODY(DataChanged,(rDCEvt))
+}
+
+bool Window::CompatPreNotify( NotifyEvent& rNEvt )
+{
+ if (!mpWindowImpl || mpWindowImpl->mbInDispose)
+ return Window::PreNotify( rNEvt );
+ else
+ return PreNotify( rNEvt );
+}
+
+bool Window::CompatNotify( NotifyEvent& rNEvt )
+{
+ if (!mpWindowImpl || mpWindowImpl->mbInDispose)
+ return Window::Notify( rNEvt );
+ else
+ return Notify( rNEvt );
+}
+
} /* namespace vcl */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index c38a2b25f8d7..5e8c8f859d82 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -509,10 +509,10 @@ bool Window::EndSaveFocus( sal_uIntPtr nSaveId, bool bRestore )
void Window::SetZoom( const Fraction& rZoom )
{
- if ( mpWindowImpl->maZoom != rZoom )
+ if ( mpWindowImpl && mpWindowImpl->maZoom != rZoom )
{
mpWindowImpl->maZoom = rZoom;
- StateChanged( StateChangedType::Zoom );
+ CompatStateChanged( StateChangedType::Zoom );
}
}
@@ -577,11 +577,11 @@ long Window::CalcZoom( long nCalc ) const
void Window::SetControlFont()
{
- if (mpWindowImpl->mpControlFont)
+ if (mpWindowImpl && mpWindowImpl->mpControlFont)
{
delete mpWindowImpl->mpControlFont;
mpWindowImpl->mpControlFont = NULL;
- StateChanged(StateChangedType::ControlFont);
+ CompatStateChanged(StateChangedType::ControlFont);
}
}
@@ -602,7 +602,7 @@ void Window::SetControlFont(const vcl::Font& rFont)
else
mpWindowImpl->mpControlFont = new vcl::Font(rFont);
- StateChanged(StateChangedType::ControlFont);
+ CompatStateChanged(StateChangedType::ControlFont);
}
vcl::Font Window::GetControlFont() const
@@ -630,7 +630,7 @@ void Window::SetControlForeground()
{
mpWindowImpl->maControlForeground = Color(COL_TRANSPARENT);
mpWindowImpl->mbControlForeground = false;
- StateChanged(StateChangedType::ControlForeground);
+ CompatStateChanged(StateChangedType::ControlForeground);
}
}
@@ -642,7 +642,7 @@ void Window::SetControlForeground(const Color& rColor)
{
mpWindowImpl->maControlForeground = Color(COL_TRANSPARENT);
mpWindowImpl->mbControlForeground = false;
- StateChanged(StateChangedType::ControlForeground);
+ CompatStateChanged(StateChangedType::ControlForeground);
}
}
else
@@ -651,7 +651,7 @@ void Window::SetControlForeground(const Color& rColor)
{
mpWindowImpl->maControlForeground = rColor;
mpWindowImpl->mbControlForeground = true;
- StateChanged(StateChangedType::ControlForeground);
+ CompatStateChanged(StateChangedType::ControlForeground);
}
}
}
@@ -670,7 +670,7 @@ void Window::SetControlBackground()
{
mpWindowImpl->maControlBackground = Color(COL_TRANSPARENT);
mpWindowImpl->mbControlBackground = false;
- StateChanged(StateChangedType::ControlBackground);
+ CompatStateChanged(StateChangedType::ControlBackground);
}
}
@@ -682,7 +682,7 @@ void Window::SetControlBackground(const Color& rColor)
{
mpWindowImpl->maControlBackground = Color(COL_TRANSPARENT);
mpWindowImpl->mbControlBackground = false;
- StateChanged(StateChangedType::ControlBackground);
+ CompatStateChanged(StateChangedType::ControlBackground);
}
}
else
@@ -691,7 +691,7 @@ void Window::SetControlBackground(const Color& rColor)
{
mpWindowImpl->maControlBackground = rColor;
mpWindowImpl->mbControlBackground = true;
- StateChanged(StateChangedType::ControlBackground);
+ CompatStateChanged(StateChangedType::ControlBackground);
}
}
}
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index ccf881f3428a..06d8fa879dfa 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -57,7 +57,7 @@
bool ImplCallPreNotify( NotifyEvent& rEvt )
{
return Application::CallEventHooks( rEvt )
- || rEvt.GetWindow()->PreNotify( rEvt );
+ || rEvt.GetWindow()->CompatPreNotify( rEvt );
}
static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePos,
@@ -1866,7 +1866,7 @@ IMPL_LINK_NOARG(vcl::Window, ImplAsyncFocusHdl)
{
NotifyEvent aNEvt( MouseNotifyEvent::LOSEFOCUS, pFocusWin );
if ( !ImplCallPreNotify( aNEvt ) )
- pFocusWin->LoseFocus();
+ pFocusWin->CompatLoseFocus();
pFocusWin->ImplCallDeactivateListeners( NULL );
}
// XXX