summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2016-11-21 23:01:31 -0500
committerKohei Yoshida <libreoffice@kohei.us>2016-11-22 13:17:40 +0000
commita0ef7474521413c8967559a635e6fdc0d88f1df6 (patch)
tree4d60cec609d6d1c79319702b89f0a004e337dd7c /vcl
parente010834dc1a82fcb80dc23025001a752a0fb60a4 (diff)
tdf#71409: Use weak reference to avoid potential circular references.
AtkListener shouldn't be holding a reference back to the context / broadcaster it listens to, as the latter also holds a reference to the former. Change-Id: Ie75cc4667f614752db710c20acbb83b93783654f Reviewed-on: https://gerrit.libreoffice.org/31063 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk/a11y/atkaction.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atkcomponent.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atkeditabletext.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atkhypertext.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atkimage.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atkselection.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atktable.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atktext.cxx44
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atkutil.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atkvalue.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx266
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.hxx34
13 files changed, 201 insertions, 253 deletions
diff --git a/vcl/unx/gtk/a11y/atkaction.cxx b/vcl/unx/gtk/a11y/atkaction.cxx
index c9e3ec776f6a..ef3c2ba4e9f1 100644
--- a/vcl/unx/gtk/a11y/atkaction.cxx
+++ b/vcl/unx/gtk/a11y/atkaction.cxx
@@ -48,14 +48,11 @@ static css::uno::Reference<css::accessibility::XAccessibleAction>
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( action );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpAction.is() )
- {
- pWrap->mpAction.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpAction;
+ uno::Reference<accessibility::XAccessibleAction> xAction(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xAction;
}
return css::uno::Reference<css::accessibility::XAccessibleAction>();
diff --git a/vcl/unx/gtk/a11y/atkcomponent.cxx b/vcl/unx/gtk/a11y/atkcomponent.cxx
index cbc4b8e38b27..60600b2e9ff0 100644
--- a/vcl/unx/gtk/a11y/atkcomponent.cxx
+++ b/vcl/unx/gtk/a11y/atkcomponent.cxx
@@ -27,14 +27,11 @@ static css::uno::Reference<css::accessibility::XAccessibleComponent>
getComponent( AtkComponent *pComponent ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pComponent );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpComponent.is() )
- {
- pWrap->mpComponent.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpComponent;
+ uno::Reference<accessibility::XAccessibleComponent> xComp(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xComp;
}
return css::uno::Reference<css::accessibility::XAccessibleComponent>();
diff --git a/vcl/unx/gtk/a11y/atkeditabletext.cxx b/vcl/unx/gtk/a11y/atkeditabletext.cxx
index f601f137dd04..ee984bdeb7b6 100644
--- a/vcl/unx/gtk/a11y/atkeditabletext.cxx
+++ b/vcl/unx/gtk/a11y/atkeditabletext.cxx
@@ -31,14 +31,11 @@ static css::uno::Reference<css::accessibility::XAccessibleEditableText>
getEditableText( AtkEditableText *pEditableText ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pEditableText );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpEditableText.is() )
- {
- pWrap->mpEditableText.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpEditableText;
+ uno::Reference<accessibility::XAccessibleEditableText> xET(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xET;
}
return css::uno::Reference<css::accessibility::XAccessibleEditableText>();
diff --git a/vcl/unx/gtk/a11y/atkhypertext.cxx b/vcl/unx/gtk/a11y/atkhypertext.cxx
index ff952558d50d..4c28babf9ee2 100644
--- a/vcl/unx/gtk/a11y/atkhypertext.cxx
+++ b/vcl/unx/gtk/a11y/atkhypertext.cxx
@@ -193,14 +193,11 @@ static css::uno::Reference<css::accessibility::XAccessibleHypertext>
getHypertext( AtkHypertext *pHypertext ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pHypertext );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpHypertext.is() )
- {
- pWrap->mpHypertext.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpHypertext;
+ uno::Reference<accessibility::XAccessibleHypertext> xAH(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xAH;
}
return css::uno::Reference<css::accessibility::XAccessibleHypertext>();
diff --git a/vcl/unx/gtk/a11y/atkimage.cxx b/vcl/unx/gtk/a11y/atkimage.cxx
index c1652a4ee582..873cddddbcd2 100644
--- a/vcl/unx/gtk/a11y/atkimage.cxx
+++ b/vcl/unx/gtk/a11y/atkimage.cxx
@@ -39,14 +39,11 @@ static css::uno::Reference<css::accessibility::XAccessibleImage>
getImage( AtkImage *pImage ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pImage );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpImage.is() )
- {
- pWrap->mpImage.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpImage;
+ uno::Reference<accessibility::XAccessibleImage> xAI(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xAI;
}
return css::uno::Reference<css::accessibility::XAccessibleImage>();
diff --git a/vcl/unx/gtk/a11y/atkselection.cxx b/vcl/unx/gtk/a11y/atkselection.cxx
index eb3b2fcef167..62dd4289fab7 100644
--- a/vcl/unx/gtk/a11y/atkselection.cxx
+++ b/vcl/unx/gtk/a11y/atkselection.cxx
@@ -27,14 +27,11 @@ static css::uno::Reference<css::accessibility::XAccessibleSelection>
getSelection( AtkSelection *pSelection ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pSelection );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpSelection.is() )
- {
- pWrap->mpSelection.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpSelection;
+ uno::Reference<accessibility::XAccessibleSelection> xAS(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xAS;
}
return css::uno::Reference<css::accessibility::XAccessibleSelection>();
diff --git a/vcl/unx/gtk/a11y/atktable.cxx b/vcl/unx/gtk/a11y/atktable.cxx
index a3423f6084d4..75dd5a11dbde 100644
--- a/vcl/unx/gtk/a11y/atktable.cxx
+++ b/vcl/unx/gtk/a11y/atktable.cxx
@@ -52,14 +52,11 @@ static css::uno::Reference<css::accessibility::XAccessibleTable>
getTable( AtkTable *pTable ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pTable );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpTable.is() )
- {
- pWrap->mpTable.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpTable;
+ uno::Reference<accessibility::XAccessibleTable> xAT(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xAT;
}
return css::uno::Reference<css::accessibility::XAccessibleTable>();
diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx
index 5c662a711131..14cf91606d87 100644
--- a/vcl/unx/gtk/a11y/atktext.cxx
+++ b/vcl/unx/gtk/a11y/atktext.cxx
@@ -137,14 +137,11 @@ static css::uno::Reference<css::accessibility::XAccessibleText>
getText( AtkText *pText ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpText.is() )
- {
- pWrap->mpText.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpText;
+ uno::Reference<accessibility::XAccessibleText> xAT(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xAT;
}
return css::uno::Reference<css::accessibility::XAccessibleText>();
@@ -156,14 +153,11 @@ static css::uno::Reference<css::accessibility::XAccessibleTextMarkup>
getTextMarkup( AtkText *pText ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpTextMarkup.is() )
- {
- pWrap->mpTextMarkup.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpTextMarkup;
+ uno::Reference<accessibility::XAccessibleTextMarkup> xATM(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xATM;
}
return css::uno::Reference<css::accessibility::XAccessibleTextMarkup>();
@@ -175,14 +169,11 @@ static css::uno::Reference<css::accessibility::XAccessibleTextAttributes>
getTextAttributes( AtkText *pText ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpTextAttributes.is() )
- {
- pWrap->mpTextAttributes.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpTextAttributes;
+ uno::Reference<accessibility::XAccessibleTextAttributes> xATA(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xATA;
}
return css::uno::Reference<css::accessibility::XAccessibleTextAttributes>();
@@ -194,14 +185,11 @@ static css::uno::Reference<css::accessibility::XAccessibleMultiLineText>
getMultiLineText( AtkText *pText ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpMultiLineText.is() )
- {
- pWrap->mpMultiLineText.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpMultiLineText;
+ uno::Reference<accessibility::XAccessibleMultiLineText> xAML(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xAML;
}
return css::uno::Reference<css::accessibility::XAccessibleMultiLineText>();
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index b7857d079b66..0620be4af6af 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.cxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.cxx
@@ -211,14 +211,11 @@ static css::uno::Reference<css::accessibility::XAccessibleComponent>
getComponent( AtkText *pText ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpComponent.is() )
- {
- pWrap->mpComponent.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpComponent;
+ uno::Reference<accessibility::XAccessibleComponent> xAC(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xAC;
}
return css::uno::Reference<css::accessibility::XAccessibleComponent>();
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index 708417722788..34192595a8de 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -86,12 +86,15 @@ atk_wrapper_focus_idle_handler (gpointer data)
// also emit state-changed:focused event under the same condition.
{
AtkObjectWrapper* wrapper_obj = ATK_OBJECT_WRAPPER (atk_obj);
- if( wrapper_obj && !wrapper_obj->mpText.is() )
+
+ if (wrapper_obj)
{
- wrapper_obj->mpText.set(wrapper_obj->mpContext, css::uno::UNO_QUERY);
- if ( wrapper_obj->mpText.is() )
+ uno::Reference<accessibility::XAccessibleText> xText(
+ wrapper_obj->mpContext.get(), uno::UNO_QUERY);
+
+ if (xText.is())
{
- gint caretPos = wrapper_obj->mpText->getCaretPosition();
+ gint caretPos = xText->getCaretPosition();
if ( caretPos != -1 )
{
diff --git a/vcl/unx/gtk/a11y/atkvalue.cxx b/vcl/unx/gtk/a11y/atkvalue.cxx
index 7babb6bf7d29..def434be6e75 100644
--- a/vcl/unx/gtk/a11y/atkvalue.cxx
+++ b/vcl/unx/gtk/a11y/atkvalue.cxx
@@ -29,14 +29,11 @@ static css::uno::Reference<css::accessibility::XAccessibleValue>
getValue( AtkValue *pValue ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pValue );
- if( pWrap )
+ if (pWrap)
{
- if( !pWrap->mpValue.is() )
- {
- pWrap->mpValue.set(pWrap->mpContext, css::uno::UNO_QUERY);
- }
-
- return pWrap->mpValue;
+ uno::Reference<accessibility::XAccessibleValue> xAV(
+ pWrap->mpContext.get(), uno::UNO_QUERY);
+ return xAV;
}
return css::uno::Reference<css::accessibility::XAccessibleValue>();
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 52f92186c846..e9f31562b65c 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -335,24 +335,30 @@ wrapper_get_name( AtkObject *atk_obj )
{
AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
- if( obj->mpContext.is() )
+ if (obj)
{
- try {
- OString aName =
- OUStringToOString(
- obj->mpContext->getAccessibleName(),
- RTL_TEXTENCODING_UTF8);
-
- int nCmp = atk_obj->name ? rtl_str_compare( atk_obj->name, aName.getStr() ) : -1;
- if( nCmp != 0 )
- {
- if( atk_obj->name )
- g_free(atk_obj->name);
- atk_obj->name = g_strdup(aName.getStr());
+ uno::Reference<accessibility::XAccessibleContext> xContext(
+ obj->mpContext.get(), uno::UNO_QUERY);
+
+ if (xContext.is())
+ {
+ try {
+ OString aName =
+ OUStringToOString(
+ xContext->getAccessibleName(),
+ RTL_TEXTENCODING_UTF8);
+
+ int nCmp = atk_obj->name ? rtl_str_compare( atk_obj->name, aName.getStr() ) : -1;
+ if( nCmp != 0 )
+ {
+ if( atk_obj->name )
+ g_free(atk_obj->name);
+ atk_obj->name = g_strdup(aName.getStr());
+ }
+ }
+ catch(const uno::Exception&) {
+ g_warning( "Exception in getAccessibleName()" );
}
- }
- catch(const uno::Exception&) {
- g_warning( "Exception in getAccessibleName()" );
}
}
@@ -366,19 +372,23 @@ wrapper_get_description( AtkObject *atk_obj )
{
AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
- if( obj->mpContext.is() )
+ if (obj)
{
- try {
- OString aDescription =
- OUStringToOString(
- obj->mpContext->getAccessibleDescription(),
- RTL_TEXTENCODING_UTF8);
-
- g_free(atk_obj->description);
- atk_obj->description = g_strdup(aDescription.getStr());
- }
- catch(const uno::Exception&) {
- g_warning( "Exception in getAccessibleDescription()" );
+ uno::Reference<accessibility::XAccessibleContext> xContext(obj->mpContext.get(), uno::UNO_QUERY);
+ if (xContext.is())
+ {
+ try {
+ OString aDescription =
+ OUStringToOString(
+ xContext->getAccessibleDescription(),
+ RTL_TEXTENCODING_UTF8);
+
+ g_free(atk_obj->description);
+ atk_obj->description = g_strdup(aDescription.getStr());
+ }
+ catch(const uno::Exception&) {
+ g_warning( "Exception in getAccessibleDescription()" );
+ }
}
}
@@ -397,7 +407,7 @@ wrapper_get_attributes( AtkObject *atk_obj )
try
{
uno::Reference< accessibility::XAccessibleExtendedAttributes >
- xExtendedAttrs( obj->mpContext, uno::UNO_QUERY );
+ xExtendedAttrs(obj->mpContext.get(), uno::UNO_QUERY);
if( xExtendedAttrs.is() )
pSet = attribute_set_new_from_extended_attributes( xExtendedAttrs );
}
@@ -417,14 +427,20 @@ wrapper_get_n_children( AtkObject *atk_obj )
AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
gint n = 0;
- if( obj->mpContext.is() )
+ if (!obj)
+ return n;
+
+ uno::Reference<accessibility::XAccessibleContext> xContext(obj->mpContext.get(), uno::UNO_QUERY);
+ if (!xContext.is())
+ return n;
+
+ try
{
- try {
- n = obj->mpContext->getAccessibleChildCount();
- }
- catch(const uno::Exception&) {
- OSL_FAIL("Exception in getAccessibleChildCount()" );
- }
+ n = xContext->getAccessibleChildCount();
+ }
+ catch(const uno::Exception&)
+ {
+ OSL_FAIL("Exception in getAccessibleChildCount()" );
}
return n;
@@ -446,17 +462,22 @@ wrapper_ref_child( AtkObject *atk_obj,
return obj->child_about_to_be_removed;
}
- if( obj->mpContext.is() )
+ if (!obj)
+ return child;
+
+ uno::Reference<accessibility::XAccessibleContext> xContext(obj->mpContext.get(), uno::UNO_QUERY);
+ if (!xContext.is())
+ return child;
+
+ try
{
- try {
- uno::Reference< accessibility::XAccessible > xAccessible =
- obj->mpContext->getAccessibleChild( i );
+ uno::Reference< accessibility::XAccessible > xAccessible =
+ xContext->getAccessibleChild( i );
- child = atk_object_wrapper_ref( xAccessible );
- }
- catch(const uno::Exception&) {
- OSL_FAIL("Exception in getAccessibleChild");
- }
+ child = atk_object_wrapper_ref( xAccessible );
+ }
+ catch(const uno::Exception&) {
+ OSL_FAIL("Exception in getAccessibleChild");
}
return child;
@@ -470,13 +491,17 @@ wrapper_get_index_in_parent( AtkObject *atk_obj )
AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
gint i = -1;
- if( obj->mpContext.is() )
+ if (obj)
{
- try {
- i = obj->mpContext->getAccessibleIndexInParent();
- }
- catch(const uno::Exception&) {
- g_warning( "Exception in getAccessibleIndexInParent()" );
+ uno::Reference<accessibility::XAccessibleContext> xContext(obj->mpContext.get(), uno::UNO_QUERY);
+ if (xContext.is())
+ {
+ try {
+ i = xContext->getAccessibleIndexInParent();
+ }
+ catch(const uno::Exception&) {
+ g_warning( "Exception in getAccessibleIndexInParent()" );
+ }
}
}
return i;
@@ -490,40 +515,44 @@ wrapper_ref_relation_set( AtkObject *atk_obj )
AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
AtkRelationSet *pSet = atk_relation_set_new();
- if( obj->mpContext.is() )
+ if (obj)
{
- try {
- uno::Reference< accessibility::XAccessibleRelationSet > xRelationSet(
- obj->mpContext->getAccessibleRelationSet()
- );
-
- sal_Int32 nRelations = xRelationSet.is() ? xRelationSet->getRelationCount() : 0;
- for( sal_Int32 n = 0; n < nRelations; n++ )
- {
- accessibility::AccessibleRelation aRelation = xRelationSet->getRelation( n );
- sal_uInt32 nTargetCount = aRelation.TargetSet.getLength();
-
- std::vector<AtkObject*> aTargets;
+ uno::Reference<accessibility::XAccessibleContext> xContext(obj->mpContext.get(), uno::UNO_QUERY);
+ if (xContext.is())
+ {
+ try {
+ uno::Reference< accessibility::XAccessibleRelationSet > xRelationSet(
+ xContext->getAccessibleRelationSet()
+ );
- for (sal_uInt32 i = 0; i < nTargetCount; ++i)
+ sal_Int32 nRelations = xRelationSet.is() ? xRelationSet->getRelationCount() : 0;
+ for( sal_Int32 n = 0; n < nRelations; n++ )
{
- uno::Reference< accessibility::XAccessible > xAccessible(
- aRelation.TargetSet[i], uno::UNO_QUERY );
- aTargets.push_back(atk_object_wrapper_ref(xAccessible));
+ accessibility::AccessibleRelation aRelation = xRelationSet->getRelation( n );
+ sal_uInt32 nTargetCount = aRelation.TargetSet.getLength();
+
+ std::vector<AtkObject*> aTargets;
+
+ for (sal_uInt32 i = 0; i < nTargetCount; ++i)
+ {
+ uno::Reference< accessibility::XAccessible > xAccessible(
+ aRelation.TargetSet[i], uno::UNO_QUERY );
+ aTargets.push_back(atk_object_wrapper_ref(xAccessible));
+ }
+
+ AtkRelation *pRel =
+ atk_relation_new(
+ aTargets.data(), nTargetCount,
+ mapRelationType( aRelation.RelationType )
+ );
+ atk_relation_set_add( pSet, pRel );
+ g_object_unref( G_OBJECT( pRel ) );
}
-
- AtkRelation *pRel =
- atk_relation_new(
- aTargets.data(), nTargetCount,
- mapRelationType( aRelation.RelationType )
- );
- atk_relation_set_add( pSet, pRel );
- g_object_unref( G_OBJECT( pRel ) );
}
- }
- catch(const uno::Exception &) {
- g_object_unref( G_OBJECT( pSet ) );
- pSet = nullptr;
+ catch(const uno::Exception &) {
+ g_object_unref( G_OBJECT( pSet ) );
+ pSet = nullptr;
+ }
}
}
@@ -536,37 +565,43 @@ wrapper_ref_state_set( AtkObject *atk_obj )
AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
AtkStateSet *pSet = atk_state_set_new();
- if( obj->mpContext.is() )
+ if (obj)
{
- try {
- uno::Reference< accessibility::XAccessibleStateSet > xStateSet(
- obj->mpContext->getAccessibleStateSet());
-
- if( xStateSet.is() )
+ uno::Reference<accessibility::XAccessibleContext> xContext(obj->mpContext.get(), uno::UNO_QUERY);
+ if (xContext.is())
+ {
+ try
{
- uno::Sequence< sal_Int16 > aStates = xStateSet->getStates();
+ uno::Reference< accessibility::XAccessibleStateSet > xStateSet(
+ xContext->getAccessibleStateSet());
- for( sal_Int32 n = 0; n < aStates.getLength(); n++ )
+ if( xStateSet.is() )
{
- // ATK_STATE_LAST_DEFINED is used to check if the state
- // is unmapped, do not report it to Atk
- if ( mapAtkState( aStates[n] ) != ATK_STATE_LAST_DEFINED )
- atk_state_set_add_state( pSet, mapAtkState( aStates[n] ) );
- }
-
- // We need to emulate FOCUS state for menus, menu-items etc.
- if( atk_obj == atk_get_focus_object() )
- atk_state_set_add_state( pSet, ATK_STATE_FOCUSED );
+ uno::Sequence< sal_Int16 > aStates = xStateSet->getStates();
+
+ for( sal_Int32 n = 0; n < aStates.getLength(); n++ )
+ {
+ // ATK_STATE_LAST_DEFINED is used to check if the state
+ // is unmapped, do not report it to Atk
+ if ( mapAtkState( aStates[n] ) != ATK_STATE_LAST_DEFINED )
+ atk_state_set_add_state( pSet, mapAtkState( aStates[n] ) );
+ }
+
+ // We need to emulate FOCUS state for menus, menu-items etc.
+ if( atk_obj == atk_get_focus_object() )
+ atk_state_set_add_state( pSet, ATK_STATE_FOCUSED );
/* FIXME - should we do this ?
- else
- atk_state_set_remove_state( pSet, ATK_STATE_FOCUSED );
+ else
+ atk_state_set_remove_state( pSet, ATK_STATE_FOCUSED );
*/
+ }
}
- }
- catch(const uno::Exception &) {
- g_warning( "Exception in wrapper_ref_state_set" );
- atk_state_set_add_state( pSet, ATK_STATE_DEFUNCT );
+ catch(const uno::Exception &)
+ {
+ g_warning( "Exception in wrapper_ref_state_set" );
+ atk_state_set_add_state( pSet, ATK_STATE_DEFUNCT );
+ }
}
}
else
@@ -616,18 +651,9 @@ atk_object_wrapper_class_init (AtkObjectWrapperClass *klass)
}
static void
-atk_object_wrapper_init (AtkObjectWrapper *wrapper,
- AtkObjectWrapperClass*)
+atk_object_wrapper_init (AtkObjectWrapper* wrapper, AtkObjectWrapperClass*)
{
- wrapper->mpAction = nullptr;
- wrapper->mpComponent = nullptr;
- wrapper->mpEditableText = nullptr;
- wrapper->mpHypertext = nullptr;
- wrapper->mpImage = nullptr;
- wrapper->mpSelection = nullptr;
- wrapper->mpTable = nullptr;
- wrapper->mpText = nullptr;
- wrapper->mpValue = nullptr;
+ wrapper->mpContext = nullptr;
}
} // extern "C"
@@ -905,18 +931,6 @@ void atk_object_wrapper_set_role(AtkObjectWrapper* wrapper, sal_Int16 role)
void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper)
{
wrapper->mpContext.clear();
- wrapper->mpAction.clear();
- wrapper->mpComponent.clear();
- wrapper->mpEditableText.clear();
- wrapper->mpHypertext.clear();
- wrapper->mpImage.clear();
- wrapper->mpSelection.clear();
- wrapper->mpMultiLineText.clear();
- wrapper->mpTable.clear();
- wrapper->mpText.clear();
- wrapper->mpTextMarkup.clear();
- wrapper->mpTextAttributes.clear();
- wrapper->mpValue.clear();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx
index e8ab83b5c778..87ff3b49cb2c 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.hxx
@@ -22,49 +22,19 @@
#include <atk/atk.h>
#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <cppuhelper/weakref.hxx>
extern "C" {
-namespace com { namespace sun { namespace star { namespace accessibility {
- class XAccessibleAction;
- class XAccessibleComponent;
- class XAccessibleEditableText;
- class XAccessibleHypertext;
- class XAccessibleImage;
- class XAccessibleMultiLineText;
- class XAccessibleSelection;
- class XAccessibleTable;
- class XAccessibleText;
- class XAccessibleTextMarkup;
- class XAccessibleTextAttributes;
- class XAccessibleValue;
-} } } }
-
struct AtkObjectWrapper
{
AtkObject aParent;
css::uno::Reference<css::accessibility::XAccessible> mpAccessible;
- css::uno::Reference<css::accessibility::XAccessibleContext> mpContext;
- css::uno::Reference<css::accessibility::XAccessibleAction> mpAction;
- css::uno::Reference<css::accessibility::XAccessibleComponent> mpComponent;
- css::uno::Reference<css::accessibility::XAccessibleEditableText>
- mpEditableText;
- css::uno::Reference<css::accessibility::XAccessibleHypertext> mpHypertext;
- css::uno::Reference<css::accessibility::XAccessibleImage> mpImage;
- css::uno::Reference<css::accessibility::XAccessibleMultiLineText>
- mpMultiLineText;
- css::uno::Reference<css::accessibility::XAccessibleSelection> mpSelection;
- css::uno::Reference<css::accessibility::XAccessibleTable> mpTable;
- css::uno::Reference<css::accessibility::XAccessibleText> mpText;
- css::uno::Reference<css::accessibility::XAccessibleTextMarkup> mpTextMarkup;
- css::uno::Reference<css::accessibility::XAccessibleTextAttributes>
- mpTextAttributes;
- css::uno::Reference<css::accessibility::XAccessibleValue> mpValue;
+ css::uno::WeakReference<css::accessibility::XAccessibleContext> mpContext;
AtkObject *child_about_to_be_removed;
gint index_of_child_about_to_be_removed;
-// OString * m_pKeyBindings
};
struct AtkObjectWrapperClass