diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-04-15 14:02:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-04-15 14:02:47 +0100 |
commit | ec240eafe9b25620383aa54015f5c55e0f64227a (patch) | |
tree | 20914f1eb8a701302635e409f5dcae07afc839fb | |
parent | 20015bfb1b10ebbd017e44b021656ae99006f845 (diff) |
Split construct into bits that depend on showing the window and not
This fixes a horrific a11y problem where Show triggers callbacks
to virtual methods, while the object is not fully constructed,
which means, that the *baseclass* virtual method is called,
not the *derived* virtual method that constructs the a11y wrapper
enable a11y, and run the smoketest with dbg-util before touching
this stuff
-rw-r--r-- | sd/source/ui/inc/ViewShell.hxx | 21 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsa.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvsh.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 34 |
6 files changed, 53 insertions, 16 deletions
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 0f1a4e71edf2..b3508bdbaace 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -564,2 +564,23 @@ protected: + /** + This must be called after the ctor, but before anything else. + It's the part of construction that is dependent + on showing the top-level window. + + Showing a window with a11y enabled causes various callbacks + to be triggered. + + Due to the "virtual methods are not virtual during constructors" + problem, this is a disaster to call from the ctor + + i.e. construct calls Show, and if a11y is enabled this + reenters the not-fully constructed object and calls + CreateAccessibleDocumentView, so if construct is called + from the ctor then if a derived class is contructed the base-cass + CreateAccessibleDocumentView is used, not the derived + CreateAccessibleDocumentView. i.e. run smoketest under a11y with + debugging assertions enabled + */ + void doShow(); + private: diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index 7719008b3fe2..17cbe0b6d9e2 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -137,5 +137,2 @@ SlideSorterViewShell::SlideSorterViewShell ( - SetPool( &GetDoc()->GetPool() ); - SetUndoManager( GetDoc()->GetDocSh()->GetUndoManager() ); - if (pFrameViewArgument != NULL) @@ -192,2 +189,7 @@ void SlideSorterViewShell::Initialize (void) + ViewShell::doShow(); + + SetPool( &GetDoc()->GetPool() ); + SetUndoManager( GetDoc()->GetDocSh()->GetUndoManager() ); + // For accessibility we have to shortly hide the content window. diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 4b2918583cd0..d4c88166ae1c 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -485,2 +485,4 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi { + ViewShell::doShow(); + meShellType = ST_TASK_PANE; diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 3c4bdb0ab9cc..5f7c07ef70a1 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -145,2 +145,4 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas { + ViewShell::doShow(); + if (pFrameViewArgument != NULL) diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 652a9401eee8..acaad8ecf941 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -227,2 +227,4 @@ OutlineViewShell::OutlineViewShell ( { + ViewShell::doShow(); + if (pFrameViewArgument != NULL) diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index a7b217993cf9..9c742859d679 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -220,7 +220,2 @@ void ViewShell::construct(void) GetParentWindow()->GetPosPixel(),GetParentWindow()->GetSizePixel()); - mpContentWindow->Show(); - static_cast< ::Window*>(mpContentWindow.get())->Resize(); - OSL_TRACE("content window has size %d %d", - mpContentWindow->GetSizePixel().Width(), - mpContentWindow->GetSizePixel().Height()); @@ -233,3 +228,2 @@ void ViewShell::construct(void) mpHorizontalScrollBar->SetScrollHdl(LINK(this, ViewShell, HScrollHdl)); - mpHorizontalScrollBar->Show(); @@ -238,9 +232,4 @@ void ViewShell::construct(void) mpVerticalScrollBar->SetScrollHdl(LINK(this, ViewShell, VScrollHdl)); - mpVerticalScrollBar->Show(); - maScrBarWH = Size( - mpVerticalScrollBar->GetSizePixel().Width(), - mpHorizontalScrollBar->GetSizePixel().Height()); mpScrollBarBox.reset(new ScrollBarBox(GetParentWindow(), WB_SIZEABLE)); - mpScrollBarBox->Show(); } @@ -266,8 +255,27 @@ void ViewShell::construct(void) GetViewShellBase().GetViewShellManager()->AddSubShellFactory(this,mpImpl->mpSubShellFactory); - - GetParentWindow()->Show(); } +void ViewShell::doShow(void) +{ + mpContentWindow->Show(); + static_cast< ::Window*>(mpContentWindow.get())->Resize(); + OSL_TRACE("content window has size %d %d", + mpContentWindow->GetSizePixel().Width(), + mpContentWindow->GetSizePixel().Height()); + + if ( ! GetDocSh()->IsPreview()) + { + // Show scroll bars + mpHorizontalScrollBar->Show(); + + mpVerticalScrollBar->Show(); + maScrBarWH = Size( + mpVerticalScrollBar->GetSizePixel().Width(), + mpHorizontalScrollBar->GetSizePixel().Height()); + mpScrollBarBox->Show(); + } + GetParentWindow()->Show(); +} |