summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-04-15 13:02:47 (GMT)
committerCaolán McNamara <caolanm@redhat.com>2011-04-15 13:02:47 (GMT)
commitec240eafe9b25620383aa54015f5c55e0f64227a (patch)
tree20914f1eb8a701302635e409f5dcae07afc839fb
parent20015bfb1b10ebbd017e44b021656ae99006f845 (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.hxx21
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx8
-rw-r--r--sd/source/ui/toolpanel/ToolPanelViewShell.cxx2
-rw-r--r--sd/source/ui/view/drviewsa.cxx2
-rw-r--r--sd/source/ui/view/outlnvsh.cxx2
-rw-r--r--sd/source/ui/view/viewshel.cxx34
6 files changed, 53 insertions, 16 deletions
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index 0f1a4e7..b3508bd 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -562,6 +562,27 @@ protected:
virtual void SetZoomFactor( const Fraction &rZoomX,
const Fraction &rZoomY );
+ /**
+ 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:
::Window* mpParentWindow;
/** This window updater is used to keep all relevant windows up to date
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 7719008..17cbe0b 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -135,9 +135,6 @@ SlideSorterViewShell::SlideSorterViewShell (
{
meShellType = ST_SLIDE_SORTER;
- SetPool( &GetDoc()->GetPool() );
- SetUndoManager( GetDoc()->GetDocSh()->GetUndoManager() );
-
if (pFrameViewArgument != NULL)
mpFrameView = pFrameViewArgument;
else
@@ -190,6 +187,11 @@ void SlideSorterViewShell::Initialize (void)
mpScrollBarBox);
mpView = &mpSlideSorter->GetView();
+ ViewShell::doShow();
+
+ SetPool( &GetDoc()->GetPool() );
+ SetUndoManager( GetDoc()->GetDocSh()->GetUndoManager() );
+
// For accessibility we have to shortly hide the content window.
// This triggers the construction of a new accessibility object for
// the new view shell. (One is created earlier while the construtor
diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
index 4b29185..d4c8816 100644
--- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
@@ -483,6 +483,8 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi
,mpSubShellManager()
,mnMenuId(0)
{
+ ViewShell::doShow();
+
meShellType = ST_TASK_PANE;
mpContentWindow->SetCenterAllowed( false );
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 3c4bdb0..5f7c07e 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -143,6 +143,8 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas
, mbIsLayerModeActive(false)
, mbIsInSwitchPage(false)
{
+ ViewShell::doShow();
+
if (pFrameViewArgument != NULL)
mpFrameView = pFrameViewArgument;
else
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 652a940..acaad8e 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -225,6 +225,8 @@ OutlineViewShell::OutlineViewShell (
mbInitialized(false)
{
+ ViewShell::doShow();
+
if (pFrameViewArgument != NULL)
mpFrameView = pFrameViewArgument;
else
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index a7b2179..9c74285 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -218,11 +218,6 @@ void ViewShell::construct(void)
mpContentWindow->SetViewShell(this);
mpContentWindow->SetPosSizePixel(
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());
if ( ! GetDocSh()->IsPreview())
{
@@ -231,18 +226,12 @@ void ViewShell::construct(void)
mpHorizontalScrollBar->EnableRTL (sal_False);
mpHorizontalScrollBar->SetRange(Range(0, 32000));
mpHorizontalScrollBar->SetScrollHdl(LINK(this, ViewShell, HScrollHdl));
- mpHorizontalScrollBar->Show();
mpVerticalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_VSCROLL | WB_DRAG)));
mpVerticalScrollBar->SetRange(Range(0, 32000));
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();
}
String aName( RTL_CONSTASCII_USTRINGPARAM( "ViewShell" ));
@@ -264,12 +253,31 @@ void ViewShell::construct(void)
// Register the sub shell factory.
mpImpl->mpSubShellFactory.reset(new ViewShellObjectBarFactory(*this));
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();
+}
void ViewShell::Init (bool bIsMainViewShell)
{