[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/source
Caolán McNamara
caolanm at redhat.com
Wed Mar 19 04:57:38 PDT 2014
sc/source/ui/Accessibility/AccessibleDocument.cxx | 70 +++++++++++++---------
1 file changed, 43 insertions(+), 27 deletions(-)
New commits:
commit b6d9aa63ab63f3236712b2b68155e6b0d129a688
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 14 20:28:10 2014 +0000
Related: rhbz#1076264 intermittent a11y crash in calc
http://retrace.fedoraproject.org/faf/reports/338291/
this crash refuses to be captured alive. But seeing as
we sometimes check mpViewShell against NULL and sometimes check
GetViewData against NULL its worth making those checks everytime
for consistency
see also...
rhbz#923993 rhbz#896711 rhbz#602273 rhbz#577595 lp#811057 lp#760665
(cherry picked from commit fae1e19af05e664364c55d4f686aaab860fd538d)
Conflicts:
sc/source/ui/Accessibility/AccessibleDocument.cxx
Reviewed-on: https://gerrit.libreoffice.org/8604
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit d01abcc7beb215c7e425248f690db8a642f00c73)
Conflicts:
sc/source/ui/Accessibility/AccessibleDocument.cxx
Change-Id: I5553848018f500b63ade60bcfc756a736b27c64f
Reviewed-on: https://gerrit.libreoffice.org/8639
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 6ce612b..d4d126d 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -337,13 +337,14 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* pAccessibleDocument, Sc
}
if (pViewShell)
{
- SfxBroadcaster* pDrawBC = pViewShell->GetViewData()->GetDocument()->GetDrawBroadcaster();
+ ScViewData *pViewData = pViewShell->GetViewData();
+ SfxBroadcaster* pDrawBC = pViewData ? pViewData->GetDocument()->GetDrawBroadcaster() : NULL;
if (pDrawBC)
{
StartListening(*pDrawBC);
- maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(pViewShell->GetViewData()->GetDocument()->GetDrawLayer()) );
- maShapeTreeInfo.SetSdrView(pViewShell->GetViewData()->GetScDrawView());
+ maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(pViewData->GetDocument()->GetDrawLayer()) );
+ maShapeTreeInfo.SetSdrView(pViewData->GetScDrawView());
maShapeTreeInfo.SetController(NULL);
maShapeTreeInfo.SetWindow(pViewShell->GetWindowByPos(meSplitPos));
maShapeTreeInfo.SetViewForwarder(mpAccessibleDocument);
@@ -356,7 +357,8 @@ ScChildrenShapes::~ScChildrenShapes()
std::for_each(maZOrderedShapes.begin(), maZOrderedShapes.end(), Destroy());
if (mpViewShell)
{
- SfxBroadcaster* pDrawBC = mpViewShell->GetViewData()->GetDocument()->GetDrawBroadcaster();
+ ScViewData *pViewData = mpViewShell->GetViewData();
+ SfxBroadcaster* pDrawBC = pViewData ? pViewData->GetDocument()->GetDrawBroadcaster() : NULL;
if (pDrawBC)
EndListening(*pDrawBC);
}
@@ -366,13 +368,14 @@ void ScChildrenShapes::SetDrawBroadcaster()
{
if (mpViewShell)
{
- SfxBroadcaster* pDrawBC = mpViewShell->GetViewData()->GetDocument()->GetDrawBroadcaster();
+ ScViewData *pViewData = mpViewShell->GetViewData();
+ SfxBroadcaster* pDrawBC = pViewData ? pViewData->GetDocument()->GetDrawBroadcaster() : NULL;
if (pDrawBC)
{
StartListening(*pDrawBC, sal_True);
- maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(mpViewShell->GetViewData()->GetDocument()->GetDrawLayer()) );
- maShapeTreeInfo.SetSdrView(mpViewShell->GetViewData()->GetScDrawView());
+ maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(pViewData->GetDocument()->GetDrawLayer()) );
+ maShapeTreeInfo.SetSdrView(pViewData->GetScDrawView());
maShapeTreeInfo.SetController(NULL);
maShapeTreeInfo.SetWindow(mpViewShell->GetWindowByPos(meSplitPos));
maShapeTreeInfo.SetViewForwarder(mpAccessibleDocument);
@@ -827,7 +830,8 @@ SdrPage* ScChildrenShapes::GetDrawPage() const
SdrPage* pDrawPage = NULL;
if (mpViewShell)
{
- ScDocument* pDoc = mpViewShell->GetViewData()->GetDocument();
+ ScViewData *pViewData = mpViewShell->GetViewData();
+ ScDocument* pDoc = pViewData ? pViewData->GetDocument() : NULL;
if (pDoc && pDoc->GetDrawLayer())
{
ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
@@ -1239,9 +1243,10 @@ ScAccessibleDocument::ScAccessibleDocument(
AddChild( pChildWin->GetAccessible(), false );
}
}
- if (pViewShell->GetViewData()->HasEditView( eSplitPos ))
+ ScViewData *pViewData = pViewShell->GetViewData();
+ if (pViewData && pViewData->HasEditView(eSplitPos))
{
- uno::Reference<XAccessible> xAcc = new ScAccessibleEditObject(this, pViewShell->GetViewData()->GetEditView(eSplitPos),
+ uno::Reference<XAccessible> xAcc = new ScAccessibleEditObject(this, pViewData->GetEditView(eSplitPos),
pViewShell->GetWindowByPos(eSplitPos), GetCurrentCellName(), GetCurrentCellDescription(),
ScAccessibleEditObject::CellInEditMode);
AddChild(xAcc, false);
@@ -1382,9 +1387,10 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
}
else if ((rRef.GetId() == SC_HINT_ACC_ENTEREDITMODE)) // this event comes only on creating edit field of a cell
{
- if (mpViewShell && mpViewShell->GetViewData()->HasEditView(meSplitPos))
+ ScViewData *pViewData = mpViewShell ? mpViewShell->GetViewData() : NULL;
+ if (pViewData && pViewData->HasEditView(meSplitPos))
{
- mpTempAccEdit = new ScAccessibleEditObject(this, mpViewShell->GetViewData()->GetEditView(meSplitPos),
+ mpTempAccEdit = new ScAccessibleEditObject(this, pViewData->GetEditView(meSplitPos),
mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(),
OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), ScAccessibleEditObject::CellInEditMode);
uno::Reference<XAccessible> xAcc = mpTempAccEdit;
@@ -1639,7 +1645,7 @@ void SAL_CALL
SolarMutexGuard aGuard;
IsObjectValid();
- if (mpChildrenShapes)
+ if (mpChildrenShapes && mpViewShell)
{
sal_Int32 nCount(mpChildrenShapes->GetCount()); //all shapes and the table
if (mxTempAcc.is())
@@ -1782,7 +1788,7 @@ void SAL_CALL
SolarMutexGuard aGuard;
IsObjectValid();
- if (mpChildrenShapes)
+ if (mpChildrenShapes && mpViewShell)
{
sal_Int32 nCount(mpChildrenShapes->GetCount()); //all shapes and the table
if (mxTempAcc.is())
@@ -1862,14 +1868,21 @@ Rectangle ScAccessibleDocument::GetVisibleArea_Impl() const
{
Rectangle aVisRect(GetBoundingBox());
- Point aPoint(mpViewShell->GetViewData()->GetPixPos(meSplitPos)); // returns a negative Point
- aPoint.setX(-aPoint.getX());
- aPoint.setY(-aPoint.getY());
- aVisRect.SetPos(aPoint);
+ if (mpViewShell)
+ {
+ ScViewData *pViewData = mpViewShell->GetViewData();
+ if (pViewData)
+ {
+ Point aPoint(pViewData->GetPixPos(meSplitPos)); // returns a negative Point
+ aPoint.setX(-aPoint.getX());
+ aPoint.setY(-aPoint.getY());
+ aVisRect.SetPos(aPoint);
+ }
- ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
- if (pWin)
- aVisRect = pWin->PixelToLogic(aVisRect, pWin->GetDrawMapMode());
+ ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
+ if (pWin)
+ aVisRect = pWin->PixelToLogic(aVisRect, pWin->GetDrawMapMode());
+ }
return aVisRect;
}
@@ -1990,8 +2003,9 @@ Rectangle ScAccessibleDocument::GetBoundingBox() const
SCTAB ScAccessibleDocument::getVisibleTable() const
{
SCTAB nVisibleTable(0);
- if (mpViewShell && mpViewShell->GetViewData())
- nVisibleTable = mpViewShell->GetViewData()->GetTabNo();
+ ScViewData *pViewData = mpViewShell ? mpViewShell->GetViewData() : NULL;
+ if (pViewData)
+ nVisibleTable = pViewData->GetTabNo();
return nVisibleTable;
}
@@ -2021,11 +2035,12 @@ void ScAccessibleDocument::FreeAccessibleSpreadsheet()
sal_Bool ScAccessibleDocument::IsTableSelected() const
{
sal_Bool bResult (false);
- if(mpViewShell)
+ ScViewData *pViewData = mpViewShell ? mpViewShell->GetViewData() : NULL;
+ if(pViewData)
{
SCTAB nTab(getVisibleTable());
//#103800#; use a copy of MarkData
- ScMarkData aMarkData(mpViewShell->GetViewData()->GetMarkData());
+ ScMarkData aMarkData(pViewData->GetMarkData());
aMarkData.MarkToMulti();
if (aMarkData.IsAllMarked(ScRange(ScAddress(0, 0, nTab),ScAddress(MAXCOL, MAXROW, nTab))))
bResult = sal_True;
@@ -2085,11 +2100,12 @@ void ScAccessibleDocument::RemoveChild(const uno::Reference<XAccessible>& xAcc,
OUString ScAccessibleDocument::GetCurrentCellName() const
{
String sName( ScResId(STR_ACC_CELL_NAME) );
- if (mpViewShell)
+ ScViewData *pViewData = mpViewShell ? mpViewShell->GetViewData() : NULL;
+ if (pViewData)
{
String sAddress;
// Document not needed, because only the cell address, but not the tablename is needed
- mpViewShell->GetViewData()->GetCurPos().Format( sAddress, SCA_VALID, NULL );
+ pViewData->GetCurPos().Format( sAddress, SCA_VALID, NULL );
sName.SearchAndReplaceAscii("%1", sAddress);
}
return OUString(sName);
More information about the Libreoffice-commits
mailing list