diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-02-25 09:08:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-25 10:45:27 +0000 |
commit | 1e0541fadf847e30053c0d8b29f90bdfaecd6be6 (patch) | |
tree | 8377bfc580eff62a883ca634850d579dbaf7d21e /svx | |
parent | 82aaa22ea43d4a4a51f9177604094452da65d124 (diff) |
mrParentWindow can never be null, simplify around that
Change-Id: Id290343219044aa8e668eb8f2e58b2d3c35a2ac7
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/accessibility/svxpixelctlaccessiblecontext.cxx | 35 | ||||
-rw-r--r-- | svx/source/inc/svxpixelctlaccessiblecontext.hxx | 4 |
2 files changed, 18 insertions, 21 deletions
diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx index a3c797a7bd2d..45a3df4250f4 100644 --- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx +++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx @@ -515,7 +515,7 @@ uno::Reference<XAccessible> SvxPixelCtlAccessible::CreateChild (long nIndex,Poin sal_Bool bPixelColorOrBG= sal_Bool(mrPixelCtl.GetBitmapPixel(sal_uInt16(nIndex))); Size size(mrPixelCtl.GetWidth() / mrPixelCtl.GetLineCount(),mrPixelCtl.GetHeight() / mrPixelCtl.GetLineCount()); uno::Reference<XAccessible> xChild; - xChild = new SvxPixelCtlAccessibleChild(&mrPixelCtl, + xChild = new SvxPixelCtlAccessibleChild(mrPixelCtl, bPixelColorOrBG, Point(nX,nY), Rectangle(mPoint,size), @@ -583,7 +583,7 @@ DBG_NAME( SvxPixelCtlAccessibleChild ) SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild( - SvxPixelCtl* rWindow, + SvxPixelCtl& rWindow, sal_Bool bPixelColorOrBG, const Point &aPoint, const Rectangle& rBoundingBox, @@ -640,8 +640,8 @@ awt::Rectangle SAL_CALL SvxPixelCtlAccessibleChild::getBounds() throw( RuntimeEx //Modified by lq, 09/26 //return AWTRectangle( GetBoundingBox() ); awt::Rectangle rect = AWTRectangle( GetBoundingBox() ); - rect.X = rect.X + mrParentWindow->GetClientWindowExtentsRelative(NULL).Left()-mrParentWindow->GetWindowExtentsRelative(NULL).Left(); - rect.Y = rect.Y + mrParentWindow->GetClientWindowExtentsRelative(NULL).Top()-mrParentWindow->GetWindowExtentsRelative(NULL).Top(); + rect.X = rect.X + mrParentWindow.GetClientWindowExtentsRelative(NULL).Left()-mrParentWindow.GetWindowExtentsRelative(NULL).Left(); + rect.Y = rect.Y + mrParentWindow.GetClientWindowExtentsRelative(NULL).Top()-mrParentWindow.GetWindowExtentsRelative(NULL).Top(); return rect; // End } @@ -674,7 +674,7 @@ sal_Int32 SvxPixelCtlAccessibleChild::getForeground( ) //::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::MutexGuard aGuard( m_aMutex ); ThrowExceptionIfNotAlive(); - return mrParentWindow->GetControlForeground().GetColor(); + return mrParentWindow.GetControlForeground().GetColor(); } sal_Int32 SvxPixelCtlAccessibleChild::getBackground( ) throw (::com::sun::star::uno::RuntimeException) @@ -683,7 +683,7 @@ sal_Int32 SvxPixelCtlAccessibleChild::getBackground( ) ::osl::MutexGuard aGuard( m_aMutex ); ThrowExceptionIfNotAlive(); - return mrParentWindow->GetControlBackground().GetColor(); + return mrParentWindow.GetControlBackground().GetColor(); } //===== XAccessibleContext ================================================== @@ -750,17 +750,14 @@ uno::Reference< XAccessibleStateSet > SAL_CALL SvxPixelCtlAccessibleChild::getAc pStateSetHelper->AddState( AccessibleStateType::SHOWING ); pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); - if (mrParentWindow ) + long nIndex = mrParentWindow.GetFoucsPosIndex(); + if ( nIndex == mnIndexInParent) { - long nIndex = mrParentWindow->GetFoucsPosIndex(); - if ( nIndex == mnIndexInParent) - { - pStateSetHelper->AddState( AccessibleStateType::SELECTED ); - } - if (mrParentWindow->GetBitmapPixel(sal_uInt16(mnIndexInParent))) - { - pStateSetHelper->AddState( AccessibleStateType::CHECKED ); - } + pStateSetHelper->AddState( AccessibleStateType::SELECTED ); + } + if (mrParentWindow.GetBitmapPixel(sal_uInt16(mnIndexInParent))) + { + pStateSetHelper->AddState( AccessibleStateType::CHECKED ); } } else @@ -881,7 +878,7 @@ Rectangle SvxPixelCtlAccessibleChild::GetBoundingBoxOnScreen( void ) throw( Runt // no ThrowExceptionIfNotAlive() because its done in GetBoundingBox() Rectangle aRect( GetBoundingBox() ); - return Rectangle( mrParentWindow->OutputToAbsoluteScreenPixel( aRect.TopLeft() ), aRect.GetSize() ); + return Rectangle( mrParentWindow.OutputToAbsoluteScreenPixel( aRect.TopLeft() ), aRect.GetSize() ); } Rectangle SvxPixelCtlAccessibleChild::GetBoundingBox( void ) throw( RuntimeException ) @@ -894,8 +891,8 @@ Rectangle SvxPixelCtlAccessibleChild::GetBoundingBox( void ) throw( RuntimeExcep OUString SvxPixelCtlAccessibleChild::GetName() { - sal_Int32 nXIndex = mnIndexInParent % mrParentWindow->GetLineCount(); - sal_Int32 nYIndex = mnIndexInParent / mrParentWindow->GetLineCount(); + sal_Int32 nXIndex = mnIndexInParent % mrParentWindow.GetLineCount(); + sal_Int32 nYIndex = mnIndexInParent / mrParentWindow.GetLineCount(); OUString str; str += "("; diff --git a/svx/source/inc/svxpixelctlaccessiblecontext.hxx b/svx/source/inc/svxpixelctlaccessiblecontext.hxx index 05e80a1ec651..2c887b73fb54 100644 --- a/svx/source/inc/svxpixelctlaccessiblecontext.hxx +++ b/svx/source/inc/svxpixelctlaccessiblecontext.hxx @@ -67,7 +67,7 @@ class SvxPixelCtlAccessibleChild : public ::comphelper::OBaseMutex, public SvxPixelCtlAccessibleChild_BASE { - SvxPixelCtl* mrParentWindow; + SvxPixelCtl& mrParentWindow; ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent; void IsValid() throw (::com::sun::star::uno::RuntimeException); sal_Bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color @@ -79,7 +79,7 @@ class SvxPixelCtlAccessibleChild : ::osl::Mutex m_aMutex; public: SvxPixelCtlAccessibleChild( - SvxPixelCtl* rWindow, + SvxPixelCtl& rWindow, sal_Bool bPixelColorOrBG, const Point& aPoint, const Rectangle& rBounds, |