Kaydet (Commit) cc755674 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Return rtl::Reference from ShapeTypeHandler::CreateAccessibleObject

...and handle related fallout

Change-Id: Ie82d853a9bf28b359d5aab9d0af01b728d68ed70
üst c30defcf
...@@ -39,7 +39,6 @@ AccessibleChartShape::AccessibleChartShape( ...@@ -39,7 +39,6 @@ AccessibleChartShape::AccessibleChartShape(
const AccessibleElementInfo& rAccInfo, const AccessibleElementInfo& rAccInfo,
bool bMayHaveChildren, bool bAlwaysTransparent ) bool bMayHaveChildren, bool bAlwaysTransparent )
:impl::AccessibleChartShape_Base( rAccInfo, bMayHaveChildren, bAlwaysTransparent ) :impl::AccessibleChartShape_Base( rAccInfo, bMayHaveChildren, bAlwaysTransparent )
,m_pAccShape( NULL )
{ {
if ( rAccInfo.m_aOID.isAdditionalShape() ) if ( rAccInfo.m_aOID.isAdditionalShape() )
{ {
...@@ -63,9 +62,8 @@ AccessibleChartShape::AccessibleChartShape( ...@@ -63,9 +62,8 @@ AccessibleChartShape::AccessibleChartShape(
::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance(); ::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance();
m_pAccShape = rShapeHandler.CreateAccessibleObject( aShapeInfo, m_aShapeTreeInfo ); m_pAccShape = rShapeHandler.CreateAccessibleObject( aShapeInfo, m_aShapeTreeInfo );
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
m_pAccShape->acquire();
m_pAccShape->Init(); m_pAccShape->Init();
} }
} }
...@@ -75,10 +73,9 @@ AccessibleChartShape::~AccessibleChartShape() ...@@ -75,10 +73,9 @@ AccessibleChartShape::~AccessibleChartShape()
{ {
OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) ); OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) );
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
m_pAccShape->dispose(); m_pAccShape->dispose();
m_pAccShape->release();
} }
} }
...@@ -94,7 +91,7 @@ sal_Int32 AccessibleChartShape::getAccessibleChildCount() ...@@ -94,7 +91,7 @@ sal_Int32 AccessibleChartShape::getAccessibleChildCount()
throw (RuntimeException, std::exception) throw (RuntimeException, std::exception)
{ {
sal_Int32 nCount(0); sal_Int32 nCount(0);
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
nCount = m_pAccShape->getAccessibleChildCount(); nCount = m_pAccShape->getAccessibleChildCount();
} }
...@@ -105,7 +102,7 @@ Reference< XAccessible > AccessibleChartShape::getAccessibleChild( sal_Int32 i ) ...@@ -105,7 +102,7 @@ Reference< XAccessible > AccessibleChartShape::getAccessibleChild( sal_Int32 i )
throw (lang::IndexOutOfBoundsException, RuntimeException, std::exception) throw (lang::IndexOutOfBoundsException, RuntimeException, std::exception)
{ {
Reference< XAccessible > xChild; Reference< XAccessible > xChild;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
xChild = m_pAccShape->getAccessibleChild( i ); xChild = m_pAccShape->getAccessibleChild( i );
} }
...@@ -116,7 +113,7 @@ sal_Int16 AccessibleChartShape::getAccessibleRole() ...@@ -116,7 +113,7 @@ sal_Int16 AccessibleChartShape::getAccessibleRole()
throw (RuntimeException, std::exception) throw (RuntimeException, std::exception)
{ {
sal_Int16 nRole(0); sal_Int16 nRole(0);
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
nRole = m_pAccShape->getAccessibleRole(); nRole = m_pAccShape->getAccessibleRole();
} }
...@@ -127,7 +124,7 @@ OUString AccessibleChartShape::getAccessibleDescription() ...@@ -127,7 +124,7 @@ OUString AccessibleChartShape::getAccessibleDescription()
throw (::com::sun::star::uno::RuntimeException, std::exception) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
OUString aDescription; OUString aDescription;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
aDescription = m_pAccShape->getAccessibleDescription(); aDescription = m_pAccShape->getAccessibleDescription();
} }
...@@ -138,7 +135,7 @@ OUString AccessibleChartShape::getAccessibleName() ...@@ -138,7 +135,7 @@ OUString AccessibleChartShape::getAccessibleName()
throw (::com::sun::star::uno::RuntimeException, std::exception) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
OUString aName; OUString aName;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
aName = m_pAccShape->getAccessibleName(); aName = m_pAccShape->getAccessibleName();
} }
...@@ -150,7 +147,7 @@ sal_Bool AccessibleChartShape::containsPoint( const awt::Point& aPoint ) ...@@ -150,7 +147,7 @@ sal_Bool AccessibleChartShape::containsPoint( const awt::Point& aPoint )
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
bool bReturn = false; bool bReturn = false;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
bReturn = m_pAccShape->containsPoint( aPoint ); bReturn = m_pAccShape->containsPoint( aPoint );
} }
...@@ -161,7 +158,7 @@ Reference< XAccessible > AccessibleChartShape::getAccessibleAtPoint( const awt:: ...@@ -161,7 +158,7 @@ Reference< XAccessible > AccessibleChartShape::getAccessibleAtPoint( const awt::
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
Reference< XAccessible > xResult; Reference< XAccessible > xResult;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
xResult.set( m_pAccShape->getAccessibleAtPoint( aPoint ) ); xResult.set( m_pAccShape->getAccessibleAtPoint( aPoint ) );
} }
...@@ -172,7 +169,7 @@ awt::Rectangle AccessibleChartShape::getBounds() ...@@ -172,7 +169,7 @@ awt::Rectangle AccessibleChartShape::getBounds()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
awt::Rectangle aBounds; awt::Rectangle aBounds;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
aBounds = m_pAccShape->getBounds(); aBounds = m_pAccShape->getBounds();
} }
...@@ -183,7 +180,7 @@ awt::Point AccessibleChartShape::getLocation() ...@@ -183,7 +180,7 @@ awt::Point AccessibleChartShape::getLocation()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
awt::Point aLocation; awt::Point aLocation;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
aLocation = m_pAccShape->getLocation(); aLocation = m_pAccShape->getLocation();
} }
...@@ -194,7 +191,7 @@ awt::Point AccessibleChartShape::getLocationOnScreen() ...@@ -194,7 +191,7 @@ awt::Point AccessibleChartShape::getLocationOnScreen()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
awt::Point aLocation; awt::Point aLocation;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
aLocation = m_pAccShape->getLocationOnScreen(); aLocation = m_pAccShape->getLocationOnScreen();
} }
...@@ -205,7 +202,7 @@ awt::Size AccessibleChartShape::getSize() ...@@ -205,7 +202,7 @@ awt::Size AccessibleChartShape::getSize()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
awt::Size aSize; awt::Size aSize;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
aSize = m_pAccShape->getSize(); aSize = m_pAccShape->getSize();
} }
...@@ -222,7 +219,7 @@ sal_Int32 AccessibleChartShape::getForeground() ...@@ -222,7 +219,7 @@ sal_Int32 AccessibleChartShape::getForeground()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
sal_Int32 nColor(0); sal_Int32 nColor(0);
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
nColor = m_pAccShape->getForeground(); nColor = m_pAccShape->getForeground();
} }
...@@ -233,7 +230,7 @@ sal_Int32 AccessibleChartShape::getBackground() ...@@ -233,7 +230,7 @@ sal_Int32 AccessibleChartShape::getBackground()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
sal_Int32 nColor(0); sal_Int32 nColor(0);
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
nColor = m_pAccShape->getBackground(); nColor = m_pAccShape->getBackground();
} }
...@@ -245,7 +242,7 @@ Reference< awt::XFont > AccessibleChartShape::getFont() ...@@ -245,7 +242,7 @@ Reference< awt::XFont > AccessibleChartShape::getFont()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
Reference< awt::XFont > xFont; Reference< awt::XFont > xFont;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
xFont.set( m_pAccShape->getFont() ); xFont.set( m_pAccShape->getFont() );
} }
...@@ -256,7 +253,7 @@ OUString AccessibleChartShape::getTitledBorderText() ...@@ -256,7 +253,7 @@ OUString AccessibleChartShape::getTitledBorderText()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
OUString aText; OUString aText;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
aText = m_pAccShape->getTitledBorderText(); aText = m_pAccShape->getTitledBorderText();
} }
...@@ -267,7 +264,7 @@ OUString AccessibleChartShape::getToolTipText() ...@@ -267,7 +264,7 @@ OUString AccessibleChartShape::getToolTipText()
throw (::com::sun::star::uno::RuntimeException, std::exception) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
OUString aText; OUString aText;
if ( m_pAccShape ) if ( m_pAccShape.is() )
{ {
aText = m_pAccShape->getToolTipText(); aText = m_pAccShape->getToolTipText();
} }
......
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
private: private:
::accessibility::AccessibleShape* m_pAccShape; rtl::Reference<accessibility::AccessibleShape> m_pAccShape;
::accessibility::AccessibleShapeTreeInfo m_aShapeTreeInfo; ::accessibility::AccessibleShapeTreeInfo m_aShapeTreeInfo;
}; };
......
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
<code>XAccessible</code> interface. This pointer may be NULL <code>XAccessible</code> interface. This pointer may be NULL
if the specified shape is of unknown type. if the specified shape is of unknown type.
*/ */
AccessibleShape* rtl::Reference<AccessibleShape>
CreateAccessibleObject ( CreateAccessibleObject (
const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeInfo& rShapeInfo,
const AccessibleShapeTreeInfo& rShapeTreeInfo) const; const AccessibleShapeTreeInfo& rShapeTreeInfo) const;
......
...@@ -566,13 +566,12 @@ Size ScIAccessibleViewForwarder::LogicToPixel (const Size& rSize) const ...@@ -566,13 +566,12 @@ Size ScIAccessibleViewForwarder::LogicToPixel (const Size& rSize) const
struct ScShapeChild struct ScShapeChild
{ {
ScShapeChild() ScShapeChild()
: mpAccShape(NULL) : mnRangeId(0)
, mnRangeId(0)
{ {
} }
ScShapeChild(const ScShapeChild& rOld); ScShapeChild(const ScShapeChild& rOld);
~ScShapeChild(); ~ScShapeChild();
mutable ::accessibility::AccessibleShape* mpAccShape; mutable rtl::Reference< ::accessibility::AccessibleShape > mpAccShape;
com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape; com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
sal_Int32 mnRangeId; sal_Int32 mnRangeId;
}; };
...@@ -582,17 +581,13 @@ ScShapeChild::ScShapeChild(const ScShapeChild& rOld) ...@@ -582,17 +581,13 @@ ScShapeChild::ScShapeChild(const ScShapeChild& rOld)
mpAccShape(rOld.mpAccShape), mpAccShape(rOld.mpAccShape),
mxShape(rOld.mxShape), mxShape(rOld.mxShape),
mnRangeId(rOld.mnRangeId) mnRangeId(rOld.mnRangeId)
{ {}
if (mpAccShape)
mpAccShape->acquire();
}
ScShapeChild::~ScShapeChild() ScShapeChild::~ScShapeChild()
{ {
if (mpAccShape) if (mpAccShape.is())
{ {
mpAccShape->dispose(); mpAccShape->dispose();
mpAccShape->release();
} }
} }
...@@ -816,7 +811,7 @@ namespace ...@@ -816,7 +811,7 @@ namespace
ScVisAreaChanged(const ScIAccessibleViewForwarder* pViewForwarder) : mpViewForwarder(pViewForwarder) {} ScVisAreaChanged(const ScIAccessibleViewForwarder* pViewForwarder) : mpViewForwarder(pViewForwarder) {}
void operator() (const ScShapeChild& rAccShapeData) const void operator() (const ScShapeChild& rAccShapeData) const
{ {
if (rAccShapeData.mpAccShape) if (rAccShapeData.mpAccShape.is())
{ {
rAccShapeData.mpAccShape->ViewForwarderChanged(::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA, mpViewForwarder); rAccShapeData.mpAccShape->ViewForwarderChanged(::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA, mpViewForwarder);
} }
...@@ -1015,7 +1010,7 @@ uno::Reference<XAccessible> ScShapeChildren::GetBackgroundShapeAt(const awt::Poi ...@@ -1015,7 +1010,7 @@ uno::Reference<XAccessible> ScShapeChildren::GetBackgroundShapeAt(const awt::Poi
::accessibility::AccessibleShape* ScShapeChildren::GetAccShape(const ScShapeChild& rShape) const ::accessibility::AccessibleShape* ScShapeChildren::GetAccShape(const ScShapeChild& rShape) const
{ {
if (!rShape.mpAccShape) if (!rShape.mpAccShape.is())
{ {
::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance(); ::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance();
::accessibility::AccessibleShapeInfo aShapeInfo(rShape.mxShape, mpAccDoc, const_cast<ScShapeChildren*>(this)); ::accessibility::AccessibleShapeInfo aShapeInfo(rShape.mxShape, mpAccDoc, const_cast<ScShapeChildren*>(this));
...@@ -1028,14 +1023,13 @@ uno::Reference<XAccessible> ScShapeChildren::GetBackgroundShapeAt(const awt::Poi ...@@ -1028,14 +1023,13 @@ uno::Reference<XAccessible> ScShapeChildren::GetBackgroundShapeAt(const awt::Poi
aShapeTreeInfo.SetWindow(mpViewShell->GetWindow()); aShapeTreeInfo.SetWindow(mpViewShell->GetWindow());
aShapeTreeInfo.SetViewForwarder(&(maShapeRanges[rShape.mnRangeId].maViewForwarder)); aShapeTreeInfo.SetViewForwarder(&(maShapeRanges[rShape.mnRangeId].maViewForwarder));
rShape.mpAccShape = rShapeHandler.CreateAccessibleObject(aShapeInfo, aShapeTreeInfo); rShape.mpAccShape = rShapeHandler.CreateAccessibleObject(aShapeInfo, aShapeTreeInfo);
if (rShape.mpAccShape) if (rShape.mpAccShape.is())
{ {
rShape.mpAccShape->acquire();
rShape.mpAccShape->Init(); rShape.mpAccShape->Init();
} }
} }
} }
return rShape.mpAccShape; return rShape.mpAccShape.get();
} }
::accessibility::AccessibleShape* ScShapeChildren::GetAccShape(const ScShapeChildVec& rShapes, sal_Int32 nIndex) const ::accessibility::AccessibleShape* ScShapeChildren::GetAccShape(const ScShapeChildVec& rShapes, sal_Int32 nIndex) const
......
...@@ -168,16 +168,14 @@ uno::Reference<XAccessible> ...@@ -168,16 +168,14 @@ uno::Reference<XAccessible>
mnNewNameIndex++); mnNewNameIndex++);
// Create accessible object that corresponds to the descriptor's // Create accessible object that corresponds to the descriptor's
// shape. // shape.
AccessibleShape* pShape = rtl::Reference<AccessibleShape> pShape(
ShapeTypeHandler::Instance().CreateAccessibleObject ( ShapeTypeHandler::Instance().CreateAccessibleObject (
aShapeInfo, aShapeInfo,
maShapeTreeInfo); maShapeTreeInfo));
rChildDescriptor.mxAccessibleShape = uno::Reference<XAccessible> ( rChildDescriptor.mxAccessibleShape = uno::Reference<XAccessible> (
static_cast<uno::XWeak*>(pShape), static_cast<uno::XWeak*>(pShape.get()),
uno::UNO_QUERY); uno::UNO_QUERY);
// Now that there is a reference to the new accessible shape we if ( pShape.is() )
// can safely call its Init() method.
if ( pShape != NULL )
{ {
pShape->Init(); pShape->Init();
pShape->setIndexInParent(_nIndex); pShape->setIndexInParent(_nIndex);
...@@ -802,12 +800,11 @@ bool ChildrenManagerImpl::ReplaceChild ( ...@@ -802,12 +800,11 @@ bool ChildrenManagerImpl::ReplaceChild (
{ {
AccessibleShapeInfo aShapeInfo( _rxShape, pCurrentChild->getAccessibleParent(), this, _nIndex ); AccessibleShapeInfo aShapeInfo( _rxShape, pCurrentChild->getAccessibleParent(), this, _nIndex );
// create the new child // create the new child
AccessibleShape* pNewChild = ShapeTypeHandler::Instance().CreateAccessibleObject ( rtl::Reference<AccessibleShape> pNewChild(ShapeTypeHandler::Instance().CreateAccessibleObject (
aShapeInfo, aShapeInfo,
_rShapeTreeInfo _rShapeTreeInfo
); ));
Reference< XAccessible > xNewChild( pNewChild ); // keep this alive (do this before calling Init!) if ( pNewChild.is() )
if ( pNewChild )
pNewChild->Init(); pNewChild->Init();
bool bResult = false; bool bResult = false;
...@@ -831,7 +828,7 @@ bool ChildrenManagerImpl::ReplaceChild ( ...@@ -831,7 +828,7 @@ bool ChildrenManagerImpl::ReplaceChild (
// Replace with replacement and send an event about existence // Replace with replacement and send an event about existence
// of the new child. // of the new child.
I->mxAccessibleShape = pNewChild; I->mxAccessibleShape = pNewChild.get();
mrContext.CommitChange ( mrContext.CommitChange (
AccessibleEventId::CHILD, AccessibleEventId::CHILD,
uno::makeAny (I->mxAccessibleShape), uno::makeAny (I->mxAccessibleShape),
......
...@@ -145,7 +145,7 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessible( ...@@ -145,7 +145,7 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessible(
if( iter != mxShapes.end() ) if( iter != mxShapes.end() )
{ {
// if we already have one, return it // if we already have one, return it
xAccessibleShape = (*iter).second; xAccessibleShape = (*iter).second.get();
} }
else else
{ {
...@@ -154,14 +154,11 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessible( ...@@ -154,14 +154,11 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessible(
AccessibleShapeInfo aShapeInfo (xShape,mxParent); AccessibleShapeInfo aShapeInfo (xShape,mxParent);
// Create accessible object that corresponds to the descriptor's shape. // Create accessible object that corresponds to the descriptor's shape.
AccessibleShape* pAcc = ShapeTypeHandler::Instance().CreateAccessibleObject( rtl::Reference<AccessibleShape> pAcc(ShapeTypeHandler::Instance().CreateAccessibleObject(
aShapeInfo, maTreeInfo); aShapeInfo, maTreeInfo));
xAccessibleShape = pAcc; xAccessibleShape = pAcc.get();
if (pAcc != NULL) if (pAcc.is())
{ {
pAcc->acquire();
// Now that we acquired the new accessible shape we can
// safely call its Init() method.
pAcc->Init (); pAcc->Init ();
} }
mxShapes[pObj] = pAcc; mxShapes[pObj] = pAcc;
...@@ -704,12 +701,10 @@ void SAL_CALL SvxGraphCtrlAccessibleContext::disposing() ...@@ -704,12 +701,10 @@ void SAL_CALL SvxGraphCtrlAccessibleContext::disposing()
for (I=mxShapes.begin(); I!=mxShapes.end(); ++I) for (I=mxShapes.begin(); I!=mxShapes.end(); ++I)
{ {
XAccessible* pAcc = (*I).second; rtl::Reference<XAccessible> pAcc((*I).second.get());
Reference< XComponent > xComp( pAcc, UNO_QUERY ); Reference< XComponent > xComp( pAcc.get(), UNO_QUERY );
if( xComp.is() ) if( xComp.is() )
xComp->dispose(); xComp->dispose();
(*I).second->release();
} }
mxShapes.clear(); mxShapes.clear();
...@@ -782,9 +777,9 @@ void SvxGraphCtrlAccessibleContext::Notify( SfxBroadcaster& /*rBC*/, const SfxHi ...@@ -782,9 +777,9 @@ void SvxGraphCtrlAccessibleContext::Notify( SfxBroadcaster& /*rBC*/, const SfxHi
if( iter != mxShapes.end() ) if( iter != mxShapes.end() )
{ {
// if we already have one, return it // if we already have one, return it
AccessibleShape* pShape = (*iter).second; rtl::Reference<AccessibleShape> pShape((*iter).second);
if( NULL != pShape ) if( pShape.is() )
pShape->CommitChange( AccessibleEventId::VISIBLE_DATA_CHANGED, uno::Any(), uno::Any() ); pShape->CommitChange( AccessibleEventId::VISIBLE_DATA_CHANGED, uno::Any(), uno::Any() );
} }
} }
......
...@@ -113,17 +113,17 @@ ShapeTypeId ShapeTypeHandler::GetTypeId (const uno::Reference<drawing::XShape>& ...@@ -113,17 +113,17 @@ ShapeTypeId ShapeTypeHandler::GetTypeId (const uno::Reference<drawing::XShape>&
given shape, then calls the descriptor's create function, and finally given shape, then calls the descriptor's create function, and finally
initializes the new object. initializes the new object.
*/ */
AccessibleShape* rtl::Reference<AccessibleShape>
ShapeTypeHandler::CreateAccessibleObject ( ShapeTypeHandler::CreateAccessibleObject (
const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeInfo& rShapeInfo,
const AccessibleShapeTreeInfo& rShapeTreeInfo) const const AccessibleShapeTreeInfo& rShapeTreeInfo) const
{ {
ShapeTypeId nSlotId (GetSlotId (rShapeInfo.mxShape)); ShapeTypeId nSlotId (GetSlotId (rShapeInfo.mxShape));
AccessibleShape* pShape = rtl::Reference<AccessibleShape> pShape(
maShapeTypeDescriptorList[nSlotId].maCreateFunction ( maShapeTypeDescriptorList[nSlotId].maCreateFunction (
rShapeInfo, rShapeInfo,
rShapeTreeInfo, rShapeTreeInfo,
maShapeTypeDescriptorList[nSlotId].mnShapeTypeId); maShapeTypeDescriptorList[nSlotId].mnShapeTypeId));
return pShape; return pShape;
} }
......
...@@ -219,7 +219,7 @@ private: ...@@ -219,7 +219,7 @@ private:
return p1 < p2; return p1 < p2;
} }
}; };
typedef ::std::map< const SdrObject*, ::accessibility::AccessibleShape*, SdrObjectCompareLess > ShapesMapType; typedef ::std::map< const SdrObject*, rtl::Reference<accessibility::AccessibleShape>, SdrObjectCompareLess > ShapesMapType;
ShapesMapType mxShapes; ShapesMapType mxShapes;
VclPtr<GraphCtrl> mpControl; VclPtr<GraphCtrl> mpControl;
......
...@@ -2028,7 +2028,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( ...@@ -2028,7 +2028,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext(
if( !xAcc.is() && bCreate ) if( !xAcc.is() && bCreate )
{ {
::accessibility::AccessibleShape *pAcc = nullptr; rtl::Reference< ::accessibility::AccessibleShape> pAcc;
uno::Reference < drawing::XShape > xShape( uno::Reference < drawing::XShape > xShape(
const_cast< SdrObject * >( pObj )->getUnoShape(), const_cast< SdrObject * >( pObj )->getUnoShape(),
uno::UNO_QUERY ); uno::UNO_QUERY );
...@@ -2043,7 +2043,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( ...@@ -2043,7 +2043,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext(
pAcc = rShapeTypeHandler.CreateAccessibleObject( pAcc = rShapeTypeHandler.CreateAccessibleObject(
aShapeInfo, mpShapeMap->GetInfo() ); aShapeInfo, mpShapeMap->GetInfo() );
} }
xAcc = pAcc; xAcc = pAcc.get();
OSL_ENSURE( xAcc.is(), "unknown shape type" ); OSL_ENSURE( xAcc.is(), "unknown shape type" );
if( xAcc.is() ) if( xAcc.is() )
...@@ -3204,11 +3204,11 @@ bool SwAccessibleMap::ReplaceChild ( ...@@ -3204,11 +3204,11 @@ bool SwAccessibleMap::ReplaceChild (
::accessibility::ShapeTypeHandler::Instance(); ::accessibility::ShapeTypeHandler::Instance();
::accessibility::AccessibleShapeInfo aShapeInfo( ::accessibility::AccessibleShapeInfo aShapeInfo(
xShape, xParent, this ); xShape, xParent, this );
::accessibility::AccessibleShape* pReplacement = rtl::Reference< ::accessibility::AccessibleShape> pReplacement(
rShapeTypeHandler.CreateAccessibleObject ( rShapeTypeHandler.CreateAccessibleObject (
aShapeInfo, mpShapeMap->GetInfo() ); aShapeInfo, mpShapeMap->GetInfo() ));
uno::Reference < XAccessible > xAcc( pReplacement ); uno::Reference < XAccessible > xAcc( pReplacement.get() );
if( xAcc.is() ) if( xAcc.is() )
{ {
pReplacement->Init(); pReplacement->Init();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment