diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-23 10:55:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-23 10:56:06 +0200 |
commit | abc42b3ea4e79581f4567420f2ed4320f5f2eb9e (patch) | |
tree | e45f9e7f9e4f368015aa47f4e7056aa9319582ab | |
parent | 116fa3a3d2e0b9652b3848bb49a5c1c2ecc570ae (diff) |
use rtl::Reference in SvxPixelCtl
instead of storing both a raw pointer and an uno::Reference
Change-Id: Ie9de5664452545a2a529f753e314aa4678c166fb
-rw-r--r-- | include/svx/dlgctrl.hxx | 5 | ||||
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 21 |
2 files changed, 13 insertions, 13 deletions
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 07e61f525674..33b525029f87 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -25,6 +25,7 @@ #include <svx/rectenum.hxx> #include <vcl/graph.hxx> #include <svx/xtable.hxx> +#include <rtl/ref.hxx> #include <o3tl/typed_flags_set.hxx> class XOBitmap; @@ -159,6 +160,8 @@ protected: bool bPaintable; //Add member identifying position Point aFocusPosition; + rtl::Reference<SvxPixelCtlAccessible> m_xAccess; + Rectangle implCalFocusRect( const Point& aPosition ); void ChangePixel( sal_uInt16 nPixel ); @@ -185,8 +188,6 @@ public: void SetPaintable( bool bTmp ) { bPaintable = bTmp; } void Reset(); - SvxPixelCtlAccessible* m_pAccess; - css::uno::Reference< css::accessibility::XAccessible > m_xAccess; virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; long GetSquares() const { return nSquares ; } long GetWidth() const { return aRectSize.getWidth() ; } diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 2fafd853b05f..42bde26b4155 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -743,9 +743,9 @@ css::uno::Reference< css::accessibility::XAccessible > SvxPixelCtl::CreateAccess { if(!m_xAccess.is()) { - m_xAccess = m_pAccess = new SvxPixelCtlAccessible(*this); + m_xAccess = new SvxPixelCtlAccessible(*this); } - return m_xAccess; + return m_xAccess.get(); } //Logic Pixel @@ -813,7 +813,6 @@ SvxPixelCtl::SvxPixelCtl(vcl::Window* pParent, sal_uInt16 nNumber) nSquares = nLines * nLines; pPixel = new sal_uInt16[ nSquares ]; memset(pPixel, 0, nSquares * sizeof(sal_uInt16)); - m_pAccess=nullptr; } void SvxPixelCtl::Resize() @@ -865,9 +864,9 @@ void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt ) long nIndex = ShowPosition(rMEvt.GetPosPixel()); - if(m_pAccess) + if(m_xAccess.is()) { - m_pAccess->NotifyChild(nIndex,true, true); + m_xAccess->NotifyChild(nIndex,true, true); } } @@ -1015,11 +1014,11 @@ void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) case KEY_DOWN: if (bFocusPosChanged) { - m_pAccess->NotifyChild(nIndex,false,false); + m_xAccess->NotifyChild(nIndex,false,false); } break; case KEY_SPACE: - m_pAccess->NotifyChild(nIndex,false,true); + m_xAccess->NotifyChild(nIndex,false,true); break; default: break; @@ -1037,9 +1036,9 @@ void SvxPixelCtl::GetFocus() { Invalidate(implCalFocusRect(aFocusPosition)); - if(m_pAccess) + if(m_xAccess.is()) { - m_pAccess->NotifyChild(GetFocusPosIndex(),true,false); + m_xAccess->NotifyChild(GetFocusPosIndex(),true,false); } Control::GetFocus(); @@ -1049,9 +1048,9 @@ void SvxPixelCtl::GetFocus() void SvxPixelCtl::LoseFocus() { HideFocus(); - if (m_pAccess) + if (m_xAccess.is()) { - m_pAccess->LoseFocus(); + m_xAccess->LoseFocus(); } Control::LoseFocus(); } |