summaryrefslogtreecommitdiff
path: root/svx/source/dialog/charmap.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-23 10:54:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-23 10:56:06 +0200
commit116fa3a3d2e0b9652b3848bb49a5c1c2ecc570ae (patch)
tree932c4e62df43b8eeb577a9496809d4fe0d371ea2 /svx/source/dialog/charmap.cxx
parent5794beabf0a2d92b0ddd2e19291531a296438364 (diff)
use rtl::Reference in SvxShowCharSet
instead of storing both a raw pointer and an uno::Reference Change-Id: I71c9cc4cc643d4b73a34b74c803378da75fd8de0
Diffstat (limited to 'svx/source/dialog/charmap.cxx')
-rw-r--r--svx/source/dialog/charmap.cxx27
1 files changed, 12 insertions, 15 deletions
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index ff89241e814b..462a11f81c03 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 ) );