Skip to content

Commit

Permalink
#95585# Moved code from dispose to disposing().
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Fischer committed Apr 30, 2002
1 parent a3a39d1 commit f11b151
Showing 1 changed file with 72 additions and 51 deletions.
123 changes: 72 additions & 51 deletions svx/source/accessibility/AccessibleShape.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
*
* $RCSfile: AccessibleShape.cxx,v $
*
* $Revision: 1.13 $
* $Revision: 1.14 $
*
* last change: $Author: thb $ $Date: 2002-04-26 10:25:00 $
* last change: $Author: af $ $Date: 2002-04-30 14:30:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
Expand Down Expand Up @@ -222,37 +222,30 @@ sal_Int32 SAL_CALL
an exception for a wrong index.
*/
uno::Reference<XAccessible> SAL_CALL
AccessibleShape::getAccessibleChild (long nIndex)
AccessibleShape::getAccessibleChild (sal_Int32 nIndex)
throw (::com::sun::star::uno::RuntimeException)
{
CheckDisposedState ();
if (nIndex >= 0)

uno::Reference<XAccessible> xChild;

if ((mpChildrenManager != NULL) && (nIndex < mpChildrenManager->GetChildCount()))
{
xChild = mpChildrenManager->GetChild (nIndex);
}
else if (mpText != NULL)
{
sal_Int32 nI = nIndex;
if (mpChildrenManager != NULL)
if (nIndex < mpChildrenManager->GetChildCount())
return mpChildrenManager->GetChild (nIndex);
else
{
// Adapt index to children (paragraphs) of the edit engine.
nIndex -= mpChildrenManager->GetChildCount();
}
if (mpText != NULL)
{
try
{
if (nIndex < mpText->GetChildCount())
return mpText->GetChild (nIndex);
}
catch (::com::sun::star::lang::IndexOutOfBoundsException e)
{
return NULL;
}
}
nI -= mpChildrenManager->GetChildCount();
xChild = mpText->GetChild (nI);
}
else
throw lang::IndexOutOfBoundsException (
::rtl::OUString::createFromAscii ("shape has no child with index ")+nIndex,
static_cast<uno::XWeak*>(this));

throw lang::IndexOutOfBoundsException (
::rtl::OUString::createFromAscii ("shape has no child with index ")+nIndex,
static_cast<uno::XWeak*>(this));
return xChild;
}


Expand Down Expand Up @@ -324,7 +317,7 @@ awt::Rectangle SAL_CALL AccessibleShape::getBounds (void)
catch (beans::UnknownPropertyException e)
{
// Fallback when there is no BoundRect Property.
OSL_TRACE ("unknown property BoundingBox");
OSL_TRACE ("unknown property BoundRect");
awt::Point aPosition (mxShape->getPosition());
awt::Size aSize (mxShape->getSize());
aBoundingBox = awt::Rectangle (
Expand Down Expand Up @@ -469,7 +462,7 @@ sal_Int32 SAL_CALL AccessibleShape::getBackground (void)
throw (::com::sun::star::uno::RuntimeException)
{
CheckDisposedState ();
sal_Int32 nColor (0x0ffffffL);
sal_Int32 nColor (0L);

try
{
Expand Down Expand Up @@ -603,6 +596,18 @@ void SAL_CALL
uno::Reference<beans::XPropertySet> xShapeProperties (mxShape, uno::UNO_QUERY);
SetState (AccessibleStateType::DEFUNC);
mxShape = NULL;

// Release the child containers.
if (mpChildrenManager != NULL)
{
delete mpChildrenManager;
mpChildrenManager = NULL;
}
if (mpText != NULL)
{
delete mpText;
mpText = NULL;
}
}
}
catch (uno::RuntimeException e)
Expand All @@ -614,29 +619,6 @@ void SAL_CALL



//===== XComponent ==========================================================

void AccessibleShape::dispose (void)
throw (uno::RuntimeException)
{
CheckDisposedState ();
OSL_TRACE ("AccessibleShape::dispose");

// Unregister listeners.
Reference<lang::XComponent> xComponent (mxShape, uno::UNO_QUERY);
if (xComponent.is())
xComponent->removeEventListener (this);

// Cleanup.
mxShape = NULL;

// Call base classes.
AccessibleContextBase::dispose ();
}




//===== IAccessibleViewForwarderListener ====================================

void AccessibleShape::ViewForwarderChanged (ChangeType aChangeType,
Expand Down Expand Up @@ -686,6 +668,9 @@ ::rtl::OUString
case DRAWING_3D_SPHERE:
sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("3DSphereShape"));
break;
case DRAWING_CAPTION:
sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("CaptionShape"));
break;

case DRAWING_CLOSED_BEZIER:
sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ClosedBezierShape"));
Expand Down Expand Up @@ -915,4 +900,40 @@ ::rtl::OUString
}



// protected
void AccessibleShape::disposing (void)
throw (uno::RuntimeException)
{
CheckDisposedState ();
OSL_TRACE ("AccessibleShape::disposing()");

// Unregister at broadcasters.
Reference<lang::XComponent> xComponent (mxShape, uno::UNO_QUERY);
if (xComponent.is())
xComponent->removeEventListener (this);

// Release the child containers.
if (mpChildrenManager != NULL)
{
delete mpChildrenManager;
mpChildrenManager = NULL;
}
if (mpText != NULL)
{
delete mpText;
mpText = NULL;
}

// Cleanup.
mxShape = NULL;

// Call base classes.
AccessibleContextBase::dispose ();
}





} // end of namespace accessibility

0 comments on commit f11b151

Please sign in to comment.