include/svx/charmap.hxx | 4 ++-- include/svx/dlgctrl.hxx | 5 +++-- svx/source/dialog/charmap.cxx | 27 ++++++++++++--------------- svx/source/dialog/dlgctrl.cxx | 21 ++++++++++----------- svx/source/form/fmscriptingenv.cxx | 10 ++++------ 5 files changed, 31 insertions(+), 36 deletions(-)
New commits: commit abc42b3ea4e79581f4567420f2ed4320f5f2eb9e Author: Noel Grandin <[email protected]> Date: Mon Jan 23 10:55:33 2017 +0200 use rtl::Reference in SvxPixelCtl instead of storing both a raw pointer and an uno::Reference Change-Id: Ie9de5664452545a2a529f753e314aa4678c166fb diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 07e61f5..33b5250 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 2fafd85..42bde26 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(); } commit 116fa3a3d2e0b9652b3848bb49a5c1c2ecc570ae Author: Noel Grandin <[email protected]> Date: Mon Jan 23 10:54:47 2017 +0200 use rtl::Reference in SvxShowCharSet instead of storing both a raw pointer and an uno::Reference Change-Id: I71c9cc4cc643d4b73a34b74c803378da75fd8de0 diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx index 011c2ec..eb1fd88 100644 --- a/include/svx/charmap.hxx +++ b/include/svx/charmap.hxx @@ -25,6 +25,7 @@ #include <vcl/vclptr.hxx> #include <map> #include <memory> +#include <rtl/ref.hxx> #include <svx/svxdllapi.h> #define COLUMN_COUNT 16 @@ -97,8 +98,7 @@ private: Link<SvxShowCharSet*,void> aSelectHdl; Link<SvxShowCharSet*,void> aHighHdl; Link<SvxShowCharSet*,void> aPreSelectHdl; - svx::SvxShowCharSetVirtualAcc* m_pAccessible; - css::uno::Reference<css::accessibility::XAccessible> m_xAccessible; + rtl::Reference<svx::SvxShowCharSetVirtualAcc> m_xAccessible; long nX; long nY; long m_nXGap; diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index ff89241..462a11f 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -57,7 +57,6 @@ sal_uInt32& SvxShowCharSet::getSelectedChar() SvxShowCharSet::SvxShowCharSet(vcl::Window* pParent) : Control(pParent, WB_TABSTOP | WB_BORDER) - , m_pAccessible(nullptr) , maFontSize(0, 0) , aVscrollSB( VclPtr<ScrollBar>::Create(this, WB_VERT) ) , mbRecalculateFont(true) @@ -624,14 +623,14 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus ) if( nSelectedIndex >= 0 ) { getSelectedChar() = mxFontCharMap->GetCharFromIndex( nSelectedIndex ); - if( m_pAccessible ) + if( m_xAccessible.is() ) { svx::SvxShowCharSetItem* pItem = ImplGetItem(nSelectedIndex); // Don't fire the focus event. if ( bFocus ) - m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call assures that m_pItem is set + m_xAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call assures that m_pItem is set else - m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS, Any(), makeAny(pItem->GetAccessible()) ); // this call assures that m_pItem is set + m_xAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS, Any(), makeAny(pItem->GetAccessible()) ); // this call assures that m_pItem is set assert(pItem->m_pItem && "No accessible created!"); Any aOldAny, aNewAny; @@ -680,14 +679,14 @@ IMPL_LINK_NOARG(SvxShowCharSet, VscrollHdl, ScrollBar*, void) } else if( nSelectedIndex > LastInView() ) { - if( m_pAccessible ) + if( m_xAccessible.is() ) { css::uno::Any aOldAny, aNewAny; int nLast = LastInView(); for ( ; nLast != nSelectedIndex; ++nLast) { aOldAny <<= ImplGetItem(nLast)->GetAccessible(); - m_pAccessible ->fireEvent( AccessibleEventId::CHILD, aOldAny, aNewAny ); + m_xAccessible ->fireEvent( AccessibleEventId::CHILD, aOldAny, aNewAny ); } } SelectIndex( (LastInView() - COLUMN_COUNT + 1) + (nSelectedIndex % COLUMN_COUNT) ); @@ -704,7 +703,7 @@ SvxShowCharSet::~SvxShowCharSet() void SvxShowCharSet::dispose() { - if ( m_pAccessible ) + if ( m_xAccessible.is() ) ReleaseAccessible(); aVscrollSB.disposeAndClear(); Control::dispose(); @@ -713,16 +712,14 @@ void SvxShowCharSet::dispose() void SvxShowCharSet::ReleaseAccessible() { m_aItems.clear(); - m_pAccessible = nullptr; - m_xAccessible = nullptr; + m_xAccessible.clear(); } css::uno::Reference< XAccessible > SvxShowCharSet::CreateAccessible() { - OSL_ENSURE(!m_pAccessible,"Accessible already created!"); - m_pAccessible = new svx::SvxShowCharSetVirtualAcc(this); - m_xAccessible = m_pAccessible; - return m_xAccessible; + OSL_ENSURE(!m_xAccessible.is(),"Accessible already created!"); + m_xAccessible = new svx::SvxShowCharSetVirtualAcc(this); + return m_xAccessible.get(); } svx::SvxShowCharSetItem* SvxShowCharSet::ImplGetItem( int _nPos ) @@ -730,9 +727,9 @@ svx::SvxShowCharSetItem* SvxShowCharSet::ImplGetItem( int _nPos ) ItemsMap::iterator aFind = m_aItems.find(_nPos); if ( aFind == m_aItems.end() ) { - OSL_ENSURE(m_pAccessible,"Who wants to create a child of my table without a parent?"); + OSL_ENSURE(m_xAccessible.is(), "Who wants to create a child of my table without a parent?"); std::shared_ptr<svx::SvxShowCharSetItem> xItem(new svx::SvxShowCharSetItem(*this, - m_pAccessible->getTable(), sal::static_int_cast< sal_uInt16 >(_nPos))); + m_xAccessible->getTable(), sal::static_int_cast< sal_uInt16 >(_nPos))); aFind = m_aItems.insert(ItemsMap::value_type(_nPos, xItem)).first; OUStringBuffer buf; buf.appendUtf32( mxFontCharMap->GetCharFromIndex( _nPos ) ); commit 5794beabf0a2d92b0ddd2e19291531a296438364 Author: Noel Grandin <[email protected]> Date: Mon Jan 23 09:51:46 2017 +0200 use rtl::Reference in QuitGuard instead of storing both a raw pointer and an uno::Reference Change-Id: Ib70bf9508210b2a58dd65437c6cbe8f4f5b343fc diff --git a/svx/source/form/fmscriptingenv.cxx b/svx/source/form/fmscriptingenv.cxx index e6a8417..9f12a2a 100644 --- a/svx/source/form/fmscriptingenv.cxx +++ b/svx/source/form/fmscriptingenv.cxx @@ -859,19 +859,17 @@ namespace svxform } }; - TerminateListener* mpListener; - css::uno::Reference<css::frame::XTerminateListener> mxLifeCycle; + rtl::Reference<TerminateListener> mxListener; public: QuitGuard() - : mpListener(new TerminateListener) - , mxLifeCycle(mpListener) + : mxListener(new TerminateListener) { - mpListener->start(); + mxListener->start(); } ~QuitGuard() { - mpListener->stop(); + mxListener->stop(); } }; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
