summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk/a11y
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2006-05-05 09:58:43 +0000
committerRüdiger Timm <rt@openoffice.org>2006-05-05 09:58:43 +0000
commit81e91b84360e74fefc00051e94cca093e893f2ea (patch)
treeb723635cb79bd5ad469f29f9d393bb0b4508f880 /vcl/unx/gtk/a11y
parent70a29bde01e962ebfe9c07d20a4017503acb1306 (diff)
INTEGRATION: CWS atkbridge (1.1.2); FILE ADDED
2006/02/15 10:59:25 obr 1.1.2.4: #i47890# replaced tabs with spaces 2006/01/12 13:56:14 obr 1.1.2.3: #i47890# Solaris compile fixes 2005/10/20 07:09:12 obr 1.1.2.2: #i47890# made cxx files standalone, avoid queryInterface on each API call and demacrofied try/catch to include appropriate warnings 2005/04/21 14:59:27 mmeeks 1.1.2.1: Issue number: i#47890# Submitted by: mmeeks Hacked up prototype of atk bridge
Diffstat (limited to 'vcl/unx/gtk/a11y')
-rw-r--r--vcl/unx/gtk/a11y/atkvalue.cxx152
1 files changed, 152 insertions, 0 deletions
diff --git a/vcl/unx/gtk/a11y/atkvalue.cxx b/vcl/unx/gtk/a11y/atkvalue.cxx
new file mode 100644
index 000000000000..676c1d049523
--- /dev/null
+++ b/vcl/unx/gtk/a11y/atkvalue.cxx
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: atkvalue.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: rt $ $Date: 2006-05-05 10:58:43 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#include "atkwrapper.hxx"
+
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+
+#include <stdio.h>
+#include <string.h>
+
+using namespace ::com::sun::star;
+
+static accessibility::XAccessibleValue*
+ getValue( AtkValue *pValue ) throw (uno::RuntimeException)
+{
+ AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pValue );
+ if( pWrap )
+ {
+ if( !pWrap->mpValue && pWrap->mpContext )
+ {
+ uno::Any any = pWrap->mpContext->queryInterface( accessibility::XAccessibleValue::static_type(NULL) );
+ pWrap->mpValue = reinterpret_cast< accessibility::XAccessibleValue * > (any.pReserved);
+ pWrap->mpValue->acquire();
+ }
+
+ return pWrap->mpValue;
+ }
+
+ return NULL;
+}
+
+static void anyToGValue( uno::Any aAny, GValue *pValue )
+{
+ // FIXME: expand to lots of types etc.
+ double aDouble;
+ aAny >>= aDouble;
+
+ memset( pValue, 0, sizeof( GValue ) );
+ g_value_init( pValue, G_TYPE_DOUBLE );
+ g_value_set_double( pValue, aDouble );
+}
+
+extern "C" {
+
+static void
+value_wrapper_get_current_value( AtkValue *value,
+ GValue *gval )
+{
+ try {
+ accessibility::XAccessibleValue* pValue = getValue( value );
+ if( pValue )
+ anyToGValue( pValue->getCurrentValue(), gval );
+ }
+ catch(const uno::Exception& e) {
+ g_warning( "Exception in getCurrentValue()" );
+ }
+}
+
+static void
+value_wrapper_get_maximum_value( AtkValue *value,
+ GValue *gval )
+{
+ try {
+ accessibility::XAccessibleValue* pValue = getValue( value );
+ if( pValue )
+ anyToGValue( pValue->getMaximumValue(), gval );
+ }
+ catch(const uno::Exception& e) {
+ g_warning( "Exception in getCurrentValue()" );
+ }
+}
+
+static void
+value_wrapper_get_minimum_value( AtkValue *value,
+ GValue *gval )
+{
+ try {
+ accessibility::XAccessibleValue* pValue = getValue( value );
+ if( pValue )
+ anyToGValue( pValue->getMinimumValue(), gval );
+ }
+ catch(const uno::Exception& e) {
+ g_warning( "Exception in getCurrentValue()" );
+ }
+}
+
+static gboolean
+value_wrapper_set_current_value( AtkValue *value,
+ const GValue *gval )
+{
+ try {
+ accessibility::XAccessibleValue* pValue = getValue( value );
+ if( pValue )
+ {
+ // FIXME - this needs expanding
+ double aDouble = g_value_get_double( gval );
+ uno::Any aAny;
+ aAny <<= aDouble;
+ return pValue->setCurrentValue( aAny );
+ }
+ }
+ catch(const uno::Exception& e) {
+ g_warning( "Exception in getCurrentValue()" );
+ }
+
+ return FALSE;
+}
+
+} // extern "C"
+
+void
+valueIfaceInit (AtkValueIface *iface)
+{
+ g_return_if_fail (iface != NULL);
+
+ iface->get_current_value = value_wrapper_get_current_value;
+ iface->get_maximum_value = value_wrapper_get_maximum_value;
+ iface->get_minimum_value = value_wrapper_get_minimum_value;
+ iface->set_current_value = value_wrapper_set_current_value;
+}